X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fclients%2FA1ClientFactory.java;h=e340e6026128305cbb1c63af258ee34ecb4dcc41;hb=86b589317c67eb2350870c9c57c35eac3e9056f6;hp=c150c08933279254fdd569581de447e72ef335b3;hpb=10811110a23cf9fcf464575bba609b8c65d19aec;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java index c150c089..e340e602 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java @@ -22,13 +22,15 @@ package org.oransc.policyagent.clients; import org.oransc.policyagent.clients.A1Client.A1ProtocolType; import org.oransc.policyagent.configuration.ApplicationConfig; -import org.oransc.policyagent.exceptions.ServiceException; import org.oransc.policyagent.repository.Ric; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import reactor.core.publisher.Mono; +/** + * Factory for A1 clients that supports four different protocol versions of the A1 api. + */ public class A1ClientFactory { private static final Logger logger = LoggerFactory.getLogger(A1ClientFactory.class); @@ -40,6 +42,19 @@ public class A1ClientFactory { this.appConfig = appConfig; } + /** + * Creates an A1 client with the correct A1 protocol for the provided Ric. + * + *
It detects the protocol version by trial and error, since there is no getVersion method specified in the A1 + * api yet. + * + *
As a side effect it also sets the protocol version in the provided Ric. This means that after the first
+ * successful creation it won't have to try which protocol to use, but can create the client directly.
+ *
+ * @param ric The Ric to get a client for.
+ * @return a client with the correct protocol, or a ServiceException if none of the protocols are supported by the
+ * Ric.
+ */
public Mono