summaryrefslogtreecommitdiffstats
path: root/appc-lifecycle-management/appc-lifecycle-management-core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'appc-lifecycle-management/appc-lifecycle-management-core/src/main')
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java186
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml56
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties66
3 files changed, 154 insertions, 154 deletions
diff --git a/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
index 890218e92..b7acf98ed 100644
--- a/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
@@ -1,102 +1,102 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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
+ * 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.
+ * 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.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.impl;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.att.eelf.i18n.EELFResourceManager;
-import org.openecomp.appc.exceptions.InvalidInputException;
-import org.openecomp.appc.i18n.Msg;
-import org.openecomp.appc.lifecyclemanager.LifecycleManager;
-import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
-import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
-import org.openecomp.appc.statemachine.StateMachine;
-import org.openecomp.appc.statemachine.StateMetaDataReader;
-import org.openecomp.appc.statemachine.impl.StateMachineFactory;
-import org.openecomp.appc.statemachine.impl.readers.AppcOamMetaDataReader;
-import org.openecomp.appc.statemachine.impl.readers.VnfMetaDataReader;
-import org.openecomp.appc.statemachine.objects.*;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class LifecycleManagerImpl implements LifecycleManager{
-
- private StateMetaDataReader metadataReader;
- private static Map<String,StateMachine> stateMachineMap = new ConcurrentHashMap<>();
- private final EELFLogger logger = EELFManager.getInstance().getLogger(LifecycleManagerImpl.class);
- private final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
-
- @Override
- public String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException{
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to getNextState with vnfType = "+ vnfType + ", currentState = " + currentState + ", event = " + event);
- }
-
- State nextState;
- StateMachine machine;
- StateMachineResponse response;
- try {
- machine = this.getStateMachine(vnfType);
- response = machine.handleEvent(new State(currentState),new Event(event));
- if(Response.NO_TRANSITION_DEFINED.equals(response.getResponse())){
- errorLogger.error(EELFResourceManager.format(Msg.VF_ILLEGAL_COMMAND, vnfType,event,currentState));
- throw new NoTransitionDefinedException("No Transition Defined for currentState = " + currentState + ", event = " + event,currentState,event);
- }
- nextState = response.getNextState();
- } catch (InvalidInputException e) {
- logger.error(e.getMessage());
- throw new LifecycleException(e,currentState,event);
- }
- if (logger.isTraceEnabled()) {
- logger.trace("Exiting from getNextState with (nextState = " + nextState.getStateName() + ")");
- }
- return nextState.getStateName();
- }
-
- private StateMachine getStateMachine(String vnfType){
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to getNextState with vnfType = "+ vnfType);
- }
- if(vnfType == null){
- vnfType = "DEFAULT";
- }
- StateMachine machine = stateMachineMap.get(vnfType);
- if(machine == null){
- metadataReader = getMetadataReader(vnfType);
- StateMachineMetadata metadata = metadataReader.readMetadata();
- machine = StateMachineFactory.getStateMachine(metadata);
- stateMachineMap.put(vnfType,machine);
- }
-
- logger.trace("Exiting getStateMachine with StateMachine = " + stateMachineMap.get(vnfType).toString());
- return stateMachineMap.get(vnfType);
- }
-
- private StateMetaDataReader getMetadataReader(String vnfType) {
- return vnfType.equals("APPC") ? new AppcOamMetaDataReader() : new VnfMetaDataReader();
- }
-
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.impl;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.appc.exceptions.InvalidInputException;
+import org.openecomp.appc.i18n.Msg;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
+import org.openecomp.appc.statemachine.StateMachine;
+import org.openecomp.appc.statemachine.StateMetaDataReader;
+import org.openecomp.appc.statemachine.impl.StateMachineFactory;
+import org.openecomp.appc.statemachine.impl.readers.AppcOamMetaDataReader;
+import org.openecomp.appc.statemachine.impl.readers.VnfMetaDataReader;
+import org.openecomp.appc.statemachine.objects.*;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class LifecycleManagerImpl implements LifecycleManager{
+
+ private StateMetaDataReader metadataReader;
+ private static Map<String,StateMachine> stateMachineMap = new ConcurrentHashMap<>();
+ private final EELFLogger logger = EELFManager.getInstance().getLogger(LifecycleManagerImpl.class);
+ private final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
+
+ @Override
+ public String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException{
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to getNextState with vnfType = "+ vnfType + ", currentState = " + currentState + ", event = " + event);
+ }
+
+ State nextState;
+ StateMachine machine;
+ StateMachineResponse response;
+ try {
+ machine = this.getStateMachine(vnfType);
+ response = machine.handleEvent(new State(currentState),new Event(event));
+ if(Response.NO_TRANSITION_DEFINED.equals(response.getResponse())){
+ errorLogger.error(EELFResourceManager.format(Msg.VF_ILLEGAL_COMMAND, vnfType,event,currentState));
+ throw new NoTransitionDefinedException("No Transition Defined for currentState = " + currentState + ", event = " + event,currentState,event);
+ }
+ nextState = response.getNextState();
+ } catch (InvalidInputException e) {
+ logger.error(e.getMessage());
+ throw new LifecycleException(e,currentState,event);
+ }
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exiting from getNextState with (nextState = " + nextState.getStateName() + ")");
+ }
+ return nextState.getStateName();
+ }
+
+ private StateMachine getStateMachine(String vnfType){
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to getNextState with vnfType = "+ vnfType);
+ }
+ if(vnfType == null){
+ vnfType = "DEFAULT";
+ }
+ StateMachine machine = stateMachineMap.get(vnfType);
+ if(machine == null){
+ metadataReader = getMetadataReader(vnfType);
+ StateMachineMetadata metadata = metadataReader.readMetadata();
+ machine = StateMachineFactory.getStateMachine(metadata);
+ stateMachineMap.put(vnfType,machine);
+ }
+
+ logger.trace("Exiting getStateMachine with StateMachine = " + stateMachineMap.get(vnfType).toString());
+ return stateMachineMap.get(vnfType);
+ }
+
+ private StateMetaDataReader getMetadataReader(String vnfType) {
+ return vnfType.equals("APPC") ? new AppcOamMetaDataReader() : new VnfMetaDataReader();
+ }
+
+}
diff --git a/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 77725db6c..cea242f1f 100644
--- a/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
============LICENSE_START=======================================================
ONAP : APPC
================================================================================
Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs
- =============================================================================
- 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.
-
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ 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.
+
ECOMP is a trademark and service mark of AT&T Intellectual Property.
- ============LICENSE_END=========================================================
- -->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
- <bean id="lifecycleManagerBean" class="org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl" scope="singleton">
- </bean>
-
- <service id="lcmService" interface="org.openecomp.appc.lifecyclemanager.LifecycleManager" ref="lifecycleManagerBean"/>
-
-</blueprint>
+ ============LICENSE_END=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+ <bean id="lifecycleManagerBean" class="org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl" scope="singleton">
+ </bean>
+
+ <service id="lcmService" interface="org.openecomp.appc.lifecyclemanager.LifecycleManager" ref="lifecycleManagerBean"/>
+
+</blueprint>
diff --git a/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties
index 6b634cad7..99d728335 100644
--- a/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties
@@ -1,39 +1,39 @@
-###
+###
# ============LICENSE_START=======================================================
# ONAP : APPC
# ================================================================================
# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
# ================================================================================
-# Copyright (C) 2017 Amdocs
-# =============================================================================
-# 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.
-#
+# Copyright (C) 2017 Amdocs
+# =============================================================================
+# 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.
+#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# ============LICENSE_END=========================================================
-###
-
-# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded
-# to supply configuration options
-org.openecomp.appc.bootstrap.file=appc.properties
-org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
-
-#Property below provided by appc.properties
-appc.LCM.provider.url=https://localhost:8443/restconf/operations/appc-provider-lcm
-appc.LCM.poolMembers=<DMAAP_IP>:3904
-appc.LCM.service=dmaap
-appc.LCM.topic.write=APPC-TEST2
-appc.LCM.client.name=APPC-TEST-CLIENT-LC-MGMT-MAIN
-appc.LCM.provider.user=test
-appc.LCM.provider.pass=test
-
-
+# ============LICENSE_END=========================================================
+###
+
+# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded
+# to supply configuration options
+org.openecomp.appc.bootstrap.file=appc.properties
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
+
+#Property below provided by appc.properties
+appc.LCM.provider.url=https://localhost:8443/restconf/operations/appc-provider-lcm
+appc.LCM.poolMembers=<DMAAP_IP>:3904
+appc.LCM.service=dmaap
+appc.LCM.topic.write=APPC-TEST2
+appc.LCM.client.name=APPC-TEST-CLIENT-LC-MGMT-MAIN
+appc.LCM.provider.user=test
+appc.LCM.provider.pass=test
+
+