[Carbon-dev] svn commit r41552 - in trunk/carbon-components: governance/org.wso2.carbon.governance.notifications.ui/src/main/java/org/wso2/carbon/governance/notifications/ui/clients registry/org.wso2.carbon.registry.activities.ui/src/main/java/org/wso2/carbon/registry/activities/ui/clients registry/org.wso2.carbon.registry.activities.ui/src/main/resources/ActivityAdminService registry/org.wso2.carbon.registry.activities/src/main/java/org/wso2/carbon/registry/activities/services registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common registry/org.wso2.carbon.registry.info.ui/src/main/java/org/wso2/carbon/registry/info/ui/clients registry/org.wso2.carbon.registry.info.ui/src/main/resources/InfoAdminService registry/org.wso2.carbon.registry.info/src/main/java/org/wso2/carbon/registry/info/services

senaka at wso2.com senaka at wso2.com
Mon Jul 20 06:58:06 PDT 2009


Author: senaka
Date: Mon Jul 20 06:58:06 2009
New Revision: 41552
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=41552

Log:
Fixes related to managing session.


Added:
   trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IManagedSession.java
Modified:
   trunk/carbon-components/governance/org.wso2.carbon.governance.notifications.ui/src/main/java/org/wso2/carbon/governance/notifications/ui/clients/InfoAdminServiceClient.java
   trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/java/org/wso2/carbon/registry/activities/ui/clients/ActivityServiceClient.java
   trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/resources/ActivityAdminService/ActivityAdminService.wsdl
   trunk/carbon-components/registry/org.wso2.carbon.registry.activities/src/main/java/org/wso2/carbon/registry/activities/services/ActivityService.java
   trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IActivityService.java
   trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IInfoService.java
   trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/java/org/wso2/carbon/registry/info/ui/clients/InfoServiceClient.java
   trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/resources/InfoAdminService/InfoAdminService.wsdl
   trunk/carbon-components/registry/org.wso2.carbon.registry.info/src/main/java/org/wso2/carbon/registry/info/services/InfoService.java

Modified: trunk/carbon-components/governance/org.wso2.carbon.governance.notifications.ui/src/main/java/org/wso2/carbon/governance/notifications/ui/clients/InfoAdminServiceClient.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/governance/org.wso2.carbon.governance.notifications.ui/src/main/java/org/wso2/carbon/governance/notifications/ui/clients/InfoAdminServiceClient.java?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/governance/org.wso2.carbon.governance.notifications.ui/src/main/java/org/wso2/carbon/governance/notifications/ui/clients/InfoAdminServiceClient.java	(original)
+++ trunk/carbon-components/governance/org.wso2.carbon.governance.notifications.ui/src/main/java/org/wso2/carbon/governance/notifications/ui/clients/InfoAdminServiceClient.java	Mon Jul 20 06:58:06 2009
@@ -72,7 +72,7 @@
         }
         EventTypeBean bean = null;
         try {
-            bean = stub.getEventTypes(path);
+            bean = stub.getEventTypes(path, null);
             if (bean.getEventTypes() == null) {
                 bean.setEventTypes(new EventType[0]);
             }
@@ -92,7 +92,7 @@
         }
         SubscriptionBean bean = null;
         try {
-            bean = stub.getSubscriptions(path);
+            bean = stub.getSubscriptions(path, null);
             if (bean.getSubscriptionInstances() == null) {
                 bean.setSubscriptionInstances(new SubscriptionInstance[0]);
             }
@@ -111,7 +111,7 @@
         String eventName = (String) Utils.getParameter(request, "eventName");
         SubscriptionBean bean = null;
         try {
-            bean = stub.subscribe(path, endpoint, eventName);
+            bean = stub.subscribe(path, endpoint, eventName, null);
             if (bean.getSubscriptionInstances() == null) {
                 bean.setSubscriptionInstances(new SubscriptionInstance[0]);
             }
@@ -130,7 +130,7 @@
         String eventName = (String) Utils.getParameter(request, "eventName");
         SubscriptionBean bean = null;
         try {
-            bean = stub.subscribeREST(path, endpoint, eventName);
+            bean = stub.subscribeREST(path, endpoint, eventName, null);
             if (bean.getSubscriptionInstances() == null) {
                 bean.setSubscriptionInstances(new SubscriptionInstance[0]);
             }
@@ -148,7 +148,7 @@
         String id = (String) Utils.getParameter(request, "id");
         boolean result = false;
         try {
-            result = stub.unsubscribe(path, id);
+            result = stub.unsubscribe(path, id, null);
         } catch (Exception e) {
             String msg = "Failed to unsubscribe. " +
                     e.getMessage();
@@ -162,7 +162,7 @@
         String path = (String) Utils.getParameter(request, "path");
         boolean result = true;
         try {
-            result = stub.isResource(path);
+            result = stub.isResource(path, null);
         } catch (Exception e) {
             String msg = "Failed to get resource type. " +
                     e.getMessage();
@@ -175,7 +175,7 @@
     public String getRemoteURL(String path) throws Exception {
         String result = null;
         try {
-            result = stub.getRemoteURL(path);
+            result = stub.getRemoteURL(path, null);
         } catch (Exception e) {
             String msg = "Failed to get remote URL. " +
                     e.getMessage();

Modified: trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/java/org/wso2/carbon/registry/activities/ui/clients/ActivityServiceClient.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/java/org/wso2/carbon/registry/activities/ui/clients/ActivityServiceClient.java?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/java/org/wso2/carbon/registry/activities/ui/clients/ActivityServiceClient.java	(original)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/java/org/wso2/carbon/registry/activities/ui/clients/ActivityServiceClient.java	Mon Jul 20 06:58:06 2009
@@ -24,6 +24,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.wso2.carbon.CarbonConstants;
 import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.core.utils.UUIDGenerator;
 import org.wso2.carbon.registry.activities.ui.ActivityAdminServiceStub;
 import org.wso2.carbon.registry.common.IActivityService;
 import org.wso2.carbon.registry.common.beans.ActivityBean;
@@ -49,7 +50,8 @@
 
         if (proxy == null) {
 
-            String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+            String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(),
+                    session);
             ConfigurationContext configContext = (ConfigurationContext) config.
                     getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
             String epr = backendServerURL + "ActivityAdminService";
@@ -60,7 +62,8 @@
                 ServiceClient client = stub._getServiceClient();
                 Options option = client.getOptions();
                 option.setManageSession(true);
-                option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+                option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
+                        cookie);
 
             } catch (AxisFault axisFault) {
                 String msg = "Failed to initiate comment service client. " + axisFault.getMessage();
@@ -70,13 +73,17 @@
             proxy = (IActivityService) CarbonUIUtil.getServerProxy(this,
                 IActivityService.class, session);
         }
-        proxy.setSession(session);
     }
 
-    public void setSession(HttpSession session) {/* Not required at client-side.*/}
+    public void setSession(String sessionId, HttpSession session) {/* Not required at client-side.*/}
+
+    public void removeSession(String sessionId) {/* Not required at client-side.*/}
 
     public ActivityBean getActivities(HttpServletRequest request) {
 
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String userName = request.getParameter("userName");
         String resourcePath = request.getParameter("path");
         String fromDate = request.getParameter("fromDate");
@@ -85,23 +92,27 @@
         String pageStr = request.getParameter("page");
 
         try {
-            return proxy.getActivities(userName, resourcePath, fromDate, toDate, filter, pageStr);
+            return proxy.getActivities(userName, resourcePath, fromDate, toDate, filter, pageStr,
+                    sessionId);
         } catch (Exception e) {
             String msg = "Failed to get activities from the activity service.";
             log.error(msg, e);
             return null;
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public ActivityBean getActivities(String userName, String resourcePath, String fromDate,
-                                String toDate, String filter, String pageStr)
+                                String toDate, String filter, String pageStr, String sessionId)
             throws RegistryException {
 
         ActivityBean result = new ActivityBean();
 
         try {
             org.wso2.carbon.registry.activities.ui.beans.xsd.ActivityBean bean =
-                    stub.getActivities(userName, resourcePath, fromDate, toDate, filter, pageStr);
+                    stub.getActivities(userName, resourcePath, fromDate, toDate, filter, pageStr,
+                            sessionId);
             if (bean.getActivity() == null) {
                 bean.setActivity(new String[0]);
             }

Modified: trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/resources/ActivityAdminService/ActivityAdminService.wsdl
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/resources/ActivityAdminService/ActivityAdminService.wsdl?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/resources/ActivityAdminService/ActivityAdminService.wsdl	(original)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.activities.ui/src/main/resources/ActivityAdminService/ActivityAdminService.wsdl	Mon Jul 20 06:58:06 2009
@@ -22,6 +22,27 @@
         <xs:schema xmlns:ax226="http://beans.common.registry.carbon.wso2.org/xsd" xmlns:ax224="http://exceptions.core.registry.carbon.wso2.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://services.activities.registry.carbon.wso2.org">
             <xs:import namespace="http://exceptions.core.registry.carbon.wso2.org/xsd" />
             <xs:import namespace="http://beans.common.registry.carbon.wso2.org/xsd" />
+            <xs:element name="removeSession">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="getSession">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="uuid" nillable="true" type="xs:string" />
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="getSessionResponse">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType" />
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
             <xs:complexType name="Exception">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType" />
@@ -43,6 +64,7 @@
                         <xs:element minOccurs="0" name="toDate" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="filter" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="pageStr" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -64,12 +86,28 @@
     <wsdl:message name="RegistryException">
         <wsdl:part name="parameters" element="ns:RegistryException" />
     </wsdl:message>
+    <wsdl:message name="removeSessionRequest">
+        <wsdl:part name="parameters" element="ns:removeSession" />
+    </wsdl:message>
+    <wsdl:message name="getSessionRequest">
+        <wsdl:part name="parameters" element="ns:getSession" />
+    </wsdl:message>
+    <wsdl:message name="getSessionResponse">
+        <wsdl:part name="parameters" element="ns:getSessionResponse" />
+    </wsdl:message>
     <wsdl:portType name="ActivityAdminServicePortType">
         <wsdl:operation name="getActivities">
             <wsdl:input message="ns:getActivitiesRequest" wsaw:Action="urn:getActivities" />
             <wsdl:output message="ns:getActivitiesResponse" wsaw:Action="urn:getActivitiesResponse" />
             <wsdl:fault message="ns:RegistryException" name="RegistryException" wsaw:Action="urn:getActivitiesRegistryException" />
         </wsdl:operation>
+        <wsdl:operation name="removeSession">
+            <wsdl:input message="ns:removeSessionRequest" wsaw:Action="urn:removeSession" />
+        </wsdl:operation>
+        <wsdl:operation name="getSession">
+            <wsdl:input message="ns:getSessionRequest" wsaw:Action="urn:getSession" />
+            <wsdl:output message="ns:getSessionResponse" wsaw:Action="urn:getSessionResponse" />
+        </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="ActivityAdminServiceSoap11Binding" type="ns:ActivityAdminServicePortType">
         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
@@ -85,6 +123,21 @@
                 <soap:fault use="literal" name="RegistryException" />
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="removeSession">
+            <soap:operation soapAction="urn:removeSession" style="document" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="getSession">
+            <soap:operation soapAction="urn:getSession" style="document" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="ActivityAdminServiceSoap12Binding" type="ns:ActivityAdminServicePortType">
         <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
@@ -100,6 +153,21 @@
                 <soap12:fault use="literal" name="RegistryException" />
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="removeSession">
+            <soap12:operation soapAction="urn:removeSession" style="document" />
+            <wsdl:input>
+                <soap12:body use="literal" />
+            </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="getSession">
+            <soap12:operation soapAction="urn:getSession" style="document" />
+            <wsdl:input>
+                <soap12:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="ActivityAdminServiceHttpBinding" type="ns:ActivityAdminServicePortType">
         <http:binding verb="POST" />
@@ -112,16 +180,31 @@
                 <mime:content type="text/xml" part="getActivities" />
             </wsdl:output>
         </wsdl:operation>
+        <wsdl:operation name="removeSession">
+            <http:operation location="removeSession" />
+            <wsdl:input>
+                <mime:content type="text/xml" part="removeSession" />
+            </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="getSession">
+            <http:operation location="getSession" />
+            <wsdl:input>
+                <mime:content type="text/xml" part="getSession" />
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="getSession" />
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="ActivityAdminService">
         <wsdl:port name="ActivityAdminServiceHttpsSoap11Endpoint" binding="ns:ActivityAdminServiceSoap11Binding">
-            <soap:address location="https://10.0.0.9:9443/services/ActivityAdminService.ActivityAdminServiceHttpsSoap11Endpoint/" />
+            <soap:address location="https://10.100.1.214:9443/services/ActivityAdminService.ActivityAdminServiceHttpsSoap11Endpoint/" />
         </wsdl:port>
         <wsdl:port name="ActivityAdminServiceHttpsSoap12Endpoint" binding="ns:ActivityAdminServiceSoap12Binding">
-            <soap12:address location="https://10.0.0.9:9443/services/ActivityAdminService.ActivityAdminServiceHttpsSoap12Endpoint/" />
+            <soap12:address location="https://10.100.1.214:9443/services/ActivityAdminService.ActivityAdminServiceHttpsSoap12Endpoint/" />
         </wsdl:port>
         <wsdl:port name="ActivityAdminServiceHttpsEndpoint" binding="ns:ActivityAdminServiceHttpBinding">
-            <http:address location="https://10.0.0.9:9443/services/ActivityAdminService.ActivityAdminServiceHttpsEndpoint/" />
+            <http:address location="https://10.100.1.214:9443/services/ActivityAdminService.ActivityAdminServiceHttpsEndpoint/" />
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>
\ No newline at end of file

Modified: trunk/carbon-components/registry/org.wso2.carbon.registry.activities/src/main/java/org/wso2/carbon/registry/activities/services/ActivityService.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.activities/src/main/java/org/wso2/carbon/registry/activities/services/ActivityService.java?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/registry/org.wso2.carbon.registry.activities/src/main/java/org/wso2/carbon/registry/activities/services/ActivityService.java	(original)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.activities/src/main/java/org/wso2/carbon/registry/activities/services/ActivityService.java	Mon Jul 20 06:58:06 2009
@@ -24,19 +24,38 @@
 import org.wso2.carbon.registry.common.beans.ActivityBean;
 
 import javax.servlet.http.HttpSession;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 public class ActivityService implements IActivityService {
 
-    private HttpSession session = null;
+    private Map<String, HttpSession> sessions = new ConcurrentHashMap<String, HttpSession>();
 
-    public void setSession(HttpSession session) {
-        this.session = session;
+    public void setSession(String sessionId, HttpSession session) {
+        if (sessionId == null) {
+            return;
+        }
+        sessions.put(sessionId, session);
+    }
+
+    public void removeSession(String sessionId) {
+        if (sessionId == null) {
+            return;
+        }
+        sessions.remove(sessionId);
+    }
+
+    public HttpSession getSession(String uuid) {
+        if (uuid == null) {
+            return null;
+        }
+        return sessions.get(uuid);
     }
 
     public ActivityBean getActivities(String userName, String resourcePath, String fromDate,
-                                      String toDate, String filter, String pageStr)
+                                      String toDate, String filter, String pageStr, String sessionId)
             throws RegistryException {
-        UserRegistry registry = CommonUtil.getRegistry(session);
+        UserRegistry registry = CommonUtil.getRegistry(getSession(sessionId));
         try{
             return ActivityBeanPopulator.populate(registry, userName, resourcePath,
                     fromDate, toDate, filter, pageStr);

Modified: trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IActivityService.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IActivityService.java?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IActivityService.java	(original)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IActivityService.java	Mon Jul 20 06:58:06 2009
@@ -5,9 +5,7 @@
 
 import javax.servlet.http.HttpSession;
 
-public interface IActivityService {
+public interface IActivityService extends IManagedSession {
     ActivityBean getActivities(String userName, String resourcePath, String fromDate,
-                                String toDate, String filter, String pageStr) throws RegistryException;
-
-    void setSession(HttpSession session);
+                                String toDate, String filter, String pageStr, String sessionId) throws RegistryException;
 }

Modified: trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IInfoService.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IInfoService.java?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IInfoService.java	(original)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IInfoService.java	Mon Jul 20 06:58:06 2009
@@ -5,34 +5,32 @@
 
 import javax.servlet.http.HttpSession;
 
-public interface IInfoService {
-    CommentBean getComments(String path) throws RegistryException;
+public interface IInfoService extends IManagedSession {
+    CommentBean getComments(String path, String sessionId) throws RegistryException;
 
-    void addComment(String comment, String path) throws RegistryException;
+    void addComment(String comment, String path, String sessionId) throws RegistryException;
 
-    TagBean getTags(String path) throws RegistryException;
+    TagBean getTags(String path, String sessionId) throws RegistryException;
 
-    void addTag(String tag, String path) throws RegistryException;
+    void addTag(String tag, String path, String sessionId) throws RegistryException;
 
-    RatingBean getRatings(String path) throws RegistryException;
+    RatingBean getRatings(String path, String sessionId) throws RegistryException;
 
-    void rateResource(String rating, String path) throws RegistryException;
+    void rateResource(String rating, String path, String sessionId) throws RegistryException;
 
-    EventTypeBean getEventTypes(String path) throws RegistryException;
+    EventTypeBean getEventTypes(String path, String sessionId) throws RegistryException;
 
-    SubscriptionBean getSubscriptions(String path) throws RegistryException;
+    SubscriptionBean getSubscriptions(String path, String sessionId) throws RegistryException;
 
-    SubscriptionBean subscribe(String path, String endpoint, String eventName) throws RegistryException;
+    SubscriptionBean subscribe(String path, String endpoint, String eventName, String sessionId) throws RegistryException;
 
-    SubscriptionBean subscribeREST(String path, String endpoint, String eventName) throws RegistryException;
+    SubscriptionBean subscribeREST(String path, String endpoint, String eventName, String sessionId) throws RegistryException;
 
-    boolean isResource(String path) throws RegistryException;
+    boolean isResource(String path, String sessionId) throws RegistryException;
 
-    String getRemoteURL(String path) throws RegistryException;
+    String getRemoteURL(String path, String sessionId) throws RegistryException;
 
-    boolean unsubscribe(String path, String id) throws RegistryException;
+    boolean unsubscribe(String path, String id, String sessionId) throws RegistryException;
 
-    boolean isUserValid(String username) throws RegistryException;
-
-    void setSession(HttpSession session);
+    boolean isUserValid(String username, String sessionId) throws RegistryException;
 }

Added: trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IManagedSession.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IManagedSession.java?pathrev=41552
==============================================================================
--- (empty file)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.common/src/main/java/org/wso2/carbon/registry/common/IManagedSession.java	Mon Jul 20 06:58:06 2009
@@ -0,0 +1,10 @@
+package org.wso2.carbon.registry.common;
+
+import javax.servlet.http.HttpSession;
+
+public interface IManagedSession {
+
+    void setSession(String sessionId, HttpSession session);
+
+    void removeSession(String sessionId);
+}

Modified: trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/java/org/wso2/carbon/registry/info/ui/clients/InfoServiceClient.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/java/org/wso2/carbon/registry/info/ui/clients/InfoServiceClient.java?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/java/org/wso2/carbon/registry/info/ui/clients/InfoServiceClient.java	(original)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/java/org/wso2/carbon/registry/info/ui/clients/InfoServiceClient.java	Mon Jul 20 06:58:06 2009
@@ -24,6 +24,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.wso2.carbon.CarbonConstants;
 import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.core.utils.UUIDGenerator;
 import org.wso2.carbon.registry.info.ui.InfoAdminServiceStub;
 import org.wso2.carbon.registry.info.ui.Utils;
 import org.wso2.carbon.registry.common.IInfoService;
@@ -49,7 +50,8 @@
                 IInfoService.class, session);
 
         if (proxy == null) {
-            String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+            String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(),
+                    session);
             ConfigurationContext configContext = (ConfigurationContext) config.
                     getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
             String epr = backendServerURL + "InfoAdminService";
@@ -60,7 +62,8 @@
                 ServiceClient client = stub._getServiceClient();
                 Options option = client.getOptions();
                 option.setManageSession(true);
-                option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+                option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
+                        cookie);
 
             } catch (AxisFault axisFault) {
                 String msg = "Failed to initiate comment service client. " + axisFault.getMessage();
@@ -70,195 +73,267 @@
             proxy = (IInfoService) CarbonUIUtil.getServerProxy(this,
                 IInfoService.class, session);
         }
-        proxy.setSession(session);
     }
 
-    public void setSession(HttpSession session) {/* Not required at client-side.*/}
+    public void setSession(String sessionId, HttpSession session) {/* Not required at client-side.*/}
+
+    public void removeSession(String sessionId) {/* Not required at client-side.*/}
 
     public CommentBean getComments(HttpServletRequest request) throws Exception {
 
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
 
         try {
-            return proxy.getComments(path);
+            return proxy.getComments(path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to get comments from the comment service.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);    
         }
 
     }
 
     public void addComment(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
         String comment = (String) Utils.getParameter(request, "comment");
 
         try {
-            proxy.addComment(comment, path);
+            proxy.addComment(comment, path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to get comments from the comment service.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public TagBean getTags(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
 
         try {
-            return proxy.getTags(path);
+            return proxy.getTags(path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to get comments from the comment service.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public void addTag(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
         String tag = (String) Utils.getParameter(request, "tag");
 
         try {
-            proxy.addTag(tag, path);
+            proxy.addTag(tag, path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to add the tag.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public RatingBean getRatings(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
 
         try {
-            return proxy.getRatings(path);
+            return proxy.getRatings(path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to get ratings.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public void rateResource(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
         String rating = (String) Utils.getParameter(request, "rating");
 
         try {
-            proxy.rateResource(rating, path);
+            proxy.rateResource(rating, path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to rate the resource.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public EventTypeBean getEventTypes(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
 
         try {
-            return proxy.getEventTypes(path);
+            return proxy.getEventTypes(path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to get Event Types.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public SubscriptionBean getSubscriptions(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
 
         try {
-            return proxy.getSubscriptions(path);
+            return proxy.getSubscriptions(path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to get Subscriptions.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public SubscriptionBean subscribe(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
         String endpoint = (String) Utils.getParameter(request, "endpoint");
         String eventName = (String) Utils.getParameter(request, "eventName");
 
         try {
-            return proxy.subscribe(path, endpoint, eventName);
+            return proxy.subscribe(path, endpoint, eventName, sessionId);
         } catch (Exception e) {
             String msg = "Failed to subscribe.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public SubscriptionBean subscribeREST(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
         String endpoint = (String) Utils.getParameter(request, "endpoint");
         String eventName = (String) Utils.getParameter(request, "eventName");
 
         try {
-            return proxy.subscribeREST(path, endpoint, eventName);
+            return proxy.subscribeREST(path, endpoint, eventName, sessionId);
         } catch (Exception e) {
             String msg = "Failed to subscribe.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public boolean unsubscribe(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
         String id = (String) Utils.getParameter(request, "id");
 
         try {
-            return proxy.unsubscribe(path, id);
+            return proxy.unsubscribe(path, id, sessionId);
         } catch (Exception e) {
             String msg = "Failed to unsubscribe.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public boolean isResource(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
 
         try {
-            return proxy.isResource(path);
+            return proxy.isResource(path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to get resource type.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
 
     public String getRemoteURL(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String path = (String) Utils.getParameter(request, "path");
 
         try {
-            return proxy.getRemoteURL(path);
+            return proxy.getRemoteURL(path, sessionId);
         } catch (Exception e) {
             String msg = "Failed to get remote URL.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
     public boolean isUserValid(HttpServletRequest request) throws Exception {
+        String sessionId = UUIDGenerator.generateUUID();
+        proxy.setSession(sessionId, request.getSession());
+
         String username = (String) Utils.getParameter(request, "username");
 
         try {
-            return proxy.isUserValid(username);
+            return proxy.isUserValid(username, sessionId);
         } catch (Exception e) {
             String msg = "Failed to check existence of user.";
             log.error(msg, e);
             throw new Exception(msg);
+        } finally {
+            proxy.removeSession(sessionId);
         }
     }
 
-    public CommentBean getComments(String path) throws RegistryException {
+    public CommentBean getComments(String path, String sessionId) throws RegistryException {
         CommentBean result = new CommentBean();
 
         try {
-            org.wso2.carbon.registry.info.ui.beans.xsd.CommentBean bean = stub.getComments(path);
+            org.wso2.carbon.registry.info.ui.beans.xsd.CommentBean bean =
+                    stub.getComments(path, sessionId);
             if (bean.getComments() == null) {
                 bean.setComments(
                         new org.wso2.carbon.registry.info.ui.beans.utils.xsd.Comment[0]);
@@ -301,9 +376,9 @@
 
     }
 
-    public void addComment(String comment, String path) throws RegistryException {
+    public void addComment(String comment, String path, String sessionId) throws RegistryException {
         try {
-            stub.addComment(comment, path);
+            stub.addComment(comment, path, sessionId);
         } catch (Exception e) {
             String msg = e.getMessage();
             log.error(msg, e);
@@ -311,10 +386,10 @@
         }
     }
 
-    public TagBean getTags(String path) throws RegistryException {
+    public TagBean getTags(String path, String sessionId) throws RegistryException {
         TagBean result = new TagBean();
         try {
-            org.wso2.carbon.registry.info.ui.beans.xsd.TagBean bean = stub.getTags(path);
+            org.wso2.carbon.registry.info.ui.beans.xsd.TagBean bean = stub.getTags(path, sessionId);
             if (bean.getTags() == null) {
                 bean.setTags(new org.wso2.carbon.registry.info.ui.beans.utils.xsd.Tag[0]);
             }
@@ -346,9 +421,9 @@
         return result;
     }
 
-    public void addTag(String tag, String path) throws RegistryException {
+    public void addTag(String tag, String path, String sessionId) throws RegistryException {
         try {
-            stub.addTag(tag, path);
+            stub.addTag(tag, path, sessionId);
         } catch (Exception e) {
             String msg = e.getMessage();
             log.error(msg, e);
@@ -356,7 +431,7 @@
         }
     }
 
-    public RatingBean getRatings(String path) throws RegistryException {
+    public RatingBean getRatings(String path, String sessionId) throws RegistryException {
         RatingBean result = new RatingBean();
         try {
             org.wso2.carbon.registry.info.ui.beans.xsd.RatingBean bean = stub.getRatings(path);
@@ -377,9 +452,9 @@
         return result;
     }
 
-    public void rateResource(String rating, String path) throws RegistryException {
+    public void rateResource(String rating, String path, String sessionId) throws RegistryException {
         try {
-            stub.rateResource(rating, path);
+            stub.rateResource(rating, path, sessionId);
         } catch (Exception e) {
             String msg = e.getMessage();
             log.error(msg, e);
@@ -387,7 +462,7 @@
         }
     }
 
-    public EventTypeBean getEventTypes(String path) throws RegistryException {
+    public EventTypeBean getEventTypes(String path, String sessionId) throws RegistryException {
         EventTypeBean result = new EventTypeBean();
         try {
             org.wso2.carbon.registry.info.ui.beans.xsd.EventTypeBean bean = stub.getEventTypes(path);
@@ -419,11 +494,11 @@
         return result;
     }
 
-    public SubscriptionBean getSubscriptions(String path) throws RegistryException {
+    public SubscriptionBean getSubscriptions(String path, String sessionId) throws RegistryException {
         SubscriptionBean result = new SubscriptionBean();
         try {
             org.wso2.carbon.registry.info.ui.beans.xsd.SubscriptionBean bean =
-                    stub.getSubscriptions(path);
+                    stub.getSubscriptions(path, sessionId);
             if (bean.getSubscriptionInstances() == null) {
                 bean.setSubscriptionInstances(
                         new org.wso2.carbon.registry.info.ui.beans.utils.xsd.SubscriptionInstance[0]);
@@ -462,11 +537,11 @@
         return result;
     }
 
-    public SubscriptionBean subscribe(String path, String endpoint, String eventName) throws RegistryException {
+    public SubscriptionBean subscribe(String path, String endpoint, String eventName, String sessionId) throws RegistryException {
         SubscriptionBean result = new SubscriptionBean();
         try {
             org.wso2.carbon.registry.info.ui.beans.xsd.SubscriptionBean bean =
-                    stub.subscribe(path, endpoint, eventName);
+                    stub.subscribe(path, endpoint, eventName, sessionId);
             if (bean.getSubscriptionInstances() == null) {
                 bean.setSubscriptionInstances(
                         new org.wso2.carbon.registry.info.ui.beans.utils.xsd.SubscriptionInstance[0]);
@@ -505,11 +580,11 @@
         return result;
     }
 
-    public SubscriptionBean subscribeREST(String path, String endpoint, String eventName) throws RegistryException {
+    public SubscriptionBean subscribeREST(String path, String endpoint, String eventName, String sessionId) throws RegistryException {
         SubscriptionBean result = new SubscriptionBean();
         try {
             org.wso2.carbon.registry.info.ui.beans.xsd.SubscriptionBean bean =
-                    stub.subscribeREST(path, endpoint, eventName);
+                    stub.subscribeREST(path, endpoint, eventName, sessionId);
             if (bean.getSubscriptionInstances() == null) {
                 bean.setSubscriptionInstances(
                         new org.wso2.carbon.registry.info.ui.beans.utils.xsd.SubscriptionInstance[0]);
@@ -548,9 +623,9 @@
         return result;
     }
 
-    public boolean isResource(String path) throws RegistryException {
+    public boolean isResource(String path, String sessionId) throws RegistryException {
         try {
-            return stub.isResource(path);
+            return stub.isResource(path, sessionId);
         } catch (Exception e) {
             String msg = e.getMessage();
             log.error(msg, e);
@@ -558,9 +633,9 @@
         }
     }
 
-    public String getRemoteURL(String path) throws RegistryException {
+    public String getRemoteURL(String path, String sessionId) throws RegistryException {
         try {
-            return stub.getRemoteURL(path);
+            return stub.getRemoteURL(path, sessionId);
         } catch (Exception e) {
             String msg = e.getMessage();
             log.error(msg, e);
@@ -568,9 +643,9 @@
         }
     }
 
-    public boolean unsubscribe(String path, String id) throws RegistryException {
+    public boolean unsubscribe(String path, String id, String sessionId) throws RegistryException {
         try {
-            return stub.unsubscribe(path, id);
+            return stub.unsubscribe(path, id, sessionId);
         } catch (Exception e) {
             String msg = e.getMessage();
             log.error(msg, e);
@@ -578,9 +653,9 @@
         }
     }
 
-    public boolean isUserValid(String username) throws RegistryException {
+    public boolean isUserValid(String username, String sessionId) throws RegistryException {
         try {
-            return stub.isUserValid(username);
+            return stub.isUserValid(username, sessionId);
         } catch (Exception e) {
             String msg = e.getMessage();
             log.error(msg, e);

Modified: trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/resources/InfoAdminService/InfoAdminService.wsdl
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/resources/InfoAdminService/InfoAdminService.wsdl?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/resources/InfoAdminService/InfoAdminService.wsdl	(original)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.info.ui/src/main/resources/InfoAdminService/InfoAdminService.wsdl	Mon Jul 20 06:58:06 2009
@@ -125,6 +125,7 @@
                     <xs:sequence>
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="id" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -141,6 +142,7 @@
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="endpoint" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="eventName" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -157,6 +159,7 @@
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="endpoint" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="eventName" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -167,11 +170,19 @@
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
+            <xs:element name="removeSession">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
             <xs:element name="rateResource">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="rating" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -179,6 +190,7 @@
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="username" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -193,6 +205,7 @@
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -207,6 +220,7 @@
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -221,6 +235,7 @@
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -231,10 +246,25 @@
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
+            <xs:element name="getSession">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="getSessionResponse">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType" />
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
             <xs:element name="getRemoteURL">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -249,6 +279,7 @@
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -263,6 +294,7 @@
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -277,6 +309,7 @@
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -292,6 +325,7 @@
                     <xs:sequence>
                         <xs:element minOccurs="0" name="tag" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -300,6 +334,7 @@
                     <xs:sequence>
                         <xs:element minOccurs="0" name="comment" nillable="true" type="xs:string" />
                         <xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
+                        <xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string" />
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -380,9 +415,18 @@
     <wsdl:message name="getSubscriptionsResponse">
         <wsdl:part name="parameters" element="ns:getSubscriptionsResponse" />
     </wsdl:message>
+    <wsdl:message name="removeSessionRequest">
+        <wsdl:part name="parameters" element="ns:removeSession" />
+    </wsdl:message>
     <wsdl:message name="addCommentRequest">
         <wsdl:part name="parameters" element="ns:addComment" />
     </wsdl:message>
+    <wsdl:message name="getSessionRequest">
+        <wsdl:part name="parameters" element="ns:getSession" />
+    </wsdl:message>
+    <wsdl:message name="getSessionResponse">
+        <wsdl:part name="parameters" element="ns:getSessionResponse" />
+    </wsdl:message>
     <wsdl:portType name="InfoAdminServicePortType">
         <wsdl:operation name="getTags">
             <wsdl:input message="ns:getTagsRequest" wsaw:Action="urn:getTags" />
@@ -447,10 +491,17 @@
             <wsdl:output message="ns:getSubscriptionsResponse" wsaw:Action="urn:getSubscriptionsResponse" />
             <wsdl:fault message="ns:RegistryException" name="RegistryException" wsaw:Action="urn:getSubscriptionsRegistryException" />
         </wsdl:operation>
+        <wsdl:operation name="removeSession">
+            <wsdl:input message="ns:removeSessionRequest" wsaw:Action="urn:removeSession" />
+        </wsdl:operation>
         <wsdl:operation name="addComment">
             <wsdl:input message="ns:addCommentRequest" wsaw:Action="urn:addComment" />
             <wsdl:fault message="ns:RegistryException" name="RegistryException" wsaw:Action="urn:addCommentRegistryException" />
         </wsdl:operation>
+        <wsdl:operation name="getSession">
+            <wsdl:input message="ns:getSessionRequest" wsaw:Action="urn:getSession" />
+            <wsdl:output message="ns:getSessionResponse" wsaw:Action="urn:getSessionResponse" />
+        </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="InfoAdminServiceSoap11Binding" type="ns:InfoAdminServicePortType">
         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
@@ -613,6 +664,21 @@
                 <soap:fault use="literal" name="RegistryException" />
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="removeSession">
+            <soap:operation soapAction="urn:removeSession" style="document" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="getSession">
+            <soap:operation soapAction="urn:getSession" style="document" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="InfoAdminServiceSoap12Binding" type="ns:InfoAdminServicePortType">
         <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
@@ -775,6 +841,21 @@
                 <soap12:fault use="literal" name="RegistryException" />
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="removeSession">
+            <soap12:operation soapAction="urn:removeSession" style="document" />
+            <wsdl:input>
+                <soap12:body use="literal" />
+            </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="getSession">
+            <soap12:operation soapAction="urn:getSession" style="document" />
+            <wsdl:input>
+                <soap12:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="InfoAdminServiceHttpBinding" type="ns:InfoAdminServicePortType">
         <http:binding verb="POST" />
@@ -895,16 +976,31 @@
                 <mime:content type="text/xml" part="addComment" />
             </wsdl:input>
         </wsdl:operation>
+        <wsdl:operation name="removeSession">
+            <http:operation location="removeSession" />
+            <wsdl:input>
+                <mime:content type="text/xml" part="removeSession" />
+            </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="getSession">
+            <http:operation location="getSession" />
+            <wsdl:input>
+                <mime:content type="text/xml" part="getSession" />
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="getSession" />
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="InfoAdminService">
         <wsdl:port name="InfoAdminServiceHttpsSoap11Endpoint" binding="ns:InfoAdminServiceSoap11Binding">
-            <soap:address location="https://10.0.0.8:9443/services/InfoAdminService.InfoAdminServiceHttpsSoap11Endpoint/" />
+            <soap:address location="https://10.100.1.214:9443/services/InfoAdminService.InfoAdminServiceHttpsSoap11Endpoint/" />
         </wsdl:port>
         <wsdl:port name="InfoAdminServiceHttpsSoap12Endpoint" binding="ns:InfoAdminServiceSoap12Binding">
-            <soap12:address location="https://10.0.0.8:9443/services/InfoAdminService.InfoAdminServiceHttpsSoap12Endpoint/" />
+            <soap12:address location="https://10.100.1.214:9443/services/InfoAdminService.InfoAdminServiceHttpsSoap12Endpoint/" />
         </wsdl:port>
         <wsdl:port name="InfoAdminServiceHttpsEndpoint" binding="ns:InfoAdminServiceHttpBinding">
-            <http:address location="https://10.0.0.8:9443/services/InfoAdminService.InfoAdminServiceHttpsEndpoint/" />
+            <http:address location="https://10.100.1.214:9443/services/InfoAdminService.InfoAdminServiceHttpsEndpoint/" />
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>
\ No newline at end of file

Modified: trunk/carbon-components/registry/org.wso2.carbon.registry.info/src/main/java/org/wso2/carbon/registry/info/services/InfoService.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/registry/org.wso2.carbon.registry.info/src/main/java/org/wso2/carbon/registry/info/services/InfoService.java?rev=41552&r1=41551&r2=41552&view=diff
==============================================================================
--- trunk/carbon-components/registry/org.wso2.carbon.registry.info/src/main/java/org/wso2/carbon/registry/info/services/InfoService.java	(original)
+++ trunk/carbon-components/registry/org.wso2.carbon.registry.info/src/main/java/org/wso2/carbon/registry/info/services/InfoService.java	Mon Jul 20 06:58:06 2009
@@ -39,50 +39,70 @@
 import org.wso2.eventing.SubscriptionData;
 
 import javax.servlet.http.HttpSession;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 public class InfoService implements IInfoService {
 
     private static final Log log = LogFactory.getLog(InfoService.class);
 
-    private HttpSession session = null;
+    private Map<String, HttpSession> sessions = new ConcurrentHashMap<String, HttpSession>();
 
-    public void setSession(HttpSession session) {
-        this.session = session;
+    public void setSession(String sessionId, HttpSession session) {
+        if (sessionId == null) {
+            return;
+        }
+        sessions.put(sessionId, session);
+    }
+
+    public void removeSession(String sessionId) {
+        if (sessionId == null) {
+            return;
+        }
+        sessions.remove(sessionId);
+    }
+
+    public HttpSession getSession(String sessionId) {
+        if (sessionId == null) {
+            return null;
+        }
+        return sessions.get(sessionId);
     }
 
-    public CommentBean getComments(String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public CommentBean getComments(String path, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         return CommentBeanPopulator.populate(registry, path);
     }
 
-    public void addComment(String comment, String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public void addComment(String comment, String path, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         registry.addComment(path, new Comment(comment));
     }
 
-    public TagBean getTags(String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public TagBean getTags(String path, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         return TagBeanPopulator.populate(registry, path);
     }
 
-    public void addTag(String tag, String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public void addTag(String tag, String path, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         registry.applyTag(path, tag);
     }
 
-    public RatingBean getRatings(String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public RatingBean getRatings(String path, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         return RatingBeanPopulator.populate(registry, path);
     }
 
-    public void rateResource(String rating, String path) throws RegistryException {
+    public void rateResource(String rating, String path, String sessionId)
+            throws RegistryException {
         int userRating = Integer.parseInt(rating);
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         registry.rateResource(path, userRating);
     }
 
-    public EventTypeBean getEventTypes(String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public EventTypeBean getEventTypes(String path, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         Resource resource = null;
         if (!path.startsWith(SubscriptionBeanPopulator.RECURSE)) {
             resource = registry.get(path);
@@ -98,23 +118,27 @@
         return EventTypeBeanPopulator.populate(registry, path);
     }
 
-    public SubscriptionBean getSubscriptions(String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public SubscriptionBean getSubscriptions(String path, String sessionId)
+            throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         return SubscriptionBeanPopulator.populate(registry, path);
     }
 
-    public SubscriptionBean subscribe(String path, String endpoint, String eventName) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public SubscriptionBean subscribe(String path, String endpoint, String eventName,
+                                      String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         return SubscriptionBeanPopulator.subscribeAndPopulate(registry, path, endpoint, eventName);
     }
 
-    public SubscriptionBean subscribeREST(String path, String endpoint, String eventName) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
-        return SubscriptionBeanPopulator.subscribeAndPopulate(registry, path, endpoint, eventName, true);
+    public SubscriptionBean subscribeREST(String path, String endpoint, String eventName,
+                                          String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
+        return SubscriptionBeanPopulator.subscribeAndPopulate(registry, path, endpoint,
+                eventName, true);
     }
 
-    public boolean isResource(String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public boolean isResource(String path, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         Resource resource = registry.get(path);
         if (resource != null) {
             String isLink = resource.getProperty("registry.link");
@@ -144,8 +168,8 @@
         return true;
     }
 
-    public String getRemoteURL(String path) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public String getRemoteURL(String path, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         Resource resource = registry.get(path);
         if (resource != null) {
             String isLink = resource.getProperty("registry.link");
@@ -153,16 +177,15 @@
             String userName = resource.getProperty("registry.user");
             if (isLink != null && realPath != null && userName != null) {
                 log.debug("Found mounted resource at: " + realPath);
-                String url = realPath.replace("/registry/resourceContent?", "/resources/resource.jsp?");
-                return url;
+                return realPath.replace("/registry/resourceContent?", "/resources/resource.jsp?");
             }
         }
         return null;
     }
 
-    public boolean unsubscribe(String path, String id) throws RegistryException {
+    public boolean unsubscribe(String path, String id, String sessionId) throws RegistryException {
         log.debug("Got unsubscribe request at path: " + path + " with id: " + id);
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         Resource resource = registry.get(path);
         String url = null;
         String userName = null;
@@ -193,7 +216,8 @@
             if (url == null || userName == null) {
                 subscription = Utils.getRegistryEventingService().getSubscription(id);
             } else  {
-                subscription = Utils.getRegistryEventingService().getSubscription(id, userName, url);
+                subscription = Utils.getRegistryEventingService().getSubscription(id, userName,
+                        url);
             }
 
             if (subscription == null) {
@@ -203,13 +227,15 @@
             SubscriptionData data = subscription.getSubscriptionData();
             String username = (String) data.getProperty(UserCoreConstants.UserMgtConfig.USERNAME);
             if (username == null || !username.equals(registry.getUserName())) {
-                if (!SubscriptionBeanPopulator.isAuthorized(registry, path, AccessControlConstants.AUTHORIZE)) {
+                if (!SubscriptionBeanPopulator.isAuthorized(registry, path,
+                        AccessControlConstants.AUTHORIZE)) {
                     if (log.isDebugEnabled()) {
                         log.warn("User doesn't have AUTHORIZE priviledges, can't unsubscribe");
                     }
                     return false;
                 }
-            } else if (!SubscriptionBeanPopulator.isAuthorized(registry, path, ActionConstants.GET)) {
+            } else if (!SubscriptionBeanPopulator.isAuthorized(registry, path,
+                    ActionConstants.GET)) {
                 return false;
             }
             if (url == null || userName == null) {
@@ -223,8 +249,8 @@
         }
     }
 
-    public boolean isUserValid(String username) throws RegistryException {
-        UserRegistry registry = (UserRegistry) Utils.getRegistry(session);
+    public boolean isUserValid(String username, String sessionId) throws RegistryException {
+        UserRegistry registry = (UserRegistry) Utils.getRegistry(getSession(sessionId));
         try {
             if (!registry.getUserRealm().getUserStoreReader().isExistingUser(username)) {
                 return false;



More information about the Carbon-dev mailing list