[Carbon-dev] svn commit r22699 - in trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui: . src/main/java/org/wso2/carbon/transport/mgt/ui src/main/resources/web

isuru at wso2.com isuru at wso2.com
Wed Oct 22 23:10:18 PDT 2008


Author: isuru
Date: Wed Oct 22 23:10:18 2008
New Revision: 22699
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=22699

Log:
Converting the UI into jsp


Added:
   trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/resources/web/index.jsp
Modified:
   trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/pom.xml
   trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/java/org/wso2/carbon/transport/mgt/ui/Activator.java

Modified: trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/pom.xml
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/pom.xml?rev=22699&r1=22698&r2=22699&view=diff
==============================================================================
--- trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/pom.xml	(original)
+++ trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/pom.xml	Wed Oct 22 23:10:18 2008
@@ -84,6 +84,60 @@
 
     <build>
         <plugins>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.1</version>
+                <executions>
+                    <execution>
+                        <id>source-code-generation</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <tasks>
+                                <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+                                    <arg line="-uri src/main/resources/TransportAdmin.wsdl -u -uw -o target/generated-code"/>
+                                    <classpath refid="maven.dependency.classpath"/>
+                                    <classpath refid="maven.compile.classpath"/>
+                                    <classpath refid="maven.runtime.classpath"/>
+                                </java>
+                            </tasks>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>target/generated-code/src</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
@@ -94,13 +148,17 @@
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                         <Bundle-Name>${pom.artifactId}</Bundle-Name>
                         <Bundle-Version>1.0.0</Bundle-Version>
-                        <Private-Package>org.wso2.carbon.transport.mgt.ui</Private-Package>
+                        <Private-Package>
+                            org.wso2.carbon.transport.*,
+                            axis2.apache.org.xsd
+                        </Private-Package>
                         <Bundle-Activator>org.wso2.carbon.transport.mgt.ui.Activator</Bundle-Activator>
                         <Import-Package>
                             org.wso2.carbon.component.*,
                             org.osgi.framework; version=1.3.0,
                             *;resolution:=optional
                         </Import-Package>
+                        <DynamicImport-Package>*</DynamicImport-Package>
                     </instructions>
                 </configuration>
             </plugin>

Modified: trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/java/org/wso2/carbon/transport/mgt/ui/Activator.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/java/org/wso2/carbon/transport/mgt/ui/Activator.java?rev=22699&r1=22698&r2=22699&view=diff
==============================================================================
--- trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/java/org/wso2/carbon/transport/mgt/ui/Activator.java	(original)
+++ trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/java/org/wso2/carbon/transport/mgt/ui/Activator.java	Wed Oct 22 23:10:18 2008
@@ -6,8 +6,13 @@
 import org.osgi.service.http.HttpService;
 import org.osgi.service.http.HttpContext;
 import org.wso2.carbon.component.SecuredComponentEntryHttpContext;
+import org.wso2.carbon.component.DefaultComponentEntryHttpContext;
 import org.wso2.carbon.registry.service.RegistryService;
 import org.wso2.registry.Registry;
+import org.eclipse.equinox.http.helper.ContextPathServletAdaptor;
+import org.eclipse.equinox.jsp.jasper.JspServlet;
+
+import javax.servlet.Servlet;
 
 /*
 *
@@ -31,12 +36,24 @@
 
                 RegistryService registryService = (RegistryService) context.getService(regRef);
                 Registry registry = registryService.getSystemRegistry();
-                
+
+//                HttpContext commonContext =
+//                        new SecuredComponentEntryHttpContext(context.getBundle(), INTERNEL_CONTEXT, registry);
+
                 HttpContext commonContext =
-                        new SecuredComponentEntryHttpContext(context.getBundle(), INTERNEL_CONTEXT, registry);
-                
+                        new DefaultComponentEntryHttpContext(context.getBundle(), INTERNEL_CONTEXT);
+
+                //register our .jsp files at the httpService
+                Servlet servlet = new ContextPathServletAdaptor(
+                        new JspServlet(context.getBundle(), INTERNEL_CONTEXT), CONTEXT);
+                httpService.registerServlet(CONTEXT + "/*.jsp", servlet,
+                        null, commonContext);
+
+                servlet.getServletConfig().getServletContext().setAttribute("registry",
+                        registryService);
+
                 httpService.registerResources(CONTEXT, "/",
-                                              commonContext);
+                        commonContext);
             } catch (Exception e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();

Added: trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/resources/web/index.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/resources/web/index.jsp?pathrev=22699
==============================================================================
--- (empty file)
+++ trunk/carbon-components/transport-mgt/org.wso2.carbon.transport.mgt.ui/src/main/resources/web/index.jsp	Wed Oct 22 23:10:18 2008
@@ -0,0 +1,164 @@
+<%@ page import="org.wso2.registry.Resource" %>
+<%@ page import="org.wso2.carbon.registry.service.RegistryService" %>
+<%@ page import="org.wso2.registry.Registry" %>
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.apache.axis2.context.ConfigurationContextFactory" %>
+<%@ page import="org.wso2.carbon.transport.mgt.TransportAdminStub" %>
+<%@ page import="org.wso2.carbon.transport.mgt.xsd.TransportSummary" %>
+<%@ page import="org.wso2.carbon.transport.mgt.xsd.TransportDetails" %>
+<%@ page import="org.wso2.carbon.transport.mgt.xsd.TransportParameter" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
+    <meta name="generator" content="Adobe GoLive"/>
+    <title>Transport Managment Component</title>
+    <link href="../styles/main.css" rel="stylesheet" type="text/css" media="all"/>
+    <script language="javascript" src="global-params.js"></script>
+    <script language="javascript" src="../main/admin/js/main.js"></script>
+    <script language="javascript" src="../../main/admin/js/breadcrumbs.js"></script>
+    <script language="javascript" src="../../main/admin/js/cookies.js"></script>
+</head>
+
+<%
+    RegistryService registryService = (RegistryService) config
+            .getServletContext().getAttribute("registry");
+    Registry systemRegistry = registryService.getSystemRegistry();
+    Resource resource = systemRegistry.get("/carbon/connection/props");
+    String servicePath = resource.getProperty("service-path");
+    String contextRoot = resource.getProperty("context-root");
+    String host = resource.getProperty("host-name");
+    contextRoot = contextRoot.equals("/") ? "" : contextRoot;
+    host = (host == null) ? "localhost" : host;
+    String httpPort = System.getProperty("carbon.https.port");
+
+    ConfigurationContext cc = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
+    TransportAdminStub stub = new TransportAdminStub(cc, "https://" + host + ":" +
+            httpPort + "/" + contextRoot + servicePath + "/TransportAdmin");
+    TransportSummary[] transportData = stub.listTransports();
+
+
+%>
+
+<script type="text/javascript">
+    function setBreadcrumb() {
+        generateBreadcrumbs(document.getElementById("breadcrumbDiv"), "Transports");
+    }
+
+    function manageTransportDetails(protocol) {
+        var protocolDiv = document.getElementById(protocol + '_div');
+        var imgObject = document.getElementById(protocol + '_img');
+        if (protocolDiv.style.display == 'none') {
+            protocolDiv.style.display = 'inline';
+            imgObject.src = "extensions/core/images/tree_open.gif";
+        } else if (protocolDiv.style.display == 'inline') {
+            protocolDiv.style.display = 'none';
+            imgObject.src = "extensions/core/images/tree_closed.gif";
+        }
+    }
+</script>
+
+
+<body onload="setBreadcrumb();">
+
+<div id="middle">
+
+    <div id="breadcrumbDiv" style="display:none;"></div>
+
+    <h2 id="listTransport">Transport Management</h2>
+    <table width="100%" border="0" cellpadding="0" cellspacing="0">
+        <tr>
+            <a id="help_link" alt="" title="Help" onclick="showHelp();" href="#">&#160;&#160;&#160;&#160;&#160;&#160;&#160;Help</a>
+        </tr>
+    </table>
+    <div id='formset'>
+        <form action="">
+            <fieldset>
+                <legend>Available Transports</legend>
+                <% if (transportData != null) {%>
+                <h4>Protocols</h4>
+                <%
+                    TransportDetails details;
+                    for (TransportSummary summary : transportData) {
+                        details = stub.getTransportDetails(summary.getProtocol());
+                %>
+                <div id="<%= summary.getProtocol()%>_main_div" style="overflow: visible;">
+                    <span class="treeSpan" id="<%= summary.getProtocol()%>_span"
+                          onclick="manageTransportDetails('<%= summary.getProtocol()%>');">
+                        <img src="extensions/core/images/tree_closed.gif" id="<%= summary.getProtocol()%>_img"/>
+                        <a href="#"><%= summary.getProtocol()%></a>
+                        <div id="<%= summary.getProtocol()%>_div" style="display: none;">
+                            <% if (details != null) {%>
+                            <div>
+                                <table class="styled">
+                                    <thead>
+                                        <tr>
+                                            <th>Name</th>
+                                            <th>Value</th>
+                                        </tr>
+                                    </thead>
+                                    <tbody>
+                                        <tr bgcolor="#EEEFFB">
+                                            <td>Active</td>
+                                            <td><%= details.getActive()%>
+                                            </td>
+                                        </tr>
+                                        <%
+                                            int position = 0;
+                                            for (TransportParameter currentParam : details.getParameters()) {
+                                                position++;
+                                                if ((position % 2) == 0) {
+                                        %>
+                                        <tr bgcolor="#EEEFFB">
+                                            <% } else { %>
+                                        <tr>
+                                            <% } %>
+                                            <td>
+                                                <%= currentParam.getName()%>
+                                            </td>
+                                            <td>
+                                                <%= currentParam.getValue()%>
+                                            </td>
+                                        </tr>
+                                        <% } %>
+                                    </tbody>
+                                </table>
+                                <% } else { %>
+                                <b>
+                                    <i>Transport Information is not available</i>
+                                </b>
+                                <% } %>
+                            </div>
+                        </div>
+                        <br/>
+                    </span>
+                </div>
+                <br/>
+                <% } %>
+                <% } else {%>
+                <p>Error occurred while listing available transports</p>
+                <% } %>
+            </fieldset>
+        </form>
+    </div>
+
+</div>
+
+<div id="alertMessageBox" style="display:none;position:absolute;z-index: 600;">
+    <!--the message area-->
+    <p id="alertMessageBoxMessageArea"></p>
+    <!-- the button area-->
+    <p id="alertButton" align="right">
+        <input id="alertBoxButton" type="button"
+               value="  OK  "
+               onclick="document.getElementById('alertMessageBox').style.display='none';return false;"/>
+    </p>
+</div>
+
+</body>
+
+</html>
\ No newline at end of file



More information about the Carbon-dev mailing list