You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2013/07/07 14:12:34 UTC

[11/11] git commit: Refactoring org.wso2.carbon.cartridge.mgt.ui to org.apache.stratos.cartridge.mgt.ui

Refactoring org.wso2.carbon.cartridge.mgt.ui to org.apache.stratos.cartridge.mgt.ui


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/f5c169db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/f5c169db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/f5c169db

Branch: refs/heads/master
Commit: f5c169db9fe55ac754df76421542ec28c4e5ddcf
Parents: 0763d6f
Author: Lahiru Sandaruwan <la...@wso2.com>
Authored: Sun Jul 7 17:47:33 2013 +0530
Committer: Lahiru Sandaruwan <la...@wso2.com>
Committed: Sun Jul 7 17:47:33 2013 +0530

----------------------------------------------------------------------
 .../org.apache.stratos.cartridge.mgt.ui/pom.xml |   95 +
 .../cartridge/mgt/ui/CartridgeAdminClient.java  |  278 ++
 .../cartridge/mgt/ui/CartridgeConstans.java     |    0
 .../stratos/cartridge/mgt/ui/Payload.java       |   14 +
 .../mgt/ui/RepoNotificationClient.java          |   52 +
 .../mgt/ui/RepoNotificationServlet.java         |   57 +
 .../stratos/cartridge/mgt/ui/Repository.java    |   14 +
 .../CartridgeManagementUIActivator.java         |   59 +
 .../src/main/resources/META-INF/component.xml   |  103 +
 .../cartridge/mgt/ui/i18n/Resources.properties  |   96 +
 .../web/cartridge-mgt/available_cartridges.jsp  |  188 ++
 .../web/cartridge-mgt/docs/userguide.html       |   41 +
 .../web/cartridge-mgt/images/ajax-loading.gif   |  Bin 0 -> 1849 bytes
 .../web/cartridge-mgt/images/cartridge.png      |  Bin 0 -> 463 bytes
 .../resources/web/cartridge-mgt/images/list.gif |  Bin 0 -> 216 bytes
 .../web/cartridge-mgt/images/search.gif         |  Bin 0 -> 578 bytes
 .../web/cartridge-mgt/images/subscribe.gif      |  Bin 0 -> 718 bytes
 .../web/cartridge-mgt/images/unsubscribe.png    |  Bin 0 -> 742 bytes
 .../resources/web/cartridge-mgt/js/common.js    |   76 +
 .../web/cartridge-mgt/js/jquery.blockUI-1.33.js |  361 +++
 .../main/resources/web/cartridge-mgt/list.jsp   |    0
 .../resources/web/cartridge-mgt/map_domain.jsp  |  120 +
 .../cartridge-mgt/map_domain_ajaxprocessor.jsp  |   69 +
 .../remove_domain_ajaxprocessor.jsp             |   62 +
 .../web/cartridge-mgt/styles/XMLSchema.dtd      |  418 +++
 .../web/cartridge-mgt/styles/XMLSchema.xsd      | 2383 ++++++++++++++++++
 .../web/cartridge-mgt/styles/annotated-wsdl.xsl |  702 ++++++
 .../cartridge-mgt/styles/annotated-wsdl2.xsl    |  721 ++++++
 .../web/cartridge-mgt/styles/annotated-xsd.xsl  |  850 +++++++
 .../resources/web/cartridge-mgt/styles/atom.xsl |  130 +
 .../web/cartridge-mgt/styles/datatypes.dtd      |  216 ++
 .../resources/web/cartridge-mgt/styles/rss.xsl  |  116 +
 .../resources/web/cartridge-mgt/subscribe.jsp   |  305 +++
 .../cartridge-mgt/subscribe_ajaxprocessor.jsp   |   90 +
 .../web/cartridge-mgt/subscribed_cartridges.jsp |  176 ++
 .../subscribed_cartridges_ajaxprocessor.jsp     |  281 +++
 .../cartridge-mgt/sync_repo_ajaxprocessor.jsp   |   62 +
 .../cartridge-mgt/test_git_ajaxprocessor.jsp    |   73 +
 .../cartridge-mgt/unsubscribe_ajaxprocessor.jsp |   66 +
 .../2.1.3/pom.xml                               |   85 -
 .../cartridge/mgt/ui/CartridgeAdminClient.java  |  275 --
 .../cartridge/mgt/ui/CartridgeConstans.java     |    0
 .../wso2/carbon/cartridge/mgt/ui/Payload.java   |   14 -
 .../mgt/ui/RepoNotificationClient.java          |   52 -
 .../mgt/ui/RepoNotificationServlet.java         |   57 -
 .../carbon/cartridge/mgt/ui/Repository.java     |   14 -
 .../CartridgeManagementUIActivator.java         |   56 -
 .../src/main/resources/META-INF/component.xml   |   93 -
 .../cartridge/mgt/ui/i18n/Resources.properties  |   96 -
 .../web/cartridge-mgt/available_cartridges.jsp  |  186 --
 .../web/cartridge-mgt/docs/userguide.html       |   41 -
 .../web/cartridge-mgt/images/ajax-loading.gif   |  Bin 1849 -> 0 bytes
 .../web/cartridge-mgt/images/cartridge.png      |  Bin 463 -> 0 bytes
 .../resources/web/cartridge-mgt/images/list.gif |  Bin 216 -> 0 bytes
 .../web/cartridge-mgt/images/search.gif         |  Bin 578 -> 0 bytes
 .../web/cartridge-mgt/images/subscribe.gif      |  Bin 718 -> 0 bytes
 .../web/cartridge-mgt/images/unsubscribe.png    |  Bin 742 -> 0 bytes
 .../resources/web/cartridge-mgt/js/common.js    |   76 -
 .../web/cartridge-mgt/js/jquery.blockUI-1.33.js |  361 ---
 .../main/resources/web/cartridge-mgt/list.jsp   |    0
 .../resources/web/cartridge-mgt/map_domain.jsp  |  118 -
 .../cartridge-mgt/map_domain_ajaxprocessor.jsp  |   67 -
 .../remove_domain_ajaxprocessor.jsp             |   60 -
 .../web/cartridge-mgt/styles/XMLSchema.dtd      |  418 ---
 .../web/cartridge-mgt/styles/XMLSchema.xsd      | 2383 ------------------
 .../web/cartridge-mgt/styles/annotated-wsdl.xsl |  702 ------
 .../cartridge-mgt/styles/annotated-wsdl2.xsl    |  721 ------
 .../web/cartridge-mgt/styles/annotated-xsd.xsl  |  850 -------
 .../resources/web/cartridge-mgt/styles/atom.xsl |  130 -
 .../web/cartridge-mgt/styles/datatypes.dtd      |  216 --
 .../resources/web/cartridge-mgt/styles/rss.xsl  |  116 -
 .../resources/web/cartridge-mgt/subscribe.jsp   |  303 ---
 .../cartridge-mgt/subscribe_ajaxprocessor.jsp   |   88 -
 .../web/cartridge-mgt/subscribed_cartridges.jsp |  174 --
 .../subscribed_cartridges_ajaxprocessor.jsp     |  279 --
 .../cartridge-mgt/sync_repo_ajaxprocessor.jsp   |   60 -
 .../cartridge-mgt/test_git_ajaxprocessor.jsp    |   71 -
 .../cartridge-mgt/unsubscribe_ajaxprocessor.jsp |   64 -
 78 files changed, 8274 insertions(+), 8226 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/pom.xml b/components/org.apache.stratos.cartridge.mgt.ui/pom.xml
new file mode 100644
index 0000000..8763c7a
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/pom.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     ~  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.
+     ~
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+	<parent>
+	    <groupId>org.wso2.carbon</groupId>
+	    <artifactId>stratos-components</artifactId>
+            <version>2.1.0</version>
+	    <relativePath>../../pom.xml</relativePath>
+	</parent>
+
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>org.apache.stratos.cartridge.mgt.ui</artifactId>
+        <version>2.1.3</version>
+	<packaging>bundle</packaging>
+	<name>WSO2 Carbon - Cartridge Management UI</name>
+	<description>Cartridge management UI bundle</description>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.wso2.carbon</groupId>
+			<artifactId>org.wso2.carbon.ui</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.wso2.carbon</groupId>
+			<artifactId>org.wso2.carbon.utils</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.wso2.carbon</groupId>
+			<artifactId>org.apache.stratos.adc.mgt.stub</artifactId>
+			<version>4.1.3</version>
+		</dependency>
+		<dependency>
+			<groupId>org.wso2.carbon</groupId>
+			<artifactId>org.apache.stratos.adc.reponotification.service.stub</artifactId>
+			<version>4.1.1</version>
+		</dependency>
+		<dependency>
+               <groupId>com.google.code.gson</groupId>
+               <artifactId>gson</artifactId>
+               <version>2.1</version>
+           </dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+						<Bundle-Name>${project.artifactId}</Bundle-Name>
+						<Export-Package>
+							!org.apache.stratos.cartridge.mgt.ui.internal,
+							org.apache.stratos.cartridge.mgt.ui.*;version="2.1.3"
+                        </Export-Package>
+						<Bundle-Activator>
+                            org.apache.stratos.cartridge.mgt.ui.internal.CartridgeManagementUIActivator
+                        </Bundle-Activator>
+						<Private-Package>org.apache.stratos.cartridge.mgt.ui.internal</Private-Package>
+						<Carbon-Component>UIBundle</Carbon-Component>
+						<Import-Package>
+							!org.apache.stratos.cartridge.mgt.ui.*,
+							org.wso2.carbon.adc.mgt.stub.*;version="1.0.0",
+							*;resolution:=optional
+                        </Import-Package>
+					</instructions>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/CartridgeAdminClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/CartridgeAdminClient.java b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/CartridgeAdminClient.java
new file mode 100644
index 0000000..a7b538b
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/CartridgeAdminClient.java
@@ -0,0 +1,278 @@
+/**
+ *  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.cartridge.mgt.ui;
+
+import java.rmi.RemoteException;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.adc.mgt.dto.xsd.CartridgeWrapper;
+import org.wso2.carbon.adc.mgt.dto.xsd.PolicyDefinition;
+import org.wso2.carbon.adc.mgt.dto.xsd.RepositoryInformation;
+import org.wso2.carbon.adc.mgt.dto.xsd.SubscriptionInfo;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceADCExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceAlreadySubscribedExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceDomainMappingExistsExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceDuplicateCartridgeAliasExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceInvalidCartridgeAliasExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceInvalidRepositoryExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceNotSubscribedExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServicePolicyExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceRepositoryCredentialsRequiredExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceRepositoryRequiredExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceRepositoryTransportExceptionException;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceStub;
+import org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceUnregisteredCartridgeExceptionException;
+
+/**
+ * Client which communicates with the Application Management service of ADC
+ */
+public class CartridgeAdminClient {
+    public static final String BUNDLE = "org.apache.stratos.cartridge.mgt.ui.i18n.Resources";
+    public static final int MILLISECONDS_PER_MINUTE = 60 * 1000;
+    private static final Log log = LogFactory.getLog(CartridgeAdminClient.class);
+    private ResourceBundle bundle;
+    public ApplicationManagementServiceStub stub;
+
+	public CartridgeAdminClient(String cookie, String backendServerURL, ConfigurationContext configCtx, Locale locale) throws AxisFault {
+		if (log.isDebugEnabled()) {
+			log.debug("Creating CartridgeAdminClient for " + backendServerURL);
+		}
+		if (cookie == null || cookie.trim().length() == 0) {
+			if (log.isDebugEnabled()) {
+				log.debug("Cookie not found. Cannot create CartridgeAdminClient for " + backendServerURL);
+			}
+			throw new RuntimeException("Session has expired");
+		}
+		String serviceURL = backendServerURL + "ApplicationManagementService";
+		bundle = ResourceBundle.getBundle(BUNDLE, locale);
+
+		stub = new ApplicationManagementServiceStub(configCtx, serviceURL);
+		ServiceClient client = stub._getServiceClient();
+		Options option = client.getOptions();
+		option.setManageSession(true);
+		option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+		option.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+	}
+
+	public CartridgeWrapper getPagedAvailableCartridges(String cartridgeSearchString, int pageNumber, boolean multiTenant) {
+		try {
+			return stub.getPagedAvailableCartridges(cartridgeSearchString, pageNumber, multiTenant);
+		} catch (ApplicationManagementServiceADCExceptionException e) {
+			handleException("cannot.list.available.cartridges", e);
+		} catch (RemoteException e) {
+			handleException("remote.error", e);
+		}
+		return null;
+	}
+    
+	public CartridgeWrapper getPagedSubscribedCartridges(String cartridgeSearchString, int pageNumber) {
+		try {
+			return stub.getPagedSubscribedCartridges(cartridgeSearchString, pageNumber);
+		} catch (ApplicationManagementServiceADCExceptionException e) {
+			handleException("cannot.list.subscribed.cartridges", e);
+		} catch (RemoteException e) {
+			handleException("remote.error", e);
+		}
+		return null;
+	}
+
+	public String addDomainMapping(String mappedDomain, String cartridgeAlias) {
+		String host = null;
+		try {
+			host = stub.addDomainMapping(mappedDomain, cartridgeAlias);
+		} catch (ApplicationManagementServiceADCExceptionException e) {
+			handleException("cannot.mapdomain", e);
+		} catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
+			handleException("notsubscribed.error", e, cartridgeAlias);
+		} catch (RemoteException e) {
+			handleException("remote.error", e);
+		} catch (ApplicationManagementServiceDomainMappingExistsExceptionException e) {
+			handleException("domainmapping.exists.error", e, mappedDomain, cartridgeAlias);
+		}
+
+		return host;
+	}
+	
+	public void removeDomainMapping(String cartridgeAlias) {
+		try {
+			stub.removeDomainMapping(cartridgeAlias);
+		} catch (RemoteException e) {
+			handleException("remote.error", e);
+		} catch (ApplicationManagementServiceADCExceptionException e) {
+			handleException("cannot.removedomain", e);
+		} catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
+			handleException("notsubscribed.error", e, cartridgeAlias);
+		}
+	}
+	
+	public void synchronizeRepository(String cartridgeAlias) {
+		try {
+			stub.synchronizeRepository(cartridgeAlias);
+		} catch (RemoteException e) {
+			handleException("remote.error", e);
+		} catch (ApplicationManagementServiceADCExceptionException e) {
+			handleException("cannot.syncrepo", e);
+		} catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
+			handleException("notsubscribed.error", e, cartridgeAlias);
+		}
+	}
+	
+	public RepositoryInformation testRepositoryConnection(String repoURL, String repoUsername, String repoPassword, boolean privateRepo) {
+		try {
+			return stub.testRepositoryConnection(repoURL, repoUsername, repoPassword, privateRepo);
+		} catch (RemoteException e) {
+			handleException("remote.error", e);
+		} catch (ApplicationManagementServiceADCExceptionException e) {
+			handleException("cannot.testrepo", e);
+		} catch (ApplicationManagementServiceRepositoryRequiredExceptionException e) {
+			handleException("repository.required", e);
+		} catch (ApplicationManagementServiceRepositoryTransportExceptionException e) {
+			handleException("repository.transport.error", e, repoURL);
+		} catch (ApplicationManagementServiceRepositoryCredentialsRequiredExceptionException e) {
+			handleException("repository.credentials.required", e, repoURL);
+		} catch (ApplicationManagementServiceInvalidRepositoryExceptionException e) {
+			handleException("repository.invalid.error", e, repoURL);
+		}
+		return null;
+	}
+	
+    public void unsubscribe(String alias) {
+        try {
+            stub.unsubscribe(alias);
+        } catch (RemoteException e) {
+        	handleException("remote.error", e);
+        } catch (ApplicationManagementServiceADCExceptionException e) {
+        	handleException("cannot.unsubscribe", e);
+        } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
+        	handleException("notsubscribed.error", e, alias);
+		}
+    }
+
+    public PolicyDefinition[] getPolicyDefinitions() {
+        try {
+            return stub.getPolicyDefinitions();
+        } catch (RemoteException e) {
+            handleException("remote.error", e);
+        }
+        return null;
+    }
+    
+    public boolean isFeatureEnabled(String feature) {
+        try {
+            return stub.isFeatureEnabled(feature);
+        } catch (RemoteException e) {
+            handleException("remote.error", e);
+        }
+        return false;
+    }
+
+    public SubscriptionInfo subscribeToCartridge(String cartridgeType,
+                                       String cartridgeAlias,
+                                       String policy,
+                                       String repositoryUrl,
+                                       boolean privateRepo,
+                                       String repoUserName,
+                                       String repoPassword,
+                                       String otherCartridgeType,
+                                       String otherCartridgeAlias) {
+    	
+		if (log.isInfoEnabled()) {
+			log.info("Subscribing to a Cartridge: " + cartridgeType + ", Alias: " + cartridgeAlias);
+		}
+		
+		if (otherCartridgeAlias != null && otherCartridgeAlias.trim().length() > 0) {
+			// currently passing empty strings for repo user name and
+			// passwords
+			try {
+				stub.subscribe(otherCartridgeType, otherCartridgeAlias, policy, null, false, "", "", null, null);
+			} catch (RemoteException e) {
+				handleException("remote.error", e);
+			} catch (ApplicationManagementServiceADCExceptionException e) {
+				handleException("cannot.subscribe", e);
+			} catch (ApplicationManagementServiceRepositoryRequiredExceptionException e) {
+				handleException("repository.required", e);
+			} catch (ApplicationManagementServiceUnregisteredCartridgeExceptionException e) {
+				handleException("cartridge.notregistered", e, otherCartridgeType);
+			} catch (ApplicationManagementServiceInvalidCartridgeAliasExceptionException e) {
+				handleException("cartridge.invalid.alias", e, otherCartridgeAlias);
+			} catch (ApplicationManagementServiceAlreadySubscribedExceptionException e) {
+				handleException("cartridge.already.subscribed", e, e.getFaultMessage().getAlreadySubscribedException()
+						.getCartridgeType());
+			} catch (ApplicationManagementServiceDuplicateCartridgeAliasExceptionException e) {
+				handleException("cartridge.alias.duplicate", e, otherCartridgeAlias);
+			} catch (ApplicationManagementServicePolicyExceptionException e) {
+				handleException("policy.error", e);
+			} catch (ApplicationManagementServiceRepositoryTransportExceptionException e) {
+				handleException("repository.transport.error", e, repositoryUrl);
+			} catch (ApplicationManagementServiceRepositoryCredentialsRequiredExceptionException e) {
+				handleException("repository.credentials.required", e, repositoryUrl);
+			} catch (ApplicationManagementServiceInvalidRepositoryExceptionException e) {
+				handleException("repository.invalid.error", e, repositoryUrl);
+			}
+		}
+		
+		try {
+			return stub.subscribe(cartridgeType, cartridgeAlias, policy, repositoryUrl, privateRepo, repoUserName,
+					repoPassword, otherCartridgeType, otherCartridgeAlias);
+		} catch (RemoteException e) {
+			handleException("remote.error", e);
+		} catch (ApplicationManagementServiceADCExceptionException e) {
+			handleException("cannot.subscribe", e);
+		} catch (ApplicationManagementServiceRepositoryRequiredExceptionException e) {
+			handleException("repository.required", e);
+		} catch (ApplicationManagementServiceUnregisteredCartridgeExceptionException e) {
+			handleException("cartridge.notregistered", e, cartridgeType);
+		} catch (ApplicationManagementServiceInvalidCartridgeAliasExceptionException e) {
+			handleException("cartridge.invalid.alias", e, cartridgeAlias);
+		} catch (ApplicationManagementServiceAlreadySubscribedExceptionException e) {
+			handleException("cartridge.already.subscribed", e, e.getFaultMessage().getAlreadySubscribedException()
+					.getCartridgeType());
+		} catch (ApplicationManagementServiceDuplicateCartridgeAliasExceptionException e) {
+			handleException("cartridge.alias.duplicate", e, cartridgeAlias);
+		} catch (ApplicationManagementServicePolicyExceptionException e) {
+			handleException("policy.error", e);
+		} catch (ApplicationManagementServiceRepositoryTransportExceptionException e) {
+			handleException("repository.transport.error", e, repositoryUrl);
+		} catch (ApplicationManagementServiceRepositoryCredentialsRequiredExceptionException e) {
+			handleException("repository.credentials.required", e, repositoryUrl);
+		} catch (ApplicationManagementServiceInvalidRepositoryExceptionException e) {
+			handleException("repository.invalid.error", e, repositoryUrl);
+		}
+		return null;
+    }
+
+    private void handleException(String msgKey, Exception e, Object... args) {
+        String msg = bundle.getString(msgKey);
+        if (args != null) {
+        	msg = MessageFormat.format(msg, args);
+        }
+        log.error(msg, e);
+        throw new RuntimeException(msg, e);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/CartridgeConstans.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/CartridgeConstans.java b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/CartridgeConstans.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/Payload.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/Payload.java b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/Payload.java
new file mode 100644
index 0000000..8bd5948
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/Payload.java
@@ -0,0 +1,14 @@
+package org.apache.stratos.cartridge.mgt.ui;
+
+public class Payload {
+	private Repository repository;
+
+	public Repository getRepository() {
+		return repository;
+	}
+
+	public void setRepository(Repository repository) {
+		this.repository = repository;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/RepoNotificationClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/RepoNotificationClient.java b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/RepoNotificationClient.java
new file mode 100644
index 0000000..5eedf29
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/RepoNotificationClient.java
@@ -0,0 +1,52 @@
+package org.apache.stratos.cartridge.mgt.ui;
+
+import java.rmi.RemoteException;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.adc.reponotification.stub.RepoNotificationServiceException;
+import org.wso2.carbon.adc.reponotification.stub.RepoNotificationServiceStub;
+
+public class RepoNotificationClient {
+
+	private ResourceBundle bundle;
+	public RepoNotificationServiceStub stub;
+	public static final String BUNDLE = "org.apache.stratos.cartridge.mgt.ui.i18n.Resources";
+	private static final Log log = LogFactory.getLog(RepoNotificationClient.class);
+
+	public RepoNotificationClient(String cookie, String backendServerURL,
+			ConfigurationContext configCtx, Locale locale) throws AxisFault {
+		String serviceURL = backendServerURL + "RepoNotificationService";
+		bundle = ResourceBundle.getBundle(BUNDLE, locale);
+
+		stub = new RepoNotificationServiceStub(configCtx, serviceURL);
+		ServiceClient client = stub._getServiceClient();
+		Options option = client.getOptions();
+		option.setManageSession(true);
+		option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+		option.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+	}
+
+	public void synchronize(String repositoryURL) throws AxisFault {
+		try {
+			stub.synchronize(repositoryURL);
+		} catch (RemoteException e) {
+			handleException("cannot.unsubscribe", e);
+		} catch (RepoNotificationServiceException e) {
+			handleException("cannot.unsubscribe", e);
+		}
+	}
+
+	private void handleException(String msgKey, Exception e) throws AxisFault {
+		String msg = bundle.getString(msgKey);
+		log.error(msg, e);
+		throw new AxisFault(msg, e);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/RepoNotificationServlet.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/RepoNotificationServlet.java b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/RepoNotificationServlet.java
new file mode 100644
index 0000000..ff51094
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/RepoNotificationServlet.java
@@ -0,0 +1,57 @@
+package org.apache.stratos.cartridge.mgt.ui;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.ui.CarbonUIUtil;
+import org.wso2.carbon.utils.ServerConstants;
+
+import com.google.gson.Gson;
+
+public class RepoNotificationServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 4315990619456849911L;
+	private static final Log log = LogFactory
+			.getLog(RepoNotificationServlet.class);
+
+	public RepoNotificationServlet() {
+	}
+
+	@Override
+	public void doPost(HttpServletRequest request, HttpServletResponse response) {
+		String payload = request.getParameter("payload");
+		log.info(" repository payload received ");
+
+		String repositoryURL;
+
+		Gson gson = new Gson();
+		Payload p = gson.fromJson(payload, Payload.class);
+		repositoryURL = p.getRepository().getUrl();
+		try {
+			String backendServerURL = CarbonUIUtil.getServerURL(
+					getServletContext(), request.getSession());
+			ConfigurationContext configContext = (ConfigurationContext) getServletContext()
+					.getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+			String cookie = (String) request.getSession().getAttribute(
+					ServerConstants.ADMIN_SERVICE_COOKIE);
+			new RepoNotificationClient(cookie, backendServerURL, configContext,
+					request.getLocale()).synchronize(repositoryURL);
+		} catch (Exception e) {
+			log.error("Exception is occurred in synchronize, Reason : "
+					+ e.getMessage());
+		}
+
+	}
+
+	@Override
+	protected void doGet(HttpServletRequest req, HttpServletResponse res) {
+
+		this.doPost(req, res);
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/Repository.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/Repository.java b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/Repository.java
new file mode 100644
index 0000000..3275e83
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/Repository.java
@@ -0,0 +1,14 @@
+package org.apache.stratos.cartridge.mgt.ui;
+
+public class Repository {
+	private String url;
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/internal/CartridgeManagementUIActivator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/internal/CartridgeManagementUIActivator.java b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/internal/CartridgeManagementUIActivator.java
new file mode 100644
index 0000000..364c5e7
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/java/org/apache/stratos/cartridge/mgt/ui/internal/CartridgeManagementUIActivator.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.cartridge.mgt.ui.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 Cartridge Management Bundle
+ */
+public class CartridgeManagementUIActivator implements BundleActivator {
+
+	private static final Log log = LogFactory.getLog(CartridgeManagementUIActivator.class);
+
+	public void start(final BundleContext bundleContext) {
+
+		if (!CarbonUtils.isRunningInStandaloneMode()) {
+			// uninstall this component
+			Thread th = new Thread() {
+				public void run() {
+					try {
+						bundleContext.getBundle().uninstall();
+					} catch (Throwable e) {
+						log.warn("Error occurred while uninstalling cartridge-mgt UI bundle", e);
+					}
+				}
+			};
+			try {
+				th.join();
+			} catch (InterruptedException ignored) {
+			}
+			th.start();
+		}
+	}
+
+	public void stop(BundleContext bundleContext) {
+		// No implementation required for this method
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/META-INF/component.xml
new file mode 100644
index 0000000..aa15795
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/META-INF/component.xml
@@ -0,0 +1,103 @@
+<!--
+     ~  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.
+     ~
+ -->
+<component xmlns="http://products.wso2.org/carbon">
+	<menus>
+		<menu>
+			<id>available_cartridges_menu</id>
+			<i18n-key>cartridge.available.services.menu</i18n-key>
+			<i18n-bundle>org.apache.stratos.cartridge.mgt.ui.i18n.Resources</i18n-bundle>
+			<parent-menu>manage_menu</parent-menu>
+			<link>#</link>
+			<region>region1</region>
+			<order>1</order>
+			<icon>../cartridge-mgt/images/cartridge.png</icon>
+			<style-class>home</style-class>
+			<require-permission>/permission/admin/manage/cartridges</require-permission>
+			<require-not-super-tenant>true</require-not-super-tenant>
+		</menu>
+		<menu>
+			<id>available_multitenant_cartridges</id>
+			<i18n-key>cartridges.available.multitenant</i18n-key>
+			<i18n-bundle>org.apache.stratos.cartridge.mgt.ui.i18n.Resources</i18n-bundle>
+			<parent-menu>available_cartridges_menu</parent-menu>
+			<link>../cartridge-mgt/available_cartridges.jsp</link>
+			<region>region1</region>
+			<order>2</order>
+			<icon>../cartridge-mgt/images/list.gif</icon>
+			<style-class>home</style-class>
+			<require-permission>/permission/admin/manage/cartridges</require-permission>
+			<require-not-super-tenant>true</require-not-super-tenant>
+		</menu>
+		<menu>
+			<id>available_singletenant_cartridges</id>
+			<i18n-key>cartridges.available.singletenant</i18n-key>
+			<i18n-bundle>org.apache.stratos.cartridge.mgt.ui.i18n.Resources</i18n-bundle>
+			<parent-menu>available_cartridges_menu</parent-menu>
+			<link>../cartridge-mgt/available_cartridges.jsp</link>
+			<region>region1</region>
+			<order>3</order>
+			<icon>../cartridge-mgt/images/list.gif</icon>
+			<style-class>home</style-class>
+			<require-permission>/permission/admin/manage/cartridges</require-permission>
+			<require-not-super-tenant>true</require-not-super-tenant>
+		</menu>
+		<menu>
+			<id>subscribed_cartridges_menu</id>
+			<i18n-key>cartridge.subscribed.services.menu</i18n-key>
+			<i18n-bundle>org.apache.stratos.cartridge.mgt.ui.i18n.Resources</i18n-bundle>
+			<parent-menu>manage_menu</parent-menu>
+			<link>#</link>
+			<region>region1</region>
+			<order>4</order>
+			<icon>../cartridge-mgt/images/cartridge.png</icon>
+			<style-class>home</style-class>
+			<require-permission>/permission/admin/manage/cartridges</require-permission>
+			<require-not-super-tenant>true</require-not-super-tenant>
+		</menu>
+		<menu>
+			<id>subscribed_cartridges</id>
+			<i18n-key>cartridges.subscribed.list</i18n-key>
+			<i18n-bundle>org.apache.stratos.cartridge.mgt.ui.i18n.Resources</i18n-bundle>
+			<parent-menu>subscribed_cartridges_menu</parent-menu>
+			<link>../cartridge-mgt/subscribed_cartridges.jsp</link>
+			<region>region1</region>
+			<order>5</order>
+			<icon>../cartridge-mgt/images/list.gif</icon>
+			<style-class>home</style-class>
+			<require-permission>/permission/admin/manage/cartridges</require-permission>
+			<require-not-super-tenant>true</require-not-super-tenant>
+		</menu>
+	</menus>
+	<servlets>
+		<servlet id="RepoNotificationServlet">
+			<servlet-name>RepoNotificationServlet</servlet-name>
+			<url-pattern>/repo_notification</url-pattern>
+			<display-name>Repository Notification Servlet</display-name>
+			<servlet-class>org.apache.stratos.cartridge.mgt.ui.RepoNotificationServlet</servlet-class>
+		</servlet>
+	</servlets>
+	<framework-configuration>
+		<bypass>
+			<authentication>
+				<link>/repo_notification</link>
+			</authentication>
+		</bypass>
+	</framework-configuration>
+</component>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/org/apache/stratos/cartridge/mgt/ui/i18n/Resources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/org/apache/stratos/cartridge/mgt/ui/i18n/Resources.properties b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/org/apache/stratos/cartridge/mgt/ui/i18n/Resources.properties
new file mode 100644
index 0000000..d8d8ed1
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/org/apache/stratos/cartridge/mgt/ui/i18n/Resources.properties
@@ -0,0 +1,96 @@
+list=List
+
+remote.error=Error connecting to back-end service.
+notsubscribed.error=You have not subscribed to {0}
+
+cartridge.information=Cartridge Information
+cartridge.connect.information=Connect Cartridge Information
+cartridge.available.services.menu=Available Cartridges
+cartridge.subscribed.services.menu=Subscribed Cartridges
+cartridges=Cartridges
+cartridges.available.multitenant=Multi-Tenant Cartridges
+cartridges.available.singletenant=Single-Tenant Cartridges
+cartridges.subscribed.list=List Cartridges
+cartrigdes.available.header=Available Cartridges
+cartrigdes.subscribed.header=Subscribed Cartridges
+cartridge.display.name=Cartridge Name
+cartridge.version=Version
+cartridge.description=Description
+cartridge.tenancymodel=Tenancy Model
+search.cartrigdes=Search Cartridges
+subscribe.new.cartridge=Subscribe to a New Cartridge
+subscribe.to=Subscribe to {0} Cartridge
+subscribed.cartridges=Subscribed cartridges
+no.subscribed.cartridges=There are no Subscribed cartridges
+no.cartridges.found=No Cartridges Found
+already.subscribed=Already Subscribed
+
+cartridge.notregistered=Cartridge {0} is not registered
+cartridge.invalid.alias=The provided cartridge alias is not valid. The alias can contain only lowercase characters and numbers.
+cartridge.already.subscribed=You have already subscribed for cartridge type {0}
+cartridge.alias.duplicate=Duplicate cartridge alias {0}
+
+policy.error=Could not load policy.
+
+ip=IP
+mapdomain.information=Map Domain Information
+mapdomain.to=Map Domain to Alias
+mapdomain=Map Domain
+removedomain=Remove Domain
+mappeddomain=Mapped Domain
+cannot.mapdomain=Map Domain failed
+cannot.removedomain=Mapped Domain removal failed
+domainmapping.exists.error=Provided domain mapping {0} already exists
+
+syncrepo=Synchronize
+cannot.syncrepo=Synchronization failed
+
+repository.information=Git Repository Information
+repository.required=An external repository required
+repository.credentials.required=Username and Password are required for the repository: {0}
+repository.transport.error=Error connecting to the repository: {0}
+repository.invalid.error=Invalid repository: {0}
+
+select.cartridge.file=Select the file to upload
+invalid.cartridge.file=Selected file is invalid
+cartridge.app=Cartridge Application
+upload.application=Upload Applications
+app.archiveapp=Upload new applications
+upload=Upload
+cancel=Cancel
+subscribe=Subscribe
+unsubscribe=Unsubscribe
+url=Access URL(s)
+repo.url=Repository URL
+upload.apps=Upload Apps
+policy=Policy
+
+type=Type
+status=Status
+instance.count=Running Instances
+alias=Alias
+action=Action
+search=Search
+
+username=Username
+password=Password
+
+next=next
+prev=prev
+
+appmgt.add.app.menu=Add
+appmgt.listservices.menu=List
+appmgt.services.menu=Cartridge Applications
+select.cartridge=Select a Cartridge
+no.selected.cartridge=Please select a cartridge
+cartridge=Cartridge
+
+successfully.subscribed=Successfully subscribed.
+
+cartridge.unsubscribe.prompt=Are you sure you want to unsubscribe?
+
+cannot.testrepo=An error occurred when testing repository connection.
+cannot.list.available.cartridges=An error occurred when getting available cartridges.
+cannot.list.subscribed.cartridges=An error occurred when getting subscribed cartridges.
+cannot.unsubscribe=Unsubscribe unsuccessful
+cannot.subscribe=Subscribe unsuccessful

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/available_cartridges.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/available_cartridges.jsp b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/available_cartridges.jsp
new file mode 100644
index 0000000..b854937
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/available_cartridges.jsp
@@ -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.
+     ~
+ -->
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+<%@ page import="org.apache.axis2.context.ConfigurationContext"%>
+<%@ page import="org.wso2.carbon.CarbonConstants"%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage"%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil"%>
+<%@ page import="org.wso2.carbon.utils.ServerConstants"%>
+<%@ page import="org.apache.stratos.cartridge.mgt.ui.CartridgeAdminClient"%>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon"%>
+<%@ page import="org.wso2.carbon.adc.mgt.dto.xsd.Cartridge"%>
+<%@ page import="org.wso2.carbon.adc.mgt.dto.xsd.CartridgeWrapper"%>
+<%@ page import="org.wso2.carbon.adc.mgt.stub.ApplicationManagementServiceADCExceptionException"%>
+<%@ page import="java.text.SimpleDateFormat"%>
+<%@ page import="java.util.ResourceBundle"%>
+<%@ page import="java.util.ArrayList"%>
+
+<jsp:include page="../dialog/display_messages.jsp" />
+
+<%
+	response.setHeader("Cache-Control", "no-cache");
+
+    String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+    ConfigurationContext configContext =
+            (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+
+    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+    CartridgeAdminClient client;
+    Cartridge[] cartridges = null;
+    
+    String item = request.getParameter("item");
+    boolean multiTenant = "available_multitenant_cartridges".equals(item);
+
+    int numberOfPages = 0;
+    String pageNumber = request.getParameter("pageNumber");
+    if (pageNumber == null) {
+        pageNumber = "0";
+    }
+    int pageNumberInt = 0;
+    try {
+        pageNumberInt = Integer.parseInt(pageNumber);
+    } catch (NumberFormatException ignored) {
+    }
+
+    String cartridgeSearchString = request.getParameter("cartridgeSearchString");
+    if (cartridgeSearchString == null) {
+        cartridgeSearchString = "";
+    }
+
+    try {
+        client = new CartridgeAdminClient(cookie, backendServerURL, configContext, request.getLocale());
+        CartridgeWrapper cartridgeWrapper = client.getPagedAvailableCartridges(cartridgeSearchString, pageNumberInt, multiTenant);
+        if (cartridgeWrapper != null) {
+        	numberOfPages = cartridgeWrapper.getNumberOfPages();
+        	cartridges = cartridgeWrapper.getCartridges();
+        }
+    } catch (Exception e) {
+        response.setStatus(500);
+        CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+        session.setAttribute(CarbonUIMessage.ID, uiMsg);
+%>
+<jsp:include page="../admin/error.jsp" />
+<%
+	return;
+    }
+    
+    ResourceBundle bundle = ResourceBundle.getBundle(CartridgeAdminClient.BUNDLE, request.getLocale());
+%>
+
+<fmt:bundle basename="org.apache.stratos.cartridge.mgt.ui.i18n.Resources">
+	<carbon:breadcrumb label="cartrigdes.available.header" resourceBundle="org.apache.stratos.cartridge.mgt.ui.i18n.Resources"
+		topPage="false" request="<%=request%>" />
+
+	<script type="text/javascript">
+		function searchCartridges() {
+			document.searchForm.submit();
+		}
+	</script>
+
+	<div id="middle">
+		<h2>
+			<fmt:message key="cartrigdes.available.header" />
+		</h2>
+
+		<div id="workArea">
+			<form action="available_cartridges.jsp" name="searchForm">
+				<table class="styledLeft">
+					<tr>
+						<td>
+							<table style="border: 0;">
+								<tbody>
+									<tr style="border: 0;">
+										<td style="border: 0;"><fmt:message key="search.cartrigdes" /> <input type="text"
+											name="cartridgeSearchString" value="<%=cartridgeSearchString != null ? cartridgeSearchString : ""%>" />&nbsp;
+										</td>
+										<td style="border: 0;"><a class="icon-link" href="#" style="background-image: url(images/search.gif);"
+											onclick="searchCartridges(); return false;" alt="<fmt:message key="search"/>"> </a></td>
+									</tr>
+								</tbody>
+							</table>
+						</td>
+					</tr>
+				</table>
+				<input type="hidden" name="item" value="<%=item%>" />
+			</form>
+
+			<p>&nbsp;</p>
+			<%
+				if (cartridges != null) {
+					String parameters = "cartridgeSearchString=" + cartridgeSearchString + "&item=" + item;
+			%>
+
+			<carbon:paginator pageNumber="<%=pageNumberInt%>" numberOfPages="<%=numberOfPages%>" page="available_cartridges.jsp"
+				pageNumberParameterName="pageNumber" resourceBundle="org.apache.stratos.cartridge.mgt.ui.i18n.Resources" prevKey="prev"
+				nextKey="next" parameters="<%=parameters%>" />
+			<p>&nbsp;</p>
+
+			<form name="cartridgesForm" method="post">
+				<input type="hidden" name="pageNumber" value="<%=pageNumber%>" />
+				<table class="styledLeft" id="cartridgesTable" style="width: 100%">
+					<thead>
+						<tr>
+							<th style="width: 15%"><fmt:message key="cartridge.display.name" /></th>
+							<th style="width: 80px"><fmt:message key="cartridge.version" /></th>
+							<th><fmt:message key="cartridge.description" /></th>
+							<th style="width: 15%"><fmt:message key="action" /></th>
+						</tr>
+					</thead>
+					<tbody>
+
+						<%
+							for (Cartridge cartridge : cartridges) {
+								boolean subscribed = "SUBSCRIBED".equals(cartridge.getStatus());
+						%>
+
+						<tr>
+							<td><%=(cartridge.getDisplayName() != null ? cartridge.getDisplayName() : "")%></td>
+							<td><%=(cartridge.getVersion() != null ? cartridge.getVersion() : "")%></td>
+							<td><%=(cartridge.getDescription() != null ? cartridge.getDescription() : "")%></td>
+							<td>
+							<% if (!subscribed) { %>
+								<a href="./subscribe.jsp?cartridgeType=<%=cartridge.getCartridgeType()%>&cartridgeProvider=<%=cartridge.getProvider()%>&multiTenant=<%=cartridge.getMultiTenant()%>&item=<%=item%>"
+									style="background-image: url(images/subscribe.gif);" class="icon-link"> <fmt:message key="subscribe" /></a>
+							<% } else { %>
+								<fmt:message key="already.subscribed" />
+							<% } %>
+							</td>
+						</tr>
+						<%
+							}
+						%>
+					</tbody>
+				</table>
+			</form>
+			<p>&nbsp;</p>
+			<carbon:paginator pageNumber="<%=pageNumberInt%>" numberOfPages="<%=numberOfPages%>" page="available_cartridges.jsp"
+				pageNumberParameterName="pageNumber" resourceBundle="org.apache.stratos.cartridge.mgt.ui.i18n.Resources" prevKey="prev"
+				nextKey="next" parameters="<%=parameters%>" />
+			<%
+				} else {
+			%>
+			<b><fmt:message key="no.cartridges.found" /></b>
+			<%
+				}
+			%>
+		</div>
+	</div>
+	<script type="text/javascript">
+		alternateTableRows('cartridgesTable', 'tableEvenRow', 'tableOddRow');
+	</script>
+</fmt:bundle>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/docs/userguide.html
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/docs/userguide.html b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/docs/userguide.html
new file mode 100644
index 0000000..326738d
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/docs/userguide.html
@@ -0,0 +1,41 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. 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.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Cartridge Management - User Guide</title>
+<link href="../../admin/css/documentation.css" rel="stylesheet"
+	type="text/css" media="all" />
+</head>
+
+<body>
+
+
+	<h1>Cartridge Management</h1>
+
+
+	<p>
+		Please refer WSO2 Stratos 2.0 Wiki <a
+			href="http://docs.wso2.org/wiki/display/Stratos200/GUI+User+Guide">GUI
+			User Guide</a> for more information.
+	</p>
+
+
+</body>
+
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/ajax-loading.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/ajax-loading.gif b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/ajax-loading.gif
new file mode 100644
index 0000000..168d273
Binary files /dev/null and b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/ajax-loading.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/cartridge.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/cartridge.png b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/cartridge.png
new file mode 100644
index 0000000..3cef1d5
Binary files /dev/null and b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/cartridge.png differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/list.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/list.gif b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/list.gif
new file mode 100644
index 0000000..638d8ab
Binary files /dev/null and b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/list.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/search.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/search.gif b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/search.gif
new file mode 100644
index 0000000..86f81ed
Binary files /dev/null and b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/search.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/subscribe.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/subscribe.gif b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/subscribe.gif
new file mode 100644
index 0000000..3b0b695
Binary files /dev/null and b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/subscribe.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/unsubscribe.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/unsubscribe.png b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/unsubscribe.png
new file mode 100644
index 0000000..0c71c3c
Binary files /dev/null and b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/images/unsubscribe.png differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/js/common.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/js/common.js b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/js/common.js
new file mode 100644
index 0000000..76910b2
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/js/common.js
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ * 
+ * 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
+ */
+
+function setStratosFormSubmitFunction(form, validateFunction,
+		ajaxprocessorPage, successPage, commandButton) {
+	jQuery(form).submit(
+			function(event) {
+				if (validateFunction && typeof validateFunction == "function"
+						&& !validateFunction()) {
+					return false;
+				}
+
+				postToBEService(ajaxprocessorPage, jQuery(form).serialize(), successPage, commandButton);
+				return false;
+			});
+}
+
+function postToBEService(ajaxprocessorPage, data, successPage, commandButton, validateFunction) {
+	if (validateFunction && typeof validateFunction == "function"
+		&& !validateFunction()) {
+		return;
+	}
+	showWait(commandButton);
+	jQuery.post(ajaxprocessorPage, data).done(
+			function(data, textStatus, jqXHR) {
+				stopWait(commandButton);
+				var msg = jQuery(jqXHR.responseText).filter('#responseMsg')
+						.text();
+				if (successPage) {
+					CARBON.showInfoDialog(msg, function() {
+						location.href = successPage;
+					});
+				} else {
+					CARBON.showInfoDialog(msg);
+				}
+			}).fail(function(jqXHR, textStatus, errorThrown) {
+		var msg = jQuery(jqXHR.responseText).filter('#responseMsg').text();
+		if (msg && msg.length > 0) {
+			CARBON.showErrorDialog(msg);
+		} else {
+			// Ignore
+			// Refer SPI-310
+		}
+	}).complete(function() {
+		stopWait(commandButton);
+	});
+}
+
+function showWait(commandButton) {
+	jQuery.blockUI('Please wait...');
+	if (commandButton) {
+		jQuery(commandButton).attr("disabled", "disabled");
+	}
+	//jQuery("body").css("cursor", "wait");
+}
+
+function stopWait(commandButton) {
+	jQuery.unblockUI();
+	if (commandButton) {
+		jQuery(commandButton).removeAttr("disabled");
+	}
+	//jQuery("body").css("cursor", "auto");
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/js/jquery.blockUI-1.33.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/js/jquery.blockUI-1.33.js b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/js/jquery.blockUI-1.33.js
new file mode 100644
index 0000000..2b0a360
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/js/jquery.blockUI-1.33.js
@@ -0,0 +1,361 @@
+/*
+ * jQuery blockUI plugin
+ * Version 1.33  (09/14/2007)
+ * @requires jQuery v1.1.1
+ *
+ * $Id$
+ *
+ * Examples at: http://malsup.com/jquery/block/
+ * Copyright (c) 2007 M. Alsup
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ */
+ (function($) {
+/**
+ * blockUI provides a mechanism for blocking user interaction with a page (or parts of a page).
+ * This can be an effective way to simulate synchronous behavior during ajax operations without
+ * locking the browser.  It will prevent user operations for the current page while it is
+ * active ane will return the page to normal when it is deactivate.  blockUI accepts the following
+ * two optional arguments:
+ *
+ *   message (String|Element|jQuery): The message to be displayed while the UI is blocked. The message
+ *              argument can be a plain text string like "Processing...", an HTML string like
+ *              "<h1><img src="busy.gif" /> Please wait...</h1>", a DOM element, or a jQuery object.
+ *              The default message is "<h1>Please wait...</h1>"
+ *
+ *   css (Object):  Object which contains css property/values to override the default styles of
+ *              the message.  Use this argument if you wish to override the default
+ *              styles.  The css Object should be in a format suitable for the jQuery.css
+ *              function.  For example:
+ *              $.blockUI({
+ *                    backgroundColor: '#ff8',
+ *                    border: '5px solid #f00,
+ *                    fontWeight: 'bold'
+ *              });
+ *
+ * The default blocking message used when blocking the entire page is "<h1>Please wait...</h1>"
+ * but this can be overridden by assigning a value to $.blockUI.defaults.pageMessage in your
+ * own code.  For example:
+ *
+ *      $.blockUI.defaults.pageMessage = "<h1>Bitte Wartezeit</h1>";
+ *
+ * The default message styling can also be overridden.  For example:
+ *
+ *      $.extend($.blockUI.defaults.pageMessageCSS, { color: '#00a', backgroundColor: '#0f0' });
+ *
+ * The default styles work well for simple messages like "Please wait", but for longer messages
+ * style overrides may be necessary.
+ *
+ * @example  $.blockUI();
+ * @desc prevent user interaction with the page (and show the default message of 'Please wait...')
+ *
+ * @example  $.blockUI( { backgroundColor: '#f00', color: '#fff'} );
+ * @desc prevent user interaction and override the default styles of the message to use a white on red color scheme
+ *
+ * @example  $.blockUI('Processing...');
+ * @desc prevent user interaction and display the message "Processing..." instead of the default message
+ *
+ * @name blockUI
+ * @param String|jQuery|Element message Message to display while the UI is blocked
+ * @param Object css Style object to control look of the message
+ * @cat Plugins/blockUI
+ */
+$.blockUI = function(msg, css, opts) {
+    $.blockUI.impl.install(window, msg, css, opts);
+};
+
+// expose version number so other plugins can interogate
+$.blockUI.version = 1.33;
+
+/**
+ * unblockUI removes the UI block that was put in place by blockUI
+ *
+ * @example  $.unblockUI();
+ * @desc unblocks the page
+ *
+ * @name unblockUI
+ * @cat Plugins/blockUI
+ */
+$.unblockUI = function(opts) {
+    $.blockUI.impl.remove(window, opts);
+};
+
+/**
+ * Blocks user interaction with the selected elements.  (Hat tip: Much of
+ * this logic comes from Brandon Aaron's bgiframe plugin.  Thanks, Brandon!)
+ * By default, no message is displayed when blocking elements.
+ *
+ * @example  $('div.special').block();
+ * @desc prevent user interaction with all div elements with the 'special' class.
+ *
+ * @example  $('div.special').block('Please wait');
+ * @desc prevent user interaction with all div elements with the 'special' class
+ * and show a message over the blocked content.
+ *
+ * @name block
+ * @type jQuery
+ * @param String|jQuery|Element message Message to display while the element is blocked
+ * @param Object css Style object to control look of the message
+ * @cat Plugins/blockUI
+ */
+$.fn.block = function(msg, css, opts) {
+    return this.each(function() {
+		if (!this.$pos_checked) {
+            if ($.css(this,"position") == 'static')
+                this.style.position = 'relative';
+            if ($.browser.msie) this.style.zoom = 1; // force 'hasLayout' in IE
+            this.$pos_checked = 1;
+        }
+        $.blockUI.impl.install(this, msg, css, opts);
+    });
+};
+
+/**
+ * Unblocks content that was blocked by "block()"
+ *
+ * @example  $('div.special').unblock();
+ * @desc unblocks all div elements with the 'special' class.
+ *
+ * @name unblock
+ * @type jQuery
+ * @cat Plugins/blockUI
+ */
+$.fn.unblock = function(opts) {
+    return this.each(function() {
+        $.blockUI.impl.remove(this, opts);
+    });
+};
+
+/**
+ * displays the first matched element in a "display box" above a page overlay.
+ *
+ * @example  $('#myImage').displayBox();
+ * @desc displays "myImage" element in a box
+ *
+ * @name displayBox
+ * @type jQuery
+ * @cat Plugins/blockUI
+ */
+$.fn.displayBox = function(css, fn, isFlash) {
+    var msg = this[0];
+    if (!msg) return;
+    var $msg = $(msg);
+    css = css || {};
+
+    var w = $msg.width()  || $msg.attr('width')  || css.width  || $.blockUI.defaults.displayBoxCSS.width;
+    var h = $msg.height() || $msg.attr('height') || css.height || $.blockUI.defaults.displayBoxCSS.height ;
+    if (w[w.length-1] == '%') {
+        var ww = document.documentElement.clientWidth || document.body.clientWidth;
+        w = parseInt(w) || 100;
+        w = (w * ww) / 100;
+    }
+    if (h[h.length-1] == '%') {
+        var hh = document.documentElement.clientHeight || document.body.clientHeight;
+        h = parseInt(h) || 100;
+        h = (h * hh) / 100;
+    }
+
+    var ml = '-' + parseInt(w)/2 + 'px';
+    var mt = '-' + parseInt(h)/2 + 'px';
+
+    // supress opacity on overlay if displaying flash content on mac/ff platform
+    var ua = navigator.userAgent.toLowerCase();
+    var opts = {
+        displayMode: fn || 1,
+        noalpha: isFlash && /mac/.test(ua) && /firefox/.test(ua)
+    };
+
+    $.blockUI.impl.install(window, msg, { width: w, height: h, marginTop: mt, marginLeft: ml }, opts);
+};
+
+
+// override these in your code to change the default messages and styles
+$.blockUI.defaults = {
+    // the message displayed when blocking the entire page
+    pageMessage:    '<h1>Please wait...</h1>',
+    // the message displayed when blocking an element
+    elementMessage: '', // none
+    // styles for the overlay iframe
+    overlayCSS:  { backgroundColor: '#fff', opacity: '0.5' },
+    // styles for the message when blocking the entire page
+    pageMessageCSS:    { width:'250px', margin:'-50px 0 0 -125px', top:'50%', left:'50%', textAlign:'center', color:'#000', backgroundColor:'#fff', border:'3px solid #aaa' },
+    // styles for the message when blocking an element
+    elementMessageCSS: { width:'250px', padding:'10px', textAlign:'center', backgroundColor:'#fff'},
+    // styles for the displayBox
+    displayBoxCSS: { width: '400px', height: '400px', top:'50%', left:'50%' },
+    // allow body element to be stetched in ie6
+    ie6Stretch: 1,
+    // supress tab nav from leaving blocking content?
+    allowTabToLeave: 0,
+    // Title attribute for overlay when using displayBox
+    closeMessage: 'Click to close',
+    // use fadeOut effect when unblocking (can be overridden on unblock call)
+    fadeOut:  1,
+    // fadeOut transition time in millis
+    fadeTime: 400
+};
+
+// the gory details
+$.blockUI.impl = {
+    box: null,
+    boxCallback: null,
+    pageBlock: null,
+    pageBlockEls: [],
+    op8: window.opera && window.opera.version() < 9,
+    ie6: $.browser.msie && /MSIE 6.0/.test(navigator.userAgent),
+    install: function(el, msg, css, opts) {
+        opts = opts || {};
+        this.boxCallback = typeof opts.displayMode == 'function' ? opts.displayMode : null;
+        this.box = opts.displayMode ? msg : null;
+        var full = (el == window);
+
+        // use logical settings for opacity support based on browser but allow overrides via opts arg
+        var noalpha = this.op8 || $.browser.mozilla && /Linux/.test(navigator.platform);
+        if (typeof opts.alphaOverride != 'undefined')
+            noalpha = opts.alphaOverride == 0 ? 1 : 0;
+
+        if (full && this.pageBlock) this.remove(window, {fadeOut:0});
+        // check to see if we were only passed the css object (a literal)
+        if (msg && typeof msg == 'object' && !msg.jquery && !msg.nodeType) {
+            css = msg;
+            msg = null;
+        }
+        msg = msg ? (msg.nodeType ? $(msg) : msg) : full ? $.blockUI.defaults.pageMessage : $.blockUI.defaults.elementMessage;
+        if (opts.displayMode)
+            var basecss = jQuery.extend({}, $.blockUI.defaults.displayBoxCSS);
+        else
+            var basecss = jQuery.extend({}, full ? $.blockUI.defaults.pageMessageCSS : $.blockUI.defaults.elementMessageCSS);
+        css = jQuery.extend(basecss, css || {});
+        var f = ($.browser.msie) ? $('<iframe class="blockUI" style="z-index:1000;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false;"></iframe>')
+                                 : $('<div class="blockUI" style="display:none"></div>');
+        var w = $('<div class="blockUI" style="z-index:1001;cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
+        var m = full ? $('<div class="blockUI blockMsg" style="z-index:1002;cursor:wait;padding:0;position:fixed"></div>')
+                     : $('<div class="blockUI" style="display:none;z-index:1002;cursor:wait;position:absolute"></div>');
+        w.css('position', full ? 'fixed' : 'absolute');
+        if (msg) m.css(css);
+        if (!noalpha) w.css($.blockUI.defaults.overlayCSS);
+        if (this.op8) w.css({ width:''+el.clientWidth,height:''+el.clientHeight }); // lame
+        if ($.browser.msie) f.css('opacity','0.0');
+
+        $([f[0],w[0],m[0]]).appendTo(full ? 'body' : el);
+
+        // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
+        var expr = $.browser.msie && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
+        if (this.ie6 || expr) {
+            // stretch content area if it's short
+            if (full && $.blockUI.defaults.ie6Stretch && $.boxModel)
+                $('html,body').css('height','100%');
+
+            // fix ie6 problem when blocked element has a border width
+            if ((this.ie6 || !$.boxModel) && !full) {
+                var t = this.sz(el,'borderTopWidth'), l = this.sz(el,'borderLeftWidth');
+                var fixT = t ? '(0 - '+t+')' : 0;
+                var fixL = l ? '(0 - '+l+')' : 0;
+            }
+
+            // simulate fixed position
+            $.each([f,w,m], function(i,o) {
+                var s = o[0].style;
+                s.position = 'absolute';
+                if (i < 2) {
+                    full ? s.setExpression('height','document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + "px"')
+                         : s.setExpression('height','this.parentNode.offsetHeight + "px"');
+                    full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
+                         : s.setExpression('width','this.parentNode.offsetWidth + "px"');
+                    if (fixL) s.setExpression('left', fixL);
+                    if (fixT) s.setExpression('top', fixT);
+                }
+                else {
+                    if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
+                    s.marginTop = 0;
+                }
+            });
+        }
+        if (opts.displayMode) {
+            w.css('cursor','default').attr('title', $.blockUI.defaults.closeMessage);
+            m.css('cursor','default');
+            $([f[0],w[0],m[0]]).removeClass('blockUI').addClass('displayBox');
+            $().click($.blockUI.impl.boxHandler).bind('keypress', $.blockUI.impl.boxHandler);
+        }
+        else
+            this.bind(1, el);
+        m.append(msg).show();
+        if (msg.jquery) msg.show();
+        if (opts.displayMode) return;
+        if (full) {
+            this.pageBlock = m[0];
+            this.pageBlockEls = $(':input:enabled:visible',this.pageBlock);
+            setTimeout(this.focus, 20);
+        }
+        else this.center(m[0]);
+    },
+    remove: function(el, opts) {
+        var o = $.extend({}, $.blockUI.defaults, opts);
+        this.bind(0, el);
+        var full = el == window;
+        var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);
+        if (full) this.pageBlock = this.pageBlockEls = null;
+
+        if (o.fadeOut) {
+            els.fadeOut(o.fadeTime, function() {
+                if (this.parentNode) this.parentNode.removeChild(this);
+            });
+        }
+        else els.remove();
+    },
+    boxRemove: function(el) {
+        $().unbind('click',$.blockUI.impl.boxHandler).unbind('keypress', $.blockUI.impl.boxHandler);
+        if (this.boxCallback)
+            this.boxCallback(this.box);
+        $('body .displayBox').hide().remove();
+    },
+    // event handler to suppress keyboard/mouse events when blocking
+    handler: function(e) {
+        if (e.keyCode && e.keyCode == 9) {
+            if ($.blockUI.impl.pageBlock && !$.blockUI.defaults.allowTabToLeave) {
+                var els = $.blockUI.impl.pageBlockEls;
+                var fwd = !e.shiftKey && e.target == els[els.length-1];
+                var back = e.shiftKey && e.target == els[0];
+                if (fwd || back) {
+                    setTimeout(function(){$.blockUI.impl.focus(back)},10);
+                    return false;
+                }
+            }
+        }
+        if ($(e.target).parents('div.blockMsg').length > 0)
+            return true;
+        return $(e.target).parents().children().filter('div.blockUI').length == 0;
+    },
+    boxHandler: function(e) {
+        if ((e.keyCode && e.keyCode == 27) || (e.type == 'click' && $(e.target).parents('div.blockMsg').length == 0))
+            $.blockUI.impl.boxRemove();
+        return true;
+    },
+    // bind/unbind the handler
+    bind: function(b, el) {
+        var full = el == window;
+        // don't bother unbinding if there is nothing to unbind
+        if (!b && (full && !this.pageBlock || !full && !el.$blocked)) return;
+        if (!full) el.$blocked = b;
+        var $e = $(el).find('a,:input');
+        $.each(['mousedown','mouseup','keydown','keypress','click'], function(i,o) {
+            $e[b?'bind':'unbind'](o, $.blockUI.impl.handler);
+        });
+    },
+    focus: function(back) {
+        if (!$.blockUI.impl.pageBlockEls) return;
+        var e = $.blockUI.impl.pageBlockEls[back===true ? $.blockUI.impl.pageBlockEls.length-1 : 0];
+        if (e) e.focus();
+    },
+    center: function(el) {
+		var p = el.parentNode, s = el.style;
+        var l = ((p.offsetWidth - el.offsetWidth)/2) - this.sz(p,'borderLeftWidth');
+        var t = ((p.offsetHeight - el.offsetHeight)/2) - this.sz(p,'borderTopWidth');
+        s.left = l > 0 ? (l+'px') : '0';
+        s.top  = t > 0 ? (t+'px') : '0';
+    },
+    sz: function(el, p) { return parseInt($.css(el,p))||0; }
+};
+
+})(jQuery);

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/list.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/list.jsp b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/list.jsp
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/map_domain.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/map_domain.jsp b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/map_domain.jsp
new file mode 100644
index 0000000..134b7b2
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/map_domain.jsp
@@ -0,0 +1,120 @@
+<!--
+     ~  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.
+     ~
+ -->
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+<%@ page import="org.apache.axis2.context.ConfigurationContext"%>
+<%@ page import="org.wso2.carbon.CarbonConstants"%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage"%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil"%>
+<%@ page import="org.wso2.carbon.utils.ServerConstants"%>
+<%@ page import="org.apache.stratos.cartridge.mgt.ui.CartridgeAdminClient"%>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon"%>
+<%@ page import="java.text.SimpleDateFormat"%>
+<%@ page import="java.util.ResourceBundle"%>
+<jsp:include page="../dialog/display_messages.jsp" />
+
+
+<%
+	response.setHeader("Cache-Control", "no-cache");
+	String cartridgeAlias = request.getParameter("cartridge_alias");
+	String domain = request.getParameter("domain");
+
+	if (cartridgeAlias == null || cartridgeAlias.trim().length() == 0) {
+		response.setStatus(500);
+		CarbonUIMessage uiMsg = new CarbonUIMessage(
+				CarbonUIMessage.ERROR, "Cartridge Alias Not Specified");
+		session.setAttribute(CarbonUIMessage.ID, uiMsg);
+%>
+<jsp:include page="../admin/error.jsp" />
+<%
+	return;
+	}
+%>
+<fmt:bundle basename="org.apache.stratos.cartridge.mgt.ui.i18n.Resources">
+	<carbon:breadcrumb label="mapdomain" resourceBundle="org.apache.stratos.cartridge.mgt.ui.i18n.Resources" topPage="true"
+		request="<%=request%>" />
+	<div id="middle">
+		<h2>
+			<fmt:message key="mapdomain.to" />
+			<%=cartridgeAlias%></h2>
+		<div id="workArea">
+			<form id="mapDomainForm" name="mapDomain">
+				<input name="cartridge_alias" type="hidden" value="<%=cartridgeAlias%>" />
+				<table id="tblMapDomain" width="100%" class="styledLeft">
+					<thead>
+						<tr>
+							<th><fmt:message key="mapdomain.information" /></th>
+						</tr>
+					</thead>
+					<tbody>
+						<tr>
+							<td class="nopadding">
+								<table class="normal-nopadding" cellspacing="0">
+									<tbody>
+										<tr>
+											<td style="width: 30%"><label>Cartridge Alias</label><span
+												class="required">*</span></td>
+											<td><span><%=cartridgeAlias%></span></td>
+										</tr>
+										<tr>
+											<td><label for="domain">Domain</label><span
+												class="required">*</span></td>
+											<td><input id="domain" name="domain" type="text"
+												style="width: 250px" maxlength="300"
+												value="<%=(domain != null ? domain : "")%>" /></td>
+										</tr>
+									</tbody>
+								</table>
+							</td>
+						</tr>
+						<tr id="buttonRow">
+							<td class="buttonRow"><input id="mapDomainSave"
+								type="submit" class="button" value="Save"> <input
+								id="mapDomainCancelButton" type="button" class="button"
+								value="Cancel" onclick="cancelMapDomain();"></td>
+						</tr>
+					</tbody>
+				</table>
+			</form>
+		</div>
+	</div>
+
+	<script type="text/javascript">
+		jQuery(document).ready(
+				function() {
+					setStratosFormSubmitFunction("#mapDomainForm", validate,
+							"map_domain_ajaxprocessor.jsp",
+							"subscribed_cartridges.jsp", "#mapDomainSave");
+				});
+
+		function validate() {
+			if (jQuery("#domain").val().length == 0) {
+				CARBON.showErrorDialog('Please enter a value for domain.');
+				return false;
+			}
+			return true;
+		}
+		
+		function cancelMapDomain() {
+			location.href = "subscribed_cartridges.jsp";
+		}
+	</script>
+	<script type="text/javascript" src="js/jquery.blockUI-1.33.js"></script>
+	<script type="text/javascript" src="js/common.js"></script>
+</fmt:bundle>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/map_domain_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/map_domain_ajaxprocessor.jsp b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/map_domain_ajaxprocessor.jsp
new file mode 100644
index 0000000..0d30e7e
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/map_domain_ajaxprocessor.jsp
@@ -0,0 +1,69 @@
+<!--
+     ~  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.
+     ~
+ -->
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+<%@ page import="org.apache.axis2.context.ConfigurationContext"%>
+<%@ page import="org.wso2.carbon.CarbonConstants"%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage"%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil"%>
+<%@ page import="org.wso2.carbon.utils.ServerConstants"%>
+<%@ page import="org.apache.stratos.cartridge.mgt.ui.CartridgeAdminClient"%>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon"%>
+<%@ page import="org.wso2.carbon.adc.mgt.dto.xsd.Cartridge"%>
+<%@ page import="java.text.SimpleDateFormat"%>
+<%@ page import="java.util.ResourceBundle"%>
+<jsp:include page="../dialog/display_messages.jsp" />
+
+
+<%
+	response.setHeader("Cache-Control", "no-cache");
+
+	ResourceBundle bundle = ResourceBundle.getBundle(CartridgeAdminClient.BUNDLE, request.getLocale());
+
+	String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+	ConfigurationContext configContext = (ConfigurationContext) config.getServletContext().getAttribute(
+			CarbonConstants.CONFIGURATION_CONTEXT);
+
+	String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+	CartridgeAdminClient client;
+
+	String cartridgeAlias = request.getParameter("cartridge_alias");
+	String mappedDomain = request.getParameter("domain");
+	try {
+		client = new CartridgeAdminClient(cookie, backendServerURL, configContext, request.getLocale());
+		String host = client.addDomainMapping(mappedDomain, cartridgeAlias);
+		String message = "";
+		if (host != null) {
+			//CarbonUIMessage.sendCarbonUIMessage
+			message = "Your own domain is successfully added. Please CNAME it to system's domain: " + host + ".";
+		} //else {
+			//TODO: Handle this scenario
+			//CarbonUIMessage.sendCarbonUIMessage("Your own domain is added", CarbonUIMessage.WARNING, request);
+		//}
+%>
+<span id="responseMsg"><%=message%></span>
+<%
+	} catch (Exception e) {
+    	//CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request);
+		response.setStatus(500);
+%>
+<span id="responseMsg"><%=e.getMessage()%></span>
+<%
+    }
+%>
\ No newline at end of file