diff --git a/src/main/java/org/onap/clamp/clds/model/CldsEvent.java b/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
index 90dc996..b993c63 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
@@ -31,6 +31,7 @@
 public class CldsEvent {
     public static final String ACTION_TEST = "TEST";
     public static final String ACTION_CREATE = "CREATE";
+    public static final String ACTION_MODIFY = "MODIFY";
     public static final String ACTION_SUBMIT = "SUBMIT";
     // an update before model is active
     public static final String ACTION_RESUBMIT = "RESUBMIT";
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsModel.java b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
index 14fe443..2c178eb 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
@@ -25,18 +25,18 @@
 
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
 
-import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.NotFoundException;
 
 import org.onap.clamp.clds.dao.CldsDao;
-import org.onap.clamp.clds.util.JacksonUtils;
+import org.onap.clamp.clds.model.actions.ActionsHandler;
+import org.onap.clamp.clds.model.actions.ActionsHandlerImpl;
+import org.onap.clamp.clds.model.status.StatusHandler;
+import org.onap.clamp.clds.model.status.StatusHandlerImpl;
 
 /**
  * Represent a CLDS Model.
@@ -77,6 +77,18 @@
     private String deploymentId;
     private String deploymentStatusUrl;
 
+    // Set default handlers but this can be changed if needed.
+    private static StatusHandler statusHandler = new StatusHandlerImpl();
+    private static ActionsHandler actionsHandler = new ActionsHandlerImpl();
+
+    public static synchronized void setStatusHandler(StatusHandler statHandler) {
+        statusHandler = statHandler;
+    }
+
+    public static synchronized void setActionsHandler(ActionsHandler cdHandler) {
+        actionsHandler = cdHandler;
+    }
+
     /**
      * Construct empty model.
      */
@@ -122,54 +134,7 @@
      * set the status in the model
      */
     public void determineStatus() {
-        status = STATUS_UNKNOWN;
-        if (event == null || event.getActionCd() == null) {
-            status = STATUS_DESIGN;
-        } else if (event.isActionStateCd(CldsEvent.ACTION_STATE_ERROR)) {
-            status = STATUS_ERROR;
-        } else if (event.isActionAndStateCd(CldsEvent.ACTION_CREATE, CldsEvent.ACTION_STATE_ANY)) {
-            status = STATUS_DESIGN;
-        } else if (event.isActionAndStateCd(CldsEvent.ACTION_DISTRIBUTE, CldsEvent.ACTION_STATE_RECEIVED)
-            || event.isActionAndStateCd(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_COMPLETED)
-            || event.isActionAndStateCd(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_STATE_COMPLETED)
-            || event.isActionAndStateCd(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_STATE_COMPLETED)) {
-            status = STATUS_DISTRIBUTED;
-        } else if (event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_SENT)) {
-            status = STATUS_DELETING;
-        } else if (event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_COMPLETED)
-            || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED)
-            || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_COMPLETED)
-            || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) {
-            status = STATUS_ACTIVE;
-        } else if (event.isActionAndStateCd(CldsEvent.ACTION_STOP, CldsEvent.ACTION_STATE_COMPLETED)) {
-            status = STATUS_STOPPED;
-        }
-    }
-
-    /**
-     * Get the actionCd from current event. If none, default value is
-     * CldsEvent.ACTION_CREATE
-     */
-    private String getCurrentActionCd() {
-        // current default actionCd is CREATE
-        String actionCd = CldsEvent.ACTION_CREATE;
-        if (event != null && event.getActionCd() != null) {
-            actionCd = event.getActionCd();
-        }
-        return actionCd;
-    }
-
-    /**
-     * Get the actionStateCd from current event. If none, default value is
-     * CldsEvent.ACTION_STATE_COMPLETED
-     */
-    private String getCurrentActionStateCd() {
-        // current default actionStateCd is CREATE
-        String actionStateCd = CldsEvent.ACTION_STATE_COMPLETED;
-        if (event != null && event.getActionStateCd() != null) {
-            actionStateCd = event.getActionStateCd();
-        }
-        return actionStateCd;
+        status = statusHandler.determineStatusOnLastEvent(event);
     }
 
     /**
@@ -179,94 +144,7 @@
      * the first one.
      */
     public void determinePermittedActionCd() {
-        String actionCd = getCurrentActionCd();
-        switch (actionCd) {
-        case CldsEvent.ACTION_CREATE:
-            permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
-            if (isSimplifiedModel()) {
-                permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY,
-                    CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
-            }
-            break;
-        case CldsEvent.ACTION_SUBMIT:
-        case CldsEvent.ACTION_RESUBMIT:
-        case CldsEvent.ACTION_DISTRIBUTE:
-            permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT,
-                CldsEvent.ACTION_DELETE);
-            if (isSimplifiedModel()) {
-                permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE,
-                    CldsEvent.ACTION_DELETE);
-            }
-            break;
-        case CldsEvent.ACTION_SUBMITDCAE:
-            permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
-            break;
-        case CldsEvent.ACTION_SUBMITPOLICY:
-            permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
-            break;
-        case CldsEvent.ACTION_UNDEPLOY:
-            permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
-                CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE);
-            if (isSimplifiedModel()) {
-                permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
-                    CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
-            }
-            break;
-        case CldsEvent.ACTION_DEPLOY:
-            permittedActionCd = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE,
-                CldsEvent.ACTION_STOP);
-            break;
-        case CldsEvent.ACTION_RESTART:
-        case CldsEvent.ACTION_UPDATE:
-            permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP,
-                CldsEvent.ACTION_UNDEPLOY);
-            if (isPolicyOnly()) {
-                permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
-            }
-            break;
-        case CldsEvent.ACTION_STOP:
-            permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
-                CldsEvent.ACTION_UNDEPLOY);
-            if (isPolicyOnly()) {
-                permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
-                    CldsEvent.ACTION_DELETE);
-            }
-            break;
-        default:
-            logger.warn("Invalid current actionCd: " + actionCd);
-        }
-    }
-
-    private boolean isSimplifiedModel() {
-        boolean result = false;
-        try {
-            if (propText != null) {
-                JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText);
-                JsonNode simpleModelJson = modelJson.get("simpleModel");
-                if (simpleModelJson != null && simpleModelJson.asBoolean()) {
-                    result = true;
-                }
-            }
-        } catch (IOException e) {
-            logger.error("Error while parsing propText json", e);
-        }
-        return result;
-    }
-
-    private boolean isPolicyOnly() {
-        boolean result = false;
-        try {
-            if (propText != null) {
-                JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText);
-                JsonNode policyOnlyJson = modelJson.get("policyOnly");
-                if (policyOnlyJson != null && policyOnlyJson.asBoolean()) {
-                    result = true;
-                }
-            }
-        } catch (IOException e) {
-            logger.error("Error while parsing propText json", e);
-        }
-        return result;
+        permittedActionCd = actionsHandler.determinePermittedActionsOnLastEvent(event, propText);
     }
 
     /**
@@ -278,8 +156,8 @@
         determinePermittedActionCd();
         if (!permittedActionCd.contains(requestedActionCd)) {
             throw new IllegalArgumentException(
-                "Invalid requestedActionCd: " + requestedActionCd + ".  Given current actionCd: " + getCurrentActionCd()
-                    + ", the permittedActionCd: " + permittedActionCd);
+                "Invalid requestedActionCd: " + requestedActionCd + ".  Given current actionCd: "
+                    + actionsHandler.getCurrentActionCd(event) + ", the permittedActionCd: " + permittedActionCd);
         }
     }
 
diff --git a/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java
new file mode 100644
index 0000000..1c54dae
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 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.onap.clamp.clds.model.actions;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.fasterxml.jackson.databind.JsonNode;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.onap.clamp.clds.model.CldsEvent;
+import org.onap.clamp.clds.util.JacksonUtils;
+
+/**
+ * Interface for actions that the user can do according to the last event.
+ *
+ *
+ */
+public interface ActionsHandler {
+
+    enum ModelType {
+        SIMPLE_MODEL("simpleModel"), POLICY_MODEL("policyModel");
+        private final String type;
+
+        private ModelType(String type) {
+            this.type = type;
+        }
+
+        public final String getType() {
+            return this.type;
+        }
+    }
+
+    public EELFLogger getLogger();
+
+    /**
+     * This method determines a list of actions that the user can do according to
+     * the last event.
+     *
+     * @param event
+     *        The last event
+     * @param propText
+     *        The Json properties string
+     * @return A list of actions
+     */
+    default List<String> determinePermittedActionsOnLastEvent(CldsEvent event, String propText) {
+        List<String> permittedActions;
+        String actionCd = getCurrentActionCd(event);
+        switch (actionCd) {
+        case CldsEvent.ACTION_CREATE:
+            permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
+            if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+                permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY,
+                    CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
+            }
+            break;
+        case CldsEvent.ACTION_SUBMIT:
+        case CldsEvent.ACTION_RESUBMIT:
+        case CldsEvent.ACTION_DISTRIBUTE:
+            permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT,
+                CldsEvent.ACTION_DELETE);
+            if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+                permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE,
+                    CldsEvent.ACTION_DELETE);
+            }
+            break;
+        case CldsEvent.ACTION_SUBMITDCAE:
+            permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
+            break;
+        case CldsEvent.ACTION_SUBMITPOLICY:
+            permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+            break;
+        case CldsEvent.ACTION_UNDEPLOY:
+            permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
+                CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE);
+            if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+                permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
+                    CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
+            }
+            break;
+        case CldsEvent.ACTION_DEPLOY:
+            permittedActions = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+            break;
+        case CldsEvent.ACTION_RESTART:
+        case CldsEvent.ACTION_UPDATE:
+            permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP,
+                CldsEvent.ACTION_UNDEPLOY);
+            if (isTypeModel(propText, ModelType.POLICY_MODEL)) {
+                permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+            }
+            break;
+        case CldsEvent.ACTION_STOP:
+            permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
+                CldsEvent.ACTION_UNDEPLOY);
+            if (isTypeModel(propText, ModelType.POLICY_MODEL)) {
+                permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
+                    CldsEvent.ACTION_DELETE);
+            }
+            break;
+        default:
+            getLogger().warn("Invalid current actionCd: " + actionCd);
+            permittedActions = Arrays.asList();
+        }
+        return permittedActions;
+    }
+
+    /**
+     * This method returns the action of the event or a default one if not found.
+     *
+     * @param event
+     *        The last event
+     * @return The action
+     */
+    default String getCurrentActionCd(CldsEvent event) {
+        // current default actionCd is CREATE
+        String actionCd = CldsEvent.ACTION_CREATE;
+        if (event != null && event.getActionCd() != null) {
+            actionCd = event.getActionCd();
+        }
+        return actionCd;
+    }
+
+    /**
+     * Check whether the text properties is of specified type ModelType.
+     *
+     * @param propText
+     *        The Clamp Json properties
+     * @param key
+     *        The model type
+     * @return True if matches the right type specified
+     */
+    default boolean isTypeModel(String propText, ModelType key) {
+        boolean result = false;
+        try {
+            if (propText != null) {
+                JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText);
+                JsonNode modelJsonOfType = modelJson.get(key.getType());
+                if (modelJsonOfType != null && modelJsonOfType.asBoolean()) {
+                    result = true;
+                }
+            }
+        } catch (IOException e) {
+            getLogger().error("Error while parsing propText json", e);
+        }
+        return result;
+    }
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java
new file mode 100644
index 0000000..8d7d240
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 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.onap.clamp.clds.model.actions;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class ActionsHandlerImpl implements ActionsHandler {
+
+    private static final EELFLogger logger = EELFManager.getInstance().getLogger(ActionsHandlerImpl.class);
+
+    @Override
+    public EELFLogger getLogger() {
+        return logger;
+    }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java b/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java
new file mode 100644
index 0000000..300c8b1
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 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.onap.clamp.clds.model.status;
+
+import org.onap.clamp.clds.model.CldsEvent;
+import org.onap.clamp.clds.model.CldsModel;
+
+/**
+ * This interface describe the handler of the status in CldsModel, it's normally
+ * based on the last event stored in db.
+ *
+ */
+public interface StatusHandler {
+
+    /**
+     * This method determines the status of the closed loop based on the last event.
+     * 
+     * @param event
+     *        The last event
+     * @return The status
+     */
+    default String determineStatusOnLastEvent(CldsEvent event) {
+        String status = CldsModel.STATUS_UNKNOWN;
+        if (event == null || event.getActionCd() == null) {
+            status = CldsModel.STATUS_DESIGN;
+        } else if (event.isActionStateCd(CldsEvent.ACTION_STATE_ERROR)) {
+            status = CldsModel.STATUS_ERROR;
+        } else if (event.isActionAndStateCd(CldsEvent.ACTION_CREATE, CldsEvent.ACTION_STATE_ANY)) {
+            status = CldsModel.STATUS_DESIGN;
+        } else if (event.isActionAndStateCd(CldsEvent.ACTION_DISTRIBUTE, CldsEvent.ACTION_STATE_RECEIVED)
+            || event.isActionAndStateCd(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_COMPLETED)
+            || event.isActionAndStateCd(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_STATE_COMPLETED)
+            || event.isActionAndStateCd(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_STATE_COMPLETED)) {
+            status = CldsModel.STATUS_DISTRIBUTED;
+        } else if (event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_SENT)) {
+            status = CldsModel.STATUS_DELETING;
+        } else if (event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_COMPLETED)
+            || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED)
+            || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_COMPLETED)
+            || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) {
+            status = CldsModel.STATUS_ACTIVE;
+        } else if (event.isActionAndStateCd(CldsEvent.ACTION_STOP, CldsEvent.ACTION_STATE_COMPLETED)) {
+            status = CldsModel.STATUS_STOPPED;
+        }
+        return status;
+    }
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java b/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java
new file mode 100644
index 0000000..b539e90
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java
@@ -0,0 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 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.onap.clamp.clds.model.status;
+
+public class StatusHandlerImpl implements StatusHandler {
+}
