summaryrefslogtreecommitdiffstats
path: root/holmes-actions
diff options
context:
space:
mode:
authorGuangrong Fu <fu.guangrong@zte.com.cn>2017-07-31 19:20:25 +0800
committerGuangrong Fu <fu.guangrong@zte.com.cn>2017-08-02 08:58:06 +0800
commit8b3c9e2b928e3a0308974482e2645ace4838c468 (patch)
tree4735ccb33920841fa22776df99cfcd821277b39d /holmes-actions
parentee93748a3535926dface4f2fa5c99f35fd9cf5d0 (diff)
Change the package name from openo to onap
Change the package name & maven from openo to onap Change-Id: I9c1fcaaa1c357fbd2b5c3bc2108d7cebd2b0ffc6 Issue-ID: HOLMES-10 Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'holmes-actions')
-rw-r--r--holmes-actions/pom.xml23
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmsCorrelation.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/api/entity/AlarmsCorrelation.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationResult.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationResult.java)4
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationRule.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceNode.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceRegisterEntity.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/api/stat/Alarm.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AplusData.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusData.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AplusResult.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusResult.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/config/MQConfig.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java)4
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/constant/AlarmConst.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java)4
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/BaseService.java34
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/Lazy.java34
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PostBaseService.java34
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreBaseService.java34
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreLoad.java34
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreServiceLoad.java35
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/AutoConfigBundle.java430
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/AutoConfigBundleBuider.java42
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/IOCApplication.java42
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/ServiceLocatorManaged.java51
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/utils/ServiceBinder.java52
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/utils/ServiceLocatorHolder.java36
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/exception/CorrelationException.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/msb/MicroserviceBusRest.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java)6
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/producer/MQProducer.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java)12
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/DbDaoUtil.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/utils/DbDaoUtil.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/ExceptionUtil.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/utils/ExceptionUtil.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/JacksonUtil.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/utils/JacksonUtil.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/JudgeNullUtil.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/utils/JudgeNullUtil.java)2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/LanguageUtil.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java)4
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/MSBRegisterUtil.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java)8
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/UserUtil.java (renamed from holmes-actions/src/main/java/org/openo/holmes/common/utils/UserUtil.java)4
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json34
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json31
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java111
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/api/entity/AlarmsCorrelationTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/api/entity/AlarmsCorrelationTest.java)3
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationResultTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/api/entity/CorrelationResultTest.java)4
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationRuleTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/api/entity/CorrelationRuleTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/api/entity/ServiceNodeTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/api/entity/ServiceNodeTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/api/entity/ServiceRegisterEntityTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/api/entity/ServiceRegisterEntityTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/api/stat/AlarmTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/api/stat/AlarmTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/config/MQConfigTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/config/MQConfigTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/config/MicroServiceConfigTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/config/MicroServiceConfigTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/exception/CorrelationExceptionTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/exception/CorrelationExceptionTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/producer/MQProducerTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/producer/MQProducerTest.java)8
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/DbDaoUtilTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/utils/DbDaoUtilTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/ExceptionUtilTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/utils/ExceptionUtilTest.java)6
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/JacksonUtilTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/utils/JacksonUtilTest.java)4
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/JudgeNullUtilTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/utils/JudgeNullUtilTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/LanguageUtilTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/utils/LanguageUtilTest.java)4
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/MSBRegisterUtilTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/utils/MSBRegisterUtilTest.java)10
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/UserUtilTest.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/utils/UserUtilTest.java)2
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/bean/TestBean.java (renamed from holmes-actions/src/test/java/org/openo/holmes/common/utils/bean/TestBean.java)2
-rw-r--r--holmes-actions/src/test/java/org/openo/holmes/common/utils/I18nProxyTest.java62
56 files changed, 936 insertions, 316 deletions
diff --git a/holmes-actions/pom.xml b/holmes-actions/pom.xml
index 1ca8a8a..e412348 100644
--- a/holmes-actions/pom.xml
+++ b/holmes-actions/pom.xml
@@ -11,9 +11,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.openo.holmes.actions</groupId>
+ <groupId>org.onap.holmes.actions</groupId>
<artifactId>holmes-actions-parent</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<name>holmes-actions-service</name>
@@ -33,10 +33,6 @@
<artifactId>activemq-pool</artifactId>
</dependency>
<dependency>
- <groupId>org.openo.common-services.common-utilities</groupId>
- <artifactId>baseservice-i18n</artifactId>
- </dependency>
- <dependency>
<groupId>org.antlr</groupId>
<artifactId>stringtemplate</artifactId>
</dependency>
@@ -91,10 +87,6 @@
<artifactId>jdom</artifactId>
</dependency>
<dependency>
- <groupId>org.openo.common-services.common-utilities</groupId>
- <artifactId>dropwizard-ioc-container</artifactId>
- </dependency>
- <dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
</dependency>
@@ -122,6 +114,17 @@
<artifactId>consumer</artifactId>
<version>${jaxrs.consumer.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>2.4</version>
+ <classifier>jdk15</classifier>
+ </dependency>
</dependencies>
<build>
<resources>
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/AlarmsCorrelation.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmsCorrelation.java
index de1005c..ee32be2 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/AlarmsCorrelation.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmsCorrelation.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationResult.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationResult.java
index d78619d..6802696 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationResult.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationResult.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
-import org.openo.holmes.common.api.stat.Alarm;
+import org.onap.holmes.common.api.stat.Alarm;
import lombok.Getter;
import lombok.NoArgsConstructor;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationRule.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java
index 24f5bc9..6b91bd3 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationRule.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceNode.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java
index e6cf4c3..d456910 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceNode.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java
@@ -15,7 +15,7 @@
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceRegisterEntity.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java
index 6db084b..7804082 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceRegisterEntity.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.ArrayList;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/Alarm.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java
index c12b549..be876e0 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/Alarm.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.api.stat;
+package org.onap.holmes.common.api.stat;
import java.io.Serializable;
import java.io.StringReader;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusData.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AplusData.java
index ce95a8d..50d28db 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusData.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AplusData.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.api.stat;
+package org.onap.holmes.common.api.stat;
import java.io.Serializable;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusResult.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AplusResult.java
index 53c6729..6e46608 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusResult.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AplusResult.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.api.stat;
+package org.onap.holmes.common.api.stat;
import java.io.Serializable;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/config/MQConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java
index 3200ec0..e1b333b 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/config/MQConfig.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.config;
+package org.onap.holmes.common.config;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java
index 05273b8..6f5a67c 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.config;
+package org.onap.holmes.common.config;
-import org.openo.holmes.common.constant.AlarmConst;
+import org.onap.holmes.common.constant.AlarmConst;
public class MicroServiceConfig {
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java b/holmes-actions/src/main/java/org/onap/holmes/common/constant/AlarmConst.java
index 9e83d4c..e9e5361 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/constant/AlarmConst.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.constant;
+package org.onap.holmes.common.constant;
public interface AlarmConst {
@@ -21,7 +21,7 @@ public interface AlarmConst {
String MQ_TOPIC_NAME_ALARM = "topic://voss/fm/alarm";
- String NFVO_PATH = "/openoapi/umc/v1/fm/curalarms/findAll";
+ String NFVO_PATH = "/onapapi/umc/v1/fm/curalarms/findAll";
int NFVO_STATUS_OK = 200;
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/BaseService.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/BaseService.java
new file mode 100644
index 0000000..9f0ae67
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/BaseService.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * basic services for identification
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface BaseService {
+
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/Lazy.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/Lazy.java
new file mode 100644
index 0000000..4f7d046
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/Lazy.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * lazy loading of related services
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Lazy {
+
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PostBaseService.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PostBaseService.java
new file mode 100644
index 0000000..4787bec
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PostBaseService.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * load on after basic services
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface PostBaseService {
+
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreBaseService.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreBaseService.java
new file mode 100644
index 0000000..669bceb
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreBaseService.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * prior to basic service loading
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface PreBaseService {
+
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreLoad.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreLoad.java
new file mode 100644
index 0000000..dce3e58
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreLoad.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * load before general service
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface PreLoad {
+
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreServiceLoad.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreServiceLoad.java
new file mode 100644
index 0000000..815c1d7
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/annotation/PreServiceLoad.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * load before general service,after PreLoad
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface PreServiceLoad {
+
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/AutoConfigBundle.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/AutoConfigBundle.java
new file mode 100644
index 0000000..2b8e114
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/AutoConfigBundle.java
@@ -0,0 +1,430 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.bundle;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.ext.Provider;
+
+import org.eclipse.jetty.util.component.LifeCycle;
+import org.glassfish.hk2.api.ServiceLocator;
+import org.glassfish.hk2.api.ServiceLocatorFactory;
+import org.glassfish.hk2.utilities.ServiceLocatorUtilities;
+import org.glassfish.hk2.utilities.binding.AbstractBinder;
+import org.glassfish.jersey.servlet.ServletProperties;
+import org.jvnet.hk2.annotations.Service;
+import org.onap.holmes.common.dropwizard.ioc.annotation.BaseService;
+import org.onap.holmes.common.dropwizard.ioc.annotation.Lazy;
+import org.onap.holmes.common.dropwizard.ioc.annotation.PostBaseService;
+import org.onap.holmes.common.dropwizard.ioc.annotation.PreBaseService;
+import org.onap.holmes.common.dropwizard.ioc.annotation.PreLoad;
+import org.onap.holmes.common.dropwizard.ioc.annotation.PreServiceLoad;
+import org.onap.holmes.common.dropwizard.ioc.utils.ServiceBinder;
+import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;
+import org.reflections.Reflections;
+import org.reflections.scanners.SubTypesScanner;
+import org.reflections.scanners.TypeAnnotationsScanner;
+import org.reflections.util.ClasspathHelper;
+import org.reflections.util.ConfigurationBuilder;
+import org.reflections.util.FilterBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.codahale.metrics.health.HealthCheck;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
+
+import io.dropwizard.Configuration;
+import io.dropwizard.ConfiguredBundle;
+import io.dropwizard.configuration.ConfigurationSourceProvider;
+import io.dropwizard.lifecycle.Managed;
+import io.dropwizard.lifecycle.ServerLifecycleListener;
+import io.dropwizard.servlets.tasks.Task;
+import io.dropwizard.setup.Bootstrap;
+import io.dropwizard.setup.Environment;
+
+/**
+ * complete the integration of hK2 container and dropwizard
+ *
+ * @author hu.rui
+ *
+ */
+
+public class AutoConfigBundle<T extends Configuration> implements ConfiguredBundle<T> {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AutoConfigBundle.class);
+
+ private ServiceLocator locator;
+ private Reflections reflections;
+ private Set<Class<?>> services;
+
+ private Bootstrap<?> bootstrap;
+
+
+ AutoConfigBundle(final String packageName) {
+ this(Lists.newArrayList(packageName));
+ }
+
+ AutoConfigBundle(List<String> packageNames) {
+ FilterBuilder filterBuilder = new FilterBuilder();
+
+ packageNames.stream().forEach(packageName -> {
+ filterBuilder.include(FilterBuilder.prefix(packageName));
+ });
+ ConfigurationBuilder reflectionCfg = new ConfigurationBuilder();
+
+ packageNames.stream().forEach(packageName -> {
+ reflectionCfg.addUrls(ClasspathHelper.forPackage(packageName));
+ });
+
+ reflectionCfg.filterInputsBy(filterBuilder).setScanners(new SubTypesScanner(),
+ new TypeAnnotationsScanner());
+ reflections = new Reflections(reflectionCfg);
+
+ locator = ServiceLocatorFactory.getInstance().create("dw-hk2");
+
+ ServiceLocatorHolder.setLocator(locator);
+
+ }
+
+ public static <T extends Configuration> AutoConfigBundleBuider<T> newBuilder() {
+ return new AutoConfigBundleBuider<T>();
+ }
+
+ @Override
+ public void initialize(final Bootstrap<?> bootstrap) {
+
+ this.bootstrap = bootstrap;
+ registerPreLoadService();
+
+ LOG.debug("Intialzing auto config bundle.");
+ }
+
+ private void registerPreLoadService() {
+
+ registerService(PreLoad.class);
+
+ }
+
+
+ @Override
+ public void run(final T configuration, final Environment environment) throws Exception {
+
+ registerConfigurationProvider(configuration, environment);
+
+
+ registerEnvironment(environment);
+ registerObjectMapper(environment);
+
+ environment.getApplicationContext().getServletContext()
+ .setAttribute(ServletProperties.SERVICE_LOCATOR, locator);
+
+ registerService(PreBaseService.class);
+ registerService(BaseService.class);
+ registerService(PostBaseService.class);
+ this.registerService(PreServiceLoad.class);
+
+
+ registerServices();
+
+ // registerManaged(environment);
+ registerLifecycle(environment);
+ registerServerLifecycleListeners(environment);
+ registerJettyLifeCycleListener(environment);
+ registerTasks(environment);
+ registerHealthChecks(environment);
+ registerProviders(environment);
+ registerResources(environment);
+
+ environment.lifecycle().manage(new ServiceLocatorManaged(locator));
+
+ }
+
+
+
+ private void registerProviders(Environment environment) {
+ reflections.getSubTypesOf(Provider.class).stream().filter(services::contains)
+ .forEach(providerKlass -> {
+ try {
+ environment.jersey().register(locator.getService(providerKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+
+ LOG.info("Registering Dropwizard Provider, class name : {}", providerKlass.getName());
+
+ });
+
+ }
+
+ private void registerTasks(Environment environment) {
+ reflections.getSubTypesOf(Task.class).stream().filter(services::contains).forEach(taskKlass -> {
+ try {
+ environment.admin().addTask(locator.getService(taskKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard Task, class name : {}", taskKlass.getName());
+ });
+
+ }
+
+ private void registerJettyLifeCycleListener(Environment environment) {
+ reflections.getSubTypesOf(LifeCycle.Listener.class).stream().filter(services::contains)
+ .forEach(lifecycleListenerKlass -> {
+
+ try {
+ environment.lifecycle()
+ .addLifeCycleListener(locator.getService(lifecycleListenerKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard lifecycleListener, class name : {}",
+ lifecycleListenerKlass.getName());
+ });
+
+ }
+
+ private void registerServerLifecycleListeners(Environment environment) {
+
+ reflections.getSubTypesOf(ServerLifecycleListener.class).stream().filter(services::contains)
+ .forEach(serverLifecycleListenerKlass -> {
+ try {
+ environment.lifecycle()
+ .addServerLifecycleListener(locator.getService(serverLifecycleListenerKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard serverLifecycleListener, class name : {}",
+ serverLifecycleListenerKlass.getName());
+ });
+
+ }
+
+ private void registerLifecycle(Environment environment) {
+ reflections.getSubTypesOf(LifeCycle.class).stream().filter(services::contains)
+ .forEach(lifeCycleKlass -> {
+ try {
+ environment.lifecycle().manage(locator.getService(lifeCycleKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard LifeCycle, class name : {}", lifeCycleKlass.getName());
+ });
+ }
+
+ /*
+ * private void registerManaged(Environment environment) {
+ *
+ * reflections.getSubTypesOf(Managed.class).stream().filter(services::contains)
+ * .forEach(managedKlass -> { try {
+ * environment.lifecycle().manage(locator.getService(managedKlass)); } catch (Exception e) {
+ * LOG.warn("", e); } LOG.info("Registering Dropwizard managed, class name : {}",
+ * managedKlass.getName()); });
+ *
+ * }
+ */
+
+ private void registerObjectMapper(Environment environment) {
+
+ final ObjectMapper objectMapper = environment.getObjectMapper();
+
+ ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
+ @Override
+ protected void configure() {
+ bind(objectMapper).to(ObjectMapper.class);
+
+ LOG.info("Registering Dropwizard objectMapper, class name : {}",
+ objectMapper.getClass().getName());
+ }
+ });
+
+ }
+
+ private void registerEnvironment(final Environment environment) {
+
+ ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
+ @Override
+ protected void configure() {
+ bind(environment).to(Environment.class);
+
+ LOG.info("Registering Dropwizard environment, class name : {}",
+ environment.getClass().getName());
+ }
+ });
+
+ }
+
+ private void registerConfigurationProvider(final T configuration, final Environment environment) {
+
+ ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
+ @Override
+ protected void configure() {
+ bind(configuration);
+ LOG.info("Registering Dropwizard Configuration class name:{}",
+ configuration.getClass().getName());
+ if (configuration instanceof Configuration) {
+ bind((Configuration) configuration).to(Configuration.class);
+ LOG.info("Registering Dropwizard Configuration class name:{}",
+ Configuration.class.getName());
+ }
+
+ }
+ });
+
+ registerSubConfigure(configuration, environment);
+
+ }
+
+ private void registerSubConfigure(final T configuration, final Environment environment) {
+ final List<Field> subDeclaredFields =
+ Arrays.asList(configuration.getClass().getDeclaredFields());
+ List<Field> parentDeclaredFields = Arrays.asList(Configuration.class.getDeclaredFields());
+
+ List<Field> filtersubDeclaredFields = subDeclaredFields.stream()
+ .filter(subDeclaredField -> !subDeclaredField.getType().isPrimitive())
+ .filter(subDeclaredField -> !subDeclaredField.getType().equals(String.class))
+ .filter(subDeclaredField -> !parentDeclaredFields.contains(subDeclaredField))
+ .collect(Collectors.toList());
+
+ ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
+ @Override
+ protected void configure() {
+ filtersubDeclaredFields.forEach(subField -> {
+ subField.setAccessible(true);
+ try {
+ Object subConfig = subField.get(configuration);
+ if (subConfig != null) {
+ bind(subConfig);
+ LOG.info("Registering Dropwizard Sub Configuration class name {}",
+ subConfig.getClass().getName());
+ }
+
+ } catch (Exception e) {
+ LOG.error("bind sub config:{} fail", subField);
+ }
+ });
+ }
+ });
+
+ }
+
+ private void registerServices() {
+ services = this.reflections.getTypesAnnotatedWith(Service.class, true);
+ if (!services.isEmpty()) {
+ ServiceLocatorUtilities.bind(locator, new ServiceBinder(services));
+
+ services.forEach(s -> {
+ LOG.info("Registering Dropwizard service, class name : {}", s.getName());
+ });
+
+ services.stream().filter(serviceClazz -> (serviceClazz.getAnnotation(Lazy.class) == null))
+ .peek(serviceClazz -> LOG.info("active service, class name : {}", serviceClazz.getName()))
+ .forEach(serviceClazz -> {
+ try {
+ long startTime = System.currentTimeMillis();
+ locator.getService(serviceClazz);
+ LOG.info("active service, class name : {},cost time:{}", serviceClazz.getName(),
+ (System.currentTimeMillis() - startTime));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+
+ });
+
+ } else {
+ LOG.warn("Registering Dropwizard service is empty");
+
+ }
+
+ }
+
+ private void registerResources(final Environment environment) {
+ reflections.getTypesAnnotatedWith(Path.class).stream().forEach(resourceClass -> {
+
+ LOG.info("begin Registering Dropwizard resource, class name : {}", resourceClass.getName());
+ try {
+ Object resourceObject = locator.getService(resourceClass);
+ if (resourceObject != null) {
+ environment.jersey().register(resourceObject);
+ LOG.info("Registering Dropwizard resource, class name : {}", resourceClass.getName());
+ } else {
+ LOG.warn(resourceClass.getName() + " not use Service annotation");
+ }
+ } catch (Exception e) {
+ LOG.error("", e);
+ }
+
+
+ });
+ }
+
+ private void registerHealthChecks(final Environment env) {
+
+ reflections.getSubTypesOf(HealthCheck.class).stream().filter(services::contains)
+ .forEach(healthCheckKlass -> {
+ try {
+ env.healthChecks().register(healthCheckKlass.getName(),
+ locator.getService(healthCheckKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard healthCheck, class name : {}",
+ healthCheckKlass.getName());
+ });
+
+ }
+
+
+
+ private void registerService(Class<? extends Annotation> annotationClazz) {
+
+ Set<Class<?>> services = this.reflections.getTypesAnnotatedWith(annotationClazz, true);
+ if (!services.isEmpty()) {
+ ServiceLocatorUtilities.bind(locator, new ServiceBinder(services));
+
+ services.forEach(s -> {
+ LOG.info("{} Registering service, class name : {}", annotationClazz.getName(),
+ s.getName());
+ });
+
+ services.stream().filter(serviceClazz -> (serviceClazz.getAnnotation(Lazy.class) == null))
+ .peek(serviceClazz -> LOG.info("active service, class name : {}", serviceClazz.getName()))
+ .forEach(serviceClazz -> {
+ try {
+ long startTime = System.currentTimeMillis();
+ locator.getService(serviceClazz);
+ LOG.info("active service, class name : {},cost time:{}", serviceClazz.getName(),
+ (System.currentTimeMillis() - startTime));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+
+ });
+
+ } else {
+ LOG.warn("Registering {} service is empty", annotationClazz.getName());
+
+ }
+
+ }
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/AutoConfigBundleBuider.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/AutoConfigBundleBuider.java
new file mode 100644
index 0000000..a439ff0
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/AutoConfigBundleBuider.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.bundle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import io.dropwizard.Configuration;
+
+public class AutoConfigBundleBuider<T extends Configuration> {
+
+ private static final String DEFAULT_PACKAGE_NAME="org.onap";
+
+ private List<String> packageNames=new ArrayList<>();
+
+ public AutoConfigBundleBuider(){
+ packageNames.add( DEFAULT_PACKAGE_NAME);
+ }
+
+ public AutoConfigBundleBuider<T> addPackageName(String packageName) {
+ this.packageNames.add(packageName);
+ return this;
+ }
+
+
+ public AutoConfigBundle<T> build() {
+ return new AutoConfigBundle<T>(packageNames);
+ }
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/IOCApplication.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/IOCApplication.java
new file mode 100644
index 0000000..6025028
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/IOCApplication.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.bundle;
+
+import io.dropwizard.Application;
+import io.dropwizard.Configuration;
+import io.dropwizard.setup.Bootstrap;
+import io.dropwizard.setup.Environment;
+
+/**
+ * complete IOC container startup
+ *
+ * @author hu.rui2
+ *
+ */
+public abstract class IOCApplication<T extends Configuration> extends Application<T> {
+
+
+ @Override
+ public void initialize(Bootstrap<T> bootstrap) {
+ super.initialize(bootstrap);
+ bootstrap.addBundle(new AutoConfigBundleBuider().build());
+ }
+
+ @Override
+ public void run(T configuration, Environment environment) throws Exception {
+
+ }
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/ServiceLocatorManaged.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/ServiceLocatorManaged.java
new file mode 100644
index 0000000..d6c0563
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/bundle/ServiceLocatorManaged.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.bundle;
+
+import org.glassfish.hk2.api.ServiceLocator;
+
+import io.dropwizard.lifecycle.Managed;
+
+/**
+ * Life cycle management for IOC containers
+ * @author hu.rui
+ *
+ */
+public class ServiceLocatorManaged implements Managed{
+
+
+
+ private ServiceLocator locator;
+
+
+
+ public ServiceLocatorManaged(ServiceLocator locator) {
+ super();
+ this.locator = locator;
+ }
+
+ @Override
+ public void start() throws Exception {
+
+
+ }
+
+ @Override
+ public void stop() throws Exception {
+ locator.shutdown();
+ }
+
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/utils/ServiceBinder.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/utils/ServiceBinder.java
new file mode 100644
index 0000000..f5801c8
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/utils/ServiceBinder.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.utils;
+
+import java.util.Set;
+
+import org.glassfish.hk2.utilities.binding.AbstractBinder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author hu.rui
+ *
+ */
+public class ServiceBinder extends AbstractBinder {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ServiceBinder.class);
+
+ final Set<Class<?>> klasses;
+
+ public ServiceBinder(Set<Class<?>> services) {
+ this.klasses = services;
+ }
+
+ @Override
+ protected void configure() {
+ for (Class<?> klass : this.klasses) {
+
+ try{
+ LOG.info("start active class:"+klass.getName());
+ addActiveDescriptor(klass);
+ }catch(Exception e){
+ LOG.info("active class error:"+klass.getName(),e);
+ }
+
+
+ }
+ }
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/utils/ServiceLocatorHolder.java b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/utils/ServiceLocatorHolder.java
new file mode 100644
index 0000000..394ab6c
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dropwizard/ioc/utils/ServiceLocatorHolder.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.dropwizard.ioc.utils;
+
+import org.glassfish.hk2.api.ServiceLocator;
+
+/**
+ * @author hu.rui
+ *
+ */
+public class ServiceLocatorHolder {
+
+ private static ServiceLocator locator;
+
+ public static ServiceLocator getLocator() {
+ return locator;
+ }
+
+ public static void setLocator(ServiceLocator locator) {
+ ServiceLocatorHolder.locator = locator;
+ }
+
+}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java b/holmes-actions/src/main/java/org/onap/holmes/common/exception/CorrelationException.java
index dfe5373..3360618 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/exception/CorrelationException.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.exception;
+package org.onap.holmes.common.exception;
public class CorrelationException extends Exception {
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java b/holmes-actions/src/main/java/org/onap/holmes/common/msb/MicroserviceBusRest.java
index c8e03e9..10ecda3 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/msb/MicroserviceBusRest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.msb;
+package org.onap.holmes.common.msb;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
@@ -22,9 +22,9 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
-@Path("/openoapi/microservices/v1/services")
+@Path("/onapapi/microservices/v1/services")
public interface MicroserviceBusRest {
@Path("")
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java b/holmes-actions/src/main/java/org/onap/holmes/common/producer/MQProducer.java
index d258695..6aaa860 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/producer/MQProducer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.producer;
+package org.onap.holmes.common.producer;
import java.io.Serializable;
import javax.inject.Inject;
@@ -28,11 +28,11 @@ import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.glassfish.hk2.api.IterableProvider;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.api.entity.CorrelationResult;
-import org.openo.holmes.common.api.stat.Alarm;
-import org.openo.holmes.common.api.stat.AplusResult;
-import org.openo.holmes.common.config.MQConfig;
-import org.openo.holmes.common.constant.AlarmConst;
+import org.onap.holmes.common.api.stat.Alarm;
+import org.onap.holmes.common.constant.AlarmConst;
+import org.onap.holmes.common.api.entity.CorrelationResult;
+import org.onap.holmes.common.api.stat.AplusResult;
+import org.onap.holmes.common.config.MQConfig;
import org.apache.activemq.ActiveMQConnectionFactory;
@Service
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/DbDaoUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/DbDaoUtil.java
index 18890ce..76e11ba 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/DbDaoUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/DbDaoUtil.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import io.dropwizard.db.DataSourceFactory;
import io.dropwizard.jdbi.DBIFactory;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/ExceptionUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/ExceptionUtil.java
index 1154f38..419dce5 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/ExceptionUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/ExceptionUtil.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/JacksonUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/JacksonUtil.java
index f030d3d..c5c52c2 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/JacksonUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/JacksonUtil.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/JudgeNullUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/JudgeNullUtil.java
index beed186..9383d22 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/JudgeNullUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/JudgeNullUtil.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import java.util.List;
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/LanguageUtil.java
index 930905a..5c2c12c 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/LanguageUtil.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
-import org.openo.holmes.common.constant.AlarmConst;
+import org.onap.holmes.common.constant.AlarmConst;
public class LanguageUtil {
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/MSBRegisterUtil.java
index 904a853..1bb3fe3 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/MSBRegisterUtil.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import com.eclipsesource.jaxrs.consumer.ConsumerFactory;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
-import org.openo.holmes.common.config.MicroServiceConfig;
-import org.openo.holmes.common.msb.MicroserviceBusRest;
+import org.onap.holmes.common.msb.MicroserviceBusRest;
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
+import org.onap.holmes.common.config.MicroServiceConfig;
@Slf4j
@Service
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/UserUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/UserUtil.java
index ec8fda6..f0ff8d9 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/UserUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/UserUtil.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import javax.servlet.http.HttpServletRequest;
-import org.openo.holmes.common.constant.AlarmConst;
+import org.onap.holmes.common.constant.AlarmConst;
public class UserUtil {
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json
deleted file mode 100644
index f45b92b..0000000
--- a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "ENGINE_CONTENT_ILLEGALITY": "The rule content have error:{0}",
- "ENGINE_DEPLOY_RULE_FAILED": "Deploy rule failed",
- "ENGINE_DELETE_RULE_NULL": "The rule do not exist :{0}",
- "ENGINE_DELETE_RULE_FAILED": "The rule remove failed :{0}",
- "ENGINE_INSERT_RULE_CACHE_FAILED": "insert rule failed in cache",
- "ENGINE_DELETE_RULE_FAILED_FROM_CACHE": "delete rule failed in cache",
- "ENGINE_CONTAINS_PACKAGE": "Is included in the package name, please amend",
- "ENGINE_QUERY_CACHE_FAILED": "Failed query cache",
- "DSA_QUERY_CURRENT_ALARM_FAILED":"query current alarm failed",
- "DSA_REQUEST_ANALYSIS_ERROR":"request analysis error",
- "DSA_REQUEST_EXECUTE_FAILED":"send request failed",
- "DSA_HTTP_CLIENT_CLOSE_FAILED":"httpclient close failed",
- "EXCEPTION_DB_RULE_NOT_EXIST_ERROR": "This rule does not exist in the database.",
- "EXCEPTION_DB_RULE_SAVE_ERROR": "Error saving rule to database",
- "EXCEPTION_DB_RULE_GET_ERROR": "Error when get rule from database",
- "EXCEPTION_REQUEST_IS_EMPTY": "The request object is empty",
- "RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED": "Delete rules from engine call interface failure ",
- "RULE_MANAGEMENT_DELETE_RULE_FAILED":"To delete rules from the engine failure",
- "RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED": "From the rules engine calls the deployment of interface failure",
- "RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED": "From the rules engine calls the check of interface failure",
- "RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED": "Create query exception",
- "RULE_MANAGEMENT_QUERY_RULE_FAILED": "Query rule failed",
- "RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY": "Request object is empty",
- "RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE": "Rule does not exist",
- "RULE_MANAGEMENT_REPEAT_RULE_NAME": "Rule name repetition",
- "RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY": "Rule name cannot be empty",
- "RULE_MANAGEMENT_DATA_FORMAT_ERROR": "Data format error",
- "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR": "Parameter enabled can only be 0 (not enabled) and 1 (enabled)",
- "RULE_MANAGEMENT_DB_ERROR": "db error",
- "RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR":"Parsing call deployment rule return the result of the failure",
- "RULE_MANAGEMENT_CHECK_NO_PASS":"Content inspection not by rule",
- "RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY":"Content cannot be empty"
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json
deleted file mode 100644
index 39b0e82..0000000
--- a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "ENGINE_CONTENT_ILLEGALITY": "规则内容有误:{0}",
- "ENGINE_DEPLOY_RULE_FAILED": "部署规则失败",
- "ENGINE_DELETE_RULE_NULL": "引擎不包含这个规则:{0}",
- "ENGINE_DELETE_RULE_FAILED": "删除规则失败{0}",
- "ENGINE_INSERT_RULE_CACHE_FAILED": "插入数据到缓存失败",
- "ENGINE_DELETE_RULE_FAILED_FROM_CACHE": "从缓存删除数据失败",
- "ENGINE_CONTAINS_PACKAGE": "package 名字已包含,请修改",
- "ENGINE_QUERY_CACHE_FAILED":"查询缓存失败",
- "DSA_QUERY_CURRENT_ALARM_FAILED":"查询当前所有告警失败",
- "DSA_REQUEST_ANALYSIS_ERROR":"解析请求数据失败",
- "DSA_REQUEST_EXECUTE_FAILED":"发送请求失败",
- "DSA_HTTP_CLIENT_CLOSE_FAILED":"httpclient 关闭失败",
- "RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED": "从引擎调用删除规则接口失败",
- "RULE_MANAGEMENT_DELETE_RULE_FAILED":"从引擎中删除规则失败",
- "RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED": "从引擎调用部署规则接口失败",
- "RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED": "从引擎调用校验规则接口失败",
- "RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED": "创建查询语句异常",
- "RULE_MANAGEMENT_QUERY_RULE_FAILED": "查询规则失败",
- "RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY":"请求对象为空",
- "RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE": "规则不存在",
- "RULE_MANAGEMENT_REPEAT_RULE_NAME" : "规则名字重复",
- "RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY" : "规则名字不能为空",
- "RULE_MANAGEMENT_DATA_FORMAT_ERROR": "数据格式异常",
- "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR" : "参数enabled只能为0(未启用)和1(启用)",
- "RULE_MANAGEMENT_DB_ERROR" : "数据库异常",
- "RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR":"解析调用部署规则返回的结果错误",
- "RULE_MANAGEMENT_CHECK_NO_PASS":"规则内容检查不通过",
- "RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY":"规则内容不能为空"
-
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java
deleted file mode 100644
index 6e9a844..0000000
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Copyright 2017 ZTE Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openo.holmes.common.utils;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import java.util.Arrays;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Optional;
-import lombok.extern.slf4j.Slf4j;
-import org.openo.baseservice.i18n.I18n;
-
-@Slf4j
-public class I18nProxy {
-
- /*-----------------------Engine------------------------------- */
- public static final String ENGINE_CONTENT_ILLEGALITY = "ENGINE_CONTENT_ILLEGALITY";
- public static final String ENGINE_DEPLOY_RULE_FAILED = "ENGINE_DEPLOY_RULE_FAILED";
- public static final String ENGINE_DELETE_RULE_NULL = "ENGINE_DELETE_RULE_NULL";
- public static final String ENGINE_DELETE_RULE_FAILED = "ENGINE_DELETE_RULE_FAILED";
- public static final String ENGINE_INSERT_RULE_CACHE_FAILED = "ENGINE_INSERT_RULE_CACHE_FAILED";
- public static final String ENGINE_DELETE_RULE_FAILED_FROM_CACHE = "ENGINE_DELETE_RULE_FAILED_FROM_CACHE";
- public static final String ENGINE_CONTAINS_PACKAGE = "ENGINE_CONTAINS_PACKAGE";
- public static final String ENGINE_QUERY_CACHE_FAILED = "ENGINE_QUERY_CACHE_FAILED";
- /*-----------------------DSA ------------------------------- */
- public static final String DSA_QUERY_CURRENT_ALARM_FAILED = "DSA_QUERY_CURRENT_ALARM_FAILED";
- public static final String DSA_REQUEST_ANALYSIS_FAILED = "DSA_REQUEST_ANALYSIS_ERROR";
- public static final String DSA_REQUEST_EXECUTE_FAILED = "DSA_REQUEST_EXECUTE_FAILED";
- public static final String DSA_HTTP_CLIENT_CLOSE_FAILED = "DSA_HTTP_CLIENT_CLOSE_FAILED";
-
- /*-----------------------Rule Management------------------------------- */
- public static final String RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED = "RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED";
- public static final String RULE_MANAGEMENT_DELETE_RULE_FAILED = "RULE_MANAGEMENT_DELETE_RULE_FAILED";
- public static final String RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED = "RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED";
- public static final String RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED = "RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED";
- public static final String RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED = "RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED";
- public static final String RULE_MANAGEMENT_QUERY_RULE_FAILED = "RULE_MANAGEMENT_QUERY_RULE_FAILED";
- public static final String RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY = "RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY";
- public static final String RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY = "RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY";
- public static final String RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE = "RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE";
- public static final String RULE_MANAGEMENT_REPEAT_RULE_NAME = "RULE_MANAGEMENT_REPEAT_RULE_NAME";
- public static final String RULE_MANAGEMENT_DATA_FORMAT_ERROR = "RULE_MANAGEMENT_DATA_FORMAT_ERROR";
- public static final String RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR = "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR";
- public static final String RULE_MANAGEMENT_DB_ERROR = "RULE_MANAGEMENT_DB_ERROR";
- public static final String RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR = "RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR";
- public static final String RULE_MANAGEMENT_CHECK_NO_PASS = "RULE_MANAGEMENT_CHECK_NO_PASS";
- public static final String RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY = "RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY";
- private Optional<I18n> optional = null;
-
- private I18nProxy() {
- optional = I18n.getInstance("correlation");
- }
-
- private static class I18nProxyHolder {
-
- private static final I18nProxy INSTANCE = new I18nProxy();
-
- private I18nProxyHolder() {
-
- }
- }
-
- public static I18nProxy getInstance() {
- return I18nProxyHolder.INSTANCE;
- }
-
- public String getValue(Locale locale, String key) {
- return optional.get().getLabelValue(key, locale);
- }
-
- public String getValueByArgs(Locale locale, String key, String[] arguments) {
- return optional.get().getLabelValue(key, locale, arguments);
- }
-
- public Map<String, String> getValue(String key) {
- return optional.get().getLabelValues(key);
- }
-
- public String jsonI18n(String key) {
-
- return optional.get().getCanonicalLabelValues(key);
- }
-
- public String i18nWithArgs(String key, String[] args) {
- String value = "";
- try {
- value = JacksonUtil.beanToJson(optional.get().getLabelValues(key, args));
- } catch (JsonProcessingException e) {
- log.warn("get i18n error, key is :" + key, e);
- } catch (IllegalArgumentException e) {
- log.warn("get i18n error IllegalArgumentException, key is :" + key + ",args is : " + Arrays.toString(args),
- e);
- }
-
- return value;
- }
-
-}
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/AlarmsCorrelationTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/AlarmsCorrelationTest.java
index 7dc1fab..dd940c4 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/AlarmsCorrelationTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/AlarmsCorrelationTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
@@ -23,7 +23,6 @@ import java.util.Date;
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
-import sun.util.resources.cldr.ga.LocaleNames_ga;
public class AlarmsCorrelationTest {
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/CorrelationResultTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationResultTest.java
index 14a52c0..1e30fab 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/CorrelationResultTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationResultTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
@@ -23,7 +23,7 @@ import java.util.Date;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.openo.holmes.common.api.stat.Alarm;
+import org.onap.holmes.common.api.stat.Alarm;
public class CorrelationResultTest {
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/CorrelationRuleTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationRuleTest.java
index 8b6268c..25ee5c6 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/CorrelationRuleTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationRuleTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/ServiceNodeTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/ServiceNodeTest.java
index 383cb91..d1b800b 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/ServiceNodeTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/ServiceNodeTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/ServiceRegisterEntityTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/ServiceRegisterEntityTest.java
index 442549d..266c8bc 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/api/entity/ServiceRegisterEntityTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/ServiceRegisterEntityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.api.entity;
+package org.onap.holmes.common.api.entity;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/api/stat/AlarmTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/stat/AlarmTest.java
index c42ee60..b0e3690 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/api/stat/AlarmTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/stat/AlarmTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.api.stat;
+package org.onap.holmes.common.api.stat;
import java.util.Date;
import static org.hamcrest.core.IsEqual.equalTo;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/config/MQConfigTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/config/MQConfigTest.java
index bb79c8a..cc9dced 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/config/MQConfigTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/config/MQConfigTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.config;
+package org.onap.holmes.common.config;
import org.junit.Test;
import org.junit.Before;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/config/MicroServiceConfigTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/config/MicroServiceConfigTest.java
index 7ec7fe6..33431ff 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/config/MicroServiceConfigTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/config/MicroServiceConfigTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.config;
+package org.onap.holmes.common.config;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/exception/CorrelationExceptionTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/exception/CorrelationExceptionTest.java
index bca63b2..d924533 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/exception/CorrelationExceptionTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/exception/CorrelationExceptionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.exception;
+package org.onap.holmes.common.exception;
import org.junit.Test;
import org.junit.Before;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/producer/MQProducerTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/producer/MQProducerTest.java
index 1390b77..7c561b0 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/producer/MQProducerTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/producer/MQProducerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.producer;
+package org.onap.holmes.common.producer;
import static org.easymock.EasyMock.anyBoolean;
import static org.easymock.EasyMock.anyInt;
@@ -34,9 +34,9 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.openo.holmes.common.api.entity.CorrelationResult;
-import org.openo.holmes.common.api.stat.Alarm;
-import org.openo.holmes.common.config.MQConfig;
+import org.onap.holmes.common.api.stat.Alarm;
+import org.onap.holmes.common.api.entity.CorrelationResult;
+import org.onap.holmes.common.config.MQConfig;
import org.powermock.api.easymock.PowerMock;
import org.powermock.modules.junit4.rule.PowerMockRule;
import org.powermock.reflect.Whitebox;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/DbDaoUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/DbDaoUtilTest.java
index 18c774e..e942eb4 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/DbDaoUtilTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/DbDaoUtilTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.expect;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/ExceptionUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/ExceptionUtilTest.java
index caa45e3..98cac63 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/ExceptionUtilTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/ExceptionUtilTest.java
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
-
-import static org.openo.holmes.common.utils.ExceptionUtil.buildExceptionResponse;
+package org.onap.holmes.common.utils;
import org.junit.Test;
@@ -24,7 +22,7 @@ public class ExceptionUtilTest {
@Test
public void testBuildExceptionResponse() throws Exception {
- buildExceptionResponse("test");
+ ExceptionUtil.buildExceptionResponse("test");
}
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/JacksonUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/JacksonUtilTest.java
index 22d628e..5f90c2d 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/JacksonUtilTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/JacksonUtilTest.java
@@ -15,13 +15,13 @@
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import org.junit.Test;
-import org.openo.holmes.common.utils.bean.TestBean;
+import org.onap.holmes.common.utils.bean.TestBean;
public class JacksonUtilTest {
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/JudgeNullUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/JudgeNullUtilTest.java
index a2a0542..5d38229 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/JudgeNullUtilTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/JudgeNullUtilTest.java
@@ -15,7 +15,7 @@
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/LanguageUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/LanguageUtilTest.java
index d688a35..06759ec 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/LanguageUtilTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/LanguageUtilTest.java
@@ -15,7 +15,7 @@
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
@@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletRequest;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
-import org.openo.holmes.common.constant.AlarmConst;
+import org.onap.holmes.common.constant.AlarmConst;
import org.powermock.api.easymock.PowerMock;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/MSBRegisterUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/MSBRegisterUtilTest.java
index 5d04c1a..a38c26e 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/MSBRegisterUtilTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/MSBRegisterUtilTest.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import com.eclipsesource.jaxrs.consumer.ConsumerFactory;
import javax.ws.rs.QueryParam;
import org.easymock.EasyMock;
import org.junit.Rule;
import org.junit.Test;
-import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
-import org.openo.holmes.common.config.MicroServiceConfig;
-import org.openo.holmes.common.msb.MicroserviceBusRest;
+import org.onap.holmes.common.msb.MicroserviceBusRest;
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
+import org.onap.holmes.common.config.MicroServiceConfig;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.rule.PowerMockRule;
@@ -55,7 +55,7 @@ public class MSBRegisterUtilTest {
serviceRegisterEntity.setServiceName("holmes-rule-mgmt");
serviceRegisterEntity.setProtocol("REST");
serviceRegisterEntity.setVersion("v1");
- serviceRegisterEntity.setUrl("/openoapi/holmes-rule-mgmt/v1");
+ serviceRegisterEntity.setUrl("/onapapi/holmes-rule-mgmt/v1");
serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9101", 0);
serviceRegisterEntity.setVisualRange("1|0");
return serviceRegisterEntity;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/UserUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/UserUtilTest.java
index d81c919..d88525a 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/UserUtilTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/UserUtilTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openo.holmes.common.utils;
+package org.onap.holmes.common.utils;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/bean/TestBean.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/bean/TestBean.java
index fab78c2..d8466d4 100644
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/bean/TestBean.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/bean/TestBean.java
@@ -15,7 +15,7 @@
*/
-package org.openo.holmes.common.utils.bean;
+package org.onap.holmes.common.utils.bean;
import java.io.Serializable;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/I18nProxyTest.java b/holmes-actions/src/test/java/org/openo/holmes/common/utils/I18nProxyTest.java
deleted file mode 100644
index c3631ac..0000000
--- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/I18nProxyTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Copyright 2016 ZTE Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.openo.holmes.common.utils;
-
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-
-import java.util.Locale;
-import java.util.Map;
-import org.junit.Before;
-import org.junit.Test;
-
-public class I18nProxyTest {
-
- private I18nProxy i18nProxy;
-
- @Before
- public void setUp() {
- i18nProxy = I18nProxy.getInstance();
- }
-
- @Test
- public void getValue_locale_and_key() {
- String result = i18nProxy.getValue(new Locale("zh"), "test");
- assertThat(result, equalTo(null));
- }
- @Test
- public void getValueByArgs(){
- String result = i18nProxy.getValueByArgs(new Locale("zh"), "test",new String[]{"1"});
- assertThat(result,equalTo(null));
- }
- @Test
- public void getValue_by_key(){
- Map<String,String> result = i18nProxy.getValue("test");
- assertThat(result, equalTo(null));
- }
- @Test
- public void jsonI18n(){
- String result = i18nProxy.jsonI18n("test");
- assertThat(result,equalTo(null));
- }
- @Test
- public void i18nWithArgs(){
- String result = i18nProxy.i18nWithArgs("test",new String[]{});
- assertThat(result,equalTo("null"));
- }
-} \ No newline at end of file