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:36 UTC

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

refactoring theme-mgt components, service stub and changing service stub parent name to stratos-service-stubs-parent


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

Branch: refs/heads/master
Commit: f6330834284d8a0aebb811239c0916582abf37a7
Parents: fcb90b1
Author: Lahiru Sandaruwan <la...@wso2.com>
Authored: Thu Jul 11 17:30:26 2013 +0530
Committer: Lahiru Sandaruwan <la...@wso2.com>
Committed: Thu Jul 11 17:30:26 2013 +0530

----------------------------------------------------------------------
 .../org.apache.stratos.theme.mgt.ui/pom.xml     |  153 +++
 .../mgt/ui/clients/ThemeMgtServiceClient.java   |  424 ++++++
 .../processors/AddThemeResourceProcessor.java   |  239 ++++
 .../mgt/ui/servlets/ThemeResourceSevelet.java   |  124 ++
 .../stratos/theme/mgt/ui/utils/ThemeUtil.java   |   67 +
 .../mgt/ui/clients/ThemeMgtServiceClient.java   |  424 ++++++
 .../processors/AddThemeResourceProcessor.java   |  240 ++++
 .../mgt/ui/servlets/ThemeResourceSevelet.java   |  124 ++
 .../carbon/theme/mgt/ui/utils/ThemeUtil.java    |   67 +
 .../src/main/resources/META-INF/component.xml   |   68 +
 .../theme/mgt/ui/i18n/JSResources.properties    |    2 +
 .../theme/mgt/ui/i18n/Resources.properties      |   51 +
 .../theme/mgt/ui/i18n/JSResources.properties    |    2 +
 .../theme/mgt/ui/i18n/Resources.properties      |   51 +
 .../add_collection_ajaxprocessor.jsp            |   50 +
 .../add_text_resource_ajaxprocessor.jsp         |   59 +
 .../web/tenant-theme/content_ajaxprocessor.jsp  |  242 ++++
 .../resources/web/tenant-theme/css-editor.jsp   |   59 +
 .../web/tenant-theme/css/loginpage.css          |  110 ++
 .../resources/web/tenant-theme/css/tenant.css   |   74 ++
 .../web/tenant-theme/css/tenent-theme.css       |   32 +
 .../web/tenant-theme/css/theme-mgt.css          |   16 +
 .../web/tenant-theme/delete_ajaxprocessor.jsp   |   48 +
 .../display_text_content_ajaxprocessor.jsp      |   48 +
 .../tenant-theme/docs/images/change-logo.png    |  Bin 0 -> 14821 bytes
 .../web/tenant-theme/docs/images/edit-theme.png |  Bin 0 -> 83056 bytes
 .../tenant-theme/docs/images/select-theme.png   |  Bin 0 -> 61602 bytes
 .../web/tenant-theme/docs/userguide.html        |   78 ++
 .../edit_text_content_ajaxprocessor.jsp         |   97 ++
 .../web/tenant-theme/images/ajax-loader.gif     |  Bin 0 -> 673 bytes
 .../web/tenant-theme/images/button-back.gif     |  Bin 0 -> 819 bytes
 .../tenant-theme/images/content-back-left.jpg   |  Bin 0 -> 2240 bytes
 .../web/tenant-theme/images/content-back.jpg    |  Bin 0 -> 852 bytes
 .../tenant-theme/images/create-org-button.gif   |  Bin 0 -> 2576 bytes
 .../web/tenant-theme/images/footer.jpg          |  Bin 0 -> 836 bytes
 .../resources/web/tenant-theme/images/forum.gif |  Bin 0 -> 1977 bytes
 .../web/tenant-theme/images/header.jpg          |  Bin 0 -> 5837 bytes
 .../resources/web/tenant-theme/images/help.gif  |  Bin 0 -> 1229 bytes
 .../web/tenant-theme/images/images.gif          |  Bin 0 -> 1067 bytes
 .../web/tenant-theme/images/issue-tracker.gif   |  Bin 0 -> 1821 bytes
 .../resources/web/tenant-theme/images/logo.jpg  |  Bin 0 -> 7171 bytes
 .../web/tenant-theme/images/logomgt.gif         |  Bin 0 -> 596 bytes
 .../web/tenant-theme/images/mailing-list.gif    |  Bin 0 -> 2064 bytes
 .../web/tenant-theme/images/page-back.jpg       |  Bin 0 -> 871 bytes
 .../web/tenant-theme/images/people.gif          |  Bin 0 -> 22151 bytes
 .../web/tenant-theme/images/sel-02.jpg          |  Bin 0 -> 809 bytes
 .../web/tenant-theme/images/services.gif        |  Bin 0 -> 604 bytes
 .../web/tenant-theme/images/thememgt.gif        |  Bin 0 -> 1030 bytes
 .../web/tenant-theme/images/user-guide.gif      |  Bin 0 -> 2161 bytes
 .../import_resource_ajaxprocessor.jsp           |  101 ++
 .../web/tenant-theme/js/editarea/change_log.txt |  281 ++++
 .../js/editarea/edit_area/autocompletion.js     |  491 +++++++
 .../js/editarea/edit_area/edit_area.css         |  530 ++++++++
 .../js/editarea/edit_area/edit_area.js          |  525 ++++++++
 .../js/editarea/edit_area/edit_area_full.js     |   38 +
 .../editarea/edit_area/edit_area_functions.js   | 1203 ++++++++++++++++++
 .../js/editarea/edit_area/edit_area_loader.js   | 1080 ++++++++++++++++
 .../js/editarea/edit_area/elements_functions.js |  333 +++++
 .../js/editarea/edit_area/highlight.js          |  391 ++++++
 .../edit_area/images/autocompletion.gif         |  Bin 0 -> 359 bytes
 .../js/editarea/edit_area/images/close.gif      |  Bin 0 -> 102 bytes
 .../js/editarea/edit_area/images/fullscreen.gif |  Bin 0 -> 198 bytes
 .../js/editarea/edit_area/images/go_to_line.gif |  Bin 0 -> 1053 bytes
 .../js/editarea/edit_area/images/help.gif       |  Bin 0 -> 295 bytes
 .../js/editarea/edit_area/images/highlight.gif  |  Bin 0 -> 256 bytes
 .../js/editarea/edit_area/images/load.gif       |  Bin 0 -> 1041 bytes
 .../js/editarea/edit_area/images/move.gif       |  Bin 0 -> 257 bytes
 .../editarea/edit_area/images/newdocument.gif   |  Bin 0 -> 170 bytes
 .../js/editarea/edit_area/images/opacity.png    |  Bin 0 -> 147 bytes
 .../js/editarea/edit_area/images/processing.gif |  Bin 0 -> 825 bytes
 .../js/editarea/edit_area/images/redo.gif       |  Bin 0 -> 169 bytes
 .../edit_area/images/reset_highlight.gif        |  Bin 0 -> 168 bytes
 .../js/editarea/edit_area/images/save.gif       |  Bin 0 -> 285 bytes
 .../js/editarea/edit_area/images/search.gif     |  Bin 0 -> 191 bytes
 .../edit_area/images/smooth_selection.gif       |  Bin 0 -> 174 bytes
 .../js/editarea/edit_area/images/spacer.gif     |  Bin 0 -> 43 bytes
 .../edit_area/images/statusbar_resize.gif       |  Bin 0 -> 79 bytes
 .../js/editarea/edit_area/images/undo.gif       |  Bin 0 -> 175 bytes
 .../js/editarea/edit_area/images/word_wrap.gif  |  Bin 0 -> 951 bytes
 .../js/editarea/edit_area/keyboard.js           |  145 +++
 .../js/editarea/edit_area/langs/en.js           |   67 +
 .../js/editarea/edit_area/license_apache.txt    |    7 +
 .../js/editarea/edit_area/license_bsd.txt       |   10 +
 .../js/editarea/edit_area/license_lgpl.txt      |  458 +++++++
 .../js/editarea/edit_area/manage_area.js        |  623 +++++++++
 .../js/editarea/edit_area/reg_syntax.js         |  166 +++
 .../js/editarea/edit_area/reg_syntax/basic.js   |   69 +
 .../editarea/edit_area/reg_syntax/brainfuck.js  |   44 +
 .../js/editarea/edit_area/reg_syntax/c.js       |   62 +
 .../editarea/edit_area/reg_syntax/coldfusion.js |  119 ++
 .../js/editarea/edit_area/reg_syntax/cpp.js     |   65 +
 .../js/editarea/edit_area/reg_syntax/css.js     |   84 ++
 .../js/editarea/edit_area/reg_syntax/html.js    |   50 +
 .../js/editarea/edit_area/reg_syntax/java.js    |   56 +
 .../js/editarea/edit_area/reg_syntax/js.js      |   93 ++
 .../js/editarea/edit_area/reg_syntax/pas.js     |   82 ++
 .../js/editarea/edit_area/reg_syntax/perl.js    |   88 ++
 .../js/editarea/edit_area/reg_syntax/php.js     |  156 +++
 .../js/editarea/edit_area/reg_syntax/python.js  |  144 +++
 .../editarea/edit_area/reg_syntax/robotstxt.js  |   24 +
 .../js/editarea/edit_area/reg_syntax/ruby.js    |   67 +
 .../js/editarea/edit_area/reg_syntax/sql.js     |   55 +
 .../js/editarea/edit_area/reg_syntax/tsql.js    |   87 ++
 .../js/editarea/edit_area/reg_syntax/vb.js      |   52 +
 .../js/editarea/edit_area/reg_syntax/xml.js     |   56 +
 .../js/editarea/edit_area/regexp.js             |  139 ++
 .../js/editarea/edit_area/resize_area.js        |   73 ++
 .../js/editarea/edit_area/search_replace.js     |  174 +++
 .../js/editarea/edit_area/template.html         |  117 ++
 .../tenant-theme/js/editarea/license_apache.txt |    7 +
 .../tenant-theme/js/editarea/license_bsd.txt    |   10 +
 .../tenant-theme/js/editarea/license_lgpl.txt   |  458 +++++++
 .../web/tenant-theme/js/editarea/todo.txt       |   71 ++
 .../web/tenant-theme/js/theme_resource_util.js  |  828 ++++++++++++
 .../resources/web/tenant-theme/logo_mgt.jsp     |  221 ++++
 .../web/tenant-theme/metadata_resourcepath.jsp  |  107 ++
 .../web/tenant-theme/raw-collection-content.jsp |  756 +++++++++++
 .../rename_resource_ajaxprocessor.jsp           |   42 +
 .../web/tenant-theme/theme_advanced.jsp         |  140 ++
 .../resources/web/tenant-theme/theme_mgt.jsp    |  240 ++++
 .../tenant-theme/theme_mgt_ajaxprocessor.jsp    |   49 +
 .../web/tenant-theme/update_text_content.jsp    |   52 +
 components/org.apache.stratos.theme.mgt/pom.xml |  106 ++
 .../TenantThemeMgtServiceComponent.java         |   99 ++
 .../theme/mgt/services/ThemeMgtService.java     |  195 +++
 .../theme/mgt/util/ThemeLoadingListener.java    |   73 ++
 .../stratos/theme/mgt/util/ThemeUtil.java       |  302 +++++
 .../TenantThemeMgtServiceComponent.java         |   99 ++
 .../theme/mgt/services/ThemeMgtService.java     |  195 +++
 .../theme/mgt/util/ThemeLoadingListener.java    |   73 ++
 .../wso2/carbon/theme/mgt/util/ThemeUtil.java   |  302 +++++
 .../src/main/resources/META-INF/component.xml   |   29 +
 .../src/main/resources/META-INF/services.xml    |  103 ++
 .../org.wso2.carbon.theme.mgt.ui/2.1.0/pom.xml  |  148 ---
 .../mgt/ui/clients/ThemeMgtServiceClient.java   |  424 ------
 .../processors/AddThemeResourceProcessor.java   |  240 ----
 .../mgt/ui/servlets/ThemeResourceSevelet.java   |  124 --
 .../carbon/theme/mgt/ui/utils/ThemeUtil.java    |   67 -
 .../src/main/resources/META-INF/component.xml   |   68 -
 .../theme/mgt/ui/i18n/JSResources.properties    |    2 -
 .../theme/mgt/ui/i18n/Resources.properties      |   51 -
 .../add_collection_ajaxprocessor.jsp            |   49 -
 .../add_text_resource_ajaxprocessor.jsp         |   57 -
 .../web/tenant-theme/content_ajaxprocessor.jsp  |  241 ----
 .../resources/web/tenant-theme/css-editor.jsp   |   58 -
 .../web/tenant-theme/css/loginpage.css          |  110 --
 .../resources/web/tenant-theme/css/tenant.css   |   74 --
 .../web/tenant-theme/css/tenent-theme.css       |   32 -
 .../web/tenant-theme/css/theme-mgt.css          |   16 -
 .../web/tenant-theme/delete_ajaxprocessor.jsp   |   47 -
 .../display_text_content_ajaxprocessor.jsp      |   47 -
 .../tenant-theme/docs/images/change-logo.png    |  Bin 14821 -> 0 bytes
 .../web/tenant-theme/docs/images/edit-theme.png |  Bin 83056 -> 0 bytes
 .../tenant-theme/docs/images/select-theme.png   |  Bin 61602 -> 0 bytes
 .../web/tenant-theme/docs/userguide.html        |   77 --
 .../edit_text_content_ajaxprocessor.jsp         |   96 --
 .../web/tenant-theme/images/ajax-loader.gif     |  Bin 673 -> 0 bytes
 .../web/tenant-theme/images/button-back.gif     |  Bin 819 -> 0 bytes
 .../tenant-theme/images/content-back-left.jpg   |  Bin 2240 -> 0 bytes
 .../web/tenant-theme/images/content-back.jpg    |  Bin 852 -> 0 bytes
 .../tenant-theme/images/create-org-button.gif   |  Bin 2576 -> 0 bytes
 .../web/tenant-theme/images/footer.jpg          |  Bin 836 -> 0 bytes
 .../resources/web/tenant-theme/images/forum.gif |  Bin 1977 -> 0 bytes
 .../web/tenant-theme/images/header.jpg          |  Bin 5837 -> 0 bytes
 .../resources/web/tenant-theme/images/help.gif  |  Bin 1229 -> 0 bytes
 .../web/tenant-theme/images/images.gif          |  Bin 1067 -> 0 bytes
 .../web/tenant-theme/images/issue-tracker.gif   |  Bin 1821 -> 0 bytes
 .../resources/web/tenant-theme/images/logo.jpg  |  Bin 7171 -> 0 bytes
 .../web/tenant-theme/images/logomgt.gif         |  Bin 596 -> 0 bytes
 .../web/tenant-theme/images/mailing-list.gif    |  Bin 2064 -> 0 bytes
 .../web/tenant-theme/images/page-back.jpg       |  Bin 871 -> 0 bytes
 .../web/tenant-theme/images/people.gif          |  Bin 22151 -> 0 bytes
 .../web/tenant-theme/images/sel-02.jpg          |  Bin 809 -> 0 bytes
 .../web/tenant-theme/images/services.gif        |  Bin 604 -> 0 bytes
 .../web/tenant-theme/images/thememgt.gif        |  Bin 1030 -> 0 bytes
 .../web/tenant-theme/images/user-guide.gif      |  Bin 2161 -> 0 bytes
 .../import_resource_ajaxprocessor.jsp           |  100 --
 .../web/tenant-theme/js/editarea/change_log.txt |  281 ----
 .../js/editarea/edit_area/autocompletion.js     |  491 -------
 .../js/editarea/edit_area/edit_area.css         |  530 --------
 .../js/editarea/edit_area/edit_area.js          |  525 --------
 .../js/editarea/edit_area/edit_area_full.js     |   38 -
 .../editarea/edit_area/edit_area_functions.js   | 1203 ------------------
 .../js/editarea/edit_area/edit_area_loader.js   | 1080 ----------------
 .../js/editarea/edit_area/elements_functions.js |  333 -----
 .../js/editarea/edit_area/highlight.js          |  391 ------
 .../edit_area/images/autocompletion.gif         |  Bin 359 -> 0 bytes
 .../js/editarea/edit_area/images/close.gif      |  Bin 102 -> 0 bytes
 .../js/editarea/edit_area/images/fullscreen.gif |  Bin 198 -> 0 bytes
 .../js/editarea/edit_area/images/go_to_line.gif |  Bin 1053 -> 0 bytes
 .../js/editarea/edit_area/images/help.gif       |  Bin 295 -> 0 bytes
 .../js/editarea/edit_area/images/highlight.gif  |  Bin 256 -> 0 bytes
 .../js/editarea/edit_area/images/load.gif       |  Bin 1041 -> 0 bytes
 .../js/editarea/edit_area/images/move.gif       |  Bin 257 -> 0 bytes
 .../editarea/edit_area/images/newdocument.gif   |  Bin 170 -> 0 bytes
 .../js/editarea/edit_area/images/opacity.png    |  Bin 147 -> 0 bytes
 .../js/editarea/edit_area/images/processing.gif |  Bin 825 -> 0 bytes
 .../js/editarea/edit_area/images/redo.gif       |  Bin 169 -> 0 bytes
 .../edit_area/images/reset_highlight.gif        |  Bin 168 -> 0 bytes
 .../js/editarea/edit_area/images/save.gif       |  Bin 285 -> 0 bytes
 .../js/editarea/edit_area/images/search.gif     |  Bin 191 -> 0 bytes
 .../edit_area/images/smooth_selection.gif       |  Bin 174 -> 0 bytes
 .../js/editarea/edit_area/images/spacer.gif     |  Bin 43 -> 0 bytes
 .../edit_area/images/statusbar_resize.gif       |  Bin 79 -> 0 bytes
 .../js/editarea/edit_area/images/undo.gif       |  Bin 175 -> 0 bytes
 .../js/editarea/edit_area/images/word_wrap.gif  |  Bin 951 -> 0 bytes
 .../js/editarea/edit_area/keyboard.js           |  145 ---
 .../js/editarea/edit_area/langs/en.js           |   67 -
 .../js/editarea/edit_area/license_apache.txt    |    7 -
 .../js/editarea/edit_area/license_bsd.txt       |   10 -
 .../js/editarea/edit_area/license_lgpl.txt      |  458 -------
 .../js/editarea/edit_area/manage_area.js        |  623 ---------
 .../js/editarea/edit_area/reg_syntax.js         |  166 ---
 .../js/editarea/edit_area/reg_syntax/basic.js   |   69 -
 .../editarea/edit_area/reg_syntax/brainfuck.js  |   44 -
 .../js/editarea/edit_area/reg_syntax/c.js       |   62 -
 .../editarea/edit_area/reg_syntax/coldfusion.js |  119 --
 .../js/editarea/edit_area/reg_syntax/cpp.js     |   65 -
 .../js/editarea/edit_area/reg_syntax/css.js     |   84 --
 .../js/editarea/edit_area/reg_syntax/html.js    |   50 -
 .../js/editarea/edit_area/reg_syntax/java.js    |   56 -
 .../js/editarea/edit_area/reg_syntax/js.js      |   93 --
 .../js/editarea/edit_area/reg_syntax/pas.js     |   82 --
 .../js/editarea/edit_area/reg_syntax/perl.js    |   88 --
 .../js/editarea/edit_area/reg_syntax/php.js     |  156 ---
 .../js/editarea/edit_area/reg_syntax/python.js  |  144 ---
 .../editarea/edit_area/reg_syntax/robotstxt.js  |   24 -
 .../js/editarea/edit_area/reg_syntax/ruby.js    |   67 -
 .../js/editarea/edit_area/reg_syntax/sql.js     |   55 -
 .../js/editarea/edit_area/reg_syntax/tsql.js    |   87 --
 .../js/editarea/edit_area/reg_syntax/vb.js      |   52 -
 .../js/editarea/edit_area/reg_syntax/xml.js     |   56 -
 .../js/editarea/edit_area/regexp.js             |  139 --
 .../js/editarea/edit_area/resize_area.js        |   73 --
 .../js/editarea/edit_area/search_replace.js     |  174 ---
 .../js/editarea/edit_area/template.html         |  117 --
 .../tenant-theme/js/editarea/license_apache.txt |    7 -
 .../tenant-theme/js/editarea/license_bsd.txt    |   10 -
 .../tenant-theme/js/editarea/license_lgpl.txt   |  458 -------
 .../web/tenant-theme/js/editarea/todo.txt       |   71 --
 .../web/tenant-theme/js/theme_resource_util.js  |  828 ------------
 .../resources/web/tenant-theme/logo_mgt.jsp     |  220 ----
 .../web/tenant-theme/metadata_resourcepath.jsp  |  106 --
 .../web/tenant-theme/raw-collection-content.jsp |  755 -----------
 .../rename_resource_ajaxprocessor.jsp           |   41 -
 .../web/tenant-theme/theme_advanced.jsp         |  139 --
 .../resources/web/tenant-theme/theme_mgt.jsp    |  239 ----
 .../tenant-theme/theme_mgt_ajaxprocessor.jsp    |   48 -
 .../web/tenant-theme/update_text_content.jsp    |   51 -
 .../org.wso2.carbon.theme.mgt/2.1.0/pom.xml     |  102 --
 .../TenantThemeMgtServiceComponent.java         |   99 --
 .../theme/mgt/services/ThemeMgtService.java     |  195 ---
 .../theme/mgt/util/ThemeLoadingListener.java    |   73 --
 .../wso2/carbon/theme/mgt/util/ThemeUtil.java   |  302 -----
 .../src/main/resources/META-INF/component.xml   |   29 -
 .../src/main/resources/META-INF/services.xml    |  103 --
 components/stratos/theme-mgt/pom.xml            |   41 -
 .../org.apache.stratos.theme.mgt.stub/pom.xml   |  125 ++
 .../src/main/resources/ThemeMgtService.wsdl     | 1146 +++++++++++++++++
 .../4.1.0/pom.xml                               |  121 --
 .../src/main/resources/ThemeMgtService.wsdl     | 1157 -----------------
 service-stubs/pom.xml                           |    2 +-
 262 files changed, 17183 insertions(+), 15628 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/org.apache.stratos.theme.mgt.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/pom.xml b/components/org.apache.stratos.theme.mgt.ui/pom.xml
new file mode 100644
index 0000000..cf7f546
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/pom.xml
@@ -0,0 +1,153 @@
+<?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-components-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+	    <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.theme.mgt.ui</artifactId>
+    <version>3.0.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <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.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.theme.mgt.ui.*,
+                            org.apache.stratos.theme.mgt.ui.processors.*,
+                        </Export-Package>
+                        <Import-Package>
+                            org.wso2.carbon.registry.resource.ui.*,
+                            org.apache.stratos.theme.mgt.ui.servlets.*,
+                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
+                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+                            org.apache.lucene.*,
+                            org.apache.batik.*,
+                            org.apache.stratos.theme.mgt.stub.*; version="${carbon.platform.package.import.version.range}",
+                            *;resolution:=optional
+                        </Import-Package>
+                        <Carbon-Component>UIBundle</Carbon-Component>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.apache.stratos.theme.mgt.stub</artifactId>
+            <version>3.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.common.ui</artifactId>
+            <version>${carbon.platform.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.resource.ui</artifactId>
+            <version>${carbon.platform.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.core</artifactId>
+            <version>${carbon.platform.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.equinox</groupId>
+            <artifactId>javax.servlet</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2.wso2</groupId>
+            <artifactId>axis2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.commons.axiom.wso2</groupId>
+            <artifactId>axiom</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.ui</artifactId>
+            <version>${carbon.platform.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.core</artifactId>
+            <version>${carbon.platform.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.batik.wso2</groupId>
+            <artifactId>batik</artifactId>
+        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.wso2.carbon</groupId>-->
+            <!--<artifactId>org.wso2.carbon.registry.profiles.ui</artifactId>-->
+            <!--<version>${registry-component.version}</version>-->
+        <!--</dependency>-->
+        <!--<dependency>-->
+            <!--<groupId>org.wso2.carbon</groupId>-->
+            <!--<artifactId>org.wso2.carbon.governance.wsdltool.ui</artifactId>-->
+            <!--<version>${registry-component.version}</version>-->
+        <!--</dependency>-->
+        <!--<dependency>-->
+            <!--<groupId>org.wso2.carbon</groupId>-->
+            <!--<artifactId>org.wso2.carbon.registry.resource.ui</artifactId>-->
+            <!--<version>${registry-component.version}</version>-->
+        <!--</dependency>-->
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/clients/ThemeMgtServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/clients/ThemeMgtServiceClient.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/clients/ThemeMgtServiceClient.java
new file mode 100644
index 0000000..0365d37
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/clients/ThemeMgtServiceClient.java
@@ -0,0 +1,424 @@
+/*
+ *  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.apache.stratos.theme.mgt.ui.clients;
+
+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.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.registry.common.utils.RegistryUtil;
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.CollectionContentBean;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentBean;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentDownloadBean;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.MetadataBean;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.ResourceTreeEntryBean;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.common.xsd.ResourceData;
+import org.apache.stratos.theme.mgt.stub.ThemeMgtServiceStub;
+import org.wso2.carbon.ui.CarbonUIUtil;
+import org.wso2.carbon.utils.ServerConstants;
+
+import javax.activation.DataHandler;
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+public class ThemeMgtServiceClient {
+
+    private static final Log log = LogFactory.getLog(ThemeMgtServiceClient.class);
+
+    private ThemeMgtServiceStub stub;
+    private String epr;
+
+    public ThemeMgtServiceClient (
+            String cookie, String backendServerURL, ConfigurationContext configContext)
+            throws RegistryException {
+
+        epr = backendServerURL + "ThemeMgtService";
+
+        try {
+            stub = new ThemeMgtServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+
+    public ThemeMgtServiceClient(String cookie, ServletConfig config, HttpSession session)
+            throws RegistryException {
+
+        String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+        ConfigurationContext configContext = (ConfigurationContext) config.
+                getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+        epr = backendServerURL + "ThemeMgtService";
+
+        try {
+            stub = new ThemeMgtServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public ThemeMgtServiceClient(ServletConfig config, HttpSession session)
+            throws RegistryException {
+
+        String cookie = (String)session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+        String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+        ConfigurationContext configContext = (ConfigurationContext) config.
+                getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+        epr = backendServerURL + "ThemeMgtService";
+
+        try {
+            stub = new ThemeMgtServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public ResourceTreeEntryBean getResourceTreeEntry(String resourcePath)
+            throws Exception {
+
+        ResourceTreeEntryBean entryBean = null;
+        try {
+            Options options = stub._getServiceClient().getOptions();
+            options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+            entryBean = stub.getResourceTreeEntry(resourcePath);
+        } catch (Exception e) {
+            String msg = "Failed to get resource tree entry for resource " +
+                    resourcePath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+        if (entryBean == null) {
+            throw new ResourceNotFoundException("The resource does not exist");
+        }
+        return entryBean;
+    }
+
+     public ContentBean getContent(HttpServletRequest request) throws Exception {
+
+        String path = RegistryUtil.getPath(request);
+        ContentBean bean = null;
+        try {
+            bean = stub.getContentBean(path);
+        } catch (Exception e) {
+            String msg = "Failed to get content from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return bean;
+    }
+
+
+    public CollectionContentBean getCollectionContent(HttpServletRequest request) throws Exception {
+
+        String path = RegistryUtil.getPath(request);
+        CollectionContentBean bean = null;
+        try {
+            bean = stub.getCollectionContent(path);
+
+        } catch (Exception e) {
+            String msg = "Failed to get collection content from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return bean;
+    }
+
+
+    public ResourceData[] getResourceData(String[] paths) throws Exception {
+
+        ResourceData[] resourceData;
+        try {
+            resourceData = stub.getResourceData(paths);
+        } catch (Exception e) {
+            String msg = "Failed to get resource data from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return resourceData;
+    }
+
+    public String addCollection(
+            String parentPath, String collectionName, String mediaType, String description) throws Exception  {
+        try {
+            return stub.addCollection(parentPath, collectionName, mediaType, description);
+        } catch (Exception e) {
+            String msg = "Failed to add collection " + collectionName + " for parent path: " + parentPath + ". " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public void addResource(String path, String mediaType, String description, DataHandler content,
+                            String symlinkLocation, String tenantPass)
+            throws Exception {
+
+        try {
+            Options options = stub._getServiceClient().getOptions();
+            options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+            options.setTimeOutInMilliSeconds(300000);
+            stub.addResource(path, mediaType, description, content, symlinkLocation, tenantPass);
+
+        } catch (Exception e) {
+
+            String msg = "Failed to add resource " + path + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public void importResource(
+            String parentPath,
+            String resourceName,
+            String mediaType,
+            String description,
+            String fetchURL,
+            String symlinkLocation,
+            boolean isAsync,
+            String tenantPass) throws Exception {
+
+        try {
+            // This is used by the add wsdl UI. WSDL validation takes long when there are wsdl
+            // imports to prevent this we make a async call.
+            if (isAsync) {
+                stub._getServiceClient().getOptions().setProperty(
+                        MessageContext.CLIENT_API_NON_BLOCKING,Boolean.TRUE);
+            }
+            stub.importResource(parentPath, resourceName, mediaType, description, fetchURL, symlinkLocation, tenantPass);
+        } catch (Exception e) {
+            String msg = "Failed to import resource with name " + resourceName +
+                    " to the parent collection " + parentPath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+    }
+
+
+    public void addTextResource(
+            String parentPath,
+            String fileName,
+            String mediaType,
+            String description,
+            String content) throws Exception {
+
+        try {
+            stub.addTextResource(parentPath, fileName, mediaType, description, content);
+        } catch (Exception e) {
+            String msg = "Failed to add new text resource with name " + fileName +
+                    " to the parent collection " + parentPath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+    }
+
+    public MetadataBean getMetadata(HttpServletRequest request) throws Exception {
+
+        String path = RegistryUtil.getPath(request);
+        if (path == null) {
+            path = getSessionResourcePath();
+            if (path == null) {
+                path = RegistryConstants.ROOT_PATH;
+            }
+
+            request.setAttribute("path", path);
+        }
+
+        MetadataBean bean = null;
+        try {
+            bean = stub.getMetadata(path);
+        } catch (Exception e) {
+            String msg = "Failed to get resource metadata from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return bean;
+    }
+
+    public MetadataBean getMetadata(HttpServletRequest request,String root) throws Exception {
+
+        String path = RegistryConstants.ROOT_PATH;
+        request.setAttribute("path", path);
+        if (path == null) {
+            path = getSessionResourcePath();
+            if (path == null) {
+                path = RegistryConstants.ROOT_PATH;
+            }
+        }
+
+        MetadataBean bean = null;
+        try {
+            bean = stub.getMetadata(path);
+        } catch (Exception e) {
+            String msg = "Failed to get resource metadata from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return bean;
+    }
+
+    public String getSessionResourcePath() throws Exception {
+
+        String sessionResourcePath;
+        try {
+            sessionResourcePath = stub.getSessionResourcePath();
+        } catch (Exception e) {
+
+            String msg = "Failed to get the session resource path. " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+        return sessionResourcePath;
+    }
+
+
+    public String getTextContent(HttpServletRequest request) throws Exception {
+
+        String path = RegistryUtil.getPath(request);
+
+        String textContent = null;
+        try {
+            textContent = stub.getTextContent(path);
+        } catch (Exception e) {
+
+            String msg = "Failed get text content of the resource " +
+                    path + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+        return textContent;
+    }
+
+     public void updateTextContent(String resourcePath, String contentText) throws Exception {
+
+        try {
+            stub.updateTextContent(resourcePath, contentText);
+        } catch (Exception e) {
+
+            String msg = "Failed to update text content of the resource " +
+                    resourcePath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public ContentDownloadBean getContentDownloadBean(String path) throws Exception {
+
+        ContentDownloadBean bean = stub.getContentDownloadBean(path);
+        return bean;
+    }
+
+    public void renameResource(
+            String parentPath, String oldResourcePath, String newResourceName)
+            throws Exception {
+
+        try {
+            stub.renameResource(parentPath, oldResourcePath, newResourceName);
+        } catch (Exception e) {
+            String msg = "Failed to rename resource with name " + oldResourcePath +
+                    " to the new name " + newResourceName + ". " + e.getMessage();
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+    }
+
+    public void delete(String pathToDelete) throws Exception {
+
+        try {
+            stub.delete(pathToDelete);
+        } catch (Exception e) {
+            String msg = "Failed to delete " + pathToDelete + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public String[] getAllPaths() throws Exception {
+
+        try {
+            return  stub.getAllPaths();
+        } catch (Exception e) {
+            String msg = "Failed to getAllPaths. " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public String[] getAllThemes(String tenantPass) throws Exception {
+        try {
+            return stub.getAllThemes(tenantPass);
+        } catch (Exception e) {
+            String msg = "Failed to get All Themes.";
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public void applyTheme(String themeName, String tenantPass) throws Exception {
+        try {
+            stub.applyTheme(themeName, tenantPass);
+        } catch (Exception e) {
+            String msg = "Failed to apply the theme: " + themeName;
+            log.error(msg, e);
+            throw e;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/processors/AddThemeResourceProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/processors/AddThemeResourceProcessor.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/processors/AddThemeResourceProcessor.java
new file mode 100644
index 0000000..c8ac3cb
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/processors/AddThemeResourceProcessor.java
@@ -0,0 +1,239 @@
+/*
+ *  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.apache.stratos.theme.mgt.ui.processors;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.CarbonException;
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.apache.stratos.theme.mgt.ui.clients.ThemeMgtServiceClient;
+import org.wso2.carbon.ui.CarbonUIMessage;
+import org.wso2.carbon.ui.transports.fileupload.AbstractFileUploadExecutor;
+import org.wso2.carbon.utils.FileItemData;
+import org.wso2.carbon.utils.ServerConstants;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.mail.util.ByteArrayDataSource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+
+
+/*
+* Copyright (c) 2006, 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.
+*/
+
+
+public class AddThemeResourceProcessor extends AbstractFileUploadExecutor {
+
+    private static final Log log = LogFactory.getLog(AddThemeResourceProcessor.class);
+
+    public boolean execute(HttpServletRequest request, HttpServletResponse response)
+            throws CarbonException, IOException {
+
+        String webContext = (String) request.getAttribute(CarbonConstants.WEB_CONTEXT);
+        String serverURL = (String) request.getAttribute(CarbonConstants.SERVER_URL);
+        String cookie = (String) request.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+        // HttpSession session = request.getSession();
+
+        Map<String, ArrayList<FileItemData>> fileItemsMap = getFileItemsMap();
+        if (fileItemsMap == null || fileItemsMap.isEmpty()) {
+            String msg = "File uploading failed. Content is not set properly.";
+            log.error(msg);
+
+            CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request);
+            response.sendRedirect(
+                    "../" + webContext + "/admin/error.jsp");
+
+            return false;
+        }
+
+        try {
+            ThemeMgtServiceClient client =
+                    new ThemeMgtServiceClient(cookie, serverURL, configurationContext);
+
+            String parentPath = null;
+            Map<String, ArrayList<java.lang.String>> formFieldsMap = getFormFieldsMap();
+            if (formFieldsMap.get("path") != null) {
+                parentPath = formFieldsMap.get("path").get(0);
+            }
+            String resourceName = null;
+            if (formFieldsMap.get("filename") != null) {
+                resourceName = formFieldsMap.get("filename").get(0);
+            }
+            String mediaType = null;
+            if (formFieldsMap.get("mediaType") != null) {
+                mediaType = formFieldsMap.get("mediaType").get(0);
+            }
+            String description = null;
+            if (formFieldsMap.get("description") != null) {
+                description = formFieldsMap.get("description").get(0);
+            }
+            String symlinkLocation = null;
+            if (formFieldsMap.get("symlinkLocation") != null) {
+                symlinkLocation = formFieldsMap.get("symlinkLocation").get(0);
+            }
+            String redirectWith = null;
+            if (formFieldsMap.get("redirectWith") != null) {
+                redirectWith = formFieldsMap.get("redirectWith").get(0);
+            }
+            /*
+            // currently chroot will not work with multitenancy
+            IServerAdmin adminClient =
+                    (IServerAdmin) CarbonUIUtil.
+                            getServerProxy(new ServerAdminClient(configurationContext,
+                                    serverURL, cookie, session), IServerAdmin.class, session);
+            ServerData data = adminClient.getServerData();
+            String chroot = "";
+            if (data.getRegistryType().equals("remote") && data.getRemoteRegistryChroot() != null &&
+                    !data.getRemoteRegistryChroot().equals(RegistryConstants.PATH_SEPARATOR)) {
+                chroot = data.getRemoteRegistryChroot();
+                if (!chroot.startsWith(RegistryConstants.PATH_SEPARATOR)) {
+                    chroot = RegistryConstants.PATH_SEPARATOR + chroot;
+                }
+                if (chroot.endsWith(RegistryConstants.PATH_SEPARATOR)) {
+                    chroot = chroot.substring(0, chroot.length() - RegistryConstants.PATH_SEPARATOR.length());
+                }
+            }
+            if (symlinkLocation != null) {
+                symlinkLocation = chroot + symlinkLocation;
+            }
+            */
+
+            FileItemData fileItemData = fileItemsMap.get("upload").get(0);
+
+            if ((fileItemData == null) || (fileItemData.getFileItem().getSize() == 0)) {
+                String msg = "Failed add resource. Resource content is empty.";
+                log.error(msg);
+
+                CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request);
+                response.sendRedirect(
+                        "../" + webContext + "/admin/error.jsp");
+
+                return false;
+            }
+            DataHandler dataHandler = scaleImage(fileItemData.getDataHandler(), 48, 119);
+
+            client.addResource(
+                    calculatePath(parentPath, resourceName), mediaType, description, dataHandler,
+                    symlinkLocation, redirectWith);
+
+            response.setContentType("text/html; charset=utf-8");
+            String msg = "The logo has been successfully updated.";
+            CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.INFO, request);
+
+            String redirectTo = request.getParameter("redirectto");
+            if ("theme_mgt".equals(redirectTo)) {
+                response.setHeader("Cache-Control", "no-cache, must-revalidate");
+                response.sendRedirect("../" + webContext +
+                        "/tenant-theme/theme_mgt.jsp?logoChanged=true&redirectWith=" + redirectWith);
+            }else if ("logo_mgt".equals(redirectTo)) {
+                response.setHeader("Cache-Control", "no-cache, must-revalidate");
+                response.sendRedirect("../" + webContext +
+                        "/tenant-theme/logo_mgt.jsp?logoChanged=true&redirectWith=" + redirectWith);
+            }
+            else {
+                response.sendRedirect("../" + webContext + "/tenant-theme/theme_advanced.jsp?path=" + parentPath);
+            }
+            return true;
+
+        } catch (Exception e) {
+            String msg = "File upload failed. Please confirm that the chosen image is not corrupted " +
+                    "and retry uploading, or upload a valid image.";
+            log.error(msg + " " + e.getMessage());
+
+            CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request);
+            response.sendRedirect(
+                    "../" + webContext + "/admin/error.jsp");
+
+            return false;
+        }
+    }
+
+    private static DataHandler scaleImage(DataHandler dataHandler, int height, int width) throws IOException {
+
+        Image image = ImageIO.read(new BufferedInputStream(dataHandler.getInputStream()));
+        // Check if the image has transparent pixels
+        boolean hasAlpha = ((BufferedImage)image).getColorModel().hasAlpha();
+
+        // Maintain Aspect ratio
+        int thumbHeight = height;
+        int thumbWidth = width;
+        double thumbRatio = (double)width / (double)height;
+        double imageRatio = (double)image.getWidth(null) / (double)image.getHeight(null);
+        if (thumbRatio < imageRatio) {
+            thumbHeight = (int)(thumbWidth / imageRatio);
+        } else {
+            thumbWidth = (int)(thumbHeight * imageRatio);
+        }
+
+        BufferedImage thumb;
+        // Check if transparent pixels are available and set the color mode accordingly 
+        if (hasAlpha) {
+            thumb = new BufferedImage(thumbWidth, thumbHeight, BufferedImage.TYPE_INT_ARGB);
+        } else {
+            thumb = new BufferedImage(thumbWidth, thumbHeight, BufferedImage.TYPE_INT_RGB);
+        }
+        Graphics2D graphics2D = thumb.createGraphics();
+        graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+                                    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+        graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);
+
+        // Save the image as PNG so that transparent images are rendered as intended
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+        ImageIO.write(thumb, "PNG", output);
+
+        DataSource dataSource= new ByteArrayDataSource(output.toByteArray(), "application/octet-stream");
+        return new DataHandler(dataSource);
+    }
+
+    private static String calculatePath(String parentPath, String resourceName) {
+        String resourcePath;
+        if (!parentPath.startsWith(RegistryConstants.PATH_SEPARATOR)) {
+            parentPath = RegistryConstants.PATH_SEPARATOR + parentPath;
+        }
+        if (parentPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
+            resourcePath = parentPath + resourceName;
+        } else {
+            resourcePath = parentPath + RegistryConstants.PATH_SEPARATOR + resourceName;
+        }
+        return resourcePath;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceSevelet.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceSevelet.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceSevelet.java
new file mode 100644
index 0000000..a79324e
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceSevelet.java
@@ -0,0 +1,124 @@
+/*
+ *  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.apache.stratos.theme.mgt.ui.servlets;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentDownloadBean;
+import org.apache.stratos.theme.mgt.ui.clients.ThemeMgtServiceClient;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ThemeResourceSevelet extends HttpServlet {
+
+    private static final Log log = LogFactory.getLog(ThemeResourceSevelet.class);
+
+    private ServletConfig servletConfig;
+
+    public void init(ServletConfig servletConfig) throws ServletException {
+        super.init(servletConfig);
+        this.servletConfig = servletConfig;
+    }
+
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+
+        try {
+            ThemeMgtServiceClient client = new ThemeMgtServiceClient(servletConfig, request.getSession());
+            String path = request.getParameter("path");
+            String viewImage = request.getParameter("viewImage");
+            if (path == null) {
+                String msg = "Could not get the resource content. Path is not specified.";
+                log.error(msg);
+                response.setStatus(400);
+                return;
+            }
+
+            ContentDownloadBean bean = client.getContentDownloadBean(path);
+
+            InputStream contentStream = null;
+            if (bean.getContent() != null) {
+                contentStream = bean.getContent().getInputStream();
+            } else {
+                String msg = "The resource content was empty.";
+                log.error(msg);
+                response.setStatus(204);
+                return;
+            }
+
+            response.setDateHeader("Last-Modified", bean.getLastUpdatedTime().getTime().getTime());
+            String ext = "jpg";
+            if (path.lastIndexOf(".") < path.length() -1 && path.lastIndexOf(".") > 0) {
+                ext = path.substring(path.lastIndexOf(".") + 1);
+            }
+
+            if (viewImage != null && viewImage.equals("1")) {
+                response.setContentType("img/" + ext);
+            }
+            else {
+                if (bean.getMediatype() != null && bean.getMediatype().length() > 0) {
+                    response.setContentType(bean.getMediatype());
+                } else {
+                    response.setContentType("application/download");
+                }
+
+                if (bean.getResourceName() != null) {
+                    response.setHeader(
+                            "Content-Disposition", "attachment; filename=\"" + bean.getResourceName() + "\"");
+                }
+            }
+
+            if (contentStream != null) {
+
+                ServletOutputStream servletOutputStream = null;
+                try {
+                    servletOutputStream = response.getOutputStream();
+
+                    byte[] contentChunk = new byte[1024];
+                    int byteCount;
+                    while ((byteCount = contentStream.read(contentChunk)) != -1) {
+                        servletOutputStream.write(contentChunk, 0, byteCount);
+                    }
+
+                    response.flushBuffer();
+                    servletOutputStream.flush();
+
+                } finally {
+                    contentStream.close();
+
+                    if (servletOutputStream != null) {
+                        servletOutputStream.close();
+                    }
+                }
+            }
+        } catch (Exception e) {
+
+            String msg = "Failed to get resource content. " + e.getMessage();
+            log.error(msg, e);
+            response.setStatus(500);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/utils/ThemeUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/utils/ThemeUtil.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/utils/ThemeUtil.java
new file mode 100644
index 0000000..c01114f
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/utils/ThemeUtil.java
@@ -0,0 +1,67 @@
+/*
+ *  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.apache.stratos.theme.mgt.ui.utils;
+
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.wso2.carbon.ui.CarbonUIUtil;
+import org.wso2.carbon.registry.core.utils.UUIDGenerator;
+import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.servlet.ServletConfig;
+
+public class ThemeUtil {
+	public static String getThemeResourceDownloadURL(String path) {
+		return "../../registry/themeResourceContent?path=" + path;
+	}
+
+	public static String getThemeResourceViewAsImageURL(String path) {
+		return "../../registry/themeResourceContent?path=" + path
+		        + "&viewImage=1";
+	}
+
+	public static String getThumbUrl(HttpServletRequest request, String themeName) {
+		String serverURL = CarbonUIUtil.getAdminConsoleURL(request);
+		String serverRoot = serverURL.substring(0, serverURL.length()
+		        - "carbon/".length());
+		return serverRoot + "registry/resource"
+		        + RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH
+		        + "/repository/components/org.wso2.carbon.all-themes/"
+		        + themeName + "/thumb.png";
+	}
+
+	public static String getLogoURL(ServletConfig config, HttpSession session) {
+		// this is to avoid the caching problem
+		String randomUUID = UUIDGenerator.generateUUID();
+		String serverURL = CarbonUIUtil.getServerURL(
+		        config.getServletContext(), session);
+		String serverRoot = serverURL.substring(0, serverURL.length() - "services/".length());
+		String tenantDomain = (String) session
+		        .getAttribute(MultitenantConstants.TENANT_DOMAIN);
+		if (tenantDomain == null) {
+			return "";
+		}
+
+        // Using relative path instead of the back-end server url.
+        return  "../../../../t/" + tenantDomain + "/registry/resource"
+		        + RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH
+		        + "/repository/theme/admin/logo.gif?thatsrnd=" + randomUUID;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/wso2/carbon/theme/mgt/ui/clients/ThemeMgtServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/wso2/carbon/theme/mgt/ui/clients/ThemeMgtServiceClient.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/wso2/carbon/theme/mgt/ui/clients/ThemeMgtServiceClient.java
new file mode 100644
index 0000000..3630e3a
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/wso2/carbon/theme/mgt/ui/clients/ThemeMgtServiceClient.java
@@ -0,0 +1,424 @@
+/*
+ *  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.ui.clients;
+
+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.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.registry.common.utils.RegistryUtil;
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException;
+import org.wso2.carbon.theme.mgt.stub.registry.resource.stub.beans.xsd.CollectionContentBean;
+import org.wso2.carbon.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentBean;
+import org.wso2.carbon.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentDownloadBean;
+import org.wso2.carbon.theme.mgt.stub.registry.resource.stub.beans.xsd.MetadataBean;
+import org.wso2.carbon.theme.mgt.stub.registry.resource.stub.beans.xsd.ResourceTreeEntryBean;
+import org.wso2.carbon.theme.mgt.stub.registry.resource.stub.common.xsd.ResourceData;
+import org.wso2.carbon.theme.mgt.stub.ThemeMgtServiceStub;
+import org.wso2.carbon.ui.CarbonUIUtil;
+import org.wso2.carbon.utils.ServerConstants;
+
+import javax.activation.DataHandler;
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+public class ThemeMgtServiceClient {
+
+    private static final Log log = LogFactory.getLog(ThemeMgtServiceClient.class);
+
+    private ThemeMgtServiceStub stub;
+    private String epr;
+
+    public ThemeMgtServiceClient (
+            String cookie, String backendServerURL, ConfigurationContext configContext)
+            throws RegistryException {
+
+        epr = backendServerURL + "ThemeMgtService";
+
+        try {
+            stub = new ThemeMgtServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+
+    public ThemeMgtServiceClient(String cookie, ServletConfig config, HttpSession session)
+            throws RegistryException {
+
+        String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+        ConfigurationContext configContext = (ConfigurationContext) config.
+                getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+        epr = backendServerURL + "ThemeMgtService";
+
+        try {
+            stub = new ThemeMgtServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public ThemeMgtServiceClient(ServletConfig config, HttpSession session)
+            throws RegistryException {
+
+        String cookie = (String)session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+        String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+        ConfigurationContext configContext = (ConfigurationContext) config.
+                getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+        epr = backendServerURL + "ThemeMgtService";
+
+        try {
+            stub = new ThemeMgtServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public ResourceTreeEntryBean getResourceTreeEntry(String resourcePath)
+            throws Exception {
+
+        ResourceTreeEntryBean entryBean = null;
+        try {
+            Options options = stub._getServiceClient().getOptions();
+            options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+            entryBean = stub.getResourceTreeEntry(resourcePath);
+        } catch (Exception e) {
+            String msg = "Failed to get resource tree entry for resource " +
+                    resourcePath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+        if (entryBean == null) {
+            throw new ResourceNotFoundException("The resource does not exist");
+        }
+        return entryBean;
+    }
+
+     public ContentBean getContent(HttpServletRequest request) throws Exception {
+
+        String path = RegistryUtil.getPath(request);
+        ContentBean bean = null;
+        try {
+            bean = stub.getContentBean(path);
+        } catch (Exception e) {
+            String msg = "Failed to get content from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return bean;
+    }
+
+
+    public CollectionContentBean getCollectionContent(HttpServletRequest request) throws Exception {
+
+        String path = RegistryUtil.getPath(request);
+        CollectionContentBean bean = null;
+        try {
+            bean = stub.getCollectionContent(path);
+
+        } catch (Exception e) {
+            String msg = "Failed to get collection content from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return bean;
+    }
+
+
+    public ResourceData[] getResourceData(String[] paths) throws Exception {
+
+        ResourceData[] resourceData;
+        try {
+            resourceData = stub.getResourceData(paths);
+        } catch (Exception e) {
+            String msg = "Failed to get resource data from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return resourceData;
+    }
+
+    public String addCollection(
+            String parentPath, String collectionName, String mediaType, String description) throws Exception  {
+        try {
+            return stub.addCollection(parentPath, collectionName, mediaType, description);
+        } catch (Exception e) {
+            String msg = "Failed to add collection " + collectionName + " for parent path: " + parentPath + ". " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public void addResource(String path, String mediaType, String description, DataHandler content,
+                            String symlinkLocation, String tenantPass)
+            throws Exception {
+
+        try {
+            Options options = stub._getServiceClient().getOptions();
+            options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+            options.setTimeOutInMilliSeconds(300000);
+            stub.addResource(path, mediaType, description, content, symlinkLocation, tenantPass);
+
+        } catch (Exception e) {
+
+            String msg = "Failed to add resource " + path + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public void importResource(
+            String parentPath,
+            String resourceName,
+            String mediaType,
+            String description,
+            String fetchURL,
+            String symlinkLocation,
+            boolean isAsync,
+            String tenantPass) throws Exception {
+
+        try {
+            // This is used by the add wsdl UI. WSDL validation takes long when there are wsdl
+            // imports to prevent this we make a async call.
+            if (isAsync) {
+                stub._getServiceClient().getOptions().setProperty(
+                        MessageContext.CLIENT_API_NON_BLOCKING,Boolean.TRUE);
+            }
+            stub.importResource(parentPath, resourceName, mediaType, description, fetchURL, symlinkLocation, tenantPass);
+        } catch (Exception e) {
+            String msg = "Failed to import resource with name " + resourceName +
+                    " to the parent collection " + parentPath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+    }
+
+
+    public void addTextResource(
+            String parentPath,
+            String fileName,
+            String mediaType,
+            String description,
+            String content) throws Exception {
+
+        try {
+            stub.addTextResource(parentPath, fileName, mediaType, description, content);
+        } catch (Exception e) {
+            String msg = "Failed to add new text resource with name " + fileName +
+                    " to the parent collection " + parentPath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+    }
+
+    public MetadataBean getMetadata(HttpServletRequest request) throws Exception {
+
+        String path = RegistryUtil.getPath(request);
+        if (path == null) {
+            path = getSessionResourcePath();
+            if (path == null) {
+                path = RegistryConstants.ROOT_PATH;
+            }
+
+            request.setAttribute("path", path);
+        }
+
+        MetadataBean bean = null;
+        try {
+            bean = stub.getMetadata(path);
+        } catch (Exception e) {
+            String msg = "Failed to get resource metadata from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return bean;
+    }
+
+    public MetadataBean getMetadata(HttpServletRequest request,String root) throws Exception {
+
+        String path = RegistryConstants.ROOT_PATH;
+        request.setAttribute("path", path);
+        if (path == null) {
+            path = getSessionResourcePath();
+            if (path == null) {
+                path = RegistryConstants.ROOT_PATH;
+            }
+        }
+
+        MetadataBean bean = null;
+        try {
+            bean = stub.getMetadata(path);
+        } catch (Exception e) {
+            String msg = "Failed to get resource metadata from the resource service. " +
+                    e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+
+        return bean;
+    }
+
+    public String getSessionResourcePath() throws Exception {
+
+        String sessionResourcePath;
+        try {
+            sessionResourcePath = stub.getSessionResourcePath();
+        } catch (Exception e) {
+
+            String msg = "Failed to get the session resource path. " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+        return sessionResourcePath;
+    }
+
+
+    public String getTextContent(HttpServletRequest request) throws Exception {
+
+        String path = RegistryUtil.getPath(request);
+
+        String textContent = null;
+        try {
+            textContent = stub.getTextContent(path);
+        } catch (Exception e) {
+
+            String msg = "Failed get text content of the resource " +
+                    path + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+        return textContent;
+    }
+
+     public void updateTextContent(String resourcePath, String contentText) throws Exception {
+
+        try {
+            stub.updateTextContent(resourcePath, contentText);
+        } catch (Exception e) {
+
+            String msg = "Failed to update text content of the resource " +
+                    resourcePath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public ContentDownloadBean getContentDownloadBean(String path) throws Exception {
+
+        ContentDownloadBean bean = stub.getContentDownloadBean(path);
+        return bean;
+    }
+
+    public void renameResource(
+            String parentPath, String oldResourcePath, String newResourceName)
+            throws Exception {
+
+        try {
+            stub.renameResource(parentPath, oldResourcePath, newResourceName);
+        } catch (Exception e) {
+            String msg = "Failed to rename resource with name " + oldResourcePath +
+                    " to the new name " + newResourceName + ". " + e.getMessage();
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+    }
+
+    public void delete(String pathToDelete) throws Exception {
+
+        try {
+            stub.delete(pathToDelete);
+        } catch (Exception e) {
+            String msg = "Failed to delete " + pathToDelete + ". " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public String[] getAllPaths() throws Exception {
+
+        try {
+            return  stub.getAllPaths();
+        } catch (Exception e) {
+            String msg = "Failed to getAllPaths. " + e.getMessage();
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public String[] getAllThemes(String tenantPass) throws Exception {
+        try {
+            return stub.getAllThemes(tenantPass);
+        } catch (Exception e) {
+            String msg = "Failed to get All Themes.";
+            log.error(msg, e);
+            throw e;
+        }
+    }
+
+    public void applyTheme(String themeName, String tenantPass) throws Exception {
+        try {
+            stub.applyTheme(themeName, tenantPass);
+        } catch (Exception e) {
+            String msg = "Failed to apply the theme: " + themeName;
+            log.error(msg, e);
+            throw e;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f6330834/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/wso2/carbon/theme/mgt/ui/processors/AddThemeResourceProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/wso2/carbon/theme/mgt/ui/processors/AddThemeResourceProcessor.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/wso2/carbon/theme/mgt/ui/processors/AddThemeResourceProcessor.java
new file mode 100644
index 0000000..11b0bd6
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/wso2/carbon/theme/mgt/ui/processors/AddThemeResourceProcessor.java
@@ -0,0 +1,240 @@
+/*
+ *  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.ui.processors;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.CarbonException;
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.wso2.carbon.theme.mgt.ui.clients.ThemeMgtServiceClient;
+import org.wso2.carbon.ui.CarbonUIMessage;
+import org.wso2.carbon.ui.transports.fileupload.AbstractFileUploadExecutor;
+import org.wso2.carbon.utils.FileItemData;
+import org.wso2.carbon.utils.ServerConstants;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.mail.util.ByteArrayDataSource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+
+
+/*
+* Copyright (c) 2006, 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.
+*/
+
+
+public class AddThemeResourceProcessor extends AbstractFileUploadExecutor {
+
+    private static final Log log = LogFactory.getLog(AddThemeResourceProcessor.class);
+
+    public boolean execute(HttpServletRequest request, HttpServletResponse response)
+            throws CarbonException, IOException {
+
+        String webContext = (String) request.getAttribute(CarbonConstants.WEB_CONTEXT);
+        String serverURL = (String) request.getAttribute(CarbonConstants.SERVER_URL);
+        String cookie = (String) request.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+        // HttpSession session = request.getSession();
+
+        Map<String, ArrayList<FileItemData>> fileItemsMap = getFileItemsMap();
+        if (fileItemsMap == null || fileItemsMap.isEmpty()) {
+            String msg = "File uploading failed. Content is not set properly.";
+            log.error(msg);
+
+            CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request);
+            response.sendRedirect(
+                    "../" + webContext + "/admin/error.jsp");
+
+            return false;
+        }
+
+        try {
+            ThemeMgtServiceClient client =
+                    new ThemeMgtServiceClient(cookie, serverURL, configurationContext);
+
+            String parentPath = null;
+            Map<String, ArrayList<java.lang.String>> formFieldsMap = getFormFieldsMap();
+            if (formFieldsMap.get("path") != null) {
+                parentPath = formFieldsMap.get("path").get(0);
+            }
+            String resourceName = null;
+            if (formFieldsMap.get("filename") != null) {
+                resourceName = formFieldsMap.get("filename").get(0);
+            }
+            String mediaType = null;
+            if (formFieldsMap.get("mediaType") != null) {
+                mediaType = formFieldsMap.get("mediaType").get(0);
+            }
+            String description = null;
+            if (formFieldsMap.get("description") != null) {
+                description = formFieldsMap.get("description").get(0);
+            }
+            String symlinkLocation = null;
+            if (formFieldsMap.get("symlinkLocation") != null) {
+                symlinkLocation = formFieldsMap.get("symlinkLocation").get(0);
+            }
+            String redirectWith = null;
+            if (formFieldsMap.get("redirectWith") != null) {
+                redirectWith = formFieldsMap.get("redirectWith").get(0);
+            }
+            /*
+            // currently chroot will not work with multitenancy
+            IServerAdmin adminClient =
+                    (IServerAdmin) CarbonUIUtil.
+                            getServerProxy(new ServerAdminClient(configurationContext,
+                                    serverURL, cookie, session), IServerAdmin.class, session);
+            ServerData data = adminClient.getServerData();
+            String chroot = "";
+            if (data.getRegistryType().equals("remote") && data.getRemoteRegistryChroot() != null &&
+                    !data.getRemoteRegistryChroot().equals(RegistryConstants.PATH_SEPARATOR)) {
+                chroot = data.getRemoteRegistryChroot();
+                if (!chroot.startsWith(RegistryConstants.PATH_SEPARATOR)) {
+                    chroot = RegistryConstants.PATH_SEPARATOR + chroot;
+                }
+                if (chroot.endsWith(RegistryConstants.PATH_SEPARATOR)) {
+                    chroot = chroot.substring(0, chroot.length() - RegistryConstants.PATH_SEPARATOR.length());
+                }
+            }
+            if (symlinkLocation != null) {
+                symlinkLocation = chroot + symlinkLocation;
+            }
+            */
+
+            FileItemData fileItemData = fileItemsMap.get("upload").get(0);
+
+            if ((fileItemData == null) || (fileItemData.getFileItem().getSize() == 0)) {
+                String msg = "Failed add resource. Resource content is empty.";
+                log.error(msg);
+
+                CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request);
+                response.sendRedirect(
+                        "../" + webContext + "/admin/error.jsp");
+
+                return false;
+            }
+            DataHandler dataHandler = scaleImage(fileItemData.getDataHandler(), 48, 119);
+
+            client.addResource(
+                    calculatePath(parentPath, resourceName), mediaType, description, dataHandler,
+                    symlinkLocation, redirectWith);
+
+            response.setContentType("text/html; charset=utf-8");
+            String msg = "The logo has been successfully updated.";
+            CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.INFO, request);
+
+            String redirectTo = request.getParameter("redirectto");
+            if ("theme_mgt".equals(redirectTo)) {
+                response.setHeader("Cache-Control", "no-cache, must-revalidate");
+                response.sendRedirect("../" + webContext +
+                        "/tenant-theme/theme_mgt.jsp?logoChanged=true&redirectWith=" + redirectWith);
+            }else if ("logo_mgt".equals(redirectTo)) {
+                response.setHeader("Cache-Control", "no-cache, must-revalidate");
+                response.sendRedirect("../" + webContext +
+                        "/tenant-theme/logo_mgt.jsp?logoChanged=true&redirectWith=" + redirectWith);
+            }
+            else {
+                response.sendRedirect("../" + webContext + "/tenant-theme/theme_advanced.jsp?path=" + parentPath);
+            }
+            return true;
+
+        } catch (Exception e) {
+            String msg = "File upload failed. Please confirm that the chosen image is not corrupted " +
+                    "and retry uploading, or upload a valid image.";
+            log.error(msg + " " + e.getMessage());
+
+            CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request);
+            response.sendRedirect(
+                    "../" + webContext + "/admin/error.jsp");
+
+            return false;
+        }
+    }
+
+    private static DataHandler scaleImage(DataHandler dataHandler, int height, int width) throws IOException {
+
+        Image image = ImageIO.read(new BufferedInputStream(dataHandler.getInputStream()));
+        // Check if the image has transparent pixels
+        boolean hasAlpha = ((BufferedImage)image).getColorModel().hasAlpha();
+
+        // Maintain Aspect ratio
+        int thumbHeight = height;
+        int thumbWidth = width;
+        double thumbRatio = (double)width / (double)height;
+        double imageRatio = (double)image.getWidth(null) / (double)image.getHeight(null);
+        if (thumbRatio < imageRatio) {
+            thumbHeight = (int)(thumbWidth / imageRatio);
+        } else {
+            thumbWidth = (int)(thumbHeight * imageRatio);
+        }
+
+        BufferedImage thumb;
+        // Check if transparent pixels are available and set the color mode accordingly 
+        if (hasAlpha) {
+            thumb = new BufferedImage(thumbWidth, thumbHeight, BufferedImage.TYPE_INT_ARGB);
+        } else {
+            thumb = new BufferedImage(thumbWidth, thumbHeight, BufferedImage.TYPE_INT_RGB);
+        }
+        Graphics2D graphics2D = thumb.createGraphics();
+        graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+                                    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+        graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);
+
+        // Save the image as PNG so that transparent images are rendered as intended
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+        ImageIO.write(thumb, "PNG", output);
+
+        DataSource dataSource= new ByteArrayDataSource(output.toByteArray(), "application/octet-stream");
+        return new DataHandler(dataSource);
+    }
+
+    private static String calculatePath(String parentPath, String resourceName) {
+        String resourcePath;
+        if (!parentPath.startsWith(RegistryConstants.PATH_SEPARATOR)) {
+            parentPath = RegistryConstants.PATH_SEPARATOR + parentPath;
+        }
+        if (parentPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
+            resourcePath = parentPath + resourceName;
+        } else {
+            resourcePath = parentPath + RegistryConstants.PATH_SEPARATOR + resourceName;
+        }
+        return resourcePath;
+    }
+}