summaryrefslogtreecommitdiffstats
path: root/rulemgt
diff options
context:
space:
mode:
Diffstat (limited to 'rulemgt')
-rw-r--r--rulemgt/pom.xml4
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java51
2 files changed, 35 insertions, 20 deletions
diff --git a/rulemgt/pom.xml b/rulemgt/pom.xml
index 5033e8b..9a9daf1 100644
--- a/rulemgt/pom.xml
+++ b/rulemgt/pom.xml
@@ -30,6 +30,10 @@
<dependencies>
<dependency>
+ <groupId>org.onap.msb.java-sdk</groupId>
+ <artifactId>msb-java-sdk</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
index 8dc697c..0aeb584 100644
--- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
@@ -16,21 +16,27 @@
package org.onap.holmes.rulemgt;
+import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
+
import io.dropwizard.setup.Environment;
-import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
import lombok.extern.slf4j.Slf4j;
-import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;
-import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
import org.onap.holmes.common.config.MicroServiceConfig;
+import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;
+import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.utils.MSBRegisterUtil;
+import org.onap.holmes.rulemgt.resources.RuleMgtResources;
+import org.onap.msb.sdk.discovery.entity.MicroServiceInfo;
+import org.onap.msb.sdk.discovery.entity.Node;
@Slf4j
-public class RuleActiveApp extends IOCApplication< RuleAppConfig > {
+public class RuleActiveApp extends IOCApplication<RuleAppConfig> {
- public static void main( String[] args ) throws Exception {
- new RuleActiveApp().run( args );
+ public static void main(String[] args) throws Exception {
+ new RuleActiveApp().run(args);
}
-
+
@Override
public String getName() {
return "Holmes Rule Management ActiveApp APP ";
@@ -40,22 +46,27 @@ public class RuleActiveApp extends IOCApplication< RuleAppConfig > {
public void run(RuleAppConfig configuration, Environment environment) throws Exception {
super.run(configuration, environment);
+ environment.jersey().register(new RuleMgtResources());
try {
- new MSBRegisterUtil().register(initServiceEntity());
- } catch (IOException e) {
- log.warn("Micro service registry httpclient close failure",e);
+ new MSBRegisterUtil().register2Msb(createMicroServiceInfo());
+ } catch (CorrelationException e) {
+ log.warn(e.getMessage(), e);
}
-
}
- private ServiceRegisterEntity initServiceEntity() {
- ServiceRegisterEntity serviceRegisterEntity = new ServiceRegisterEntity();
- serviceRegisterEntity.setServiceName("holmes-rule-mgmt");
- serviceRegisterEntity.setProtocol("REST");
- serviceRegisterEntity.setVersion("v1");
- serviceRegisterEntity.setUrl("/onapapi/holmes-rule-mgmt/v1");
- serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9101", 0);
- serviceRegisterEntity.setVisualRange("1|0");
- return serviceRegisterEntity;
+ private MicroServiceInfo createMicroServiceInfo() {
+ MicroServiceInfo msinfo = new MicroServiceInfo();
+ msinfo.setServiceName("holmes-rule-mgmt");
+ msinfo.setVersion("v1");
+ msinfo.setUrl("/onapapi/holmes-rule-mgmt/v1");
+ msinfo.setProtocol("REST");
+ msinfo.setVisualRange("0|1");
+ Set<Node> nodes = new HashSet<>();
+ Node node = new Node();
+ node.setIp(MicroServiceConfig.getServiceIp());
+ node.setPort("9101");
+ nodes.add(node);
+ msinfo.setNodes(nodes);
+ return msinfo;
}
}