diff options
author | Guangrong Fu <fu.guangrong@zte.com.cn> | 2017-07-31 19:20:25 +0800 |
---|---|---|
committer | Guangrong Fu <fu.guangrong@zte.com.cn> | 2017-08-02 08:58:06 +0800 |
commit | 8b3c9e2b928e3a0308974482e2645ace4838c468 (patch) | |
tree | 4735ccb33920841fa22776df99cfcd821277b39d /holmes-actions/src/main/java/org/openo | |
parent | ee93748a3535926dface4f2fa5c99f35fd9cf5d0 (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/src/main/java/org/openo')
24 files changed, 0 insertions, 1475 deletions
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/AlarmsCorrelation.java b/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/AlarmsCorrelation.java deleted file mode 100644 index de1005c..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/AlarmsCorrelation.java +++ /dev/null @@ -1,53 +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.api.entity;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.Date;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@NoArgsConstructor
-public class AlarmsCorrelation {
-
- @JsonProperty(value = "ruleid")
- private String ruleId;
-
- @JsonProperty(value = "ruleinfo")
- private String ruleInfo;
-
- @JsonProperty(value = "resulttype")
- private byte resultType;
-
- @JsonProperty(value = "createtime")
- private Date createTime;
-
- @JsonProperty(value = "parentalarmid")
- private long parentAlarmId;
-
- @JsonProperty(value = "childalarmid")
- private long childAlarmId;
-
- @JsonProperty(defaultValue = "-1")
- private long reserve1 = -1;
-
- @JsonProperty(defaultValue = "-1")
- private long reserve2 = -1;
-
- @JsonProperty(defaultValue = "-1")
- private long reserve3 = -1;
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationResult.java b/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationResult.java deleted file mode 100644 index d78619d..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationResult.java +++ /dev/null @@ -1,44 +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.api.entity;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.io.Serializable;
-import org.openo.holmes.common.api.stat.Alarm;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-@Setter
-@Getter
-@NoArgsConstructor
-@ToString
-public class CorrelationResult implements Serializable{
-
- @JsonProperty
- private String ruleId;
-
- @JsonProperty
- private long createTimeL;
-
- @JsonProperty
- private byte resultType;
-
- @JsonProperty
- private Alarm[] affectedAlarms;
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationRule.java b/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationRule.java deleted file mode 100644 index 24f5bc9..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/CorrelationRule.java +++ /dev/null @@ -1,57 +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.api.entity;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.Date;
-import java.util.Properties;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class CorrelationRule {
-
- @JsonProperty(value = "ruleid")
- private String rid;
- @JsonProperty(value = "rulename")
- private String name;
- @JsonProperty
- private String description;
- @JsonProperty
- private int enabled;
- @JsonProperty
- private int templateID;
- private String engineID;
- @JsonProperty
- private String engineType;
- @JsonProperty
- private String creator;
- @JsonProperty
- private String modifier;
- @JsonProperty
- private Properties params;
- @JsonProperty
- private String content;
- @JsonProperty
- private String vendor;
- @JsonProperty(value = "createtime")
- private Date createTime;
- @JsonProperty(value = "updatetime")
- private Date updateTime;
- @JsonProperty(value = "package")
- private String packageName;
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceNode.java b/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceNode.java deleted file mode 100644 index e6cf4c3..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceNode.java +++ /dev/null @@ -1,39 +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.api.entity;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@JsonIgnoreProperties(ignoreUnknown = true)
-@Getter
-@Setter
-public class ServiceNode {
-
- private String ip;
- private String port;
- private int ttl;
-
-}
\ No newline at end of file diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceRegisterEntity.java b/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceRegisterEntity.java deleted file mode 100644 index 6db084b..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/api/entity/ServiceRegisterEntity.java +++ /dev/null @@ -1,54 +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.api.entity;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@JsonIgnoreProperties(ignoreUnknown = true)
-@Setter
-@Getter
-public class ServiceRegisterEntity {
-
- private String serviceName;
- private String version;
- private String url;
- private String protocol;
- private String visualRange = "1";
- private List<ServiceNode> nodes = new ArrayList<>();
-
- public void setSingleNode(String ip, String port, int ttl) {
- ServiceNode node = new ServiceNode();
- if (ip != null && ip.length() > 0) {
- node.setIp(ip);
- } else {
- node.setIp(null);
- }
- node.setPort(port);
- node.setTtl(ttl);
- nodes.add(node);
- }
-}
\ No newline at end of file diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/Alarm.java b/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/Alarm.java deleted file mode 100644 index c12b549..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/Alarm.java +++ /dev/null @@ -1,279 +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.api.stat;
-
-import java.io.Serializable;
-import java.io.StringReader;
-import java.lang.reflect.Field;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import lombok.Getter;
-import lombok.Setter;
-import org.jdom.Attribute;
-import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-import org.jdom.output.XMLOutputter;
-
-
-@Getter
-@Setter
-public class Alarm implements AplusData, Cloneable, Serializable {
-
- public static final byte EVENT_CLEARED_ALARM = 3;
-
- public static final byte EVENT_CHANGED = 2;
-
- public static final byte EVENT_CLEARED = 1;
-
- public static final byte EVENT_RAISED = 0;
-
- private static final long serialVersionUID = 4520003737132012000L;
- private final static Date clearedServerTime = null;
- private final Map<Integer, Integer> linkIdNodeIdxMap = new HashMap<Integer, Integer>();
- private byte eventType = EVENT_RAISED;
- private long id = 0L;
- private String alarmKey = "";
- private String network = "";
- private String neType = "";
- private String equipType = "";
- private String position1 = "";
- private String subPosition1 = null;
- private String position2 = null;
- private String subPosition2 = null;
- private byte severity = -1;
- private byte alarmType = -1;
- private long probableCause = -1;
- private String specificProblem = null;
- private String additionalText = null;
- private Date raisedTime = new Date();
- private Date raisedServerTime = new Date();
- private Date clearedTime = null;
- private String region = null;
- private String site = null;
- private String aid = null;
- private short systemType = -1;
- private boolean rootAlarmFlag = false;
- private int linkId = -1;
- private int nodeIdx = -1;
- private Set<Integer> linkIds = new HashSet<Integer>();
- private HashMap<String, Integer> priorityMap = new HashMap<String, Integer>();
- private HashMap<String, Integer> rootAlarmTypeMap = new HashMap<String, Integer>();
- private int rootAlarmType = -1;
- private boolean keyAlarmFlag = false;
- private int keyAlarmType = -1;
- private int networkLevel = -1;
- private int linkType = -1;
- private int centerType;
-
- public static Alarm valueOf(String xmlString) {
- Element element;
- try {
- StringReader sb = new StringReader(xmlString);
- element = new SAXBuilder().build(sb).getRootElement();
- sb.close();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- Alarm alarm = new Alarm();
- @SuppressWarnings("unchecked")
- List<Attribute> list = element.getAttributes();
- for (Attribute attr : list) {
- String attrName = attr.getName();
- try {
- Field field = Alarm.class.getDeclaredField(attrName);
- if (!attrName.endsWith("Time")) {
- String type = field.getType().getSimpleName();
- if ("byte".equals(type)) {
- field.set(alarm, Byte.parseByte(attr.getValue()));
- } else if ("long".equals(type)) {
- field.set(alarm, Long.parseLong(attr.getValue()));
- } else if ("String".equals(type)) {
- field.set(alarm, attr.getValue());
- } else {
- throw new RuntimeException("unknow attr type: " + type.toString());
- }
- } else {
- Date date = new Date();
- date.setTime(Long.parseLong(attr.getValue()));
- field.set(alarm, date);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- return alarm;
- }
-
- public void addLinkIdNodeIdx(int linkId, int index) {
- linkIdNodeIdxMap.put(linkId, index);
- }
-
- /**
- * Comparison of the location of different links: 999 the same link: the location of the node
- * number less than otherIdIdx in the location of the number (in the otherIdIdx upstream):-1,
- * the same link: the node position number is equal to the number of position in the otherIdIdx
- * (in the same site otherIdIdx):0, the same link: the node location number is greater than the
- * number of locations in otherIdIdx (otherIdIdx) with the site):1,
- */
- public int CompareLinkPosition(Map<Integer, Integer> otherIdIdx) {
- Set<Integer> myIdSet = new HashSet<Integer>();
- myIdSet.addAll(this.linkIdNodeIdxMap.keySet());
- myIdSet.retainAll(otherIdIdx.keySet());
-
- if (myIdSet.isEmpty()) {
- return 999;
- }
-
- for (int tempLinkId : myIdSet) {
- return this.linkIdNodeIdxMap.get(tempLinkId) - otherIdIdx.get(tempLinkId);
- }
- return 999;
- }
-
- public boolean containNode(int linkId, int index) {
- return linkIdNodeIdxMap.containsKey(linkId) && linkIdNodeIdxMap.get(linkId) == index;
- }
-
- @Override
- public byte getDataType() {
- return APLUS_EVENT;
- }
-
- @Override
- public String toString() {
- final String nullStr = "<null>";
-
- Element el = new Element("Alarm");
- el.setAttribute("id", String.valueOf(id));
- el.setAttribute("aid", String.valueOf(aid));
- el.setAttribute("alarmKey", String.valueOf(alarmKey));
- el.setAttribute("eventType", String.valueOf(eventType));
- el.setAttribute("region", region == null ? nullStr : region);
- el.setAttribute("site", site == null ? nullStr : site);
- el.setAttribute("network", network);
- el.setAttribute("neType", neType);
- el.setAttribute("equipType", equipType);
- el.setAttribute("position1", position1);
- el.setAttribute("subPosition1", subPosition1 == null ? nullStr : subPosition1);
- el.setAttribute("position2", position2 == null ? nullStr : position2);
- el.setAttribute("subPosition2", subPosition2 == null ? nullStr : subPosition2);
- el.setAttribute("severity", String.valueOf(severity));
- el.setAttribute("alarmType", String.valueOf(alarmType));
- el.setAttribute("probableCause", String.valueOf(probableCause));
- el.setAttribute("specificProblem", specificProblem == null ? nullStr : specificProblem);
- el.setAttribute("additionalText", additionalText == null ? nullStr : additionalText);
- el.setAttribute("raisedTime", String.valueOf(raisedTime.getTime()));
- el.setAttribute("raisedServerTime", String.valueOf(raisedServerTime.getTime()));
- if (clearedTime != null) {
- el.setAttribute("clearedTime", String.valueOf(clearedTime.getTime()));
- }
- if (clearedServerTime != null) {
- el.setAttribute("clearedServerTime", String.valueOf(clearedServerTime.getTime()));
- }
-
- return new XMLOutputter().outputString(el);
- }
-
- @Override
- public int hashCode() {
- return this.getAlarmKey().hashCode();
- }
-
- @Override
- public boolean equals(Object arg0) {
- if (arg0 == null || !(arg0 instanceof Alarm)) {
- return false;
- }
- return this.alarmKey.equals(((Alarm) arg0).getAlarmKey());
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- super.clone();
-
- Alarm alarm = new Alarm();
-
- alarm.setEventType(this.getEventType());
-
- alarm.setAid(this.getAid());
- alarm.setId(this.getId());
- alarm.setAlarmKey(this.getAlarmKey());
-
- alarm.setNetwork(this.getNetwork());
- alarm.setEquipType(this.getEquipType());
- alarm.setNeType(this.getNeType());
- alarm.setPosition1(this.getPosition1());
- alarm.setSubPosition1(this.getSubPosition1());
- alarm.setPosition2(this.getPosition2());
- alarm.setSubPosition2(this.getSubPosition2());
- alarm.setRegion(this.getRegion());
- alarm.setSite(this.getSite());
-
- alarm.setSeverity(this.getSeverity());
- alarm.setAlarmType(this.getAlarmType());
- alarm.setSystemType(this.getSystemType());
- alarm.setSpecificProblem(this.getSpecificProblem());
- alarm.setAdditionalText(this.getAdditionalText());
- alarm.setProbableCause(this.getProbableCause());
-
- alarm.setRaisedTime(this.getRaisedTime());
- alarm.setRaisedServerTime(this.getRaisedServerTime());
- alarm.setClearedTime(this.getClearedTime());
-
- return alarm;
- }
-
- @Override
- public String getObjectId() {
- return String.valueOf(id);
- }
-
- public void addLinkIds(int linkId) {
- linkIds.add(linkId);
- }
-
-
- public boolean containsPriority(String ruleId) {
- if (priorityMap.keySet().contains(ruleId)) {
- return true;
- }
- return false;
- }
-
- public int getPriority(String ruleId) {
- Integer priority = this.priorityMap.get(ruleId);
- if (priority == null) {
- priority = 0;
- }
- return priority;
- }
-
- public int getRootAlarmType(String ruleId) {
- Integer rootAlarmType = this.rootAlarmTypeMap.get(ruleId);
- if (rootAlarmType == null) {
- rootAlarmType = -1;
- }
- return rootAlarmType;
- }
-
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusData.java b/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusData.java deleted file mode 100644 index ce95a8d..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusData.java +++ /dev/null @@ -1,43 +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.api.stat;
-
-import java.io.Serializable;
-
-public interface AplusData extends Serializable {
-
- /**
- * The data to be analyzed with aging characteristics - 0
- */
- byte APLUS_EVENT = 0;
-
- /**
- * The data to be analyzed without aging characteristics - 1
- */
- byte APLUS_FACT = 1;
-
-
- /**
- * @see #APLUS_EVENT
- * @see #APLUS_FACT
- */
- byte getDataType();
-
- /**
- * @return String
- */
- String getObjectId();
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusResult.java b/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusResult.java deleted file mode 100644 index 53c6729..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/api/stat/AplusResult.java +++ /dev/null @@ -1,66 +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.api.stat;
-
-import java.io.Serializable;
-
-public interface AplusResult extends Serializable {
-
- /**
- * Derived new alarm type - 0
- */
- byte APLUS_RAISED = 0;
-
- /**
- * Correlation alarm, root-child alarm - 1
- */
- byte APLUS_CORRELATION = 1;
-
- /**
- * cleared
- */
- byte APLUS_CLEAR = 2;
-
-
- int getId();
-
- void setId(int id);
-
- String getRuleInfo();
-
- void setRuleInfo(String ruleInfo);
-
- String getRuleType();
-
- void setRuleType(String ruleType);
-
- void setRuleId(String ruleId);
-
- String getRuleId();
-
- long getCreateTime();
-
- void setCreateTime(long createTime);
-
- byte getResultType();
-
- void setResultType(byte resultType);
-
- Alarm[] getAffectedAlarms();
-
- void setAffectedAlarms(Alarm[] affectedAlarms);
-
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/config/MQConfig.java b/holmes-actions/src/main/java/org/openo/holmes/common/config/MQConfig.java deleted file mode 100644 index 3200ec0..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/config/MQConfig.java +++ /dev/null @@ -1,39 +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.config;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.HashMap;
-import java.util.Map;
-import javax.validation.constraints.NotNull;
-
-public class MQConfig {
-
- @JsonProperty
- @NotNull
- public String brokerIp;
-
- @JsonProperty
- @NotNull
- public int brokerPort;
-
- @JsonProperty
- public String brokerUsername;
-
- @JsonProperty
- public String brokerPassword;
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java b/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java deleted file mode 100644 index 05273b8..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java +++ /dev/null @@ -1,38 +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.config;
-
-import org.openo.holmes.common.constant.AlarmConst;
-
-public class MicroServiceConfig {
-
- private static String getProperty(String name) {
- String value = System.getenv(name);
- if (value == null) {
- value = System.getProperty(name);
- }
- return value;
- }
-
- public static String getMsbServerAddr() {
- return AlarmConst.HTTP + getProperty("MSB_ADDR");
- }
-
- public static String getServiceIp() {
- return getProperty("SERVICE_IP");
- }
-
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java b/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java deleted file mode 100644 index 9e83d4c..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java +++ /dev/null @@ -1,41 +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.constant;
-
-public interface AlarmConst {
-
- String MQ_TOPIC_NAME_ALARMS_CORRELATION = "topic://voss/fm/alarms_correlation";
-
- String MQ_TOPIC_NAME_ALARM = "topic://voss/fm/alarm";
-
- String NFVO_PATH = "/openoapi/umc/v1/fm/curalarms/findAll";
-
- int NFVO_STATUS_OK = 200;
-
- String I18N_EN = "en";
-
- String I18N_ZH = "zh";
-
- String ZH_CN = "zh_CN";
-
- String ADMIN = "admin";
-
- int MICRO_SERVICE_STATUS_SUCCESS = 201;
-
- int MICRO_SERVICE_PORT = 8086;
-
- String HTTP = "http://";
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java b/holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java deleted file mode 100644 index dfe5373..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java +++ /dev/null @@ -1,27 +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.exception;
-
-public class CorrelationException extends Exception {
-
- public CorrelationException(String msg, Exception e) {
- super(msg, e);
- }
-
- public CorrelationException(String msg) {
- super(msg);
- }
-}
\ No newline at end of file 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/msb/MicroserviceBusRest.java b/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java deleted file mode 100644 index c8e03e9..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java +++ /dev/null @@ -1,36 +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.msb;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-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;
-
-@Path("/openoapi/microservices/v1/services")
-public interface MicroserviceBusRest {
-
- @Path("")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate,
- ServiceRegisterEntity entity);
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java b/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java deleted file mode 100644 index d258695..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java +++ /dev/null @@ -1,107 +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.producer;
-
-import java.io.Serializable;
-import javax.inject.Inject;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-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.apache.activemq.ActiveMQConnectionFactory;
-
-@Service
-@Slf4j
-@NoArgsConstructor
-public class MQProducer {
-
- @Inject
- private IterableProvider<MQConfig> mqConfigProvider;
- private ConnectionFactory connectionFactory;
-
- public void init() {
-
- String brokerURL =
- "tcp://" + mqConfigProvider.get().brokerIp + ":" + mqConfigProvider.get().brokerPort;
- connectionFactory = new ActiveMQConnectionFactory(mqConfigProvider.get().brokerUsername,
- mqConfigProvider.get().brokerPassword, brokerURL);
- }
-
- public void sendAlarmMQTopicMsg(Alarm alarm) {
- sendMQTopicMsg(alarm);
- }
-
- public void sendCorrelationMQTopicMsg(String ruleId, long createTimeL, Alarm parentAlarm,
- Alarm childAlarm) {
- CorrelationResult correlationResult = getCorrelationResult(ruleId, createTimeL, parentAlarm, childAlarm);
- sendMQTopicMsg(correlationResult);
- }
-
- private <T> void sendMQTopicMsg(T t) {
- Serializable msgEntity = (Serializable) t;
- Connection connection = null;
- Session session;
- Destination destination = null;
- MessageProducer messageProducer;
-
- try {
- connection = connectionFactory.createConnection();
- connection.start();
- session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
- if (t instanceof CorrelationResult) {
- destination = session.createTopic(AlarmConst.MQ_TOPIC_NAME_ALARMS_CORRELATION);
- } else if (t instanceof Alarm) {
- destination = session.createTopic(AlarmConst.MQ_TOPIC_NAME_ALARM);
- }
- messageProducer = session.createProducer(destination);
- ObjectMessage message = session.createObjectMessage(msgEntity);
- messageProducer.send(message);
- session.commit();
- } catch (Exception e) {
- log.error("Failed send correlation." + e.getMessage(), e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (JMSException e) {
- log.error("Failed close connection." + e.getMessage(), e);
- }
- }
- }
- }
-
- private CorrelationResult getCorrelationResult(String ruleId, long createTimeL, Alarm parentAlarm,
- Alarm childAlarm) {
- CorrelationResult correlationResult = new CorrelationResult();
- correlationResult.setRuleId(ruleId);
- correlationResult.setCreateTimeL(createTimeL);
- correlationResult.setResultType(AplusResult.APLUS_CORRELATION);
- correlationResult.setAffectedAlarms(new Alarm[]{parentAlarm, childAlarm});
- return correlationResult;
- }
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/DbDaoUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/DbDaoUtil.java deleted file mode 100644 index 18890ce..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/DbDaoUtil.java +++ /dev/null @@ -1,92 +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 io.dropwizard.db.DataSourceFactory;
-import io.dropwizard.jdbi.DBIFactory;
-import io.dropwizard.setup.Environment;
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import lombok.extern.slf4j.Slf4j;
-import org.jvnet.hk2.annotations.Service;
-import org.skife.jdbi.v2.DBI;
-import org.skife.jdbi.v2.Handle;
-
-@Singleton
-@Service
-@Slf4j
-public class DbDaoUtil {
-
- private DBI jdbi;
- @Inject
- private Environment environmentProvider;
- @Inject
- private DataSourceFactory dataSourceFactoryProvider;
-
- private DBIFactory factory = new DBIFactory();
-
- @PostConstruct
- public void init() {
- if (jdbi == null) {
- synchronized (DbDaoUtil.class) {
- if (jdbi == null) {
- jdbi = factory.build(environmentProvider, dataSourceFactoryProvider, "mysql");
- }
- }
- }
- }
-
- public <K> K getDao(Class<K> clazz) {
- try {
- return jdbi.open(clazz);
- } catch (Exception e) {
- log.warn("get object instance of Dao error.", e);
- }
- return null;
- }
-
- public Handle getHandle() {
- try {
- return jdbi.open();
- } catch (Exception e) {
- log.warn("get object instance of Dao error.", e);
- }
- return null;
- }
-
- public void close(Object obj) {
- if (obj != null) {
- try {
- jdbi.close(obj);
- } catch (Exception e) {
- log.warn("close jdbi connection error.", e);
- }
- }
- }
-
- public <T> T getJdbiDaoByOnDemand(Class<T> daoClazz) {
-
- return jdbi.onDemand(daoClazz);
-
- }
-
- public <T> T getJdbiDaoByOpen(Class<T> daoClazz) {
-
- return jdbi.open(daoClazz);
-
- }
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/ExceptionUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/ExceptionUtil.java deleted file mode 100644 index 1154f38..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/ExceptionUtil.java +++ /dev/null @@ -1,34 +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 javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-public class ExceptionUtil {
-
- private static final int EXCEPTION_CODE = 499;
-
- private ExceptionUtil() {
-
- }
-
- public static WebApplicationException buildExceptionResponse(String message) {
- Response response = Response.status(EXCEPTION_CODE).entity(message).type(MediaType.TEXT_PLAIN).build();
- return new WebApplicationException(response);
- }
-}
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/main/java/org/openo/holmes/common/utils/JacksonUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/JacksonUtil.java deleted file mode 100644 index f030d3d..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/JacksonUtil.java +++ /dev/null @@ -1,40 +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 com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-
-public class JacksonUtil {
-
- private JacksonUtil() {
-
- }
-
- public static String beanToJson(Object obj) throws JsonProcessingException {
- ObjectMapper objectMapper = new ObjectMapper();
- return objectMapper.writeValueAsString(obj);
- }
-
- public static <T> T jsonToBean(String json, Class<T> cls) throws IOException {
- ObjectMapper objectMapper = new ObjectMapper();
- if (json == null) {
- return objectMapper.readValue("{}", cls);
- }
- return objectMapper.readValue(json, cls);
- }
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/JudgeNullUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/JudgeNullUtil.java deleted file mode 100644 index beed186..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/JudgeNullUtil.java +++ /dev/null @@ -1,49 +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 java.util.List;
-
-public class JudgeNullUtil {
-
- private JudgeNullUtil() {
-
- }
-
- public static boolean isEmpty( short[] shorts ) {
- return shorts == null || shorts.length == 0;
- }
-
- public static boolean isEmpty( int[] ints ) {
- return ints == null || ints.length == 0;
- }
-
- public static boolean isEmpty( long[] longs ) {
- return longs == null || longs.length == 0;
- }
-
- public static boolean isEmpty( Object[] obj ) {
- return obj == null || obj.length == 0;
- }
-
- public static boolean isEmpty( String str ) {
- return str == null || "".equals( str.trim() );
- }
-
- public static boolean isEmpty( List < ? > list ) {
- return list == null || list.isEmpty();
- }
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java deleted file mode 100644 index 930905a..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java +++ /dev/null @@ -1,52 +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 java.util.Locale;
-import javax.servlet.http.HttpServletRequest;
-import org.openo.holmes.common.constant.AlarmConst;
-
-public class LanguageUtil {
-
- private LanguageUtil() {
- }
-
- public static String getLanguage(HttpServletRequest servletRequest) {
- String language = servletRequest.getHeader("language-option");
- if (JudgeNullUtil.isEmpty(language)) {
- language = AlarmConst.I18N_EN;
- }
- if (language.startsWith(AlarmConst.I18N_ZH)) {
- language = AlarmConst.I18N_ZH;
- } else if (language.startsWith(AlarmConst.I18N_EN)) {
- language = AlarmConst.I18N_EN;
- }
- return language;
- }
-
- public static Locale getLocale(HttpServletRequest servletRequest) {
- String language = servletRequest.getHeader("language-option");
- if (JudgeNullUtil.isEmpty(language)) {
- language = AlarmConst.I18N_EN;
- }
- if (language.startsWith(AlarmConst.I18N_ZH)) {
- language = AlarmConst.I18N_ZH;
- } else if (language.startsWith(AlarmConst.I18N_EN)) {
- language = AlarmConst.I18N_EN;
- }
- return new Locale(language);
- }
-}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java deleted file mode 100644 index 904a853..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java +++ /dev/null @@ -1,74 +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.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;
-
-@Slf4j
-@Service
-public class MSBRegisterUtil {
-
- public void register(ServiceRegisterEntity entity) throws IOException {
- log.info("start holmes micro service register");
- boolean flag = false;
- int retry = 0;
- while (!flag && retry < 20) {
- log.info("Holmes microservice register. retry:" + retry);
- retry++;
- flag = innerRegister(entity);
- if (!flag) {
- log.warn("micro service register failed, sleep 30S and try again.");
- threadSleep(30000);
- } else {
- log.info("micro service register success!");
- break;
- }
- }
- log.info("holmes micro service register end.");
- }
-
- private boolean innerRegister(ServiceRegisterEntity entity) {
- try {
- log.info("msbServerAddr:" + MicroServiceConfig.getMsbServerAddr());
- log.info("entity:" + entity);
- MicroserviceBusRest resourceserviceproxy = ConsumerFactory.createConsumer(
- MicroServiceConfig.getMsbServerAddr(), MicroserviceBusRest.class);
- resourceserviceproxy.registerServce("false", entity);
- } catch (Exception error) {
- log.error("microservice register failed!" + error.getMessage(), error);
- return false;
- }
- return true;
- }
-
- private void threadSleep(int second) {
- log.info("start sleep ....");
- try {
- Thread.sleep(second);
- } catch (InterruptedException error) {
- log.error("thread sleep error.errorMsg:" + error.getMessage(), error);
- Thread.currentThread().interrupt();
- }
- log.info("sleep end .");
- }
-}
\ No newline at end of file diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/UserUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/UserUtil.java deleted file mode 100644 index ec8fda6..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/UserUtil.java +++ /dev/null @@ -1,35 +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 javax.servlet.http.HttpServletRequest;
-import org.openo.holmes.common.constant.AlarmConst;
-
-public class UserUtil {
-
- private UserUtil() {
-
- }
-
- public static String getUserName(HttpServletRequest request) {
- String userName = AlarmConst.ADMIN;
- String sessionName = request.getHeader("username");
- if (sessionName != null) {
- userName = sessionName.toLowerCase();
- }
- return userName;
- }
-}
|