[Carbon-commits] [Carbon] svn commit r113358 - in trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui: . src src/main src/main/java src/main/java/org src/main/java/org/wso2 src/main/java/org/wso2/carbon src/main/java/org/wso2/carbon/shindig src/main/java/org/wso2/carbon/shindig/module src/main/java/org/wso2/carbon/shindig/module/oauth src/main/java/org/wso2/carbon/shindig/module/oauth/ui src/main/resources src/main/resources/META-INF src/main/resources/org src/main/resources/org/wso2 src/main/resources/org/wso2/carbon src/main/resources/org/wso2/carbon/shindig src/main/resources/org/wso2/carbon/shindig/module src/main/resources/org/wso2/carbon/shindig/module/oauth src/main/resources/org/wso2/carbon/shindig/module/oauth/ui src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/resource src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/resource/i18n src/main/resources/web src/main/resources/web/oauth src/main/resources/web/oauth/docs src/main/resources/ web/oauth/images src/test src/test/java

lalaji at wso2.com lalaji at wso2.com
Sun Oct 2 08:03:44 EDT 2011


Author: lalaji
Date: Sun Oct  2 05:03:44 2011
New Revision: 113358
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=113358

Log:
Seperated gadget-oauth ui bundle from dashboard component and added it into gadget-framework

Added:
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/pom.xml
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/shindig/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/shindig/module/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/shindig/module/oauth/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/shindig/module/oauth/ui/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/shindig/module/oauth/ui/OAuthMgtServiceClient.java
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/META-INF/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/META-INF/component.xml
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/oauth/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/resource/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/resource/i18n/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/resource/i18n/Resources.properties
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/add_keys.jsp
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/docs/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/docs/userguide.html
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/images/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/images/oAuthKeyMgmt.gif   (contents, props changed)
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/index.jsp   (contents, props changed)
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/oauthmgt-ajaxprocessor.jsp
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/test/
   trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/test/java/

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/pom.xml
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/pom.xml?pathrev=113358
==============================================================================
--- (empty file)
+++ trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/pom.xml	Sun Oct  2 05:03:44 2011
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (c) 2009-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~      http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.wso2.carbon</groupId>
+        <artifactId>gadget-framework</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.wso2.carbon.shindig.module.oauth.ui</artifactId>
+    <packaging>bundle</packaging>
+    <name>WSO2 Carbon - Gadget Server OAuth User Management UI</name>
+    <description>Gadget Server User Management UI bundle</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.axis2.wso2</groupId>
+            <artifactId>axis2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-adb-codegen</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.ui</artifactId>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.logging</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.ui</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.server.admin</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.server.admin.ui</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.resource.ui</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.shindig.module.oauth.stub</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.shindig.module.oauth.common</artifactId>
+            <version>${wso2carbon.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>1.4.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
+                        <Private-Package>org.wso2.carbon.shindig.module.oauth.ui
+                        </Private-Package>
+                        <Export-Package>
+                            org.wso2.carbon.shindig.module.oauth.ui.*; version=1.0.0,
+                        </Export-Package>
+                        <Import-Package>
+                            org.wso2.carbon.shindig.module.oauth.stub.*,
+                            javax.servlet;version="2.4.0",
+                            javax.servlet.http;version="2.4.0",
+                            javax.xml.namespace; version="0.0.0",
+                            *;resolution:=optional
+                        </Import-Package>
+                        <DynamicImport-Package>*</DynamicImport-Package>
+                        <Carbon-Component>UIBundle</Carbon-Component>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/shindig/module/oauth/ui/OAuthMgtServiceClient.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/shindig/module/oauth/ui/OAuthMgtServiceClient.java?pathrev=113358
==============================================================================
--- (empty file)
+++ trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/java/org/wso2/carbon/shindig/module/oauth/ui/OAuthMgtServiceClient.java	Sun Oct  2 05:03:44 2011
@@ -0,0 +1,101 @@
+package org.wso2.carbon.shindig.module.oauth.ui;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.shindig.module.oauth.stub.OAuthMgtServiceStub;
+import org.wso2.carbon.shindig.module.oauth.stub.types.carbon.ConsumerEntry;
+
+import java.rmi.RemoteException;
+import java.util.Locale;
+
+/**
+ * The class contains the wiring with the backend service
+ */
+public class OAuthMgtServiceClient {
+
+    private static final Log log = LogFactory.getLog(OAuthMgtServiceClient.class);
+    public OAuthMgtServiceStub stub;
+
+    public OAuthMgtServiceClient(String cookie,
+                                 String backendServerURL,
+                                 ConfigurationContext configCtx,
+                                 Locale locale) throws AxisFault {
+        String serviceURL = backendServerURL + "OAuthMgtService";
+
+        stub = new OAuthMgtServiceStub(configCtx, serviceURL);
+        ServiceClient client = stub._getServiceClient();
+        Options option = client.getOptions();
+        option.setManageSession(true);
+        option.setProperty(
+                org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
+                cookie);
+    }
+
+    public ConsumerEntry[] getConsumerEntries() {
+        ConsumerEntry[] entries = new ConsumerEntry[0];
+        try {
+            entries = stub.getConsumerEntries();
+            if (entries == null) {
+                return new ConsumerEntry[0];
+            }
+        } catch (RemoteException e) {
+            log.error(e.getMessage(), e);
+        }
+        return entries;
+    }
+
+    public ConsumerEntry[] getConsumerPagedEntries(int pageNum) {
+        ConsumerEntry[] entries = new ConsumerEntry[0];
+        try {
+            entries = stub.getConsumerPagedEntries(pageNum);
+            if (entries == null) {
+                return new ConsumerEntry[0];
+            }
+        } catch (RemoteException e) {
+            log.error(e.getMessage(), e);
+        }
+        return entries;
+    }
+
+    public boolean addConsumerEntry(ConsumerEntry entry, String mode) {
+        try {
+            boolean ret = stub.addConsumerEntry(entry, mode);
+            return ret;
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return false;
+        }
+
+    }
+
+    public ConsumerEntry getConsumerEntry(String consumerServiceName) {
+        try {
+            return stub.getConsumerEntry(consumerServiceName);
+        } catch (RemoteException e) {
+            log.error(e.getMessage(), e);
+            return null;
+        }
+    }
+
+    public int getNumberOfPages() {
+        try {
+            return stub.getNumberOfPages();
+        } catch (RemoteException e) {
+            log.error(e.getMessage(), e);
+            return 0;
+        }
+    }
+
+    public boolean deleteConsumerEntry(String consumerServiceName) {
+        try {
+            stub.deleteConsumerEntry(consumerServiceName);
+        } catch (RemoteException e) {
+            log.error(e.getMessage(), e);
+        }
+        return false;
+    }
+}

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/META-INF/component.xml
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/META-INF/component.xml?pathrev=113358
==============================================================================
--- (empty file)
+++ trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/META-INF/component.xml	Sun Oct  2 05:03:44 2011
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component xmlns="http://products.wso2.org/carbon">
+    <menus>
+        <menu>
+            <id>gadget_server_oauth_mgt_menu</id>
+            <i18n-key>dashboard.resources.oauth.menu</i18n-key>
+            <i18n-bundle>org.wso2.carbon.shindig.module.oauth.ui.resource.i18n.Resources</i18n-bundle>
+            <parent-menu>manage_gs</parent-menu>
+            <link>../oauth/index.jsp</link>
+            <region>region1</region>
+            <order>5</order>
+            <style-class>manage</style-class>
+            <icon>../oauth/images/oAuthKeyMgmt.gif</icon>
+            <require-permission>/permission/admin/login</require-permission>
+            <require-permission>/permission/admin/gadget-server/oauth-management</require-permission>
+        </menu>
+    </menus>
+</component>

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/resource/i18n/Resources.properties
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/resource/i18n/Resources.properties?pathrev=113358
==============================================================================
--- (empty file)
+++ trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/org/wso2/carbon/shindig/module/oauth/ui/resource/i18n/Resources.properties	Sun Oct  2 05:03:44 2011
@@ -0,0 +1,3 @@
+dashboard.resources.oauth.menu=OAuth Key Management
+page.title=Manage oauth keys
+page.title.add.keys=Add consumer key data
\ No newline at end of file

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/add_keys.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/add_keys.jsp?pathrev=113358
==============================================================================
--- (empty file)
+++ trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/add_keys.jsp	Sun Oct  2 05:03:44 2011
@@ -0,0 +1,174 @@
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@
+        page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@
+        page import="org.wso2.carbon.CarbonConstants" %>
+<%@
+        page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@
+        page import="org.wso2.carbon.shindig.module.oauth.ui.OAuthMgtServiceClient" %>
+<%@
+        page import="org.wso2.carbon.shindig.module.oauth.stub.types.carbon.ConsumerEntry" %>
+<%@
+        page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@
+        page import="org.wso2.carbon.shindig.module.oauth.common.OAuthConstants" %>
+<%@
+        taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@
+        taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"
+               prefix="carbon" %>
+<%
+    String addConsumerMode = request.getParameter("mode");
+    String consumerServiceName = request.getParameter("service");
+
+    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);
+
+    OAuthMgtServiceClient client;
+
+    client = new OAuthMgtServiceClient(cookie, backendServerURL, configContext, request.getLocale());
+    ConsumerEntry entry = null;
+    if ("update".equals(addConsumerMode) && consumerServiceName != null) {
+        entry = client.getConsumerEntry(consumerServiceName);
+    }
+
+    String pageAction = request.getParameter("action");
+
+    if ((pageAction != null) && ("submit".equals(pageAction))) {
+        ConsumerEntry newEntry = new ConsumerEntry();
+        newEntry.setConsumerKey(request.getParameter(OAuthConstants.CONSUMER_KEY_KEY));
+        newEntry.setConsumerSecret(request.getParameter(OAuthConstants.CONSUMER_SECRET_KEY));
+        newEntry.setKeyType(request.getParameter(OAuthConstants.KEY_TYPE_KEY));
+        newEntry.setService(request.getParameter(OAuthConstants.CONSUMER_SERVICE));
+
+        boolean ret = client.addConsumerEntry(newEntry, request.getParameter("mode"));
+        if (ret == false) {
+            CarbonUIMessage uiMsg = new CarbonUIMessage("Failed to add consumer key data. " +
+                                                        "Please refer to error logs for more details", CarbonUIMessage.ERROR);
+            session.setAttribute(CarbonUIMessage.ID, uiMsg);
+%>
+<jsp:include page="../admin/error.jsp"/>
+<%
+        return;
+    }
+%>
+<script type="text/javascript">location.href = 'index.jsp?region=region1&item=gadget_server_oauth_mgt_menu';</script>
+<%
+    }
+    // response.sendRedirect("http://www.google.com");
+%>
+<jsp:include page="../dialog/display_messages.jsp"/>
+<fmt:bundle
+        basename="org.wso2.carbon.shindig.module.oauth.ui.resource.i18n.Resources">
+    <carbon:breadcrumb label="page.title.add.keys"
+                       resourceBundle="org.wso2.carbon.shindig.module.oauth.ui.resource.i18n.Resources"
+                       topPage="false" request="<%=request%>"/>
+    <script type="text/javascript" src="javascript/jquery-1.3.2.js"></script>
+    <script type="text/javascript" src="../ajax/js/prototype.js"></script>
+    <script type="text/javascript">
+        sessionAwareFunction();
+
+        function addEntry(resPath, func) {
+            location.href = 'add_keys.jsp?mode=' + func + '&resPath=' + resPath;
+        }
+
+    </script>
+
+    <div id="middle">
+        <h2><fmt:message key="page.title.add.keys"/></h2>
+
+        <div id="workArea">
+
+            <table class="styledLeft">
+                <thead>
+                <tr>
+                    <th colspan="2">Add new consumer key information</th>
+                </tr>
+                </thead>
+                <tbody>
+                <tr>
+                    <td class="formRow">
+                        <form onsubmit="true" target="_self" action="add_keys.jsp" id="keyDataForm"
+                              name="keyDataForm"
+                              method="post">
+                                    <% if (("update").equals(addConsumerMode) && entry != null) {%>
+                            <input type="hidden" name="action" value="submit"/>
+                            <input type="hidden" name="mode" value="update"/>
+                            <table class="normal">
+                                <tr>
+                                    <td>Consumer Service</td>
+                                    <td><input id="consumer_service" type="text"
+                                               name="consumer_service"
+                                               value="<%=entry.getService()%>" readonly="true"
+                                               style="width:400px;"/>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td>Consumer Key</td>
+                                    <td><input id="consumer_key" type="text" name="consumer_key"
+                                               value="<%=entry.getConsumerKey()%>"
+                                               style="width:400px;"/></td>
+                                </tr>
+                                <tr>
+                                    <td style="vertical-align:top !important;">Consumer Secret</td>
+                                    <td><textarea id="consumer_secret" type=""
+                                                  name="consumer_secret"
+                                                  style="width:400px; height:250px;"><%=entry.getConsumerSecret()%>
+                                    </textarea></td>
+                                </tr>
+                                <tr>
+                                    <td>Consumer Key Type</td>
+                                    <td><input id="key_type" type="text" name="key_type"
+                                               value="<%=entry.getKeyType()%>"
+                                               style="width:400px;"/></td>
+                                </tr>
+                            </table>
+                                    <% } else { %>
+                            <input type="hidden" name="action" value="submit"/>
+                            <input type="hidden" name="mode" value="new"/>
+                            <table class="normal">
+                                <tr>
+                                    <td>Consumer Service</td>
+                                    <td><input id="consumer_service" type="text"
+                                               name="consumer_service"
+                                               style="width:400px;"/></td>
+                                </tr>
+                                <tr>
+                                    <td>Consumer Key</td>
+                                    <td><input id="consumer_key" type="text" name="consumer_key"
+                                               style="width:400px;"/>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td style="vertical-align:top !important;">Consumer Secret</td>
+                                    <td><textarea id="consumer_secret" type=""
+                                                  name="consumer_secret"
+                                                  style="width:400px; height:250px;"></textarea>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td>Consumer Key Type</td>
+                                    <td><input id="key_type" type="text" name="key_type"
+                                               style="width:400px;"/></td>
+                                </tr>
+                            </table>
+                                    <% } %>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="buttonRow"><input id="Save" class="button" type="submit"
+                                                 name="save_but" value="Save"/>
+                    </td>
+                </tr>
+                </form>
+                </tbody>
+            </table>
+        </div>
+    </div>
+</fmt:bundle>
\ No newline at end of file

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/docs/userguide.html
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/docs/userguide.html?pathrev=113358
==============================================================================
--- (empty file)
+++ trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/docs/userguide.html	Sun Oct  2 05:03:44 2011
@@ -0,0 +1,35 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head><title>The Dashboard - User Guide</title>
+
+    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
+    <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all"/>
+</head>
+
+<body style="direction: ltr;">
+<h1>OAuth Key Management</h1>
+
+The key management user interface provides a place to manage gadget specific, OAuth keys. If your
+gadgets need to access a certain
+API via OAuth, this interface enables you to add the keys to the WSO2 Gadget Server. The gadget
+written with the added service ID can consume the required APIs via OAuth
+
+</body>
+</html>

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/images/oAuthKeyMgmt.gif
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/images/oAuthKeyMgmt.gif?pathrev=113358
==============================================================================
Binary file. No diff available.

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/index.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/index.jsp?pathrev=113358
==============================================================================
--- (empty file)
+++ trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/index.jsp	Sun Oct  2 05:03:44 2011
@@ -0,0 +1,132 @@
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="org.wso2.carbon.shindig.module.oauth.ui.OAuthMgtServiceClient" %>
+<%@ page import="org.wso2.carbon.shindig.module.oauth.stub.types.carbon.ConsumerEntry" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"
+           prefix="carbon" %>
+<jsp:include page="../dialog/display_messages.jsp"/>
+<%
+    String loggeduser = (String) request.getSession().getAttribute("logged-user");
+    String selectPageString = (String) request.getParameter("selectPage");
+    if (selectPageString == null || selectPageString.equals("")) {
+        selectPageString = "0";
+    }
+
+    int selectPage;
+    try {
+        selectPage = Integer.parseInt(selectPageString);
+    } catch (Exception e) {
+        selectPage = 0;
+    }
+
+    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);
+
+    OAuthMgtServiceClient client;
+
+    client = new OAuthMgtServiceClient(cookie, backendServerURL, configContext, request.getLocale());
+
+    ConsumerEntry[] entries = client.getConsumerPagedEntries(selectPage);
+
+    int numberOfPages = client.getNumberOfPages();
+
+%>
+<fmt:bundle
+        basename="org.wso2.carbon.shindig.module.oauth.ui.resource.i18n.Resources">
+    <carbon:breadcrumb label="page.title"
+                       resourceBundle="org.wso2.carbon.shindig.module.oauth.ui.resource.i18n.Resources"
+                       topPage="false" request="<%=request%>"/>
+    <script type="text/javascript" src="javascript/jquery-1.3.2.js"></script>
+    <script type="text/javascript">
+        function addEntry(service, func) {
+            if (func == 'update') {
+                location.href = 'add_keys.jsp?mode=' + func + '&service=' + service;
+            } else {
+                location.href = 'add_keys.jsp?mode=' + func;
+            }
+        }
+
+        function deleteEntry(service, id) {
+            var resp = jQuery.ajax({
+                                       url: 'oauthmgt-ajaxprocessor.jsp?func=delete&service=' + service,
+                                       async: false
+                                   }).responseText;
+
+            jQuery('#cons-' + id).hide('slow');
+        }
+    </script>
+    <div id="middle">
+        <h2><fmt:message key="page.title"/></h2>
+
+        <div id="workArea">
+            <div style="float:right;"><carbon:paginator pageNumber="<%=selectPage%>"
+                                                        numberOfPages="<%=numberOfPages%>"
+                                                        page="index.jsp"
+                                                        pageNumberParameterName="selectPage"/></div>
+            <a href="javascript:addEntry('', 'new')" name="add_new_key" class="icon-link"
+               accesskey=""
+               style="float:left; background-image: url(../admin/images/add.gif);">Add new
+                                                                                   consumer</a><br/><br/>
+            <%if (entries.length != 0) {%>
+            <form action="_self" method="get">
+                <table class="styledLeft">
+                    <thead>
+                    <tr>
+                        <th colspan="2">Available OAuth Consumer Information</th>
+                    </tr>
+                    </thead>
+                    <% for (int i = 0; i < entries.length; i++) { %>
+                    <tr id="cons-<%=i%>">
+                        <td>
+                            <table width="100%" cellspacing="0" cellpadding="0" border="0"
+                                   class="normal">
+                                <tr class="tableOddRow">
+                                    <td nowrap="nowrap">Service name:</td>
+                                    <td width="100%"><%=entries[i].getService()%>
+                                    </td>
+                                </tr>
+                                <tr class="tableEvenRow">
+                                    <td nowrap="nowrap">Consumer Key:</td>
+                                    <td><%=entries[i].getConsumerKey()%>
+                                    </td>
+                                </tr>
+                                <tr class="tableOddRow">
+                                    <td nowrap="nowrap">Consumer Secret:</td>
+                                    <td><%=entries[i].getConsumerSecret()%>
+                                    </td>
+                                </tr>
+                                <tr class="tableEvenRow">
+                                    <td nowrap="nowrap">Key Type:</td>
+                                    <td><%=entries[i].getKeyType()%>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td colspan="2" style="padding-top: 10px;"><input type="button"
+                                                                                      value="Edit"
+                                                                                      id="but-<%=i%>"
+                                                                                      class="button selec"
+                                                                                      onclick="javascript:addEntry('<%=entries[i].getService()%>', 'update')">
+                                        <input type="button" value="Delete"
+                                               id="but-<%=i%>"
+                                               class="button selec"
+                                               onclick="javascript:deleteEntry('<%=entries[i].getService()%>', '<%=i%>')">
+                                    </td>
+                                </tr>
+                            </table>
+                        </td>
+                    </tr>
+                    <% } %>
+                </table>
+            </form>
+            <%} %>
+        </div>
+    </div>
+</fmt:bundle>
\ No newline at end of file

Added: trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/oauthmgt-ajaxprocessor.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/oauthmgt-ajaxprocessor.jsp?pathrev=113358
==============================================================================
--- (empty file)
+++ trunk/carbon/components/gadgets/org.wso2.carbon.shindig.module.oauth.ui/src/main/resources/web/oauth/oauthmgt-ajaxprocessor.jsp	Sun Oct  2 05:03:44 2011
@@ -0,0 +1,45 @@
+<%--<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->--%>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="org.wso2.carbon.shindig.module.oauth.ui.OAuthMgtServiceClient" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"
+           prefix="carbon" %>
+<%
+    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);
+
+    OAuthMgtServiceClient client;
+
+    client = new OAuthMgtServiceClient(cookie, backendServerURL, configContext, request.getLocale());
+
+    String funcName = request.getParameter("func");
+
+    if ("delete".equals(funcName)) {
+        String service = request.getParameter("service");
+        out.print(client.deleteConsumerEntry(service));
+    }
+%>
\ No newline at end of file


More information about the Carbon-commits mailing list