You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2014/01/08 06:51:44 UTC

[33/46] renaming package adc.mgt to manager

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/DuplicateCartridgeAliasException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/DuplicateCartridgeAliasException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/DuplicateCartridgeAliasException.java
new file mode 100644
index 0000000..079783d
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/DuplicateCartridgeAliasException.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class DuplicateCartridgeAliasException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private final String message;
+
+	private final String cartridgeType;
+
+	private final String cartridgeAlias;
+
+	public DuplicateCartridgeAliasException(String message, String cartridgeType, String cartridgeAlias, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+		this.cartridgeType = cartridgeType;
+		this.cartridgeAlias = cartridgeAlias;
+	}
+
+	public DuplicateCartridgeAliasException(String message, String cartridgeType, String cartridgeAlias) {
+		super(message);
+		this.message = message;
+		this.cartridgeType = cartridgeType;
+		this.cartridgeAlias = cartridgeAlias;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public String getCartridgeType() {
+		return cartridgeType;
+	}
+
+	public String getCartridgeAlias() {
+		return cartridgeAlias;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/InvalidCartridgeAliasException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/InvalidCartridgeAliasException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/InvalidCartridgeAliasException.java
new file mode 100644
index 0000000..44481a4
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/InvalidCartridgeAliasException.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class InvalidCartridgeAliasException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private final String message;
+
+	private final String cartridgeType;
+
+	private final String cartridgeAlias;
+
+    private int tenantId;
+
+	public InvalidCartridgeAliasException(String message, String cartridgeType, String cartridgeAlias, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+		this.cartridgeType = cartridgeType;
+		this.cartridgeAlias = cartridgeAlias;
+	}
+
+	public InvalidCartridgeAliasException(String message, String cartridgeType, String cartridgeAlias) {
+		super(message);
+		this.message = message;
+		this.cartridgeType = cartridgeType;
+		this.cartridgeAlias = cartridgeAlias;
+	}
+
+    public InvalidCartridgeAliasException(String message, int tenantId, String cartridgeType, String cartridgeAlias) {
+        super(message);
+        this.message = message;
+        this.tenantId = tenantId;
+        this.cartridgeType = cartridgeType;
+        this.cartridgeAlias = cartridgeAlias;
+    }
+
+	public String getMessage() {
+		return message;
+	}
+
+	public String getCartridgeType() {
+		return cartridgeType;
+	}
+
+	public String getCartridgeAlias() {
+		return cartridgeAlias;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/InvalidRepositoryException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/InvalidRepositoryException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/InvalidRepositoryException.java
new file mode 100644
index 0000000..4a21afc
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/InvalidRepositoryException.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class InvalidRepositoryException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private String message;
+
+	public InvalidRepositoryException(String message, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/NotSubscribedException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/NotSubscribedException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/NotSubscribedException.java
new file mode 100644
index 0000000..1886186
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/NotSubscribedException.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class NotSubscribedException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private final String message;
+
+	private final String cartridgeAlias;
+
+	public NotSubscribedException(String message, String cartridgeAlias, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+		this.cartridgeAlias = cartridgeAlias;
+	}
+
+	public NotSubscribedException(String message, String cartridgeAlias) {
+		super(message);
+		this.message = message;
+		this.cartridgeAlias = cartridgeAlias;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public String getCartridgeAlias() {
+		return cartridgeAlias;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/PersistenceManagerException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/PersistenceManagerException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/PersistenceManagerException.java
new file mode 100644
index 0000000..0491639
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/PersistenceManagerException.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class PersistenceManagerException extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
+    private String message;
+
+    public PersistenceManagerException() {
+        super();
+    }
+
+    public PersistenceManagerException(String message, Throwable cause) {
+        super(message, cause);
+        this.message = message;
+    }
+
+    public PersistenceManagerException(String message) {
+        super(message);
+        this.message = message;
+    }
+
+    public PersistenceManagerException(Throwable cause) {
+        super(cause);
+    }
+
+    public String getMessage() {
+        return message;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/PolicyException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/PolicyException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/PolicyException.java
new file mode 100644
index 0000000..068401a
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/PolicyException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class PolicyException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private final String message;
+
+	public PolicyException(String message, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+	}
+
+	public PolicyException(String message) {
+		super(message);
+		this.message = message;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryCredentialsRequiredException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryCredentialsRequiredException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryCredentialsRequiredException.java
new file mode 100644
index 0000000..1d0febe
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryCredentialsRequiredException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class RepositoryCredentialsRequiredException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private String message;
+
+	public RepositoryCredentialsRequiredException(String message, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+	}
+
+	public RepositoryCredentialsRequiredException(String message) {
+		super(message);
+		this.message = message;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryRequiredException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryRequiredException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryRequiredException.java
new file mode 100644
index 0000000..bb19269
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryRequiredException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class RepositoryRequiredException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private String message;
+
+	public RepositoryRequiredException(String message, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+	}
+
+	public RepositoryRequiredException(String message) {
+		super(message);
+		this.message = message;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryTransportException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryTransportException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryTransportException.java
new file mode 100644
index 0000000..738a86e
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/RepositoryTransportException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class RepositoryTransportException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private final String message;
+
+	public RepositoryTransportException(String message, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+	}
+
+	public RepositoryTransportException(String message) {
+		super(message);
+		this.message = message;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/UnregisteredCartridgeException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/UnregisteredCartridgeException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/UnregisteredCartridgeException.java
new file mode 100644
index 0000000..be33d21
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/UnregisteredCartridgeException.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.exception;
+
+public class UnregisteredCartridgeException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	private final String message;
+
+	private final String cartridgeType;
+
+	public UnregisteredCartridgeException(String message, String cartridgeType, Throwable cause) {
+		super(message, cause);
+		this.message = message;
+		this.cartridgeType = cartridgeType;
+	}
+
+	public UnregisteredCartridgeException(String message, String cartridgeType) {
+		super(message);
+		this.message = message;
+		this.cartridgeType = cartridgeType;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public String getCartridgeType() {
+		return cartridgeType;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/ADCManagementServerComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/ADCManagementServerComponent.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/ADCManagementServerComponent.java
new file mode 100644
index 0000000..07b5186
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/ADCManagementServerComponent.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.internal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.listener.InstanceStatusListener;
+import org.apache.stratos.manager.publisher.TenantEventPublisher;
+import org.apache.stratos.manager.publisher.TenantSynchronizerTaskScheduler;
+import org.apache.stratos.manager.retriever.DataInsertionAndRetrievalManager;
+import org.apache.stratos.manager.topology.receiver.StratosManagerTopologyReceiver;
+import org.apache.stratos.manager.utils.CartridgeConfigFileReader;
+import org.apache.stratos.manager.utils.StratosDBUtils;
+import org.apache.stratos.adc.topology.mgt.service.TopologyManagementService;
+import org.apache.stratos.messaging.broker.publish.EventPublisher;
+import org.apache.stratos.messaging.broker.subscribe.TopicSubscriber;
+import org.apache.stratos.messaging.util.Constants;
+import org.osgi.service.component.ComponentContext;
+import org.wso2.carbon.ntask.core.service.TaskService;
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+/**
+ * @scr.component name="org.wso2.carbon.hosting.mgt.internal.ADCManagementServerComponent"
+ *                immediate="true"
+ * @scr.reference name="config.context.service"
+ *                interface="org.wso2.carbon.utils.ConfigurationContextService"
+ *                cardinality="1..1" policy="dynamic"
+ *                bind="setConfigurationContextService"
+ *                unbind="unsetConfigurationContextService"
+ * @scr.reference name="user.realmservice.default"
+ *                interface="org.wso2.carbon.user.core.service.RealmService"
+ *                cardinality="1..1" policy="dynamic" bind="setRealmService"
+ *                unbind="unsetRealmService"
+ * @scr.reference name="registry.service"
+ *                interface=
+ *                "org.wso2.carbon.registry.core.service.RegistryService"
+ *                cardinality="1..1" policy="dynamic" bind="setRegistryService"
+ *                unbind="unsetRegistryService"
+ * @scr.reference name="topology.mgt.service"
+ *                interface=
+ *                "org.apache.stratos.adc.topology.mgt.service.TopologyManagementService"
+ *                cardinality="1..1" policy="dynamic"
+ *                bind="setTopologyManagementService"
+ *                unbind="unsetTopologyManagementService"
+ * @scr.reference name="ntask.component" interface="org.wso2.carbon.ntask.core.service.TaskService"
+ *                cardinality="1..1" policy="dynamic" bind="setTaskService"
+ *                unbind="unsetTaskService"
+ */
+
+public class ADCManagementServerComponent {
+
+    private static final Log log = LogFactory.getLog(ADCManagementServerComponent.class);
+    private StratosManagerTopologyReceiver stratosManagerTopologyReceiver;
+
+    protected void activate(ComponentContext componentContext) throws Exception {
+		try {
+			CartridgeConfigFileReader.readProperties();
+			StratosDBUtils.initialize();
+			DataHolder.setEventPublisher(new EventPublisher(Constants.INSTANCE_NOTIFIER_TOPIC));
+
+            // Schedule complete tenant event synchronizer
+            if(log.isDebugEnabled()) {
+                log.debug("Scheduling tenant synchronizer task...");
+            }
+            TenantSynchronizerTaskScheduler.schedule(ServiceReferenceHolder.getInstance().getTaskService());
+
+            // Register tenant event publisher
+            if(log.isDebugEnabled()) {
+                log.debug("Starting tenant event publisher...");
+            }
+            TenantEventPublisher tenantEventPublisher = new TenantEventPublisher();
+            componentContext.getBundleContext().registerService(
+                    org.apache.stratos.common.listeners.TenantMgtListener.class.getName(),
+                    tenantEventPublisher, null);
+
+            // Start instance status topic subscriber
+            if(log.isDebugEnabled()) {
+                log.debug("Starting instance status topic subscriber...");
+            }
+            TopicSubscriber subscriber = new TopicSubscriber(Constants.INSTANCE_STATUS_TOPIC);
+            subscriber.setMessageListener(new InstanceStatusListener());
+            Thread tsubscriber = new Thread(subscriber);
+			tsubscriber.start();
+
+            //initializing the topology event subscriber
+            /*TopicSubscriber topologyTopicSubscriber = new TopicSubscriber(Constants.TOPOLOGY_TOPIC);
+            topologyTopicSubscriber.setMessageListener(new TopologyEventListner());
+            Thread topologyTopicSubscriberThread = new Thread(topologyTopicSubscriber);
+            topologyTopicSubscriberThread.start();
+
+            //Starting Topology Receiver
+            TopologyReceiver topologyReceiver = new TopologyReceiver();
+            Thread topologyReceiverThread = new Thread(topologyReceiver);
+            topologyReceiverThread.start();*/
+
+            stratosManagerTopologyReceiver = new StratosManagerTopologyReceiver();
+            Thread topologyReceiverThread = new Thread(stratosManagerTopologyReceiver);
+            topologyReceiverThread.start();
+            log.info("Topology receiver thread started");
+
+            // retrieve persisted CartridgeSubscriptions
+            new DataInsertionAndRetrievalManager().cachePersistedSubscriptions();
+
+            //Component activated successfully
+            log.info("ADC management server component is activated");
+			
+		} catch (Exception e) {
+            if(log.isFatalEnabled()) {
+			    log.fatal("Could not activate ADC management server component", e);
+            }
+		}
+	}
+
+    protected void setConfigurationContextService(ConfigurationContextService contextService) {
+        DataHolder.setClientConfigContext(contextService.getClientConfigContext());
+        DataHolder.setServerConfigContext(contextService.getServerConfigContext());
+
+    }
+
+    protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
+        DataHolder.setClientConfigContext(null);
+        DataHolder.setServerConfigContext(null);
+    }
+
+    protected void setRealmService(RealmService realmService) {
+        // keeping the realm service in the DataHolder class
+        DataHolder.setRealmService(realmService);
+    }
+
+    protected void unsetRealmService(RealmService realmService) {
+    }
+
+    protected void setRegistryService(RegistryService registryService) {
+        try {
+            DataHolder.setRegistryService(registryService);
+        } catch (Exception e) {
+            log.error("Cannot retrieve governance registry", e);
+        }
+    }
+
+    protected void unsetRegistryService(RegistryService registryService) {
+    }
+
+    protected void setTopologyManagementService(TopologyManagementService topologyMgtService) {
+        DataHolder.setTopologyMgtService(topologyMgtService);
+    }
+
+    protected void unsetTopologyManagementService(TopologyManagementService topologyMgtService) {
+    }
+
+    protected void setTaskService(TaskService taskService) {
+        if (log.isDebugEnabled()) {
+            log.debug("Setting the task service");
+        }
+        ServiceReferenceHolder.getInstance().setTaskService(taskService);
+    }
+
+    protected void unsetTaskService(TaskService taskService) {
+        if (log.isDebugEnabled()) {
+            log.debug("Un-setting the task service");
+        }
+        ServiceReferenceHolder.getInstance().setTaskService(null);
+    }
+
+    protected void deactivate(ComponentContext context) {
+
+        //terminate Stratos Manager Topology Receiver
+        stratosManagerTopologyReceiver.terminate();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/DataHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/DataHolder.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/DataHolder.java
new file mode 100644
index 0000000..02f0f2f
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/DataHolder.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.internal;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.stratos.adc.topology.mgt.service.TopologyManagementService;
+import org.apache.stratos.messaging.broker.publish.EventPublisher;
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.utils.CarbonUtils;
+
+/**
+ * Holds the some of the data required by the webapps component
+ */
+public class DataHolder {
+	private static ConfigurationContext clientConfigContext;
+	private static ConfigurationContext serverConfigContext;
+
+	private static RealmService realmService;
+	private static RegistryService registryService;
+	private static TopologyManagementService topologyMgtService;
+	private static EventPublisher eventPublisher;
+
+	public static RealmService getRealmService() {
+		return realmService;
+	}
+
+	public static void setRealmService(RealmService realmService) {
+		DataHolder.realmService = realmService;
+	}
+
+	public static RegistryService getRegistryService() {
+		return registryService;
+	}
+
+	public static ConfigurationContext getClientConfigContext() {
+		CarbonUtils.checkSecurity();
+		return clientConfigContext;
+	}
+
+	public static void setClientConfigContext(ConfigurationContext clientConfigContext) {
+		DataHolder.clientConfigContext = clientConfigContext;
+	}
+
+	public static ConfigurationContext getServerConfigContext() {
+		CarbonUtils.checkSecurity();
+		return serverConfigContext;
+	}
+
+	public static void setServerConfigContext(ConfigurationContext serverConfigContext) {
+		DataHolder.serverConfigContext = serverConfigContext;
+	}
+
+	public static void setRegistryService(RegistryService registryService) {
+		DataHolder.registryService = registryService;
+	}
+
+	public static TopologyManagementService getTopologyMgtService() {
+		return topologyMgtService;
+	}
+
+	public static void setTopologyMgtService(TopologyManagementService topologyMgtService) {
+		DataHolder.topologyMgtService = topologyMgtService;
+	}
+
+	public static EventPublisher getEventPublisher() {
+		return eventPublisher;
+	}
+
+	public static void setEventPublisher(EventPublisher eventPublisher) {
+		DataHolder.eventPublisher = eventPublisher;
+	}	
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/HostingConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/HostingConstants.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/HostingConstants.java
new file mode 100644
index 0000000..849c610
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/HostingConstants.java
@@ -0,0 +1,40 @@
+///*
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements.  See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership.  The ASF licenses this file
+// * to you 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.apache.stratos.manager.internal;
+//
+///**
+// * Web Application Constants
+// */
+//public final class HostingConstants {
+//	public static final String WEBAPP_PREFIX = "webapps";
+//	public static final String WEBAPP_DEPLOYMENT_FOLDER = "webapps";
+//	public static final String WEBAPP_EXTENSION = "war";
+//
+//	public static final class WebappState {
+//		public static final String STARTED = "started";
+//		public static final String STOPPED = "stopped";
+//
+//		private WebappState() {
+//		}
+//	}
+//
+//	private HostingConstants() {
+//	}
+//}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/HostingManagementActivator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/HostingManagementActivator.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/HostingManagementActivator.java
new file mode 100644
index 0000000..7f5b9c8
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/HostingManagementActivator.java
@@ -0,0 +1,63 @@
+///*
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements.  See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership.  The ASF licenses this file
+// * to you 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.apache.stratos.manager.internal;
+//
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+//import org.osgi.framework.BundleActivator;
+//import org.osgi.framework.BundleContext;
+//import org.wso2.carbon.utils.CarbonUtils;
+//
+///**
+// * Activator for the Webapp Management Bundle
+// */
+//public class HostingManagementActivator implements BundleActivator {
+//	private static final Log log = LogFactory.getLog(HostingManagementActivator.class);
+//
+//	@Override
+//	public void start(final BundleContext bundleContext) {
+//
+//		// If Carbon is running as a webapp within some other servlet container,
+//		// then we should
+//		// uninstall this component
+//		if (!CarbonUtils.isRunningInStandaloneMode()) {
+//			Thread th = new Thread() {
+//				@Override
+//				public void run() {
+//					try {
+//						bundleContext.getBundle().uninstall();
+//					} catch (Throwable e) {
+//						log.warn("Error occurred while uninstalling hosting.mgt UI bundle", e);
+//					}
+//				}
+//			};
+//			try {
+//				th.join();
+//			} catch (InterruptedException ignored) {
+//			}
+//			th.start();
+//		}
+//	}
+//
+//	@Override
+//	public void stop(BundleContext bundleContext) {
+//		// No implementation required for this method
+//	}
+//}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/ServiceReferenceHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/ServiceReferenceHolder.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/ServiceReferenceHolder.java
new file mode 100644
index 0000000..c5b75bd
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/ServiceReferenceHolder.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.internal;
+
+import org.wso2.carbon.ntask.core.service.TaskService;
+
+/**
+ * Service reference holder.
+ */
+public class ServiceReferenceHolder {
+    private static volatile ServiceReferenceHolder instance = null;
+    private TaskService taskService;
+
+    private ServiceReferenceHolder() {       }
+
+    public static ServiceReferenceHolder getInstance() {
+        if (instance == null) {
+            synchronized (ServiceReferenceHolder .class){
+                if (instance == null) {
+                    instance = new ServiceReferenceHolder();
+                }
+            }
+        }
+        return instance;
+    }
+
+    public void setTaskService(TaskService taskService) {
+        this.taskService = taskService;
+    }
+
+    public TaskService getTaskService() {
+        return taskService;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java
new file mode 100644
index 0000000..69ff2cf
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.listener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.publisher.ArtifactUpdatePublisher;
+import org.apache.stratos.manager.retriever.DataInsertionAndRetrievalManager;
+import org.apache.stratos.manager.subscription.CartridgeSubscription;
+import org.apache.stratos.messaging.event.instance.status.InstanceStartedEvent;
+import org.apache.stratos.messaging.util.Constants;
+import org.apache.stratos.messaging.util.Util;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+public class InstanceStatusListener implements MessageListener {
+
+    private static final Log log = LogFactory
+            .getLog(InstanceStatusListener.class);
+
+    @Override
+    public void onMessage(Message message) {
+        TextMessage receivedMessage = (TextMessage) message;
+        if(log.isInfoEnabled()) {
+            log.info("Instance status message received");
+        }
+
+        try {
+            String type = message.getStringProperty(Constants.EVENT_CLASS_NAME);
+            if(log.isInfoEnabled()) {
+                log.info(String.format("Event class name: %s ", type));
+            }
+            // If member started event is received publish artifact update message
+            // To do a git clone
+            if (InstanceStartedEvent.class.getName().equals(type)) {
+                String json = receivedMessage.getText();
+                InstanceStartedEvent event = (InstanceStartedEvent) Util.jsonToObject(json, InstanceStartedEvent.class);
+                String clusterId = event.getClusterId();
+                if(log.isInfoEnabled()) {
+                    log.info("Cluster id: " + clusterId);
+                }
+                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+                /*CartridgeSubscriptionInfo subscription = PersistenceManager.getSubscriptionFromClusterId(clusterId);
+
+                if (subscription.getRepository() != null) {
+                    ArtifactUpdatePublisher publisher = new ArtifactUpdatePublisher(subscription.getRepository(), clusterId, String.valueOf(subscription.getTenantId()));
+                    publisher.publish();
+                }
+                else {
+                    //TODO: make this log debug
+                    log.info("No repository found for subscription with alias: " + subscription.getAlias() + ", type: " + subscription.getCartridge() +
+                        ". Not sending the Depsync event");
+                }*/
+                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+                CartridgeSubscription cartridgeSubscription = new DataInsertionAndRetrievalManager().getCartridgeSubscription(clusterId);
+                if (cartridgeSubscription.getRepository() != null) {
+                    ArtifactUpdatePublisher publisher = new ArtifactUpdatePublisher(cartridgeSubscription.getRepository(), clusterId,
+                            String.valueOf(cartridgeSubscription.getSubscriber().getTenantId()));
+                    publisher.publish();
+                } else {
+                    //TODO: make this log debug
+                    log.info("No repository found for subscription with alias: " + cartridgeSubscription.getAlias() + ", type: " + cartridgeSubscription.getType()+
+                            ". Not sending the Depsync event");
+                }
+
+            }
+        } catch (Exception e) {
+            if(log.isErrorEnabled()) {
+                log.error("Could not process instance status message", e);
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/TenantStatusListner.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/TenantStatusListner.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/TenantStatusListner.java
new file mode 100644
index 0000000..49f8e2f
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/TenantStatusListner.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.listener;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.wso2.carbon.utils.Axis2ConfigurationContextObserver;
+
+public class TenantStatusListner implements Axis2ConfigurationContextObserver {
+
+    public void creatingConfigurationContext(int i) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void createdConfigurationContext(ConfigurationContext configurationContext) {
+
+    }
+
+    public void terminatingConfigurationContext(ConfigurationContext configurationContext) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void terminatedConfigurationContext(ConfigurationContext configurationContext) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/ClusterIdToSubscription.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/ClusterIdToSubscription.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/ClusterIdToSubscription.java
new file mode 100644
index 0000000..6b85c68
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/ClusterIdToSubscription.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.lookup;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.subscription.CartridgeSubscription;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ClusterIdToSubscription implements Serializable {
+
+    private static final Log log = LogFactory.getLog(ClusterIdToSubscription.class);
+
+    // Map: Cluster Id (Domain) -> CartridgeSubscription
+    private Map<String, CartridgeSubscription> clusterIdToCartridgeSubscription;
+
+    public ClusterIdToSubscription() {
+        clusterIdToCartridgeSubscription = new HashMap<String, CartridgeSubscription>();
+    }
+
+    public void addSubscription (CartridgeSubscription cartridgeSubscription) {
+
+        clusterIdToCartridgeSubscription.put(cartridgeSubscription.getClusterDomain(), cartridgeSubscription);
+    }
+
+    public CartridgeSubscription getSubscription (String clusterId) {
+
+        return clusterIdToCartridgeSubscription.get(clusterId);
+    }
+
+    public void removeSubscription (String clusterId) {
+
+        if (clusterIdToCartridgeSubscription.remove(clusterId) != null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Deleted the subscription for cluster " + clusterId + " from [Cluster Id -> CartridgeSubscription] map");
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/LookupDataHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/LookupDataHolder.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/LookupDataHolder.java
new file mode 100644
index 0000000..3dffbe6
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/LookupDataHolder.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.lookup;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.subscription.CartridgeSubscription;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+public class LookupDataHolder implements Serializable {
+
+    private static final Log log = LogFactory.getLog(LookupDataHolder.class);
+
+    private ClusterIdToSubscription clusterIdToSubscription;
+    private TenantIdToSubscriptionContext tenantIdToSubscriptionContext;
+    private static volatile  LookupDataHolder lookupDataHolder;
+
+    //locks
+    private static volatile ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
+    private static volatile ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock();
+    private static volatile ReentrantReadWriteLock.ReadLock readLock = lock.readLock();
+
+    private LookupDataHolder () {
+        clusterIdToSubscription = new ClusterIdToSubscription();
+        tenantIdToSubscriptionContext = new TenantIdToSubscriptionContext();
+    }
+
+    public static LookupDataHolder getInstance () {
+
+        if (lookupDataHolder == null) {
+            synchronized (LookupDataHolder.class) {
+                if (lookupDataHolder == null) {
+                    lookupDataHolder = new LookupDataHolder();
+                }
+            }
+        }
+        return lookupDataHolder;
+    }
+
+    public void putSubscription (CartridgeSubscription cartridgeSubscription) {
+
+        if (clusterIdToSubscription.getSubscription(cartridgeSubscription.getClusterDomain()) != null) {
+            if(log.isDebugEnabled()) {
+                log.debug("Overwriting the existing CartridgeSubscription for cluster " + cartridgeSubscription.getClusterDomain() +
+                " in [Cluster Id -> CartridgeSubscription] map");
+            }
+        }
+        // add or update
+        clusterIdToSubscription.addSubscription(cartridgeSubscription);
+
+        // check if an existing SubscriptionContext is available
+        SubscriptionContext existingSubscriptionCtx = tenantIdToSubscriptionContext.getSubscriptionContext(cartridgeSubscription.getSubscriber().getTenantId());
+        if(existingSubscriptionCtx != null) {
+            existingSubscriptionCtx.addSubscription(cartridgeSubscription);
+
+        } else {
+            //create a new subscription context and add the subscription
+            SubscriptionContext subscriptionContext = new SubscriptionContext();
+            subscriptionContext.addSubscription(cartridgeSubscription);
+            tenantIdToSubscriptionContext.addSubscriptionContext(cartridgeSubscription.getSubscriber().getTenantId(), subscriptionContext);
+        }
+
+    }
+
+    public void removeSubscription (int tenantId, String type, String subscriptionAlias, String clusterId) {
+
+        tenantIdToSubscriptionContext.removeSubscriptionContext(tenantId, type, subscriptionAlias);
+        clusterIdToSubscription.removeSubscription(clusterId);
+    }
+
+    public Collection<CartridgeSubscription> getSubscriptions (int tenantId) {
+
+        SubscriptionContext subscriptionContext = tenantIdToSubscriptionContext.getSubscriptionContext(tenantId);
+        if (subscriptionContext == null) {
+            // no subscriptions
+            return null;
+        }
+
+        return subscriptionContext.getSubscriptions();
+
+    }
+
+    public Collection<CartridgeSubscription> getSubscriptionForType (int tenantId, String cartridgeType) {
+
+         SubscriptionContext subscriptionContext = tenantIdToSubscriptionContext.getSubscriptionContext(tenantId);
+         if (subscriptionContext == null) {
+            // no subscriptions
+            return null;
+         }
+
+         return subscriptionContext.getSubscriptionsOfType(cartridgeType);
+    }
+
+    public CartridgeSubscription getSubscriptionForAlias (int tenantId, String subscriptionAlias) {
+
+        SubscriptionContext subscriptionContext = tenantIdToSubscriptionContext.getSubscriptionContext(tenantId);
+        if (subscriptionContext == null) {
+            // no subscriptions
+            return null;
+        }
+
+        return subscriptionContext.getSubscriptionForAlias(subscriptionAlias);
+
+    }
+
+    public CartridgeSubscription getSubscription (String clusterId) {
+
+        return clusterIdToSubscription.getSubscription(clusterId);
+
+    }
+
+    public void acquireWriteLock () {
+
+        writeLock.lock();
+    }
+
+    public void releaseWriteLock () {
+
+        writeLock.unlock();
+    }
+
+    public void acquireReadLock () {
+
+        readLock.lock();
+    }
+
+    public void releaseReadLock () {
+
+        readLock.unlock();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/SubscriptionContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/SubscriptionContext.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/SubscriptionContext.java
new file mode 100644
index 0000000..77f8872
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/SubscriptionContext.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.lookup;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.subscription.CartridgeSubscription;
+
+import java.io.Serializable;
+import java.util.*;
+
+public class SubscriptionContext implements Serializable {
+
+    private static final Log log = LogFactory.getLog(SubscriptionContext.class);
+
+    // Map: Cartridge Type -> Set<CartridgeSubscription>
+    private Map<String, Set<CartridgeSubscription>> cartridgeTypeToSubscriptions;
+
+    // Map: Subscription Alias -> CartridgeSubscription
+    private Map<String, CartridgeSubscription> aliasToSubscription;
+
+    public SubscriptionContext () {
+
+        cartridgeTypeToSubscriptions = new HashMap<String, Set<CartridgeSubscription>>();
+        aliasToSubscription = new HashMap<String, CartridgeSubscription>();
+    }
+
+    public void addSubscription (CartridgeSubscription cartridgeSubscription) {
+
+        String cartridgeType = cartridgeSubscription.getType();
+        if (cartridgeTypeToSubscriptions.containsKey(cartridgeType)) {
+            Set<CartridgeSubscription> existingSubscriptions = cartridgeTypeToSubscriptions.get(cartridgeType);
+            // if an existing subscription is present, remove it
+            if(existingSubscriptions.remove(cartridgeSubscription)){
+                if(log.isDebugEnabled()) {
+                    log.debug("Removed the existing Cartridge Subscription for type " + cartridgeType + ", alias " + cartridgeSubscription.getAlias() +
+                    " in [Cartridge Type -> Set<CartridgeSubscription>] map");
+                }
+            }
+            // add or update
+            existingSubscriptions.add(cartridgeSubscription);
+            if(log.isDebugEnabled()) {
+                log.debug("Added Cartridge Subscription for type " + cartridgeType + ", alias " + cartridgeSubscription.getAlias() +
+                " in [Cartridge Type -> Set<CartridgeSubscription>] map");
+            }
+
+        } else {
+            // create a new set and add it
+            Set<CartridgeSubscription> subscriptions = new HashSet<CartridgeSubscription>();
+            subscriptions.add(cartridgeSubscription);
+            cartridgeTypeToSubscriptions.put(cartridgeType, subscriptions);
+        }
+
+        // put Subscription to aliasToSubscription map
+        if (aliasToSubscription.put(cartridgeSubscription.getAlias(), cartridgeSubscription) != null) {
+            if(log.isDebugEnabled()) {
+                log.debug("Overwrote the existing Cartridge Subscription for alias " + cartridgeSubscription.getAlias() +
+                " in [Subscription Alias -> CartridgeSubscription] map");
+            }
+        }
+    }
+
+    public Collection<CartridgeSubscription> getSubscriptions () {
+
+        return aliasToSubscription.values();
+    }
+
+    public Collection<CartridgeSubscription> getSubscriptionsOfType (String cartridgeType) {
+
+        return cartridgeTypeToSubscriptions.get(cartridgeType);
+    }
+
+    public CartridgeSubscription getSubscriptionForAlias (String subscriptionAlias) {
+
+        return aliasToSubscription.get(subscriptionAlias);
+    }
+
+    public void deleteSubscription (String type, String subscriptionAlias) {
+
+        // remove Subscription from cartridgeTypeToSubscriptions map
+        Set<CartridgeSubscription> existingSubscriptions = cartridgeTypeToSubscriptions.get(type);
+        if (existingSubscriptions != null && !existingSubscriptions.isEmpty()) {
+            // iterate through the set
+            Iterator<CartridgeSubscription> iterator = existingSubscriptions.iterator();
+            while (iterator.hasNext()) {
+                CartridgeSubscription cartridgeSubscription = iterator.next();
+                // if a matching CartridgeSubscription is found, remove
+                if (cartridgeSubscription.getAlias().equals(subscriptionAlias)) {
+                    iterator.remove();
+                    if (log.isDebugEnabled()) {
+                        log.debug("Deleted the subscription for alias " + subscriptionAlias + " and type " + type + " from [Type -> Set<CartridgeSubscription>] map");
+                    }
+                    break;
+                }
+            }
+        }
+
+        // if the Subscriptions set is empty now, remove it from cartridgeTypeToSubscriptions map
+        if (existingSubscriptions.isEmpty()) {
+            cartridgeTypeToSubscriptions.remove(type);
+            if (log.isDebugEnabled()) {
+                log.debug("Deleted the subscriptions set for type " + type + " from [Type -> Set<CartridgeSubscription>] map");
+            }
+        }
+
+        // remove from aliasToSubscription map
+        if (aliasToSubscription.remove(subscriptionAlias) != null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Deleted the subscription for alias " + subscriptionAlias + " from [Alias -> CartridgeSubscription] map");
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/TenantIdToSubscriptionContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/TenantIdToSubscriptionContext.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/TenantIdToSubscriptionContext.java
new file mode 100644
index 0000000..1d57053
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lookup/TenantIdToSubscriptionContext.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.manager.lookup;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TenantIdToSubscriptionContext {
+
+    private static final Log log = LogFactory.getLog(TenantIdToSubscriptionContext.class);
+
+    // Map: tenant Id -> SubscriptionContext
+    private Map<Integer, SubscriptionContext> tenantIdToSubscriptionContext;
+
+    public TenantIdToSubscriptionContext() {
+        tenantIdToSubscriptionContext = new HashMap<Integer, SubscriptionContext>();
+    }
+
+    public SubscriptionContext getSubscriptionContext (int tenantId) {
+
+        return tenantIdToSubscriptionContext.get(tenantId);
+    }
+
+    public void addSubscriptionContext (int tenantId, SubscriptionContext subscriptionContext) {
+
+        tenantIdToSubscriptionContext.put(tenantId, subscriptionContext);
+    }
+
+    public void removeSubscriptionContext (int tenantId, String type, String subscriptionAlias) {
+
+        if (tenantIdToSubscriptionContext.containsKey(tenantId)) {
+            SubscriptionContext subscriptionContext = tenantIdToSubscriptionContext.get(tenantId);
+            subscriptionContext.deleteSubscription(type, subscriptionAlias);
+
+            // delete the SubscriptionContext instance for the tenant if it carries no information
+            if (subscriptionContext.getSubscriptionsOfType(type) == null && subscriptionContext.getSubscriptionForAlias(subscriptionAlias) == null) {
+                tenantIdToSubscriptionContext.remove(tenantId);
+                if (log.isDebugEnabled()) {
+                    log.debug("Deleted the subscriptionContext instance for tenant " + tenantId);
+                }
+            }
+        }
+    }
+}