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

[07/11] Refactoring org.wso2.carbon.cartridge.mgt.ui to org.apache.stratos.cartridge.mgt.ui

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/annotated-xsd.xsl
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/annotated-xsd.xsl b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/annotated-xsd.xsl
new file mode 100644
index 0000000..3209e7c
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/annotated-xsd.xsl
@@ -0,0 +1,850 @@
+<?xml version="1.0"?>
+<!--
+  ~ Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ 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.
+  -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
+    <!--
+         Created by: Jonathan Marsh <jo...@wso2.com>
+         23 October 2006
+         7 November 2006 - JM: code review and cleanup
+     -->
+    <xsl:output method="html" indent="yes" encoding="UTF-8"/>
+    <!--
+         Many schemas refer to the built-in schema types.  In order to navigate to those types, one needs
+         to know where to load the schema for schemas, hopefully a local version with this stylesheet
+         applied so the user can continue to navigate.
+      -->
+    <xsl:param name="xsd-schema-location" select="'/service-mgt/styles/XMLSchema.xsd'"/>
+
+    <!-- QName resolving functions require the targetNamespace, so stuff it in a global variable. -->
+    <xsl:variable name="targetNamespace" select="xs:schema/@targetNamespace"/>
+
+    <!-- Mozilla doesn't support the namespace axis, which makes simulating namespace declarations
+         problematic.  At least we can try alternate reconstruction methods if we know the functionality
+         isn't there.  -->
+    <xsl:variable name="supports-namespace-axis" select="count(/*/namespace::*) &gt; 0"/>
+
+    <!-- ===  Main  ========================================
+         Main template for the schema document
+     -->
+    <xsl:template match="/">
+        <html>
+            <head>
+                <title>Schema for
+                    <xsl:value-of select="xs:schema/@targetNamespace"/>
+                </title>
+                <style type="text/css">
+                    <xsl:call-template name="css"/>
+                </style>
+            </head>
+            <body>
+                <!-- use a table to ensure sidebars longer than their associated tag don't run into the following sidebar.
+                        CSS would be preferable (progressive rendering would be improved) if there were a way to do this (I can't find one.) -->
+                <table cellpadding="0" cellspacing="0">
+                    <xsl:apply-templates select="xs:schema"/>
+                </table>
+                <p/>
+                <hr/>
+                <table cellpadding="0" cellspacing="0" id="index">
+                    <xsl:call-template name="generate-xsd-index"/>
+                </table>
+            </body>
+        </html>
+    </xsl:template>
+    <!-- ===  Elements  ========================================
+         The following templates format elements of various flavors
+         (xs:schema, children of xs:schema, grandchildren etc. of schema, and extension elements)
+     -->
+    <xsl:template match="xs:schema">
+        <!--
+              Schema element has schema-block classes, enabling a stylesheet to style the
+              entire schema, especially useful when embedding schema in another langage (e.g. WSDL).
+          -->
+        <tr>
+            <td class="schema-block annotation-area">
+                <div class="sidebar">
+                    <xsl:call-template name="index-reference"/>
+                </div>
+            </td>
+            <td class="schema-block">
+                <div class="arrow">&#160;</div>
+            </td>
+            <td class="schema-block source-area">
+                <div class="schema">
+                    <xsl:call-template name="element-start"/>
+                </div>
+            </td>
+        </tr>
+        <xsl:apply-templates/>
+        <tr>
+            <td colspan="2" class="schema-block annotation-area"/>
+            <td class="schema-block source-area">
+                <div class="schema">
+                    <xsl:call-template name="element-end"/>
+                </div>
+            </td>
+        </tr>
+    </xsl:template>
+    <xsl:template match="xs:schema/xs:*">
+        <xsl:variable name="identifier">
+            <xsl:call-template name="schema-identifier"/>
+        </xsl:variable>
+        <tr>
+            <xsl:choose>
+                <!-- Decide which top-level schema elements get sidebars -->
+                <xsl:when test="not(self::xs:annotation or self::xs:import or self::xs:include)">
+                    <td class="schema-block annotation-area">
+                        <div class="{local-name()} sidebar sidebar-title">
+                            <xsl:if test="$identifier">
+                                <xsl:attribute name="id">
+                                    <xsl:value-of select="$identifier"/>
+                                </xsl:attribute>
+                            </xsl:if>
+                            <span class="sidebar-title-highlight">
+                                <xsl:value-of select="@name"/>
+                            </span>
+                            <xsl:text></xsl:text>
+                            <xsl:value-of select="local-name()"/>
+                            <xsl:call-template name="referenced-by"/>
+                        </div>
+                    </td>
+                    <td class="schema-block">
+                        <div class="arrow">&#160;</div>
+                    </td>
+                </xsl:when>
+                <xsl:otherwise>
+                    <td colspan="2" class="schema-block annotation-area"/>
+                </xsl:otherwise>
+            </xsl:choose>
+            <td class="schema-block source-area">
+                <div class="schema-top-level">
+                    <xsl:call-template name="element-start"/>
+                </div>
+                <div class="schema-top-level">
+                    <xsl:apply-templates/>
+                </div>
+                <div class="schema-top-level">
+                    <xsl:call-template name="element-end"/>
+                </div>
+            </td>
+        </tr>
+    </xsl:template>
+    <xsl:template match="xs:*">
+        <!-- Third and deeper levels of schema elements (no sidebar, therefore no table row - just a div. -->
+        <xsl:variable name="identifier">
+            <xsl:call-template name="schema-identifier"/>
+        </xsl:variable>
+        <div class="indent">
+            <xsl:if test="$identifier != ''">
+                <xsl:attribute name="id">
+                    <xsl:value-of select="$identifier"/>
+                </xsl:attribute>
+            </xsl:if>
+            <div>
+                <xsl:call-template name="element-start"/>
+            </div>
+            <xsl:apply-templates/>
+            <div>
+                <xsl:call-template name="element-end"/>
+            </div>
+        </div>
+    </xsl:template>
+    <xsl:template match="xs:schema/*[not(self::xs:*)]">
+        <!-- Top-level extension elements -->
+        <tr>
+            <td colspan="2" class="schema-block annotation-area"/>
+            <td class="schema-block source-area">
+                <div class="schema-top-level extension">
+                    <xsl:call-template name="element-start">
+                        <xsl:with-param name="class" select="'markup-extension-element'"/>
+                    </xsl:call-template>
+                </div>
+                <xsl:apply-templates/>
+                <div class="extension">
+                    <xsl:call-template name="element-end">
+                        <xsl:with-param name="class" select="'markup-extension-element'"/>
+                    </xsl:call-template>
+                </div>
+            </td>
+        </tr>
+    </xsl:template>
+    <xsl:template match="*">
+        <!-- If we've got to here, we're dealing with non-top-level extension elements.  -->
+        <div class="indent">
+            <div class="extension">
+                <xsl:call-template name="element-start">
+                    <xsl:with-param name="class" select="'markup-extension-element'"/>
+                </xsl:call-template>
+            </div>
+            <xsl:apply-templates/>
+            <div class="extension">
+                <xsl:call-template name="element-end">
+                    <xsl:with-param name="class" select="'markup-extension-element'"/>
+                </xsl:call-template>
+            </div>
+        </div>
+    </xsl:template>
+    <!-- ===  Attributes  =========================================
+         The following templates format attributes of various flavors
+     -->
+    <xsl:template match="xs:*/@id">
+        <a name="{@id}"/>
+        <xsl:call-template name="attribute"/>
+    </xsl:template>
+    <xsl:template match="xs:*/@name">
+        <xsl:call-template name="attribute">
+            <xsl:with-param name="value-class">markup-name-attribute-value</xsl:with-param>
+        </xsl:call-template>
+    </xsl:template>
+    <xsl:template match="xs:*/@ref">
+        <xsl:call-template name="attribute">
+            <xsl:with-param name="value-class">markup-name-attribute-value</xsl:with-param>
+            <xsl:with-param name="reference">
+                <xsl:call-template name="external-reference"/>
+                <xsl:text>#_</xsl:text>
+                <xsl:value-of select="local-name(..)"/>
+                <xsl:text>_</xsl:text>
+                <xsl:value-of select="substring-after(.,':')"/>
+            </xsl:with-param>
+        </xsl:call-template>
+    </xsl:template>
+    <xsl:template match="xs:*/@type | xs:*/@base | xs:*/@itemType | xs:*/@memberTypes">
+        <xsl:call-template name="attribute">
+            <xsl:with-param name="value-class">markup-name-attribute-value</xsl:with-param>
+            <xsl:with-param name="reference">
+                <xsl:call-template name="external-reference"/>
+                <xsl:text>#_type_</xsl:text>
+                <xsl:value-of select="substring-after(.,':')"/>
+            </xsl:with-param>
+        </xsl:call-template>
+    </xsl:template>
+    <xsl:template match="xs:*/@source | xs:*/@schemaLocation">
+        <xsl:call-template name="attribute">
+            <xsl:with-param name="reference" select="."/>
+        </xsl:call-template>
+    </xsl:template>
+    <xsl:template match="@*">
+        <xsl:call-template name="attribute"/>
+    </xsl:template>
+
+    <!-- ===  Text nodes  ========================================
+         The following template formats text nodes
+     -->
+    <xsl:template match="text()[normalize-space(.) != '']">
+        <div class="markup-text-content">
+            <xsl:value-of select="."/>
+        </div>
+    </xsl:template>
+
+    <!-- ===  Comments  ========================================
+         The following template formats comment nodes
+     -->
+    <xsl:template match="xs:schema/comment()">
+        <tr>
+            <td colspan="2" class="schema-block annotation-area"/>
+            <td class="schema-block source-area">
+                <div class="schema-top-level markup-comment">
+                    <xsl:text>&lt;!--</xsl:text>
+                    <xsl:value-of select="."/>
+                    <xsl:text>--&gt;</xsl:text>
+                </div>
+            </td>
+        </tr>
+    </xsl:template>
+    <xsl:template match="comment()">
+        <div class="markup-comment indent">
+            <xsl:text>&lt;!--</xsl:text>
+            <xsl:value-of select="."/>
+            <xsl:text>--&gt;</xsl:text>
+        </div>
+    </xsl:template>
+
+    <!-- ===  Library templates  ========================================
+         Library of useful named templates
+     -->
+    <xsl:template name="css"><![CDATA[
+.schema {padding-left:5em; text-indent:-5em}
+.schema-top-level {padding-left: 6em; text-indent:-5em}
+.indent {margin-left:1em}
+.double-indent {margin-left:2em}
+.trivialText {color:gray}
+
+td {vertical-align:top; font: 100%/1.3 "Lucida Grande","Lucida Sans","Lucida Sans Unicode","trebuchet ms",verdana,sans-serif}
+.annotation-area {width:16em}
+.source-area    {font-size:80%; padding-bottom:.6em}
+.sidebar        {font-size:80%; padding-bottom:.6em; margin-bottom:2px}
+.arrow          {border-top: 1px dashed black; width:2em; position:relative; top:.5em}
+.note           {background-color:rgb(255,255,210); text-align:right; border: 1px dashed black; padding:.5em}
+.simpleType     {background-color:rgb(255,242,210); text-align:right; border: 1px dashed black; padding:.5em} 
+.complexType    {background-color:rgb(255,242,210); text-align:right; border: 1px dashed black; padding:.5em} 
+.element        {background-color:rgb(225,237,246); text-align:right; border: 1px dashed black; padding:.5em}
+.group          {background-color:rgb(225,237,246); text-align:right; border: 1px dashed black; padding:.5em} 
+.attribute      {background-color:rgb(225,246,235); text-align:right; border: 1px dashed black; padding:.5em} 
+.attributeGroup {background-color:rgb(225,246,235); text-align:right; border: 1px dashed black; padding:.5em} 
+.redefine       {background-color:rgb(255,255,210); text-align:right; border: 1px dashed black; padding:.5em} 
+.notation       {background-color:rgb(255,255,210); text-align:right; border: 1px dashed black; padding:.5em} 
+.sidebar-title  {} 
+.sidebar-title-highlight {font-weight:bold}
+.sidebar-text   {padding-top:.3em}
+ul {margin-left:1em; margin-top:0em; margin-bottom:0em}
+.referenced-item {list-style-type:square; text-align:left; margin-left:.5em}
+.referenced-list {margin-top:.5em; text-align:left}
+
+#index {margin-top:2em; margin-bottom:2em} 
+
+.markup {color:gray}
+.markup-element {color:gray; text-indent:-2em; }
+.markup-extension-element {color:navy}
+.markup-attribute {color:gray}
+.markup-extension-attribute {color:navy}
+.markup-attribute-value {}
+.markup-name-attribute-value {font-weight:bold}
+.markup-namespace {color:purple}
+.markup-namespace-uri {color:purple}
+.markup-text-content  {margin-left:-4em; text-indent:0em}
+.markup-comment  {color:green}
+]]>
+    </xsl:template>
+    <xsl:template name="attribute">
+        <xsl:param name="value-class" select="'markup-attribute-value'"/>
+        <xsl:param name="reference"/>
+        <xsl:param name="native-attribute" select="parent::xs:* and namespace-uri(.)=''"/>
+        <xsl:text></xsl:text>
+        <span>
+            <xsl:choose>
+                <xsl:when test="$native-attribute">
+                    <xsl:attribute name="class">markup-attribute</xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="class">markup-extension-attribute</xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+            <xsl:value-of select="name(.)"/>
+        </span>
+        <span class="markup">
+            <xsl:text>="</xsl:text>
+        </span>
+        <span class="{$value-class}">
+            <xsl:choose>
+                <xsl:when test="$reference">
+                    <a href="{$reference}">
+                        <xsl:value-of select="."/>
+                    </a>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="."/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </span>
+        <span class="markup">
+            <xsl:text>"</xsl:text>
+        </span>
+    </xsl:template>
+    <xsl:template name="namespaces">
+        <xsl:variable name="current" select="current()"/>
+        <!-- Unfortunately Mozilla doesn't support the namespace axis, need to check for that and simulate declarations -->
+        <xsl:choose>
+            <xsl:when test="$supports-namespace-axis">
+                <!--
+                        When the namespace axis is present (e.g. Internet Explorer), we can simulate
+                        the namespace declarations by comparing the namespaces in scope on this element
+                        with those in scope on the parent element.  Any difference must have been the
+                        result of a namespace declaration.  Note that this doesn't reflect the actual
+                        source - it will strip out redundant namespace declarations.
+                    -->
+                <xsl:for-each select="namespace::*[. != 'http://www.w3.org/XML/1998/namespace']">
+                    <xsl:if test="not($current/parent::*[namespace::*[. = current()]])">
+                        <span class="markup-namespace">
+                            <xsl:text>xmlns</xsl:text>
+                            <xsl:if test="name() != ''">:</xsl:if>
+                            <xsl:value-of select="name()"/>
+                            <xsl:text>="</xsl:text>
+                        </span>
+                        <span class="markup-namespace-uri">
+                            <xsl:value-of select="."/>
+                        </span>
+                        <span class="markup-namespace">
+                            <xsl:text>"</xsl:text>
+                        </span>
+                    </xsl:if>
+                </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+                <!--
+                        When the namespace axis isn't supported (e.g. Mozilla), we can simulate
+                        appropriate declarations from namespace elements.
+                        This currently doesn't check for namespaces on attributes.
+                        In the general case we can't reliably detect the use of QNames in content, but
+                        in the case of schema, we know which content could contain a QName and look
+                        there too.  This mechanism is rather unpleasant though, since it records
+                        namespaces where they are used rather than showing where they are declared
+                        (on some parent element) in the source.  Yukk!
+                    -->
+                <xsl:if test="namespace-uri(.) != namespace-uri(parent::*)">
+                    <span class="markup-namespace">
+                        <xsl:text>xmlns</xsl:text>
+                        <xsl:if test="substring-before(name(),':') != ''">:</xsl:if>
+                        <xsl:value-of select="substring-before(name(),':')"/>
+                        <xsl:text>="</xsl:text>
+                    </span>
+                    <span class="markup-namespace-uri">
+                        <xsl:value-of select="namespace-uri(.)"/>
+                    </span>
+                    <span class="markup-namespace">
+                        <xsl:text>"</xsl:text>
+                    </span>
+                </xsl:if>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template name="element-start">
+        <xsl:param name="class" select="'markup-element'"/>
+        <span class="markup">&lt;</span>
+        <span class="{$class}">
+            <xsl:value-of select="name(.)"/>
+        </span>
+        <xsl:apply-templates select="@*"/>
+        <xsl:call-template name="namespaces"/>
+        <span class="markup">
+            <xsl:if test="not(node())">
+                <xsl:text>/</xsl:text>
+            </xsl:if>
+            <xsl:text>&gt;</xsl:text>
+        </span>
+    </xsl:template>
+    <xsl:template name="element-end">
+        <xsl:param name="class" select="'markup-element'"/>
+        <xsl:if test="node()">
+            <span class="markup">
+                <xsl:text>&lt;/</xsl:text>
+            </span>
+            <span class="{$class}">
+                <xsl:value-of select="name(.)"/>
+            </span>
+            <span class="markup">
+                <xsl:text>&gt;</xsl:text>
+            </span>
+        </xsl:if>
+    </xsl:template>
+
+    <xsl:template name="schema-identifier">
+        <!-- Calculate a fragment identifier for the element this element refers to, if any -->
+        <xsl:if test="@name | @ref">
+            <xsl:choose>
+                <xsl:when
+                        test="(self::xs:attribute or self::xs:element) and not(parent::xs:schema)">
+                    <xsl:variable name="top" select="ancestor::*[parent::xs:schema]"/>
+                    <xsl:variable name="toptype">
+                        <xsl:choose>
+                            <xsl:when test="$top[self::xs:complexType or self::xs:simpleType]">type
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:value-of select="local-name($top)"/>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+                    <xsl:text>_local</xsl:text>
+                    <xsl:value-of select="local-name()"/>
+                    <xsl:text>_</xsl:text>
+                    <xsl:value-of select="$toptype"/>
+                    <xsl:text>_</xsl:text>
+                    <xsl:value-of select="$top/@name"/>
+                </xsl:when>
+                <xsl:when test="local-name()='complexType' or local-name()='simpleType'">_type
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:text>_</xsl:text>
+                    <xsl:value-of select="local-name()"/>
+                </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>_</xsl:text>
+            <xsl:value-of select="@name | @ref"/>
+        </xsl:if>
+    </xsl:template>
+
+    <xsl:template name="componentListItem">
+        <xsl:variable name="typeIdentifier">
+            <xsl:choose>
+                <xsl:when test="self::xs:complexType or self::xs:simpleType">type</xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="local-name()"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:if test="position()>1">
+            <xsl:text>,</xsl:text>
+        </xsl:if>
+        <a href="#_{$typeIdentifier}_{@name}">
+            <xsl:value-of select="@name"/>
+        </a>
+    </xsl:template>
+    <xsl:template name="localComponentListItem">
+        <xsl:variable name="typeIdentifier" select="local-name()"/>
+        <xsl:variable name="top" select="ancestor::*[parent::xs:schema]"/>
+        <xsl:variable name="toptype">
+            <xsl:choose>
+                <xsl:when test="$top[self::xs:complexType or self::xs:simpleType]">type</xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="local-name($top)"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="tnsName">
+            <xsl:choose>
+                <xsl:when test="contains(@name, ':') and namespace::*[. = $targetNamespace and name(.) =
+					substring-before(@name,':')]">
+                    <xsl:value-of select="substring-after(@name,':')"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="@name"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:if test="position()>1">
+            <xsl:text>,</xsl:text>
+        </xsl:if>
+        <a href="#_local{$typeIdentifier}_{$toptype}_{$top/@name}_{@name}">
+            <xsl:value-of select="$tnsName"/>
+        </a>
+        <span class="trivialText">of the</span>
+        <xsl:value-of select="$top/@name"/>
+        <xsl:text></xsl:text>
+        <span class="trivialText">
+            <xsl:value-of select="local-name($top)"/>
+        </span>
+    </xsl:template>
+    <xsl:template name="insert-reference">
+        <xsl:if test="self::xs:attribute">
+            <xsl:variable name="top" select="ancestor::*[parent::xs:schema]"/>
+            <xsl:variable name="toptype">
+                <xsl:choose>
+                    <xsl:when test="$top[self::xs:complexType or self::xs:simpleType]">type
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:value-of select="local-name($top)"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+            <a href="#_localattribute_{$toptype}_{$top/@name}_{@name | @ref}">
+                <xsl:value-of select="@name | @ref"/>
+            </a>
+            <xsl:text>local attribute of the</xsl:text>
+        </xsl:if>
+        <xsl:for-each select="ancestor-or-self::xs:*[last() - 1]">
+            <xsl:variable name="type">
+                <xsl:choose>
+                    <xsl:when test="self::xs:complexType or self::xs:simpleType">type</xsl:when>
+                    <xsl:otherwise>
+                        <xsl:value-of select="local-name(.)"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+            <a href="#_{$type}_{@name}">
+                <xsl:value-of select="@name"/>
+            </a>
+            <xsl:text></xsl:text>
+            <xsl:value-of select="local-name(.)"/>
+        </xsl:for-each>
+    </xsl:template>
+    <xsl:template name="referenced-by">
+        <xsl:variable name="target" select="@name"/>
+        <xsl:if test="parent::xs:schema">
+            <div class="sidebar-text">
+                <xsl:variable name="extended-by" select="ancestor::xs:schema//xs:extension[substring-after(@base | @type | @ref |
+					@itemType,':') = $target]"/>
+                <xsl:if test="count($extended-by) > 0">
+                    <div class="referenced-list">Extended by:</div>
+                    <ul>
+                        <xsl:for-each select="$extended-by">
+                            <xsl:sort select="@base | @type | @ref | @itemType"/>
+                            <li class="referenced-item">
+                                <xsl:call-template name="insert-reference"/>
+                            </li>
+                        </xsl:for-each>
+                    </ul>
+                </xsl:if>
+                <xsl:variable name="restricted-by" select="ancestor::xs:schema//xs:restriction[substring-after(@base | @type | @ref |
+					@itemType,':') = $target]"/>
+                <xsl:if test="count($restricted-by) > 0">
+                    <div class="referenced-list">Restricted by:</div>
+                    <ul>
+                        <xsl:for-each select="$restricted-by">
+                            <xsl:sort select="@base | @type | @ref | @itemType"/>
+                            <li class="referenced-item">
+                                <xsl:call-template name="insert-reference"/>
+                            </li>
+                        </xsl:for-each>
+                    </ul>
+                </xsl:if>
+                <xsl:variable name="referenced-by" select="ancestor::xs:schema//xs:*[not(self::xs:extension) and
+					not(self::xs:restriction)][substring-after(@base | @type | @ref | @itemType,':')
+					= $target]"/>
+                <xsl:if test="count($referenced-by) > 0">
+                    <div class="referenced-list">Referenced by:</div>
+                    <ul>
+                        <xsl:for-each select="$referenced-by">
+                            <xsl:sort select="@base | @type | @ref | @itemType"/>
+                            <li class="referenced-item">
+                                <xsl:call-template name="insert-reference"/>
+                            </li>
+                        </xsl:for-each>
+                    </ul>
+                </xsl:if>
+                <xsl:call-template name="additional-references">
+                    <xsl:with-param name="target" select="$target"/>
+                </xsl:call-template>
+            </div>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template name="additional-references">
+        <xsl:param name="target"/>
+        <!-- override this template to list additonal references -->
+    </xsl:template>
+    <xsl:template name="external-reference">
+        <xsl:choose>
+            <xsl:when test="$supports-namespace-axis">
+                <xsl:if test="not(../namespace::*[. = $targetNamespace and name(.) =
+					substring-before(current(),':')])">
+                    <xsl:variable name="prefix" select="substring-before(.,':')"/>
+                    <xsl:variable name="uri" select="../namespace::*[name(.) = $prefix]"/>
+                    <xsl:choose>
+                        <xsl:when test="$uri = 'http://www.w3.org/2001/XMLSchema'">
+                            <xsl:value-of select="$xsd-schema-location"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:value-of
+                                    select="ancestor::xs:schema/xs:import[@namespace=$uri]/@schemaLocation"/>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:if>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:choose>
+                    <!-- Take a wild guess at the most commonly used type prefixes -->
+                    <xsl:when
+                            test="substring-before(current(),':') = 'xs' or substring-before(current(),':') = 'xsd'">
+                        <xsl:value-of select="$xsd-schema-location"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <!-- The link will be broken.  Bad Mozilla! -->
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template name="generate-xsd-index">
+        <xsl:if test="xs:schema/xs:complexType">
+            <tr>
+                <td id="complexType-list" class="annotation-area">
+                    <div class="complexType sidebar sidebar-title-highlight">Index of complexTypes
+                    </div>
+                </td>
+                <td>
+                    <div class="arrow">&#160;</div>
+                </td>
+                <td class="source-area">
+                    <xsl:for-each select="xs:schema/xs:complexType">
+                        <xsl:sort select="@name"/>
+                        <xsl:call-template name="componentListItem"/>
+                    </xsl:for-each>
+                </td>
+            </tr>
+        </xsl:if>
+        <xsl:if test="xs:schema/xs:simpleType">
+            <tr>
+                <td id="simpleType-list" class="annotation-area">
+                    <div class="simpleType sidebar sidebar-title-highlight">Index of simpleTypes
+                    </div>
+                </td>
+                <td>
+                    <div class="arrow">&#160;</div>
+                </td>
+                <td class="source-area">
+                    <xsl:for-each select="xs:schema/xs:simpleType">
+                        <xsl:sort select="@name"/>
+                        <xsl:call-template name="componentListItem"/>
+                    </xsl:for-each>
+                </td>
+            </tr>
+        </xsl:if>
+        <xsl:if test="xs:schema/xs:element">
+            <tr>
+                <td id="global-element-list" class="annotation-area">
+                    <div class="element sidebar sidebar-title-highlight">Index of global elements
+                    </div>
+                </td>
+                <td>
+                    <div class="arrow">&#160;</div>
+                </td>
+                <td class="source-area">
+                    <xsl:for-each select="xs:schema/xs:element">
+                        <xsl:sort select="@name"/>
+                        <xsl:call-template name="componentListItem"/>
+                    </xsl:for-each>
+                </td>
+            </tr>
+        </xsl:if>
+        <xsl:if test="xs:schema/*//xs:element[@name]">
+            <tr>
+                <td id="local-element-list" class="annotation-area">
+                    <div class="element sidebar sidebar-title-highlight">Index of local elements
+                    </div>
+                </td>
+                <td>
+                    <div class="arrow">&#160;</div>
+                </td>
+                <td class="source-area">
+                    <xsl:for-each select="xs:schema/*//xs:element[@name]">
+                        <xsl:sort select="@name"/>
+                        <xsl:call-template name="localComponentListItem"/>
+                    </xsl:for-each>
+                </td>
+            </tr>
+        </xsl:if>
+        <xsl:if test="xs:schema/xs:attribute">
+            <tr>
+                <td id="global-attribute-list" class="annotation-area">
+                    <div class="attribute sidebar sidebar-title-highlight">Index of global
+                        attributes
+                    </div>
+                </td>
+                <td>
+                    <div class="arrow">&#160;</div>
+                </td>
+                <td class="source-area">
+                    <xsl:for-each select="xs:schema/xs:attribute">
+                        <xsl:sort select="@name"/>
+                        <xsl:call-template name="componentListItem"/>
+                    </xsl:for-each>
+                </td>
+            </tr>
+        </xsl:if>
+        <xsl:if test="xs:schema/*//xs:attribute[@name]">
+            <tr>
+                <td id="local-attribute-list" class="annotation-area">
+                    <div class="attribute sidebar sidebar-title-highlight">Index of local attributes
+                    </div>
+                </td>
+                <td>
+                    <div class="arrow">&#160;</div>
+                </td>
+                <td class="source-area">
+                    <xsl:for-each select="xs:schema/*//xs:attribute[@name]">
+                        <xsl:sort select="@name"/>
+                        <xsl:call-template name="localComponentListItem"/>
+                    </xsl:for-each>
+                </td>
+            </tr>
+        </xsl:if>
+        <xsl:if test="xs:schema/xs:group">
+            <tr>
+                <td id="model-group-list" class="annotation-area">
+                    <div class="group sidebar sidebar-title-highlight">Index of model groups</div>
+                </td>
+                <td>
+                    <div class="arrow">&#160;</div>
+                </td>
+                <td class="source-area">
+                    <xsl:for-each select="xs:schema/xs:group">
+                        <xsl:sort select="@name"/>
+                        <xsl:call-template name="componentListItem"/>
+                    </xsl:for-each>
+                </td>
+            </tr>
+        </xsl:if>
+        <xsl:if test="xs:schema/xs:attributeGroup">
+            <tr>
+                <td id="attributeGroup-list" class="annotation-area">
+                    <div class="attributeGroup sidebar sidebar-title-highlight">Index of attribute
+                        groups
+                    </div>
+                </td>
+                <td>
+                    <div class="arrow">&#160;</div>
+                </td>
+                <td class="source-area">
+                    <xsl:for-each select="xs:schema/xs:attributeGroup">
+                        <xsl:sort select="@name"/>
+                        <xsl:call-template name="componentListItem"/>
+                    </xsl:for-each>
+                </td>
+            </tr>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template name="index-reference">
+        <div class="note sidebar-text">See the
+            <a href="#index">index</a>
+            of
+            <xsl:variable name="ss1">
+                <xsl:if test="xs:complexType">
+                    <a href="#complexType-list">complexTypes</a>
+                </xsl:if>
+            </xsl:variable>
+            <xsl:variable name="ss2">
+                <xsl:copy-of select="$ss1"/>
+                <xsl:if test="xs:simpleType">
+                    <xsl:if test="$ss1!=''">,</xsl:if>
+                    <a href="#simpleType-list">simpleTypes</a>
+                </xsl:if>
+            </xsl:variable>
+            <xsl:variable name="ss3">
+                <xsl:copy-of select="$ss2"/>
+                <xsl:if test="xs:element">
+                    <xsl:if test="$ss2!=''">,</xsl:if>
+                    <a href="#global-element-list">global elements</a>
+                </xsl:if>
+            </xsl:variable>
+            <xsl:variable name="ss4">
+                <xsl:copy-of select="$ss3"/>
+                <xsl:if test="*//xs:element[@name]">
+                    <xsl:if test="$ss3!=''">,</xsl:if>
+                    <a href="#local-element-list">local elements</a>
+                </xsl:if>
+            </xsl:variable>
+            <xsl:variable name="ss5">
+                <xsl:copy-of select="$ss4"/>
+                <xsl:if test="xs:attribute">
+                    <xsl:if test="$ss4!=''">,</xsl:if>
+                    <a href="#global-attribute-list">global attributes</a>
+                </xsl:if>
+            </xsl:variable>
+            <xsl:variable name="ss6">
+                <xsl:copy-of select="$ss5"/>
+                <xsl:if test="*//xs:attribute[@name]">
+                    <xsl:if test="$ss5!=''">,</xsl:if>
+                    <a href="#local-attribute-list">local attributes</a>
+                </xsl:if>
+            </xsl:variable>
+            <xsl:variable name="ss7">
+                <xsl:copy-of select="$ss6"/>
+                <xsl:if test="xs:group">
+                    <xsl:if test="$ss6!=''">,</xsl:if>
+                    <a href="#model-group-list">model groups</a>
+                </xsl:if>
+            </xsl:variable>
+            <xsl:variable name="ss8">
+                <xsl:copy-of select="$ss7"/>
+                <xsl:if test="xs:attributeGroup">
+                    <xsl:if test="$ss7!=''">,</xsl:if>
+                    <a href="#attributeGroup-list">attribute groups</a>
+                </xsl:if>
+            </xsl:variable>
+            <xsl:copy-of select="$ss8"/>
+            <xsl:text>defined in this schema.</xsl:text>
+        </div>
+    </xsl:template>
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/atom.xsl
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/atom.xsl b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/atom.xsl
new file mode 100644
index 0000000..7ce7e04
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/atom.xsl
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ 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.
+  -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="html"/>
+
+    <xsl:template match="ns1:feed" xmlns:ns1="http://www.w3.org/2005/Atom">
+        <html>
+            <head>
+                <title>
+                    <xsl:value-of select="ns2:title" xmlns:ns2="http://www.w3.org/2005/Atom"/>
+                </title>
+                <style media="all" lang="en" type="text/css">
+                    :root:before, :root:before {
+                    font: 80% "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif;
+                    font-size:70%;
+                    content: "This data file is meant to be read in a XML Atom reader. See document
+                    source."
+                    }
+                    .AtomTitle
+                    {
+                    display: block;
+                    font-size:200%;
+                    font-weight:bolder;
+                    color:#436976;
+                    text-decoration:none;
+                    border-bottom: 20px solid #dee7ec;
+                    }
+                    .Entry
+                    {
+                    border-width: 2px;
+                    border-color: #336699;
+                    border-style: solid;
+                    width: 500px;
+                    }
+                    .Title
+                    {
+                    background-color: #436976;
+                    color: #FFFFFF;
+                    font-size: 1.4em;
+                    font-family: Verdana;
+                    font-size: 9pt;
+                    font-weight: bold;
+                    padding-left: 5px;
+                    padding-top: 5px;
+                    padding-bottom: 5px;
+                    }
+                    .Title A:visited
+                    {
+                    color: #FFFFFF;
+                    text-decoration: underline;
+                    }
+                    .Title A:link
+                    {
+                    color: #FFFFFF;
+                    text-decoration: underline;
+                    }
+                    .Title A:hover
+                    {
+                    color: #FFFF00;
+                    text-decoration: none;
+                    }
+                    .Summary
+                    {
+                    color: #000000;
+                    font-family: Verdana;
+                    font-size: 9pt;
+                    padding-left: 5px;
+                    padding-top: 5px;
+                    padding-bottom: 5px;
+                    padding-right: 5px;
+                    }
+                </style>
+            </head>
+            <body>
+                <div class="AtomTitle">
+                    <xsl:value-of select="ns2:title" xmlns:ns2="http://www.w3.org/2005/Atom"/>
+                </div>
+                <br/>
+
+                <xsl:for-each select="ns2:entry" xmlns:ns2="http://www.w3.org/2005/Atom">
+
+                    <div class="Entry">
+                        <div class="Title">
+                            <a>
+                                <xsl:attribute name="href">
+                                    <xsl:value-of select="ns2:link/@href"
+                                                  xmlns:ns2="http://www.w3.org/2005/Atom"/>
+                                </xsl:attribute>
+                                <xsl:value-of select="ns2:title"
+                                              xmlns:ns2="http://www.w3.org/2005/Atom"/>
+                            </a>
+                            <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
+                            <xsl:value-of select="ns2:updated"
+                                          xmlns:ns2="http://www.w3.org/2005/Atom"/>
+                        </div>
+                        <div class="Summary">
+                            <xsl:choose>
+                                <xsl:when test="ns2:summary"
+                                          xmlns:ns2="http://www.w3.org/2005/Atom">
+                                    <b>Summary:</b>
+                                    <xsl:value-of select="ns2:summary"
+                                                  xmlns:ns2="http://www.w3.org/2005/Atom"/>
+                                </xsl:when>
+                            </xsl:choose>
+
+                        </div>
+                    </div>
+                    <br/>
+
+                </xsl:for-each>
+            </body>
+        </html>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/datatypes.dtd
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/datatypes.dtd b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/datatypes.dtd
new file mode 100644
index 0000000..cd47625
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/datatypes.dtd
@@ -0,0 +1,216 @@
+<!--
+  ~ Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ 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.
+  -->
+
+<!--
+        DTD for XML Schemas: Part 2: Datatypes
+        $Id: datatypes.dtd,v 1.23 2001/03/16 17:36:30 ht Exp $
+        Note this DTD is NOT normative, or even definitive. - - the
+        prose copy in the datatypes REC is the definitive version
+        (which shouldn't differ from this one except for this comment
+        and entity expansions, but just in case)
+  -->
+<!--
+        This DTD cannot be used on its own, it is intended
+        only for incorporation in XMLSchema.dtd, q.v.
+  -->
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % simpleType "%p;simpleType">
+<!ENTITY % restriction "%p;restriction">
+<!ENTITY % list "%p;list">
+<!ENTITY % union "%p;union">
+<!ENTITY % maxExclusive "%p;maxExclusive">
+<!ENTITY % minExclusive "%p;minExclusive">
+<!ENTITY % maxInclusive "%p;maxInclusive">
+<!ENTITY % minInclusive "%p;minInclusive">
+<!ENTITY % totalDigits "%p;totalDigits">
+<!ENTITY % fractionDigits "%p;fractionDigits">
+<!ENTITY % length "%p;length">
+<!ENTITY % minLength "%p;minLength">
+<!ENTITY % maxLength "%p;maxLength">
+<!ENTITY % enumeration "%p;enumeration">
+<!ENTITY % whiteSpace "%p;whiteSpace">
+<!ENTITY % pattern "%p;pattern">
+<!--
+        Customisation entities for the ATTLIST of each element
+        type. Define one of these if your schema takes advantage
+        of the anyAttribute='##other' in the schema for schemas
+  -->
+<!ENTITY % simpleTypeAttrs "">
+<!ENTITY % restrictionAttrs "">
+<!ENTITY % listAttrs "">
+<!ENTITY % unionAttrs "">
+<!ENTITY % maxExclusiveAttrs "">
+<!ENTITY % minExclusiveAttrs "">
+<!ENTITY % maxInclusiveAttrs "">
+<!ENTITY % minInclusiveAttrs "">
+<!ENTITY % totalDigitsAttrs "">
+<!ENTITY % fractionDigitsAttrs "">
+<!ENTITY % lengthAttrs "">
+<!ENTITY % minLengthAttrs "">
+<!ENTITY % maxLengthAttrs "">
+<!ENTITY % enumerationAttrs "">
+<!ENTITY % whiteSpaceAttrs "">
+<!ENTITY % patternAttrs "">
+<!-- Define some entities for informative use as attribute
+        types -->
+<!ENTITY % URIref "CDATA">
+<!ENTITY % XPathExpr "CDATA">
+<!ENTITY % QName "NMTOKEN">
+<!ENTITY % QNames "NMTOKENS">
+<!ENTITY % NCName "NMTOKEN">
+<!ENTITY % nonNegativeInteger "NMTOKEN">
+<!ENTITY % boolean "(true|false)">
+<!ENTITY % simpleDerivationSet "CDATA">
+<!--
+        #all or space-separated list drawn from derivationChoice
+  -->
+<!--
+        Note that the use of 'facet' below is less restrictive
+        than is really intended:  There should in fact be no
+        more than one of each of minInclusive, minExclusive,
+        maxInclusive, maxExclusive, totalDigits, fractionDigits,
+        length, maxLength, minLength within datatype,
+        and the min- and max- variants of Inclusive and Exclusive
+        are mutually exclusive. On the other hand,  pattern and
+        enumeration may repeat.
+  -->
+<!ENTITY % minBound "(%minInclusive; | %minExclusive;)">
+<!ENTITY % maxBound "(%maxInclusive; | %maxExclusive;)">
+<!ENTITY % bounds "%minBound; | %maxBound;">
+<!ENTITY % numeric "%totalDigits; | %fractionDigits;">
+<!ENTITY % ordered "%bounds; | %numeric;">
+<!ENTITY % unordered "%pattern; | %enumeration; | %whiteSpace; | %length; |
+   %maxLength; | %minLength;">
+<!ENTITY % facet "%ordered; | %unordered;">
+<!ENTITY % facetAttr "value CDATA #REQUIRED
+        id ID #IMPLIED">
+<!ENTITY % fixedAttr "fixed %boolean; #IMPLIED">
+<!ENTITY % facetModel "(%annotation;)?">
+<!ELEMENT %simpleType; ((%annotation;)?, (%restriction; | %list; | %union;))>
+<!ATTLIST %simpleType;
+	name %NCName; #IMPLIED
+	final %simpleDerivationSet; #IMPLIED
+	id ID #IMPLIED
+	%simpleTypeAttrs; 
+>
+<!-- name is required at top level -->
+<!ELEMENT %restriction; ((%annotation;)?, (%restriction1; | ((%simpleType;)?, (%facet;)*)), (%attrDecls;))>
+<!ATTLIST %restriction;
+	base %QName; #IMPLIED
+	id ID #IMPLIED
+	%restrictionAttrs; 
+>
+<!--
+        base and simpleType child are mutually exclusive,
+        one is required.
+
+        restriction is shared between simpleType and
+        simpleContent and complexContent (in XMLSchema.xsd).
+        restriction1 is for the latter cases, when this
+        is restricting a complex type, as is attrDecls.
+  -->
+<!ELEMENT %list; ((%annotation;)?, (%simpleType;)?)>
+<!ATTLIST %list;
+	itemType %QName; #IMPLIED
+	id ID #IMPLIED
+	%listAttrs; 
+>
+<!--
+        itemType and simpleType child are mutually exclusive,
+        one is required
+  -->
+<!ELEMENT %union; ((%annotation;)?, (%simpleType;)*)>
+<!ATTLIST %union;
+	id ID #IMPLIED
+	memberTypes %QNames; #IMPLIED
+	%unionAttrs; 
+>
+<!--
+        At least one item in memberTypes or one simpleType
+        child is required
+  -->
+<!ELEMENT %maxExclusive; %facetModel;>
+<!ATTLIST %maxExclusive;
+	%facetAttr; 
+	%fixedAttr; 
+	%maxExclusiveAttrs; 
+>
+<!ELEMENT %minExclusive; %facetModel;>
+<!ATTLIST %minExclusive;
+	%facetAttr; 
+	%fixedAttr; 
+	%minExclusiveAttrs; 
+>
+<!ELEMENT %maxInclusive; %facetModel;>
+<!ATTLIST %maxInclusive;
+	%facetAttr; 
+	%fixedAttr; 
+	%maxInclusiveAttrs; 
+>
+<!ELEMENT %minInclusive; %facetModel;>
+<!ATTLIST %minInclusive;
+	%facetAttr; 
+	%fixedAttr; 
+	%minInclusiveAttrs; 
+>
+<!ELEMENT %totalDigits; %facetModel;>
+<!ATTLIST %totalDigits;
+	%facetAttr; 
+	%fixedAttr; 
+	%totalDigitsAttrs; 
+>
+<!ELEMENT %fractionDigits; %facetModel;>
+<!ATTLIST %fractionDigits;
+	%facetAttr; 
+	%fixedAttr; 
+	%fractionDigitsAttrs; 
+>
+<!ELEMENT %length; %facetModel;>
+<!ATTLIST %length;
+	%facetAttr; 
+	%fixedAttr; 
+	%lengthAttrs; 
+>
+<!ELEMENT %minLength; %facetModel;>
+<!ATTLIST %minLength;
+	%facetAttr; 
+	%fixedAttr; 
+	%minLengthAttrs; 
+>
+<!ELEMENT %maxLength; %facetModel;>
+<!ATTLIST %maxLength;
+	%facetAttr; 
+	%fixedAttr; 
+	%maxLengthAttrs; 
+>
+<!-- This one can be repeated -->
+<!ELEMENT %enumeration; %facetModel;>
+<!ATTLIST %enumeration;
+	%facetAttr; 
+	%enumerationAttrs; 
+>
+<!ELEMENT %whiteSpace; %facetModel;>
+<!ATTLIST %whiteSpace;
+	%facetAttr; 
+	%fixedAttr; 
+	%whiteSpaceAttrs; 
+>
+<!-- This one can be repeated -->
+<!ELEMENT %pattern; %facetModel;>
+<!ATTLIST %pattern;
+	%facetAttr; 
+	%patternAttrs; 
+>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/rss.xsl
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/rss.xsl b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/rss.xsl
new file mode 100644
index 0000000..be86baf
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/styles/rss.xsl
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ 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.
+  -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="html"/>
+    <xsl:template match="rss/channel">
+        <html>
+            <head>
+                <title>
+                    <xsl:value-of select="title"/>
+                </title>
+                <style media="all" lang="en" type="text/css">
+                    :root:before, :root:before {
+                    font: 80% "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif;
+                    font-size:70%;
+                    content: "This data file is meant to be read in a XML feed reader. See document
+                    source."
+                    }
+                    .ChannelTitle
+                    {
+                    display: block;
+                    font-size:200%;
+                    font-weight:bolder;
+                    color:#436976;
+                    text-decoration:none;
+                    border-bottom: 20px solid #dee7ec;
+                    }
+                    .ArticleEntry
+                    {
+                    border-width: 2px;
+                    border-color: #336699;
+                    border-style: solid;
+                    width: 500px;
+                    }
+                    .ArticleTitle
+                    {
+                    background-color: #436976;
+                    color: #FFFFFF;
+                    font-size: 1.4em;
+                    font-family: Verdana;
+                    font-size: 9pt;
+                    font-weight: bold;
+                    padding-left: 5px;
+                    padding-top: 5px;
+                    padding-bottom: 5px;
+                    }
+                    .ArticleTitle A:visited
+                    {
+                    color: #FFFFFF;
+                    text-decoration: underline;
+                    }
+                    .ArticleTitle A:link
+                    {
+                    color: #FFFFFF;
+                    text-decoration: underline;
+                    }
+                    .ArticleTitle A:hover
+                    {
+                    color: #FFFF00;
+                    text-decoration: none;
+                    }
+                    .ArticleDescription
+                    {
+                    color: #000000;
+                    font-family: Verdana;
+                    font-size: 9pt;
+                    padding-left: 5px;
+                    padding-top: 5px;
+                    padding-bottom: 5px;
+                    padding-right: 5px;
+                    }
+                </style>
+            </head>
+            <body>
+                <xsl:apply-templates select="title"/>
+                <xsl:apply-templates select="item"/>
+            </body>
+        </html>
+    </xsl:template>
+    <xsl:template match="title">
+        <div class="ChannelTitle">
+            <xsl:value-of select="text()"/>
+        </div>
+        <br/>
+    </xsl:template>
+    <xsl:template match="item">
+        <div class="ArticleEntry">
+            <div class="ArticleTitle">
+                <a href="{link}">
+                    <xsl:value-of select="title"/>
+                </a>
+                <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
+                <xsl:value-of select="pubDate"/>
+            </div>
+            <div class="ArticleDescription">
+                <b>Description:</b>
+                <xsl:value-of select="description"/>
+            </div>
+        </div>
+        <br/>
+    </xsl:template>
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribe.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribe.jsp b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribe.jsp
new file mode 100644
index 0000000..a821dd3
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribe.jsp
@@ -0,0 +1,305 @@
+<!--
+     ~  Licensed to the Apache Software Foundation (ASF) under one
+     ~  or more contributor license agreements.  See the NOTICE file
+     ~  distributed with this work for additional information
+     ~  regarding copyright ownership.  The ASF licenses this file
+     ~  to you under the Apache License, Version 2.0 (the
+     ~  "License"); you may not use this file except in compliance
+     ~  with the License.  You may obtain a copy of the License at
+     ~
+     ~    http://www.apache.org/licenses/LICENSE-2.0
+     ~
+     ~  Unless required by applicable law or agreed to in writing,
+     ~  software distributed under the License is distributed on an
+     ~  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     ~  KIND, either express or implied.  See the License for the
+     ~  specific language governing permissions and limitations
+     ~  under the License.
+     ~
+ -->
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="org.apache.stratos.cartridge.mgt.ui.CartridgeAdminClient" %>
+<%@ page import="org.wso2.carbon.adc.mgt.dto.xsd.PolicyDefinition" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="java.util.ResourceBundle" %>
+<jsp:include page="../dialog/display_messages.jsp"/>
+
+
+<%
+    response.setHeader("Cache-Control", "no-cache");
+    String cartridgeType = request.getParameter("cartridgeType");
+    String multiTenantValue = request.getParameter("multiTenant");
+    String cartridgeProvider = request.getParameter("cartridgeProvider");
+    boolean multiTenant = Boolean.valueOf(multiTenantValue);
+    String item = request.getParameter("item");
+    
+    PolicyDefinition[] policyDefinitions = null;
+
+    String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+    ConfigurationContext configContext =
+          (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+
+    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+    CartridgeAdminClient client;
+    
+    boolean internalRepoFeatureEnabled = false;
+
+    try{
+        client = new CartridgeAdminClient(cookie, backendServerURL, configContext,request.getLocale());
+        policyDefinitions = client.getPolicyDefinitions();
+        
+        if (policyDefinitions == null || policyDefinitions.length == 0) {
+        	throw new IllegalStateException("Policy Definitions not found.");
+        }
+        internalRepoFeatureEnabled = client.isFeatureEnabled("feature.internalrepo.enabled");
+    }catch (Exception e) {
+        response.setStatus(500);
+        CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+        session.setAttribute(CarbonUIMessage.ID, uiMsg);
+        %>
+            <jsp:include page="../admin/error.jsp"/>
+        <%
+        return;
+    }
+
+%>
+<fmt:bundle basename="org.apache.stratos.cartridge.mgt.ui.i18n.Resources">
+<carbon:breadcrumb
+    label="subscribe"
+    resourceBundle="org.apache.stratos.cartridge.mgt.ui.i18n.Resources"
+    topPage="true"
+    request="<%=request%>"/>
+<div id="middle">
+<%if(cartridgeType != null) {%>
+    <h2><fmt:message key="subscribe.to"><fmt:param value="<%= cartridgeType%>"/></fmt:message></h2>
+<%} else {%>
+	<h2><fmt:message key="subscribe.new.cartridge"/></h2>
+    <p>&nbsp;</p>
+<%} %>
+<div id="workArea">
+    <form id="subscribeForm" name="subscribeToCartridge">
+        <table id="subscribeToCartridgeTbl" width="100%" class="styledLeft">
+	        <thead>
+	        <tr>
+	            <th>
+	                <fmt:message key="cartridge.information"/>
+	            </th>
+	        </tr>
+	        </thead>
+            <tbody>
+            <tr>
+            <td class="nopadding">
+           	<table class="normal-nopadding" cellspacing="0">
+            <tbody>
+                <tr>
+                	<!-- Keep 30% width to give more space for inputs -->
+                    <td style="width: 30%"><label>Cartridge Type</label><span class="required">*</span></td>
+                    <td>
+                        <span><%=cartridgeType%></span>
+                        <input name="cartridge_type" type="hidden" value="<%=cartridgeType%>"/>
+                        <input name="cartridge_provider" type="hidden" value="<%=cartridgeProvider%>"/>
+                    </td>
+                </tr>
+                <tr>
+                    <td><label for="cartridge_alias">Alias</label><span class="required">*</span></td>
+                    <td><input id="cartridge_alias" name="cartridge_alias" type="text" style="width: 400px" maxlength="300" /></td>
+                </tr>
+                <%if((cartridgeProvider != null && !cartridgeProvider.equalsIgnoreCase("data")) && !multiTenant) {%>
+                    <tr>
+                    	<td><label for="policy">Policy</label><span class="required">*</span></td>
+						<td style="border: 0;"><select name="policy" id="policy">
+								<%
+									for (PolicyDefinition policy : policyDefinitions) {
+												
+								%>
+								<option value="<%=policy.getName()%>" <%if (policy.getDefaultPolicy()) {%>selected="selected"<%}%>>
+									<%=policy.getDescription()%>
+								</option>
+								<%
+									}
+								%>
+						</select></td>
+                    </tr>
+                <%}%>
+                <%if((cartridgeProvider != null && !cartridgeProvider.equalsIgnoreCase("data"))) {%>
+               		<tr>
+                        <td colspan="2" class="middle-header"><fmt:message key="repository.information"/></td>
+                    </tr>
+                	<%if(internalRepoFeatureEnabled) {%>
+                	<tr>
+                        <td><label for="internalRepo" id="internalRepoLabel">Use Internal Repository</label><span class="required">*</span></td>
+                        <td>
+                        	<input name="internalRepo" type="radio" value="yes" /> Yes
+							<input name="internalRepo" type="radio" value="no" checked="checked" /> No
+						</td>
+                    </tr>
+                    <%} %>
+                    <tr class="repoDetails">
+                        <td><label for="repoType" id="repoTypeLabel">Repository Type</label><span class="required">*</span></td>
+                        <td>
+                        	<input name="repoType" type="radio" value="public" checked="checked" /> Public
+							<input name="repoType" type="radio" value="private" /> Private
+						</td>
+                    </tr>
+                    <tr class="repoDetails">
+                        <td><label for="repo_url" id="repoLabel">GIT repository URL: (http:// or https://)</label><span class="required">*</span></td>
+                        <td><input id="repo_url" name="repo_url" type="text" style="width: 400px" maxlength="1000" />
+                        </td>
+                    </tr>
+                    <tr class="repoDetails repoCredentials">
+                        <td><label for="repo_username" id="repo_usernameLabel">GIT Repository Username</label><span class="required" style="display: none;">*</span></td>
+                        <td><input id="repo_username" name="repo_username" type="text" style="width: 400px" maxlength="500" autocomplete="off" /></td>
+                    </tr>
+                    <tr class="repoDetails repoCredentials">
+                        <td><label for="repo_password" id="repo_passwordLabel">GIT Repository Password</label><span class="required" style="display: none;">*</span></td>
+                        <td><input id="repo_password" name="repo_password" type="password" style="width: 400px" maxlength="500" autocomplete="off" /></td>
+                    </tr>
+                    <tr class="repoDetails" id="testConnectionRow">
+                    	<td></td>
+                    	<td>
+                    		<input id="testGitButton" type="button" class="button" value="Test Connection"
+                        		onclick="postToBEService('test_git_ajaxprocessor.jsp', jQuery('#subscribeForm').serialize(), null, '#testGitButton', validateRepository);">
+                       	</td>
+                    </tr>
+                    <tr class="dataCartridgeRow" style="display: none;">
+                        <td colspan="2" class="middle-header"><fmt:message key="cartridge.connect.information"/></td>
+                    </tr>
+                    <tr class="dataCartridgeRow" style="display: none;">
+                        <td><label for="other_cartridge_type">Connect Data Cartridge</label><span class="required">*</span></td>
+                        <td><select id="other_cartridge_type" name="other_cartridge_type" ><option value="mysql">mysql</option></select></td>
+                    </tr>
+                    <tr class="dataCartridgeRow" style="display: none;">
+                        <td><label for="other_alias">Data Cartridge Alias</label><span class="required">*</span></td>
+                        <td><input id="other_alias" name="other_alias" type="text" style="width: 400px" maxlength="300" /></td>
+                    </tr>
+                <%}%>
+            </tbody>
+            </table>
+            </td>
+        </tr>
+        <tr id="buttonRow" class="buttonRow">
+            <td>
+                <input id="subscribeButton" type="submit" class="button" value="Subscribe" />
+                <input id="subscribeCancelButton" type="button" class="button" value="Cancel" onclick="cancelSubscribe('<%=item%>');" />
+                <%if(!"data".equalsIgnoreCase(cartridgeProvider) && !multiTenant){%>
+                    <a id="showConnect" onclick="showConnectCartridge();" style="cursor: pointer;">Connect another cartridge...</a>
+                    <a id="hideConnect" onclick="hideConnectCartridge();" style="cursor: pointer; display: none;">Hide connecting cartridge fields...</a>
+                <%}%>
+            </td>
+        </tr>
+        </tbody>
+        </table>
+    </form>
+
+    <p>&nbsp;</p>
+    </div>
+
+</div>
+
+<script type="text/javascript">
+	jQuery(document).ready(
+		function() {
+			if (jQuery("#internalRepoLabel").length > 0) {
+				jQuery('input:radio[name="internalRepo"]').click(
+					function() {
+						var $this = jQuery(this);
+						if ($this.val() == "no") {
+							jQuery(".repoDetails").show();
+						} else {
+							jQuery(".repoDetails").hide();
+							jQuery("#repo_url").val("");
+							jQuery("#repo_username").val("");
+							jQuery("#repo_password").val("");
+						}
+					})
+			};
+	
+			jQuery('input:radio[name="repoType"]').click(
+				function() {
+					var $this = jQuery(this);
+					if ($this.val() == "private") {
+						jQuery(".repoCredentials .required").show();
+					} else {
+						jQuery(".repoCredentials .required").hide();
+					}
+				})
+			
+			setStratosFormSubmitFunction("#subscribeForm", validate, "subscribe_ajaxprocessor.jsp", "subscribed_cartridges.jsp", "#subscribeButton");
+		});
+
+	function validate() {
+		if (jQuery("#cartridge_alias").val().length == 0) {
+			CARBON.showErrorDialog('Please enter an alias for the cartridge.');
+			return false;
+		}
+		if (!validateRepository()) {
+			return false;
+		}
+		if (jQuery(".dataCartridgeRow").length > 0 && 
+				jQuery(".dataCartridgeRow").css("display") != "none" && jQuery("#other_alias").val().length == 0) {
+			CARBON.showErrorDialog('Please enter an alias for the data cartridge.');
+			return false;
+		}
+		return true;
+	}
+
+	function validateRepository() {
+		var repoRequired = false;
+		if (jQuery("#internalRepoLabel").length > 0) {
+			if (jQuery('input[name="internalRepo"]:checked').val() == "no") {
+				repoRequired = true;
+				if (jQuery("#repo_url").val().length == 0) {
+					CARBON.showWarningDialog('Please enter GIT repository URL.');
+					return false;
+				}
+			}
+		} else {
+			// Some cartridges do not have a repo URL
+			if (jQuery("#repo_url").length > 0) {
+				repoRequired = true;
+				if (jQuery("#repo_url").val().length == 0) {
+					CARBON.showWarningDialog('Please enter GIT repository URL.');
+					return false;
+				}
+			}
+		}
+
+		if (repoRequired && jQuery("#repoTypeLabel").length > 0
+				&& jQuery('input[name="repoType"]:checked').val() == "private") {
+			if (jQuery("#repo_username").val().length == 0) {
+				CARBON.showWarningDialog('Please enter GIT repository username.');
+				return false;
+			}
+			if (jQuery("#repo_password").val().length == 0) {
+				CARBON.showWarningDialog('Please enter GIT repository password.');
+				return false;
+			}
+		}
+		return true;
+	}
+
+	function showConnectCartridge() {
+		jQuery(".dataCartridgeRow").show();
+		jQuery("#showConnect").hide();
+		jQuery("#hideConnect").show();
+	}
+
+	function hideConnectCartridge() {
+		jQuery(".dataCartridgeRow").hide();
+		jQuery("#showConnect").show();
+		jQuery("#hideConnect").hide();
+	}
+	
+	function cancelSubscribe(item) {
+		location.href = "available_cartridges.jsp?item=" + item;
+	}
+</script>
+<script type="text/javascript" src="js/jquery.blockUI-1.33.js"></script>
+<script type="text/javascript" src="js/common.js"></script>
+</fmt:bundle>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribe_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribe_ajaxprocessor.jsp b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribe_ajaxprocessor.jsp
new file mode 100644
index 0000000..a993c00
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribe_ajaxprocessor.jsp
@@ -0,0 +1,90 @@
+<!--
+     ~  Licensed to the Apache Software Foundation (ASF) under one
+     ~  or more contributor license agreements.  See the NOTICE file
+     ~  distributed with this work for additional information
+     ~  regarding copyright ownership.  The ASF licenses this file
+     ~  to you under the Apache License, Version 2.0 (the
+     ~  "License"); you may not use this file except in compliance
+     ~  with the License.  You may obtain a copy of the License at
+     ~
+     ~    http://www.apache.org/licenses/LICENSE-2.0
+     ~
+     ~  Unless required by applicable law or agreed to in writing,
+     ~  software distributed under the License is distributed on an
+     ~  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     ~  KIND, either express or implied.  See the License for the
+     ~  specific language governing permissions and limitations
+     ~  under the License.
+     ~
+ -->
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="org.apache.stratos.cartridge.mgt.ui.CartridgeAdminClient" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+<%@ page import="org.wso2.carbon.adc.mgt.dto.xsd.Cartridge" %>
+<%@ page import="org.wso2.carbon.adc.mgt.dto.xsd.SubscriptionInfo" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="java.util.ResourceBundle" %>
+<%@ page import="java.util.Map" %>
+<jsp:include page="../dialog/display_messages.jsp"/>
+
+
+<%
+	response.setHeader("Cache-Control", "no-cache");
+
+	ResourceBundle bundle = ResourceBundle
+        .getBundle(CartridgeAdminClient.BUNDLE, request.getLocale());
+
+    String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+    ConfigurationContext configContext =
+          (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+
+    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+    CartridgeAdminClient client;
+    String repoUrl = "";
+    String repoUserName = "";
+    String repoPassword = "";
+    String otherCartridgeType = "";
+    String otherAlias = "";
+    String policy = null;
+    String repoType = null;
+    
+    String cartridgeType = request.getParameter("cartridge_type");
+    String cartridgeProvider = request.getParameter("cartridge_provider");
+    String cartridgeAlias = request.getParameter("cartridge_alias");
+    if(!"data".equalsIgnoreCase(cartridgeProvider)){
+        repoUrl = request.getParameter("repo_url");
+        repoUserName = request.getParameter("repo_username");
+        repoPassword = request.getParameter("repo_password");
+        otherCartridgeType = request.getParameter("other_cartridge_type");
+        otherAlias = request.getParameter("other_alias");
+        policy = request.getParameter("policy");
+        repoType = request.getParameter("repoType");
+    }
+    try{
+   		client = new CartridgeAdminClient(cookie, backendServerURL, configContext, request.getLocale());
+   		SubscriptionInfo info = client.subscribeToCartridge(cartridgeType, cartridgeAlias, policy, repoUrl, "private".equals(repoType), repoUserName, repoPassword,
+				otherCartridgeType, otherAlias);
+   		String message = "";
+   		if (info != null && info.getHostname() != null) {
+   			message = "Successfully subscribed. Please map the host name " + info.getHostname() + " to ELB IP";
+   		} else {
+   			message = "Successfully subscribed.";
+   		}
+		//CarbonUIMessage.sendCarbonUIMessage(message, CarbonUIMessage.INFO, request);
+%>
+<span id="responseMsg"><%=message%></span>
+<%
+	} catch (Exception e) {
+		response.setStatus(500);
+%>
+<span id="responseMsg"><%=e.getMessage()%></span>
+<%
+		//CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request);
+	}
+%>
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c169db/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribed_cartridges.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribed_cartridges.jsp b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribed_cartridges.jsp
new file mode 100644
index 0000000..f58d48a
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.mgt.ui/src/main/resources/web/cartridge-mgt/subscribed_cartridges.jsp
@@ -0,0 +1,176 @@
+<!--
+     ~  Licensed to the Apache Software Foundation (ASF) under one
+     ~  or more contributor license agreements.  See the NOTICE file
+     ~  distributed with this work for additional information
+     ~  regarding copyright ownership.  The ASF licenses this file
+     ~  to you under the Apache License, Version 2.0 (the
+     ~  "License"); you may not use this file except in compliance
+     ~  with the License.  You may obtain a copy of the License at
+     ~
+     ~    http://www.apache.org/licenses/LICENSE-2.0
+     ~
+     ~  Unless required by applicable law or agreed to in writing,
+     ~  software distributed under the License is distributed on an
+     ~  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     ~  KIND, either express or implied.  See the License for the
+     ~  specific language governing permissions and limitations
+     ~  under the License.
+     ~
+ -->
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+<%@ page import="org.apache.axis2.context.ConfigurationContext"%>
+<%@ page import="org.wso2.carbon.CarbonConstants"%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage"%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil"%>
+<%@ page import="org.wso2.carbon.utils.ServerConstants"%>
+<%@ page import="org.apache.stratos.cartridge.mgt.ui.CartridgeAdminClient"%>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon"%>
+<%@ page import="org.wso2.carbon.adc.mgt.dto.xsd.Cartridge"%>
+<%@ page import="org.wso2.carbon.adc.mgt.dto.xsd.CartridgeWrapper"%>
+<%@ page import="java.text.SimpleDateFormat"%>
+<%@ page import="java.util.ResourceBundle"%>
+<%@ page import="java.util.ArrayList"%>
+
+<jsp:include page="../dialog/display_messages.jsp" />
+
+<%
+	response.setHeader("Cache-Control", "no-cache");
+
+    String pageNumber = request.getParameter("pageNumber");
+    if (pageNumber == null) {
+        pageNumber = "0";
+    }
+    int pageNumberInt = 0;
+    try {
+        pageNumberInt = Integer.parseInt(pageNumber);
+    } catch (NumberFormatException ignored) {
+    }
+
+    String cartridgeSearchString = request.getParameter("cartridgeSearchString");
+    if (cartridgeSearchString == null) {
+        cartridgeSearchString = "";
+    }
+    
+    // Fix issue when subscribed_cartridges_ajaxprocessor.jsp page return errors continuously 
+    String reloadCount = request.getParameter("reload");
+    if (reloadCount == null) {
+    	reloadCount = "0";
+    }
+    int reloadCountInt = 0;
+    try {
+    	reloadCountInt = Integer.parseInt(reloadCount);
+    } catch (NumberFormatException ignored) {
+    }
+    
+    if (new Boolean(request.getParameter("loginStatus"))) {
+    	// This is a login request
+    	// Initialize the reload count to zero
+    	reloadCountInt = 0;
+    }
+%>
+
+<fmt:bundle basename="org.apache.stratos.cartridge.mgt.ui.i18n.Resources">
+	<carbon:breadcrumb label="cartrigdes.subscribed.header" resourceBundle="org.apache.stratos.cartridge.mgt.ui.i18n.Resources"
+		topPage="false" request="<%=request%>" />
+
+	<script type="text/javascript">
+		function searchCartridges() {
+			document.searchForm.submit();
+		}
+	    function showCartridgeInfo(popupID, alias) {
+	        CARBON.showPopupDialog(jQuery('#' + popupID).html(), "Cartridge Information for " + alias, 350, null, null, 400);
+	    }
+	    function unsubscribeCartridge(alias) {
+	        if (alias) {
+	            CARBON.showConfirmationDialog("<fmt:message key="cartridge.unsubscribe.prompt"></fmt:message>",
+	                                          function() {
+	                                              //location.href = './call_unsubscribe.jsp?cartridge_alias=' + alias;
+	                                              postToBEService('unsubscribe_ajaxprocessor.jsp', 'cartridge_alias=' + alias, 'subscribed_cartridges.jsp');
+	                                          }
+	                    );
+	        }
+	    }
+	    
+	    function syncRepo(alias) {
+	        if (alias) {
+            	postToBEService('sync_repo_ajaxprocessor.jsp', 'cartridge_alias=' + alias);
+	        }
+	    }
+	    
+	    function removeDomain(alias) {
+	        if (alias) {
+            	postToBEService('remove_domain_ajaxprocessor.jsp', 'cartridge_alias=' + alias, 'subscribed_cartridges.jsp');
+	        }
+	    }
+	</script>
+
+	<div id="middle">
+		<h2>
+			<fmt:message key="cartrigdes.subscribed.header" />
+		</h2>
+
+		<div id="workArea">
+			<form action="subscribed_cartridges.jsp" name="searchForm">
+				<table class="styledLeft">
+					<tr>
+						<td>
+							<table style="border: 0;">
+								<tbody>
+									<tr style="border: 0;">
+										<td style="border: 0;"><fmt:message key="search.cartrigdes" /> <input type="text"
+											name="cartridgeSearchString" value="<%=cartridgeSearchString != null ? cartridgeSearchString : ""%>" />&nbsp;
+										</td>
+										<td style="border: 0;"><a class="icon-link" href="#" style="background-image: url(images/search.gif);"
+											onclick="searchCartridges(); return false;" alt="<fmt:message key="search"/>"> </a></td>
+									</tr>
+								</tbody>
+							</table>
+						</td>
+					</tr>
+				</table>
+			</form>
+
+			<p>&nbsp;</p>
+			<div id="cartridges"></div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		var refresh;
+        jQuery(document).ready(function() {
+            var refreshTable = function(){
+            	jQuery.ajax({
+                    url:'subscribed_cartridges_ajaxprocessor.jsp?pageNumber=<%=pageNumber%>&cartridgeSearchString=<%=cartridgeSearchString%>',
+                    success:function(data){
+                    	jQuery('#cartridges').html(data);
+                    },
+                    error:function(jqXHR, textStatus, errorThrown) {
+                    	reloadPage();
+                    }
+                })
+            }
+            // Call this initially
+            refreshTable();
+            refresh = setInterval(refreshTable, 15000);
+        });
+        
+        function stopRefreshTable() {
+            if (refresh) {
+                clearInterval(refresh);
+            }
+        }
+        
+        function reloadPage() {
+        	stopRefreshTable();
+        	<%
+        	if (reloadCountInt <= 1) {
+        	%>
+        	// Reload page. If the session is not there, the page should redirect to login page.
+        	location.href = 'subscribed_cartridges.jsp?reload=<%=++reloadCountInt%>';
+        	<% 
+        	}
+        	%>
+        }
+	</script>
+	<script type="text/javascript" src="js/jquery.blockUI-1.33.js"></script>
+	<script type="text/javascript" src="js/common.js"></script>
+</fmt:bundle>