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/11 13:55:17 UTC

[03/22] refactoring theme-mgt components, service stub and changing service stub parent name to stratos-service-stubs-parent

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/theme_mgt.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/theme_mgt.jsp b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/theme_mgt.jsp
deleted file mode 100644
index cb13dad..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/theme_mgt.jsp
+++ /dev/null
@@ -1,239 +0,0 @@
-<!--
- ~ 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.
- -->
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
-<%@ page import="org.wso2.carbon.theme.mgt.ui.clients.ThemeMgtServiceClient" %>
-<%@ page import="org.wso2.carbon.theme.mgt.ui.utils.ThemeUtil" %>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%
-response.setHeader("Pragma", "no-cache");
-%>
-
-<jsp:include page="../dialog/display_messages.jsp"/>
-
-<!-- YUI inculudes for rich text editor -->
-<link rel="stylesheet" type="text/css"
-      href="../yui/build/editor/assets/skins/sam/simpleeditor.css"/>
-<link type="text/css" href="css/tenent-theme.css" rel="stylesheet" />
-<link rel="stylesheet" type="text/css" href="../yui/assets/yui.css" >
-<link rel="stylesheet" type="text/css" href="../yui/build/menu/assets/skins/sam/menu.css" />
-<link rel="stylesheet" type="text/css" href="../yui/build/button/assets/skins/sam/button.css" />
-<link rel="stylesheet" type="text/css" href="../yui/build/container/assets/skins/sam/container.css" />
-<link rel="stylesheet" type="text/css" href="../yui/build/autocomplete/assets/skins/sam/autocomplete.css" />
-<link rel="stylesheet" type="text/css" href="../yui/build/editor/assets/skins/sam/editor.css" />
-
-<script type="text/javascript" src="../yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
-<script type="text/javascript" src="../yui/build/element/element-beta-min.js"></script>
-<script type="text/javascript" src="../yui/build/container/container_core-min.js"></script>
-<script type="text/javascript" src="../yui/build/editor/simpleeditor-min.js"></script>
-
-<script type="text/javascript" src="../admin/js/jquery.js"></script>
-<script type="text/javascript" src="../admin/js/jquery.form.js"></script>
-<script type="text/javascript" src="../dialog/js/jqueryui/jquery-ui.min.js"></script>
-
-<!-- other includes -->
-<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
-<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
-<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
-<script type="text/javascript" src="../ajax/js/prototype.js"></script>
-<script type="text/javascript" src="../tenant-theme/js/theme_resource_util.js"></script>
-<jsp:include page="../resources/resources-i18n-ajaxprocessor.jsp"/>
-<script type="text/javascript" src="../resources/js/resource_util.js"></script>
-<script type="text/javascript" src="../tenant-theme/js/theme_resource_util.js"></script>
-<link rel="stylesheet" type="text/css" href="../resources/css/registry.css"/>
-<link rel="stylesheet" type="text/css" href="../tenant-theme/css/tenant.css"/>
-<link rel="stylesheet" type="text/css" href="../tenant-theme/css/theme-mgt.css"/>
-
-<script language="javascript" type="text/javascript">
-function setChecked(value,id){
-	var itemLength = document.forms['ThemeMgtForm'].elements['theme'].length; 
-	setCheckedValue(document.forms['ThemeMgtForm'].elements['theme'], value);
-	for(var i=0;i<=itemLength;i++){
-		YAHOO.util.Dom.removeClass('themeObj'+i,'sel-box');
-		YAHOO.util.Dom.addClass('themeObj'+i,'nor-box');
-	}	
-	YAHOO.util.Dom.removeClass('themeObj'+id,'nor-box');
-	YAHOO.util.Dom.addClass('themeObj'+id,'sel-box');
-	
-}
-function setCheckedValue(radioObj, newValue) {
-	if(!radioObj)
-		return;
-	var radioLength = radioObj.length;
-	if(radioLength == undefined) {
-		radioObj.checked = (radioObj.value == newValue.toString());
-		return;
-	}
-	for(var i = 0; i < radioLength; i++) {
-		radioObj[i].checked = false;
-		if(radioObj[i].value == newValue.toString()) {
-			radioObj[i].checked = true;
-		}
-	}
-}
-
-</script>
-<%--Syntax hylighter include--%>
-<script language="javascript" type="text/javascript" src="../tenant-theme/js/editarea/edit_area/edit_area_full.js"></script>
-
-<%
-    // the redirectWithStr will be used in the following operations
-    String redirectWithStr = request.getParameter("redirectWith");
-    if (redirectWithStr == null) {
-        redirectWithStr = "";
-    }
-%>
-
-<fmt:bundle basename="org.wso2.carbon.theme.mgt.ui.i18n.Resources">
-
-<%
-
-    String updateThemeVal = request.getParameter("updateTheme");
-     if("Failed".equals(updateThemeVal)){
-%>
-
-    <script type="text/javascript">
-        jQuery(document).ready(function() {
-            CARBON.showErrorDialog('Error in updating the theme, Please try again setting the theme again.');
-        });
-    </script>
-<%
-    }
-
-    String onceMessageShowed = (String)session.getAttribute("once-message-showed");
-    if ("Success".equals(updateThemeVal) && !"true".equals(onceMessageShowed)) {
-%>
-    <script type="text/javascript">
-        // we need to refresh the page to load the theme
-        jQuery(document).ready(function() {
-            CARBON.showWarningDialog('The theme successfully updated. Please refresh the page to load the theme.');
-        });
-    </script>
-<%
-        session.setAttribute("once-message-showed", "true");
-    }
-    if ("Success".equals(updateThemeVal) && "true".equals(onceMessageShowed)) {
-        session.setAttribute("once-message-showed", "false");
-%>
-    <script type="text/javascript">
-        // we need to refresh the page to load the theme
-        window.location.href="theme_mgt.jsp?redirectWith=<%=redirectWithStr%>";
-    </script>
-<%
-    }
-
-
-    ThemeMgtServiceClient client;
-    String[] allThemes;
-    try {
-        client = new ThemeMgtServiceClient(config, session);
-
-        allThemes = client.getAllThemes(redirectWithStr);
-    } catch (Exception e) {
-%>
-<jsp:forward page="../admin/error.jsp?<%=e.getMessage()%>"/>
-<%
-        return;
-    }
-    String parentPathToUpload = "/";
-    String logoFilename = "logo.gif";
-    
-    if (allThemes.length < 2) {
-        return;
-    }
-
-    // to derive the thumbnail url
-    //Customization of UI theming per tenant
-
-
-%>
-
-
-<carbon:breadcrumb label="resources"
-                       resourceBundle="org.wso2.carbon.registry.resource.ui.i18n.Resources"
-                       topPage="true" request="<%=request%>"/>
-<div id="middle">
-
-<h2> Theme Management </h2>
-
-<div id="workArea">
-    
-<div class="subtopic">Select a Theme</div>
-<div class="subcontent">
-<form id="ThemeMgtForm" name="ThemeMgtForm" action="theme_mgt_ajaxprocessor.jsp?redirectWith=<%=redirectWithStr%>" method="post">
-
-<%
-String selectedTheme = allThemes[0];
-
-for (int i = 1; i < allThemes.length; i ++) {
-    String theme = allThemes[i];
-    String checkedStr = "";
-    String thumbUrl = ThemeUtil.getThumbUrl(request, theme);
-    if (theme.equals(selectedTheme)) {
-        checkedStr = "checked";
-    }
-%>
-<a onclick="setChecked('<%=theme%>','<%=i%>')">
-<div <%if (theme.equals(selectedTheme)) {%>class="sel-box"<% } else { %>class="nor-box"<%}%> id="themeObj<%=i%>">
-	<span><%=theme%></span>
-	<div>
-		<input style="display:none" type="radio"  name="theme" checked="<%=checkedStr%>" value="<%=theme%>"/>
-		<div><img src="<%=thumbUrl%>"/></div>
-	</div>
-</div>
-</a>
-<%
-}
-%>
-<div style="clear:both;"></div>
-<p>
-<%
-    if (redirectWithStr.equals("")) {
-        // mean the user is logged in
-%>
-<input type="submit" value="Update"/>
-<%
-    } else {
-%>
-<input type="submit" value="Apply theme"/>
-<input type="button" value="Skip" onclick="javascript:location.href='../admin/login.jsp'"/>
-<%
-    }
-%>
-</p>
-</form>
-</div>
-
-<%
-    if (redirectWithStr.equals("")) {
-        // mean the user is logged in
-%>
-    
-<div class="subtopic">Customize the theme</div>
-<div class="subcontent">
-<a href="theme_advanced.jsp">Click here</a>  to customize the current theme
-</div>
-</div>
-
-<%
-    }
-%>
-    
-</div>
-
-</fmt:bundle>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/theme_mgt_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/theme_mgt_ajaxprocessor.jsp b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/theme_mgt_ajaxprocessor.jsp
deleted file mode 100644
index 4afff98..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/theme_mgt_ajaxprocessor.jsp
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
- ~ 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.
- -->
-<%@ page import="org.wso2.carbon.CarbonConstants" %>
-<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
-<%@ page import="org.wso2.carbon.theme.mgt.ui.clients.ThemeMgtServiceClient" %>
-<%@ page import="java.util.UUID" %>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
-<carbon:jsi18n
-		resourceBundle="org.wso2.carbon.theme.mgt.ui.i18n.JSResources"
-		request="<%=request%>" />
-<%
-
-    String redirectWithStr = request.getParameter("redirectWith");
-    if (redirectWithStr == null) {
-        redirectWithStr = "";
-    }
-    try {
-        ThemeMgtServiceClient client = new ThemeMgtServiceClient(config, session);
-        String themeName = request.getParameter("theme");
-        request.getSession().setAttribute(
-                CarbonConstants.THEME_URL_RANDOM_SUFFIX_SESSION_KEY, UUID.randomUUID().toString());        
-        client.applyTheme(themeName, redirectWithStr);
-        if (redirectWithStr.equals("")) {
-            response.sendRedirect("../tenant-theme/theme_mgt.jsp?updateTheme=Success&redirectWith=" + redirectWithStr);
-        } else {
-            response.sendRedirect("../admin/login.jsp");
-        }
-    } catch (UIException e) {
-        response.sendRedirect("../tenant-theme/theme_mgt.jsp?updateTheme=Failed&redirectWith=" + redirectWithStr);
-    }
-%>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/update_text_content.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/update_text_content.jsp b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/update_text_content.jsp
deleted file mode 100644
index 5ecfef6..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt.ui/2.1.0/src/main/resources/web/tenant-theme/update_text_content.jsp
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
- ~ 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.
- -->
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-
-<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
-<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
-<%@ page import="org.wso2.carbon.theme.mgt.ui.clients.ThemeMgtServiceClient" %>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<fmt:bundle basename="org.wso2.carbon.registry.resource.ui.i18n.Resources">
-
-    <%
-        try {
-            String resourcePath = request.getParameter("resourcePath");
-            String contentText = request.getParameter("contentText");
-
-             String cookie = (String) request.
-                    getSession().getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
-
-            try {
-                ThemeMgtServiceClient client =
-                        new ThemeMgtServiceClient(cookie, config, request.getSession());
-                client.updateTextContent(resourcePath, contentText);
-
-            } catch (Exception e) {
-                String msg = "Failed to update text content of the resource " +
-                        resourcePath + ". " + e.getMessage();
-                throw new UIException(msg, e);
-            }
-        } catch (UIException e) {
-            response.setStatus(500);
-            %><fmt:message key="error.updating.text.message"/>.<br/><%=e.getMessage()%><%
-            return;
-        }
-%>
-
-</fmt:bundle>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/pom.xml b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/pom.xml
deleted file mode 100644
index 73477b4..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/pom.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<!--
-# Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-  -->
-<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>theme-mgt-parent</artifactId>
-        <version>2.1.0</version>
-<relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-	<artifactId>org.wso2.carbon.theme.mgt</artifactId>
-	<version>2.1.0</version>
-    <packaging>bundle</packaging>
-    <name>WSO2 Stratos - Tenant Theme Configurations</name>
-
-    <build>
-
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </plugin>
-            <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>
-                        <Axis2Module>${project.artifactId}-${project.version}</Axis2Module>
-                        <Private-Package>
-                            org.wso2.carbon.theme.mgt.internal.*,
-                            org.wso2.carbon.theme.mgt.services.*,
-                        </Private-Package>
-                        <Export-Package>
-                            org.wso2.carbon.theme.mgt.util.*,
-                            org.wso2.carbon.theme.mgt.module.*,
-                            org.wso2.carbon.theme.mgt.handler.*,
-                        </Export-Package>
-                        <Import-Package>
-                            org.wso2.carbon.registry.core.*;version=1.0.1,
-                            org.wso2.carbon.registry.resource.*,
-                            !javax.xml.namespace,
-                            javax.xml.namespace; version=0.0.0,
-                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
-                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
-                            org.apache.axiom.*; version="${axiom.osgi.version.range}",
-                            *;resolution:=optional
-                        </Import-Package>
-                         <DynamicImport-Package>*</DynamicImport-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>org.apache.axis2.wso2</groupId>
-            <artifactId>axis2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.resource</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.stratos.common</artifactId>
-        </dependency>
-    </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/internal/TenantThemeMgtServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/internal/TenantThemeMgtServiceComponent.java b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/internal/TenantThemeMgtServiceComponent.java
deleted file mode 100644
index 4769b85..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/internal/TenantThemeMgtServiceComponent.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-*  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.
-*/
-package org.wso2.carbon.theme.mgt.internal;
-
-import org.wso2.carbon.stratos.common.listeners.TenantMgtListener;
-import org.wso2.carbon.theme.mgt.util.ThemeLoadingListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.framework.BundleContext;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.theme.mgt.util.ThemeUtil;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-import java.util.Hashtable;
-
-/**
- * @scr.component name="org.wso2.carbon.governance.theme.tenant" immediate="true"
- * @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="user.realmservice.default" interface="org.wso2.carbon.user.core.service.RealmService"
- * cardinality="1..1" policy="dynamic" bind="setRealmService"
- * unbind="unsetRealmService"
- * @scr.reference name="config.context.service"
- *                interface="org.wso2.carbon.utils.ConfigurationContextService" cardinality="1..1"
- *                policy="dynamic" bind="setConfigurationContextService"
- *                unbind="unsetConfigurationContextService"
- *
- */
-public class TenantThemeMgtServiceComponent {
-    private static Log log = LogFactory.getLog(TenantThemeMgtServiceComponent.class);
-    private static ConfigurationContextService configContextService = null;
-
-    protected void activate(ComponentContext context) {
-        try {
-            ThemeUtil.loadResourceThemes();
-
-            // registering the Theme Logding Listener
-            BundleContext bundleContext = context.getBundleContext();
-            bundleContext.registerService(TenantMgtListener.class.getName(),
-                new ThemeLoadingListener(), new Hashtable());
-            
-            log.debug("******* Multitenancy Theme Config bundle is activated ******* ");
-        } catch (Exception e) {
-            log.error("******* Multitenancy Theme Config bundle failed activating ****", e);
-        }
-    }
-
-    protected void deactivate(ComponentContext context) {
-        log.debug("******* Multitenancy Theme Config bundle is deactivated ******* ");
-    }
-
-    protected void setRegistryService(RegistryService registryService) {
-        ThemeUtil.setRegistryService(registryService);
-    }
-
-    protected void unsetRegistryService(RegistryService registryService) {
-        ThemeUtil.setRegistryService(null);
-    }
-
-    protected void setRealmService(RealmService realmService) {
-        ThemeUtil.setRealmService(realmService);
-    }
-
-    protected void unsetRealmService(RealmService realmService) {
-        ThemeUtil.setRealmService(null);
-    }
-
-    protected void setConfigurationContextService(ConfigurationContextService contextService) {
-        if (log.isDebugEnabled()) {
-            log.debug("Setting the ConfigurationContext");
-        }
-        configContextService = contextService;
-    }
-
-    protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
-        if (log.isDebugEnabled()) {
-            log.debug("Unsetting the ConfigurationContext");
-        }
-    }
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/services/ThemeMgtService.java
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/services/ThemeMgtService.java b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/services/ThemeMgtService.java
deleted file mode 100644
index ea21565..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/services/ThemeMgtService.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *  Copyright (c) 2005-2008, 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.
- *
- */
-package org.wso2.carbon.theme.mgt.services;
-
-import org.wso2.carbon.core.AbstractAdmin;
-import org.wso2.carbon.registry.core.Registry;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.wso2.carbon.registry.core.Collection;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.theme.mgt.util.ThemeUtil;
-import org.wso2.carbon.registry.resource.beans.*;
-import org.wso2.carbon.registry.resource.services.utils.*;
-import org.wso2.carbon.registry.common.ResourceData;
-import org.wso2.carbon.registry.common.utils.RegistryUtil;
-
-import javax.activation.DataHandler;
-import java.util.ArrayList;
-import java.util.Stack;
-
-public class ThemeMgtService extends AbstractAdmin {
-    public ResourceTreeEntryBean getResourceTreeEntry(String resourcePath) throws Exception {
-        UserRegistry themeRegistry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        return GetResourceTreeEntryUtil.getResourceTreeEntry(resourcePath, themeRegistry);
-    }
-
-    public ContentBean getContentBean(String path) throws Exception {
-        UserRegistry themeRegistry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        return ContentUtil.getContent(path, themeRegistry);
-    }
-
-
-    public CollectionContentBean getCollectionContent(String path) throws Exception {
-        UserRegistry themeRegistry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        return ContentUtil.getCollectionContent(path, themeRegistry);
-    }
-
-    public ResourceData[] getResourceData(String[] paths) throws Exception {
-        UserRegistry themeRegistry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        return ContentUtil.getResourceData(paths, themeRegistry);
-    }
-    
-    public String addCollection(
-            String parentPath, String collectionName, String mediaType, String description)
-            throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        return AddCollectionUtil.process(parentPath, collectionName, mediaType, description, registry);
-    }
-
-    public void addResource(String path, String mediaType, String description, DataHandler content,
-                            String symlinkLocation, String tenantPass)
-            throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        if (registry == null) {
-            registry = ThemeUtil.getThemeRegistryFromTenantPass(tenantPass);
-        }
-        AddResourceUtil.addResource(path, mediaType, description, content, symlinkLocation, registry,new String[0][0]);
-    }
-
-    public void importResource(
-            String parentPath,
-            String resourceName,
-            String mediaType,
-            String description,
-            String fetchURL,
-            String symlinkLocation,
-            String tenantPass) throws Exception {
-
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        if (registry == null) {
-            registry = ThemeUtil.getThemeRegistryFromTenantPass(tenantPass);
-        }
-        ImportResourceUtil.importResource(parentPath, resourceName, mediaType, description, fetchURL,
-                        symlinkLocation, registry,new String[0][0]);
-    }
-
-    public void addTextResource(
-            String parentPath,
-            String fileName,
-            String mediaType,
-            String description,
-            String content) throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        AddTextResourceUtil.addTextResource(parentPath, fileName, mediaType, description, content, registry);
-    }
-
-    public MetadataBean getMetadata(String path) throws Exception {
-        RegistryUtil.setSessionResourcePath(path);
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        return MetadataPopulator.populate(path, registry);
-    }
-
-    public String getSessionResourcePath() throws Exception {
-        return RegistryUtil.getSessionResourcePath();
-    }
-
-    public String getTextContent(String path) throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        return GetTextContentUtil.getTextContent(path, registry);
-    }
-
-    public void updateTextContent(String resourcePath, String contentText) throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        UpdateTextContentUtil.updateTextContent(resourcePath, contentText, registry);
-    }
-
-    public ContentDownloadBean getContentDownloadBean(String path) throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        return GetDownloadContentUtil.getContentDownloadBean(path, registry);
-    }
-
-    public void renameResource(
-            String parentPath, String oldResourcePath, String newResourceName)
-            throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        RenameResourceUtil.renameResource(parentPath, oldResourcePath, newResourceName, registry);
-    }
-
-    public void delete(String pathToDelete) throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        DeleteUtil.process(pathToDelete, registry);
-    }
-
-    public String[] getAllPaths() throws Exception {
-        UserRegistry registry = ThemeUtil.getThemeRegistry(getGovernanceSystemRegistry());
-        // will use a stack in place of calling recurssion
-
-        
-        ArrayList<String> paths = new ArrayList<String>();
-        Stack<Collection> parentCollections = new Stack<Collection>();
-        Collection rootCollection = (Collection)registry.get("/");
-        parentCollections.push(rootCollection);
-        while (!parentCollections.empty()) {
-            Collection parentCollection = parentCollections.pop();
-            String[] childs = parentCollection.getChildren();
-            for (String childPath: childs) {
-                String pathToAdd = childPath.substring(1);
-                paths.add(pathToAdd);
-                Resource resource = registry.get(childPath);
-                if (resource instanceof Collection) {
-                    Collection c = (Collection)resource;
-                    parentCollections.push(c);
-                }
-            }
-        }
-        return paths.toArray(new String[paths.size()]);
-    }
-
-    public String[] getAllThemes(String tenantPass) throws Exception {
-        String[] allThemes = ThemeUtil.getAvailableThemes();
-        //we are readding the selected theme as the first element
-        String currentTheme = ThemeUtil.getCurrentTheme(tenantPass, (UserRegistry) getGovernanceSystemRegistryIfLoggedIn());
-        String[] returnVal = new String[allThemes.length + 1];
-        returnVal[0] = currentTheme;
-        for (int i = 0; i < allThemes.length; i ++) {
-            returnVal[i + 1] = allThemes[i];
-        }
-        return returnVal;
-    }
-
-    public void applyTheme(String themeName, String tenantPass) throws Exception {
-        ThemeUtil.applyTheme(themeName, tenantPass, (UserRegistry) getGovernanceSystemRegistryIfLoggedIn());
-        ThemeUtil.removeTheUUID(tenantPass);
-    }
-
-    private Registry getGovernanceSystemRegistryIfLoggedIn() {
-        UserRegistry tempRegistry = (UserRegistry)getConfigUserRegistry();
-        if (tempRegistry != null) {
-            try {
-                return ThemeUtil.getRegistryService().getGovernanceSystemRegistry(
-                        tempRegistry.getTenantId());
-            } catch (Exception ignored) {
-                // The Registry service should not fail if the above if condition holds.
-                return null;
-            }
-        }
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/util/ThemeLoadingListener.java
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/util/ThemeLoadingListener.java b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/util/ThemeLoadingListener.java
deleted file mode 100644
index d6f9151..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/util/ThemeLoadingListener.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.wso2.carbon.theme.mgt.util;
-
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.stratos.common.beans.TenantInfoBean;
-import org.wso2.carbon.stratos.common.exception.StratosException;
-import org.wso2.carbon.stratos.common.listeners.TenantMgtListener;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class ThemeLoadingListener implements TenantMgtListener {
-    private static final Log log = LogFactory.getLog(ThemeLoadingListener.class);
-    private static final int EXEC_ORDER = 10;
-    public void onTenantCreate(TenantInfoBean tenantInfo) throws StratosException {
-        try {
-            ThemeUtil.loadTheme(tenantInfo.getTenantId());
-        } catch (RegistryException e) {
-            String msg = "Error in loading the theme for the tenant: " 
-                + tenantInfo.getTenantDomain() + ".";
-            log.error(msg, e);
-            throw new StratosException(msg, e);
-        }
-    }
-    
-    public void onTenantUpdate(TenantInfoBean tenantInfo) throws StratosException {
-        // doing nothing
-    }
-    
-    public void onTenantRename(int tenantId, String oldDomainName,
-                             String newDomainName) throws StratosException {
-        // doing nothing
-    }
-
-    public int getListenerOrder() {
-        return EXEC_ORDER;
-    }
-
-    public void onTenantInitialActivation(int tenantId) throws StratosException {
-        // doing nothing
-        
-    }
-
-    public void onTenantActivation(int tenantId) throws StratosException {
-        // doing nothing
-        
-    }
-
-    public void onTenantDeactivation(int tenantId) throws StratosException {
-        // doing nothing
-        
-    }
-
-    public void onSubscriptionPlanChange(int tenentId, String oldPlan, 
-                                         String newPlan) throws StratosException {
-        // doing nothing
-        
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/util/ThemeUtil.java
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/util/ThemeUtil.java b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/util/ThemeUtil.java
deleted file mode 100644
index 7a29521..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/java/org/wso2/carbon/theme/mgt/util/ThemeUtil.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.wso2.carbon.theme.mgt.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.registry.core.Collection;
-import org.wso2.carbon.registry.core.Registry;
-import org.wso2.carbon.registry.core.RegistryConstants;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.wso2.carbon.registry.core.utils.RegistryUtils;
-import org.wso2.carbon.stratos.common.constants.StratosConstants;
-import org.wso2.carbon.stratos.common.util.CommonUtil;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.utils.ServerConstants;
-
-import javax.activation.MimetypesFileTypeMap;
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ThemeUtil {
-
-    private static final Log log = LogFactory.getLog(ThemeUtil.class);
-
-    private static RegistryService registryService;
-    private static RealmService realmService;
-    private static final String CURRENT_THEME_KEY = "current-theme";
-    private static final String THEME_PATH = "/repository/theme";
-    private static final String THEME_ADMIN_PATH = THEME_PATH + "/admin";
-
-    public static synchronized void setRegistryService(RegistryService service) {
-        if (registryService == null) {
-            registryService = service;
-        }
-    }
-    public static RegistryService getRegistryService() {
-        return registryService;
-    }
-
-    public static synchronized void setRealmService(RealmService service) {
-        if (realmService == null) {
-            realmService = service;
-        }
-    }
-
-    public static RealmService getRealmService() {
-        return realmService;
-    }
-
-    public static UserRegistry getThemeMgtSystemRegistry(String tenantPass) throws RegistryException {
-        if (tenantPass != null && !tenantPass.equals("")) {
-            // tenant 0th system registry
-            UserRegistry systemRegistry = registryService.getGovernanceSystemRegistry();
-            Resource resource = systemRegistry.get(
-                    StratosConstants.TENANT_CREATION_THEME_PAGE_TOKEN + "/" + tenantPass);
-            String tenantIdStr = resource.getProperty("tenantId");
-            int tenantId = Integer.parseInt(tenantIdStr);
-
-            return registryService.getGovernanceSystemRegistry(tenantId);
-        }
-
-        return null;
-    }
-
-    public static void removeTheUUID(String tenantPass) throws RegistryException {
-        if (tenantPass != null && !tenantPass.equals("")) {
-            // tenant 0th system registry
-            UserRegistry systemRegistry = registryService.getGovernanceSystemRegistry();
-            if(systemRegistry.resourceExists(
-                    StratosConstants.TENANT_CREATION_THEME_PAGE_TOKEN + "/" + tenantPass)) {
-                systemRegistry.delete(
-                        StratosConstants.TENANT_CREATION_THEME_PAGE_TOKEN + "/" + tenantPass);
-            }
-        }
-    }
-
-    public static void transferAllThemesToRegistry(File rootDirectory, Registry registry,
-                                                String registryPath)
-                                                throws RegistryException {
-        try {
-            // adding the common media types
-            Map<String, String> extensionToMediaTypeMap = new HashMap<String, String>();
-            extensionToMediaTypeMap.put("gif", "image/gif");
-            extensionToMediaTypeMap.put("jpg", "image/jpeg");
-            extensionToMediaTypeMap.put("jpe", "image/jpeg");
-            extensionToMediaTypeMap.put("jpeg", "image/jpeg");
-            extensionToMediaTypeMap.put("png", "image/png");
-            extensionToMediaTypeMap.put("css", "text/css");
-            
-            File[] filesAndDirs = rootDirectory.listFiles();
-            if (filesAndDirs == null) {
-                return;
-            }
-            List<File> filesDirs = Arrays.asList(filesAndDirs);
-
-            for (File file : filesDirs) {
-                String filename = file.getName();
-                String fileRegistryPath = registryPath + RegistryConstants.PATH_SEPARATOR + filename;
-                if (!file.isFile()) {
-                    // This is a Directory add a new collection
-                    // This path is used to store the file resource under registry
-                    Collection newCollection = registry.newCollection();
-                    registry.put(fileRegistryPath, newCollection);
-
-                    // recur
-                    transferAllThemesToRegistry(file, registry, fileRegistryPath);
-                } else {
-                    // Add the file to registry
-                    Resource newResource = registry.newResource();
-                    String mediaType = null;
-                    if (filename.contains(".")) {
-                        String fileExt = filename.substring(filename.lastIndexOf(".") + 1);
-                        mediaType = extensionToMediaTypeMap.get(fileExt.toLowerCase());
-                    }
-                    if (mediaType == null) {
-                        mediaType = new MimetypesFileTypeMap().getContentType(file);
-                    }
-                    newResource.setMediaType(mediaType);
-                    newResource.setContentStream(new FileInputStream(file));
-                    registry.put(fileRegistryPath, newResource);
-                }
-            }
-        } catch (Exception e) {
-            String msg = "Error loading theme to the sytem registry for registry path: " + registryPath;
-            log.error(msg, e);
-            throw new RegistryException(msg, e);
-        }
-
-    }
-
-    public static UserRegistry getThemeRegistryFromTenantPass(String tenantPass) throws RegistryException {
-        UserRegistry themeMgtSystemRegistry = getThemeMgtSystemRegistry(tenantPass);
-        if (themeMgtSystemRegistry != null) {
-            return themeMgtSystemRegistry.getChrootedRegistry(THEME_ADMIN_PATH);
-        } else {
-            return null;
-        }
-    }
-
-    public static UserRegistry getThemeRegistry(Registry registry) throws RegistryException {
-        if (registry == null) {
-            return null;
-        }
-        return ((UserRegistry)registry).getChrootedRegistry(THEME_ADMIN_PATH);
-    }
-
-    public static void loadResourceThemes() throws RegistryException {
-        // loads the tenant0's system registry
-        UserRegistry systemRegistry = registryService.getGovernanceSystemRegistry();
-        // we are not checking whether the theme resources already exists to make sure, the newly
-        // added themes can be loaded just at the activation of the component
-        String themeRootFileName = System.getProperty(ServerConstants.CARBON_HOME) + File
-                .separator + "resources" + File.separator + "allthemes";
-        // we are always making this accessible from anyware
-        File themeRootFile = new File(themeRootFileName);
-        ThemeUtil.transferAllThemesToRegistry(themeRootFile, systemRegistry, StratosConstants.ALL_THEMES_PATH);
-
-        CommonUtil.setAnonAuthorization(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + StratosConstants.ALL_THEMES_PATH,
-                systemRegistry.getUserRealm());
-    }
-
-    public static String[] getAvailableThemes() throws RegistryException {
-        Registry systemRegistry = registryService.getGovernanceSystemRegistry();
-        if (!systemRegistry.resourceExists(StratosConstants.ALL_THEMES_PATH)) {
-            log.info("The theme root path: " + StratosConstants.ALL_THEMES_PATH + " doesn't exist.");
-            return new String[0];
-        }
-        Collection c = (Collection)systemRegistry.get(StratosConstants.ALL_THEMES_PATH);
-        String[] childPaths = c.getChildren();
-        for (int i = 0; i < childPaths.length; i ++) {
-            childPaths[i] = RegistryUtils.getResourceName(childPaths[i]);
-        }
-        return childPaths;
-    }
-
-
-    public static void loadTheme(int tenantId) throws RegistryException {
-        // get the util functions from the theme
-        // this is always the 0th system reigstry
-        UserRegistry systemRegistry = registryService.getGovernanceSystemRegistry(tenantId);
-        String[] allThemes = getAvailableThemes();
-        if (allThemes.length == 0) {
-            log.info("No themes found.");
-            return;
-        }
-        int randomNumber = (int)(Math.random() * allThemes.length);
-        String ourLuckyTheme = allThemes[randomNumber];
-        // anway now we are hard coding the default theme to be loaded here,
-        ourLuckyTheme = "Default";
-        applyThemeForDomain(ourLuckyTheme, systemRegistry);
-    }
-
-    public static void applyTheme(String themeName, String tenantPass, UserRegistry systemTenantRegistry) throws Exception {
-        if (systemTenantRegistry == null) {
-            systemTenantRegistry = getThemeMgtSystemRegistry(tenantPass);
-        }
-        applyThemeForDomain(themeName, systemTenantRegistry);
-    }
-
-    public static void applyThemeForDomain(String themeName, UserRegistry systemTenantRegistry)
-                throws RegistryException {
-        String sourcePath = StratosConstants.ALL_THEMES_PATH + "/" + themeName; // tenant 0s path
-        String targetPath = THEME_PATH;
-
-        UserRegistry systemZeroRegistry = registryService.getGovernanceSystemRegistry();
-
-        // if the themes doesn't exist we would exclude applying it
-        if (!systemZeroRegistry.resourceExists(sourcePath)) {
-            log.info("The theme source path: " + sourcePath + " doesn't exist.");
-            return;
-        }
-
-        // first delete the old one, or we can backup it if required
-        // we are anyway getting a backup of the logo
-        Resource logoR = null;
-        String logoPath = targetPath + "/admin/" + "logo.gif";
-        if (systemTenantRegistry.resourceExists(targetPath)) {
-            if (systemTenantRegistry.resourceExists(logoPath)) {
-                logoR = systemTenantRegistry.get(logoPath);
-            }
-            if (logoR != null) {
-                logoR.getContent(); // we will load the content as well.
-            }
-            systemTenantRegistry.delete(targetPath);
-        }
-
-        // copy theme resources to tenant's registry 
-        addResourcesRecursively(sourcePath, targetPath, systemZeroRegistry, systemTenantRegistry);
-
-        // replace the logo
-        if (logoR != null) {
-            systemTenantRegistry.put(logoPath, logoR);
-        }
-
-        // remember the theme name
-        Resource tenantThemeCollection = systemTenantRegistry.get(targetPath);
-        tenantThemeCollection.setProperty(CURRENT_THEME_KEY, themeName);
-        systemTenantRegistry.put(targetPath, tenantThemeCollection);
-
-        try {
-            CommonUtil.setAnonAuthorization(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + targetPath,
-                    systemTenantRegistry.getUserRealm());
-            CommonUtil.setAnonAuthorization(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + 
-                    StratosConstants.ALL_THEMES_PATH,
-                    systemTenantRegistry.getUserRealm());
-        } catch (RegistryException e) {
-            String msg = "Error in giving authorizations of the " + targetPath +
-                    " to the anonymous user and everyone role.";
-            log.error(msg, e);
-            throw new RegistryException(msg, e);
-        }
-    }
-
-    private static void addResourcesRecursively(String sourcePath, String targetPath,
-                                                Registry superRegistry, Registry tenantRegistry)
-            throws RegistryException {
-        Resource resource = superRegistry.get(sourcePath);
-        tenantRegistry.put(targetPath, resource);
-
-        if (resource instanceof Collection) {
-            String[] children = ((Collection) resource).getChildren();
-            for (String child : children) {
-                String childName = child.substring(child.lastIndexOf("/"), child.length());
-                addResourcesRecursively(child, targetPath + childName, superRegistry, tenantRegistry);
-            }
-        }
-    }
-
-    public static String getCurrentTheme(String tenantPass, UserRegistry registry) throws Exception {
-        if (registry == null) {
-            registry = getThemeMgtSystemRegistry(tenantPass);
-        }
-        String targetPath = THEME_PATH;
-
-        // remember the theme name
-        Resource tenantThemeCollection = registry.get(targetPath);
-        if (tenantThemeCollection == null) {
-            return null;
-        }
-        return tenantThemeCollection.getProperty(CURRENT_THEME_KEY);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/resources/META-INF/component.xml b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/resources/META-INF/component.xml
deleted file mode 100644
index 8d674c1..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/resources/META-INF/component.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Copyright (c) 2009, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-  ~
-  ~  Licensed under the Apache License, Version 2.0 (the "License");
-  ~  you may not use this file except in compliance with the License.
-  ~  You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  -->
-
-<component xmlns="http://products.wso2.org/carbon">
-    <ManagementPermissions>
-        <ManagementPermission>
-            <DisplayName>Configure</DisplayName>
-            <ResourceId>/permission/admin/configure</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Theme</DisplayName>
-            <ResourceId>/permission/admin/configure/theme</ResourceId>
-        </ManagementPermission>
-    </ManagementPermissions>
-</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/resources/META-INF/services.xml b/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/resources/META-INF/services.xml
deleted file mode 100644
index f72d5b8..0000000
--- a/components/stratos/theme-mgt/org.wso2.carbon.theme.mgt/2.1.0/src/main/resources/META-INF/services.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- !
- ! Copyright 2006 The Apache Software Foundation.
- !
- ! 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.
- !-->
-<serviceGroup>
-    <service name="ThemeMgtService" scope="transportsession">
-        <transports>
-            <transport>https</transport>
-        </transports>
-        <parameter name="ServiceClass" locked="false">
-            org.wso2.carbon.theme.mgt.services.ThemeMgtService
-        </parameter>
-
-        <operation name="getResourceTreeEntry">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="getContentBean">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="getCollectionContent">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="getResourceData">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="addCollection">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="addResource">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="importResource">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="addTextResource">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="getMetadata">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="getSessionResourcePath">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="getTextContent">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="updateTextContent">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="getContentDownloadBean">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="renameResource">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="delete">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-
-        <operation name="getAllPaths">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-        <operation name="getAllThemes">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-        
-        <operation name="applyTheme">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/theme</parameter>
-        </operation>
-        
-        
-        <parameter name="enableMTOM" locked="true">false</parameter>
-    </service>
-     <parameter name="adminService" locked="true">true</parameter>
-    <parameter name="hiddenService" locked="true">true</parameter>
-</serviceGroup>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/stratos/theme-mgt/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/theme-mgt/pom.xml b/components/stratos/theme-mgt/pom.xml
deleted file mode 100644
index 66f11f7..0000000
--- a/components/stratos/theme-mgt/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (c) 2009-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~      http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
--->
-
-<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>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>theme-mgt-parent</artifactId>
-    <packaging>pom</packaging>
-    <name>WSO2 Stratos - Theme Management Parent Module</name>
-    <description>WSO2 Stratos Theme Management Parent Module</description>
-    <url>http://wso2.org</url>
-
-    <modules>
-        <module>org.wso2.carbon.theme.mgt/2.1.0</module>
-        <module>org.wso2.carbon.theme.mgt.ui/2.1.0</module>
-    </modules>
-
-</project>
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/service-stubs/org.apache.stratos.theme.mgt.stub/pom.xml
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.theme.mgt.stub/pom.xml b/service-stubs/org.apache.stratos.theme.mgt.stub/pom.xml
new file mode 100644
index 0000000..26a4be2
--- /dev/null
+++ b/service-stubs/org.apache.stratos.theme.mgt.stub/pom.xml
@@ -0,0 +1,125 @@
+<?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.apache.stratos</groupId>
+        <artifactId>stratos-service-stubs-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.theme.mgt.stub</artifactId>
+    <packaging>bundle</packaging>
+    <version>3.0.0-SNAPSHOT</version>
+    <name>Apache Stratos - Theme Configuration User Interface</name>
+
+    <build>
+
+        <plugins>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.1</version>
+                <executions>
+                    <execution>
+                        <id>source-code-generation</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <tasks>
+                                <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+                                    <arg line="-uri src/main/resources/ThemeMgtService.wsdl -u -uw -o target/generated-code
+                                    -p org.wso2.carbon.theme.mgt.stub
+                                    -ns2p http://services.mgt.theme.carbon.wso2.org=org.wso2.carbon.theme.mgt.stub.services,http://utils.services.resource.registry.carbon.wso2.org/xsd=org.wso2.carbon.theme.mgt.stub.registry.resource.stub.services.utils.xsd,http://common.registry.carbon.wso2.org/xsd=org.wso2.carbon.theme.mgt.stub.registry.resource.stub.common.xsd,http://beans.resource.registry.carbon.wso2.org/xsd=org.wso2.carbon.theme.mgt.stub.registry.resource.stub.beans.xsd,http://services.resource.registry.carbon.wso2.org=org.wso2.carbon.theme.mgt.stub.registry.resource.stub.services"/>
+                                    <classpath refid="maven.dependency.classpath"/>
+                                    <classpath refid="maven.compile.classpath"/>
+                                    <classpath refid="maven.runtime.classpath"/>
+                                </java>
+                            </tasks>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+	    
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>target/generated-code/src</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <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.wso2.carbon.theme.mgt.stub.*; version="${carbon.platform.package.export.version}",
+                        </Export-Package>
+                        <Import-Package>
+                            !org.wso2.carbon.theme.mgt.stub.*;
+                            *;resolution:=optional
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.axis2.wso2</groupId>
+            <artifactId>axis2</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>