aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlj1412 <lji@research.att.com>2017-02-15 12:45:23 +0000
committerlj1412 <lji@research.att.com>2017-02-15 12:45:25 +0000
commit4a69ee4417940dde4311e8dc43474f38d6c9412e (patch)
tree455250b4c17706791cc66aa91388308b61596a9c
parentce343cc80095bf4d4684616580546eeaac1d4259 (diff)
Init dcae.operation.utils
Change-Id: I8c5d28aefa33396707d27168254d857cd321a4d1 Signed-off-by: lj1412 <lji@research.att.com>
-rw-r--r--.gitreview4
-rw-r--r--LICENSE.txt22
-rw-r--r--README.md7
-rw-r--r--operation-utils/.classpath32
-rw-r--r--operation-utils/.gitignore1
-rw-r--r--operation-utils/.project34
-rw-r--r--operation-utils/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--operation-utils/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--operation-utils/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--operation-utils/LICENSE.txt22
-rw-r--r--operation-utils/META-INF/MANIFEST.MF8
-rw-r--r--operation-utils/build.properties4
-rw-r--r--operation-utils/pom.xml140
-rw-r--r--operation-utils/src/main/java/org/openecomp/entity/EcompComponent.java31
-rw-r--r--operation-utils/src/main/java/org/openecomp/entity/EcompOperation.java44
-rw-r--r--operation-utils/src/main/java/org/openecomp/entity/EcompOperationEnum.java27
-rw-r--r--operation-utils/src/main/java/org/openecomp/entity/EcompSubComponent.java33
-rw-r--r--operation-utils/src/main/java/org/openecomp/entity/EcompSubComponentInstance.java63
-rw-r--r--operation-utils/src/main/java/org/openecomp/logger/Catalog.java28
-rw-r--r--operation-utils/src/main/java/org/openecomp/logger/EcompLogger.java406
-rw-r--r--operation-utils/src/main/java/org/openecomp/logger/EcompMessageEnum.java28
-rw-r--r--operation-utils/src/main/java/org/openecomp/logger/GenericMessageEnum.java38
-rw-r--r--operation-utils/src/main/java/org/openecomp/utils/ConvertMessagePropertiesToYaml.java63
-rw-r--r--operation-utils/src/main/java/org/openecomp/utils/YamlToJava.java134
-rw-r--r--operation-utils/src/main/resources/GenericMessages.properties65
-rw-r--r--operation-utils/src/main/resources/GenericMessages.yaml36
-rw-r--r--operation-utils/src/main/resources/messageEnum.java_template18
-rw-r--r--operation-utils/src/main/resources/operationEnum.java_template13
-rw-r--r--operation-utils/src/main/resources/properties_template9
29 files changed, 1330 insertions, 0 deletions
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..2922167
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,4 @@
+[gerrit]
+host=gerrit.openecomp.org
+port=29418
+project=dcae/operation/utils.git
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..30471b5
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,22 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+ECOMP and OpenECOMP are trademarks and service marks of AT&T Intellectual Property.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a7f8a32
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+
+Some OpenECOMP utilities. ECOMP Logging.
+
+# Build instructions
+
+1. Clone the repository
+2. Build using Maven: mvn clean install
diff --git a/operation-utils/.classpath b/operation-utils/.classpath
new file mode 100644
index 0000000..1ab68f0
--- /dev/null
+++ b/operation-utils/.classpath
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/operation-utils/.gitignore b/operation-utils/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/operation-utils/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/operation-utils/.project b/operation-utils/.project
new file mode 100644
index 0000000..48e38d7
--- /dev/null
+++ b/operation-utils/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>operation-utils</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/operation-utils/.settings/org.eclipse.core.resources.prefs b/operation-utils/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..abdea9a
--- /dev/null
+++ b/operation-utils/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding/<project>=UTF-8
diff --git a/operation-utils/.settings/org.eclipse.jdt.core.prefs b/operation-utils/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..6249222
--- /dev/null
+++ b/operation-utils/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/operation-utils/.settings/org.eclipse.m2e.core.prefs b/operation-utils/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/operation-utils/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/operation-utils/LICENSE.txt b/operation-utils/LICENSE.txt
new file mode 100644
index 0000000..30471b5
--- /dev/null
+++ b/operation-utils/LICENSE.txt
@@ -0,0 +1,22 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+ECOMP and OpenECOMP are trademarks and service marks of AT&T Intellectual Property.
diff --git a/operation-utils/META-INF/MANIFEST.MF b/operation-utils/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..65b7caa
--- /dev/null
+++ b/operation-utils/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: operation-utils
+Bundle-SymbolicName: operation-utils
+Bundle-Version: 0.1.0.qualifier
+Export-Package: org.openecomp.entity,
+ org.openecomp.logger,
+ org.openecomp.utils
diff --git a/operation-utils/build.properties b/operation-utils/build.properties
new file mode 100644
index 0000000..0dd4717
--- /dev/null
+++ b/operation-utils/build.properties
@@ -0,0 +1,4 @@
+source.. = src/main/java/,\
+ src/main/resources/
+bin.includes = META-INF/,\
+ .
diff --git a/operation-utils/pom.xml b/operation-utils/pom.xml
new file mode 100644
index 0000000..5486f67
--- /dev/null
+++ b/operation-utils/pom.xml
@@ -0,0 +1,140 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openecomp.dcae.operation</groupId>
+ <artifactId>operation-utils</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
+ </properties>
+
+
+ <pluginRepositories>
+ <!-- Black Duck plugin dependencies -->
+ <pluginRepository>
+ <id>JCenter</id>
+ <name>JCenter Repository</name>
+ <url>http://jcenter.bintray.com</url>
+ </pluginRepository>
+
+ <pluginRepository>
+ <id>Restlet</id>
+ <name>Restlet Repository</name>
+ <url>http://maven.restlet.com</url>
+ </pluginRepository>
+ </pluginRepositories>
+<build>
+ <plugins>
+ <!-- blackduck maven plugin -->
+ <plugin>
+ <groupId>com.blackducksoftware.integration</groupId>
+ <artifactId>hub-maven-plugin</artifactId>
+ <version>1.4.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <hubProjectName>${project.name}</hubProjectName>
+ <outputDirectory>${project.basedir}</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-bdio-file</id>
+ <phase>package</phase>
+ <goals>
+ <goal>createHubOutput</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- site maven plugin -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.6</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <!-- blackduck maven plugin -->
+ <plugin>
+ <groupId>com.blackducksoftware.integration</groupId>
+ <artifactId>hub-maven-plugin</artifactId>
+ <version>1.4.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <hubProjectName>${project.name}</hubProjectName>
+ <outputDirectory>${project.basedir}</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-bdio-file</id>
+ <phase>package</phase>
+ <goals>
+ <goal>createHubOutput</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.6</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>0.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.6</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.15</version>
+ </dependency>
+
+
+
+ <dependency>
+ <groupId>org.openecomp.ncomp.utils</groupId>
+ <artifactId>ncomp-utils-java</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>2.4.3</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.ncomp.maven</groupId>
+ <artifactId>ncomp-maven-base</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../dcae-org.openecomp.ncomp.maven/ncomp-maven-base</relativePath>
+ </parent>
+</project>
diff --git a/operation-utils/src/main/java/org/openecomp/entity/EcompComponent.java b/operation-utils/src/main/java/org/openecomp/entity/EcompComponent.java
new file mode 100644
index 0000000..b52e9ee
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/entity/EcompComponent.java
@@ -0,0 +1,31 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.entity;
+
+public class EcompComponent {
+
+ public static void initialize(String string) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/operation-utils/src/main/java/org/openecomp/entity/EcompOperation.java b/operation-utils/src/main/java/org/openecomp/entity/EcompOperation.java
new file mode 100644
index 0000000..367a342
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/entity/EcompOperation.java
@@ -0,0 +1,44 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.entity;
+
+public class EcompOperation {
+ private String requestId;
+ private String serviceInstanceId;
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+}
diff --git a/operation-utils/src/main/java/org/openecomp/entity/EcompOperationEnum.java b/operation-utils/src/main/java/org/openecomp/entity/EcompOperationEnum.java
new file mode 100644
index 0000000..94be8ee
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/entity/EcompOperationEnum.java
@@ -0,0 +1,27 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.entity;
+
+
+public interface EcompOperationEnum {
+
+}
diff --git a/operation-utils/src/main/java/org/openecomp/entity/EcompSubComponent.java b/operation-utils/src/main/java/org/openecomp/entity/EcompSubComponent.java
new file mode 100644
index 0000000..85dacb1
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/entity/EcompSubComponent.java
@@ -0,0 +1,33 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.entity;
+
+public class EcompSubComponent {
+
+ static String name = "NON-SET";
+
+ public static void initialize(String name1) {
+ name = name1;
+ EcompSubComponentInstance.initialize();
+ }
+
+}
diff --git a/operation-utils/src/main/java/org/openecomp/entity/EcompSubComponentInstance.java b/operation-utils/src/main/java/org/openecomp/entity/EcompSubComponentInstance.java
new file mode 100644
index 0000000..9b54bdd
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/entity/EcompSubComponentInstance.java
@@ -0,0 +1,63 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.entity;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class EcompSubComponentInstance {
+ private static final Logger logger = Logger.getLogger(EcompSubComponentInstance.class.getName());
+
+ static String uuid = "???";
+ public static String getServerIP() {
+ initialize();
+ return serverIP;
+ }
+
+ public static String getServerName() {
+ initialize();
+ return serverName;
+ }
+
+ private static String serverIP, serverName;
+
+ public static String getUuid() {
+ return uuid;
+ }
+
+ public static void initialize() {
+ if (serverIP == null || serverName == null || ("").equals(serverIP) || ("").equals(serverName)) {
+ try {
+ InetAddress server = InetAddress.getLocalHost();
+ serverIP = server.getHostAddress();
+ serverName = server.getCanonicalHostName();
+ } catch (UnknownHostException e) {
+ logger.log(Level.SEVERE, "Could not get local hostname", e);
+ serverIP = "";
+ serverName = "";
+ }
+ }
+ }
+}
diff --git a/operation-utils/src/main/java/org/openecomp/logger/Catalog.java b/operation-utils/src/main/java/org/openecomp/logger/Catalog.java
new file mode 100644
index 0000000..f512a3c
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/logger/Catalog.java
@@ -0,0 +1,28 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.logger;
+
+public class Catalog {
+
+
+
+}
diff --git a/operation-utils/src/main/java/org/openecomp/logger/EcompLogger.java b/operation-utils/src/main/java/org/openecomp/logger/EcompLogger.java
new file mode 100644
index 0000000..254b06e
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/logger/EcompLogger.java
@@ -0,0 +1,406 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+
+package org.openecomp.logger;
+
+
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Date;
+import java.util.UUID;
+import java.util.logging.Logger;
+
+import org.slf4j.MDC;
+
+import org.openecomp.entity.EcompOperation;
+import org.openecomp.entity.EcompOperationEnum;
+import org.openecomp.entity.EcompSubComponentInstance;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.configuration.SLF4jWrapper;
+
+/**
+ * Simple wrapper around the EELF Logger class for MSO usage.
+ * This class supports all of the normal logging functions (debug, info, etc.),
+ * prepending a string of format "[<requestId>|<serviceId]" to each message.
+ *
+ * MSO code should initialize with these IDs when available, so that individual
+ * requests and/or services can be tracked throughout the various MSO component
+ * logs (API Handler, BPEL, and Adapters).
+ *
+ */
+public class EcompLogger {
+ // MDC parameters
+ public static final String REQUEST_ID = "RequestId";
+ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ public static final String SERVICE_NAME = "ServiceName";
+ public static final String INSTANCE_UUID = "InstanceUUID";
+ public static final String SERVER_IP = "ServerIPAddress";
+ public static final String FQDN = "ServerFQDN";
+ public static final String REMOTE_HOST = "RemoteHost";
+ public static final String ALERT_SEVERITY = "AlertSeverity";
+ public static final String TIMER = "Timer";
+ public static final String USER = "User";
+ public static final String CATALOG = "Catalog";
+ public static final String DUMMY_REQUEST_VALUE = "?";
+ public static final String DUMMY_SERVICE_INSTANCE_VALUE = "??";
+
+ private static final String FATAL_LEVEL = "FATAL";
+ private static final String ERROR_LEVEL = "ERROR";
+ private static final String WARN_LEVEL = "WARN";
+ private static final String INFO_LEVEL = "INFO";
+ private static final String DEBUG_LEVEL = "DEBUG";
+
+ private EELFLogger errorLogger, auditLogger, metricsLogger, debugLogger;
+
+
+ // For internal logging of the initialization of MSO logs
+ private static final Logger LOGGER = Logger.getLogger (EcompLogger.class.getName ());
+ private static final String ERROR_LOGGER_NAME = "org.openecomp.error";
+ private static final String AUDIT_LOGGER_NAME = "org.openecomp.audit";
+ private static final String METRICS_LOGGER_NAME = "org.openecomp.metrics";
+ private static final String DEBUG_LOGGER_NAME = "org.openecomp.debug";
+
+
+ private EcompLogger () {
+ this.errorLogger = new SLF4jWrapper(ERROR_LOGGER_NAME);
+ this.auditLogger = new SLF4jWrapper(AUDIT_LOGGER_NAME);;
+ this.metricsLogger = new SLF4jWrapper(METRICS_LOGGER_NAME);
+ this.debugLogger = new SLF4jWrapper(DEBUG_LOGGER_NAME);
+ }
+
+
+ public static synchronized EcompLogger getEcompLogger () {
+ return new EcompLogger ();
+ }
+
+ /**
+ * Record the Audit start event
+ *
+ */
+ public void recordAuditEventStart (EcompMessageEnum msg, String... args) {
+ prepareMsg (INFO_LEVEL);
+ setStart();
+ auditLogger.info (msg, args);
+ }
+ /**
+ * Record the Audit start event
+ *
+ */
+ public void recordAuditEventStart () {
+ recordAuditEventStart(GenericMessageEnum.AUDIT_BEGIN);
+ }
+
+ /**
+ * Record the Audit end event with log message to put
+ *
+ * @param arg0 The log message to put
+ */
+ public void recordAuditEventEnd (EcompMessageEnum msg, String... args) {
+ setTimer();
+ prepareMsg (INFO_LEVEL);
+ auditLogger.info (msg, normalizeArray(args));
+ }
+
+ /**
+ * Record the Audit end event with log message to put
+ *
+ * @param arg0 The log message to put
+ */
+ public void recordAuditEventEnd () {
+ auditLogger.info (GenericMessageEnum.AUDIT_END);
+ }
+ /**
+ * Record the Metric start event without log message
+ *
+ */
+ public void recordMetricEventStart (EcompMessageEnum msg, String... args) {
+ prepareMsg (INFO_LEVEL);
+ setStart();
+ metricsLogger.info (msg, args);
+ }
+
+ /**
+ * Record the Metric end event with log message to put
+ *
+ * @param arg0 The log message to put
+ */
+ public void recordMetricEventEnd (EcompMessageEnum msg, String... args) {
+ prepareMsg (INFO_LEVEL);
+ setTimer();
+ metricsLogger.info (msg, normalizeArray(args));
+ }
+ /**
+ * Record the Metric start event without log message
+ *
+ */
+ public void recordMetricEventStart () {
+ recordMetricEventStart(GenericMessageEnum.METRICS_BEGIN);
+ }
+
+ /**
+ * Record the Metric end event with log message to put
+ *
+ * @param arg0 The log message to put
+ */
+ public void recordMetricEventEnd () {
+ recordMetricEventEnd (GenericMessageEnum.METRICS_END);
+ }
+
+ // Debug methods
+ /**
+ * Record the Debug event
+ *
+ * @param msg The log message to put
+ */
+ public void debug (String msg) {
+ prepareMsg (DEBUG_LEVEL);
+ errorLogger.debug (msg);
+ }
+
+ /**
+ * Record the Debug event
+ *
+ * @param msg The log message to put
+ * @param t The exception to put
+ */
+ public void debug (String msg, Throwable t) {
+ prepareMsg (DEBUG_LEVEL);
+ errorLogger.debug (msg);
+ }
+
+ // Info methods
+ /**
+ * Record the Info event
+ *
+ * @param msg The log message to put
+ */
+ public void info (EcompMessageEnum msg, String... args) {
+ prepareMsg (INFO_LEVEL);
+ errorLogger.info (msg,normalizeArray(args));
+ }
+
+ /**
+ * Record the Info event
+ *
+ * @param msg The log message to put
+ * @param t The exception info
+ */
+ public void info (EcompMessageEnum msg, Throwable t, String... args) {
+ prepareMsg (WARN_LEVEL);
+ errorLogger.info (msg,normalizeArray(args));
+ errorLogger.info ("Exception raised: " + getNormalizedStackTrace (t));
+ errorLogger.debug ("Exception raised", t);
+ }
+
+ // Warning methods
+ /**
+ * Record the Warning event
+ *
+ * @param msg The log message to put
+ */
+ public void warn (EcompMessageEnum msg, String... args) {
+ prepareMsg (WARN_LEVEL);
+ errorLogger.warn (msg,normalizeArray(args));
+ }
+
+
+
+ /**
+ * Record the Warning event
+ *
+ * @param msg The log message to put
+ * @param t The exception info
+ */
+ public void warn (EcompMessageEnum msg, Throwable t, String... args) {
+ prepareMsg (WARN_LEVEL);
+ errorLogger.warn (msg,normalizeArray(args));
+ errorLogger.warn ("Exception raised: " + getNormalizedStackTrace (t));
+ errorLogger.debug ("Exception raised", t);
+ }
+
+ // Error methods
+ /**
+ * Record the Error event
+ *
+ * @param msg The log message to put
+ */
+ public void error (EcompMessageEnum msg, String... args) {
+ prepareMsg (ERROR_LEVEL);
+ errorLogger.error (msg, normalizeArray(args));
+ }
+
+ /**
+ * Record the Error event
+ *
+ * @param msg The log message to put
+ * @param t The exception info
+ */
+ public void error (EcompMessageEnum msg, Throwable t, String... args) {
+ prepareMsg (ERROR_LEVEL);
+ errorLogger.error (msg, normalizeArray(args));
+ errorLogger.error (GenericMessageEnum.GENERAL_EXCEPTION, getNormalizedStackTrace (t));
+ errorLogger.debug ("Exception raised", t);
+ }
+
+ public boolean isDebugEnabled () {
+ return errorLogger.isDebugEnabled();
+ }
+
+ private void setStart() {
+ MDC.put("startTime", Long.toString(new Date().getTime()));
+ }
+
+
+ private void setTimer() {
+ Date d = new Date(Long.parseLong(MDC.get("startTime")));
+ MDC.put(TIMER, Long.toString(new Date().getTime()-d.getTime()));
+ }
+
+
+ private void prepareMsg (String loggingLevel) {
+ prepareMsg (loggingLevel, null, null);
+ }
+
+ private void prepareMsg (String loggingLevel, String serviceNamep, String timer) {
+ String reqId = MDC.get (REQUEST_ID);
+ String svcId = MDC.get (SERVICE_INSTANCE_ID);
+
+ if (reqId == null || reqId.isEmpty()) {
+ MDC.put (REQUEST_ID, DUMMY_REQUEST_VALUE);
+ }
+
+ if (svcId == null || svcId.isEmpty()) {
+ MDC.put (SERVICE_INSTANCE_ID, DUMMY_SERVICE_INSTANCE_VALUE);
+ }
+
+ if (timer != null) {
+ MDC.put (TIMER, timer);
+ } else {
+ MDC.remove(TIMER);
+ }
+
+ MDC.put (ALERT_SEVERITY, getSeverityLevel (loggingLevel));
+// MDC.put (INSTANCE_UUID, EcompSubComponentInstance.getUuid());
+ MDC.put (SERVER_IP, EcompSubComponentInstance.getServerIP());
+ MDC.put (FQDN, EcompSubComponentInstance.getServerName());
+ }
+
+ private String getSeverityLevel (String loggingLevel) {
+ String severity;
+ // According to the Nagios alerting: 0=OK; 1=WARNING; 2=UNKOWN; 3=CRITICAL
+ switch (loggingLevel) {
+ case ERROR_LEVEL:
+ severity = "2";
+ break;
+ case FATAL_LEVEL:
+ severity = "3";
+ break;
+ case WARN_LEVEL:
+ severity = "1";
+ break;
+ default:
+ severity = "0";
+ break;
+ }
+ return severity;
+ }
+
+
+ public static void setLogContext (String reqId, String svcId) {
+ MDC.put (REQUEST_ID, reqId);
+ MDC.put (SERVICE_INSTANCE_ID, svcId);
+ }
+
+ public static void setLoggerParameters (String remoteIpp, String userp) {
+ MDC.put (REMOTE_HOST, remoteIpp);
+ MDC.put (USER, userp);
+ }
+
+ public static void setServiceName (String serviceNamep) {
+ MDC.put (SERVICE_NAME, serviceNamep);
+ }
+
+ public static void resetServiceName () {
+ MDC.remove (SERVICE_NAME);
+ }
+
+ public static void setLogContext (EcompOperation operation) {
+ if (operation != null) {
+ MDC.put (REQUEST_ID, operation.getRequestId());
+ MDC.put (SERVICE_INSTANCE_ID, operation.getServiceInstanceId());
+ }
+ else {
+ MDC.put (REQUEST_ID, DUMMY_REQUEST_VALUE);
+ MDC.put (SERVICE_INSTANCE_ID, DUMMY_SERVICE_INSTANCE_VALUE);
+ }
+ }
+
+ private String normalize (String input) {
+ if (input == null) {
+ return null;
+ }
+ String result = input.replace ('|', '!');
+ result = result.replace ("\n", " - ");
+ return result;
+ }
+
+
+ private String[] normalizeArray(String[] args) {
+ for (int i = 0; i< args.length; i++) {
+ args[i] = normalize(args[i]);
+ }
+ return args;
+ }
+
+ private String getNormalizedStackTrace (Throwable t) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ return sw.toString().replace ('|', '!').replace ("\n", " - ");
+ }
+
+
+ public void setOperation(EcompOperationEnum op) {
+ MDC.put (SERVICE_NAME, op.toString());
+ }
+
+ public void newRequestId() {
+ String uuid = UUID.randomUUID().toString();
+ MDC.put (REQUEST_ID, uuid);
+ }
+
+
+ public void setRequestId(String requestId) {
+ MDC.put (REQUEST_ID, requestId);
+ }
+
+ public void setRemoteHost(String remote) {
+ MDC.put (REMOTE_HOST, remote);
+ }
+
+ public void setInstanceId(String instance) {
+ MDC.put (INSTANCE_UUID, instance);
+ }
+
+}
diff --git a/operation-utils/src/main/java/org/openecomp/logger/EcompMessageEnum.java b/operation-utils/src/main/java/org/openecomp/logger/EcompMessageEnum.java
new file mode 100644
index 0000000..903d5e0
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/logger/EcompMessageEnum.java
@@ -0,0 +1,28 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.logger;
+
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
+
+public interface EcompMessageEnum extends EELFResolvableErrorEnum {
+
+}
diff --git a/operation-utils/src/main/java/org/openecomp/logger/GenericMessageEnum.java b/operation-utils/src/main/java/org/openecomp/logger/GenericMessageEnum.java
new file mode 100644
index 0000000..deed808
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/logger/GenericMessageEnum.java
@@ -0,0 +1,38 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.logger;
+
+import com.att.eelf.i18n.EELFResourceManager;
+
+public enum GenericMessageEnum implements EcompMessageEnum {
+ GENERAL_INFO,
+ GENERAL_WARNING,
+ GENERAL_ERROR,
+ GENERAL_EXCEPTION,
+ AUDIT_BEGIN,
+ AUDIT_END,
+ METRICS_BEGIN,
+ METRICS_END;
+ static {
+ EELFResourceManager.loadMessageBundle("GenericMessages");
+ }
+}
diff --git a/operation-utils/src/main/java/org/openecomp/utils/ConvertMessagePropertiesToYaml.java b/operation-utils/src/main/java/org/openecomp/utils/ConvertMessagePropertiesToYaml.java
new file mode 100644
index 0000000..28026d6
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/utils/ConvertMessagePropertiesToYaml.java
@@ -0,0 +1,63 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.util.Properties;
+
+import org.json.JSONObject;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.Yaml;
+
+import org.openecomp.ncomp.webservice.utils.FileUtils;
+
+public class ConvertMessagePropertiesToYaml {
+
+ public static void main(String[] args) throws IOException {
+
+ Properties props = new Properties();
+ String pname = "GenericMessages.properties";
+ String fname = "src/main/resources/GenericMessages.yaml";
+ props.load(ConvertMessagePropertiesToYaml.class.getClassLoader().getResourceAsStream(pname));
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ Yaml y = new Yaml(options);
+ JSONObject j = new JSONObject();
+ for (Object k : props.keySet()) {
+ String a[] = props.getProperty((String) k).split("\\|");
+ JSONObject j1 = new JSONObject();
+ j.put((String) k, j1);
+ j1.put("errorCode", a[0]);
+ j1.put("messageFormat", a[1]);
+ j1.put("resolution", a[2]);
+ j1.put("description", a[3].trim());
+ }
+
+ Object data = y.load(j.toString());
+ OutputStreamWriter w = FileUtils.filename2writer(fname);
+ w.append(y.dump(data) + "\n");
+ w.close();
+ }
+}
diff --git a/operation-utils/src/main/java/org/openecomp/utils/YamlToJava.java b/operation-utils/src/main/java/org/openecomp/utils/YamlToJava.java
new file mode 100644
index 0000000..4577e06
--- /dev/null
+++ b/operation-utils/src/main/java/org/openecomp/utils/YamlToJava.java
@@ -0,0 +1,134 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ */
+
+package org.openecomp.utils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Properties;
+
+import org.json.JSONObject;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.Yaml;
+
+import groovy.lang.Writable;
+import groovy.text.SimpleTemplateEngine;
+
+import org.openecomp.ncomp.utils.PropertyUtil;
+import org.openecomp.ncomp.webservice.utils.FileUtils;
+
+public class YamlToJava {
+
+// package org.openecomp.operation.logging.usecases;
+//
+// import org.openecomp.logger.EcompMessageEnum;
+// import com.att.eelf.i18n.EELFResourceManager;
+//
+// public enum MyMessageEnum implements EcompMessageEnum {
+// // Api Handler Messages
+// FOOBAR;
+//
+// static {
+// EELFResourceManager.loadMessageBundle("foobar");
+// }
+// }
+
+ @SuppressWarnings("unchecked")
+ static public void convert(String yamlFileName, String outputSourceRootDir, String packageName) {
+ try {
+ if (! (new File(yamlFileName).exists())) {
+ System.err.println(yamlFileName + " does not exists");
+ return;
+ }
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ Yaml y = new Yaml(options);
+ Map<String,Object> m = (Map<String, Object>) y.load(FileUtils.filename2stream(yamlFileName, null));
+ File f = new File(yamlFileName);
+ String name = f.getName().replace(".yaml", "");
+ m.put("name", name);
+ m.put("packageName", packageName);
+ String ofile1 = outputSourceRootDir + "/" + name + ".properties";
+ OutputStreamWriter w;
+ SimpleTemplateEngine engine = new SimpleTemplateEngine();
+ if (m.containsKey("messages")) {
+ w = FileUtils.filename2writer(ofile1);
+ w.append(engine.createTemplate(getTemplate("properties_template")).make(m).toString());
+ w.close();
+ String ofile2 = outputSourceRootDir + "/" + name + "MessageEnum.java";
+ w = FileUtils.filename2writer(ofile2);
+ w.append(engine.createTemplate(getTemplate("messageEnum.java_template")).make(m).toString());
+ w.close();
+ }
+ if (m.containsKey("operations")) {
+ String ofile3 = outputSourceRootDir + "/" + name + "OperationEnum.java";
+ w = FileUtils.filename2writer(ofile3);
+ w.append(engine.createTemplate(getTemplate("operationEnum.java_template")).make(m).toString());
+ w.close();
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ private static String getTemplate(String res) throws IOException {
+ InputStream in = YamlToJava.class.getClassLoader().getResourceAsStream(res);
+ if (in == null) {
+ throw new RuntimeException("Unable to find resource: " + res);
+ }
+ ByteArrayOutputStream o = new ByteArrayOutputStream();
+ FileUtils.copyStream(in, o);
+ return o.toString();
+}
+
+ public static void main(String[] args) throws IOException {
+
+ Properties props = new Properties();
+ String pname = "GenericMessages.properties";
+ String fname = "src/main/resources/GenericMessages.yaml";
+ props.load(YamlToJava.class.getClassLoader().getResourceAsStream(pname));
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ Yaml y = new Yaml(options);
+ JSONObject j = new JSONObject();
+ for (Object k : props.keySet()) {
+ String a[] = props.getProperty((String) k).split("\\|");
+ JSONObject j1 = new JSONObject();
+ j.put((String) k, j1);
+ j1.put("errorCode", a[0]);
+ j1.put("messageFormat", a[1]);
+ j1.put("resolution", a[2]);
+ j1.put("description", a[3].trim());
+ }
+
+ Object data = y.load(j.toString());
+ OutputStreamWriter w = FileUtils.filename2writer(fname);
+ w.append(y.dump(data) + "\n");
+ w.close();
+ }
+}
diff --git a/operation-utils/src/main/resources/GenericMessages.properties b/operation-utils/src/main/resources/GenericMessages.properties
new file mode 100644
index 0000000..b7322f8
--- /dev/null
+++ b/operation-utils/src/main/resources/GenericMessages.properties
@@ -0,0 +1,65 @@
+########################################################################
+#Resource key=Error Code|Message text|Resolution text |Description text
+#######
+# {component}-{subcomponent}-{4-digit code}{classification}
+#Newlines can be utilized to add some clarity ensuring continuing line
+#has atleast one leading space
+#ResourceKey=\
+# ERR0000E\
+# Sample error msg txt\
+# Sample resolution msg\
+# Sample description txt
+#
+#######
+#Error code classification category for other components
+#1400-1499 Security/Permission Related
+#2400-2499 Availability/Timeout Related
+#3400-3499 Data Access/Integrity Related
+#4400-4499 Schema Interface Type/Validation
+#5400-5499 Business/Flow Processing Related
+#6400-6499 Reserved \u2013 do not use
+#9400-9499 Unknown Errors
+#
+######
+#{classification} description
+# I = Information
+# W = Warning
+# E = Error
+# F = Fatal
+########################################################################
+GENERAL_INFO=\
+ ECOMP-GENERAL-INFO-5401|\
+ {0}|\
+ Please check other logs for more detailed info|\
+ General info
+GENERAL_WARNING=\
+ ECOMP-GENERAL-WARNING-5402|\
+ {0}|\
+ Please check other logs for more detailed info|\
+ General warning
+GENERAL_ERROR=\
+ ECOMP-GENERAL-ERROR-5403|\
+ {0}|\
+ Please check other logs for more detailed info|\
+ General error
+AUDIT_BEGIN=\
+ ECOMP-GENERAL-5403|\
+ Entering method|\
+ No resolution needed|\
+ Entering method
+AUDIT_END=\
+ ECOMP-GENERAL-5404|\
+ Exiting method|\
+ No resolution needed|\
+ Exiting method
+METRICS_BEGIN=\
+ ECOMP-GENERAL-5403|\
+ Entering method|\
+ No resolution needed|\
+ Entering method
+METRICS_END=\
+ ECOMP-GENERAL-5404|\
+ Exiting method|\
+ No resolution needed|\
+ Exiting method
+
diff --git a/operation-utils/src/main/resources/GenericMessages.yaml b/operation-utils/src/main/resources/GenericMessages.yaml
new file mode 100644
index 0000000..df592e2
--- /dev/null
+++ b/operation-utils/src/main/resources/GenericMessages.yaml
@@ -0,0 +1,36 @@
+GENERAL_ERROR:
+ errorCode: ECOMP-GENERAL-ERROR-5403
+ messageFormat: '{0}'
+ resolution: Please check other logs for more detailed info
+ description: General error
+GENERAL_INFO:
+ errorCode: ECOMP-GENERAL-INFO-5401
+ messageFormat: '{0}'
+ resolution: Please check other logs for more detailed info
+ description: General info
+GENERAL_WARNING:
+ errorCode: ECOMP-GENERAL-WARNING-5402
+ messageFormat: '{0}'
+ resolution: Please check other logs for more detailed info
+ description: General warning
+METRICS_END:
+ errorCode: ECOMP-GENERAL-5404
+ messageFormat: Exiting method
+ resolution: No resolution needed
+ description: Exiting method
+AUDIT_END:
+ errorCode: ECOMP-GENERAL-5404
+ messageFormat: Exiting method
+ resolution: No resolution needed
+ description: Exiting method
+AUDIT_BEGIN:
+ errorCode: ECOMP-GENERAL-5403
+ messageFormat: Entering method
+ resolution: No resolution needed
+ description: Entering method
+METRICS_BEGIN:
+ errorCode: ECOMP-GENERAL-5403
+ messageFormat: Entering method
+ resolution: No resolution needed
+ description: Entering method
+
diff --git a/operation-utils/src/main/resources/messageEnum.java_template b/operation-utils/src/main/resources/messageEnum.java_template
new file mode 100644
index 0000000..e0b3c12
--- /dev/null
+++ b/operation-utils/src/main/resources/messageEnum.java_template
@@ -0,0 +1,18 @@
+
+package $packageName;
+
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.logger.EcompMessageEnum;
+
+public enum ${name}MessageEnum implements EcompMessageEnum {
+<%
+def last
+messages.each { n, v -> last = n }
+messages.each { n, v -> %>
+ $n${n==last ? ";" : ","}\
+<% } %>
+
+ static {
+ EELFResourceManager.loadMessageBundle("${packageName}.$name");
+ }
+}
diff --git a/operation-utils/src/main/resources/operationEnum.java_template b/operation-utils/src/main/resources/operationEnum.java_template
new file mode 100644
index 0000000..9ec9d3d
--- /dev/null
+++ b/operation-utils/src/main/resources/operationEnum.java_template
@@ -0,0 +1,13 @@
+
+package $packageName;
+
+import org.openecomp.entity.EcompOperationEnum;
+
+public enum ${name}OperationEnum implements EcompOperationEnum {
+<%
+def last
+operations.each { n, v -> last = n }
+operations.each { n, v -> %>
+ $n${n==last ? ";" : ","}\
+<% } %>
+}
diff --git a/operation-utils/src/main/resources/properties_template b/operation-utils/src/main/resources/properties_template
new file mode 100644
index 0000000..76b2b48
--- /dev/null
+++ b/operation-utils/src/main/resources/properties_template
@@ -0,0 +1,9 @@
+<%
+ messages.each { n, v ->
+%>
+$n=\\
+ $v.errorCode|\\
+ $v.messageFormat|\\
+ $v.resolution|\\
+ $v.description
+<% } %> \ No newline at end of file