[wsas-java-dev] svn commit r1754 - in trunk/wsas/java/modules: clustering clustering/src/org/wso2/wsas/clustering samples/NodeManagement

svn at wso2.org svn at wso2.org
Wed Apr 4 22:25:50 PDT 2007


Author: azeez
Date: Wed Apr  4 22:25:41 2007
New Revision: 1754

Modified:
   trunk/wsas/java/modules/clustering/nodemanager.wsdl
   trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManager.java
   trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManagerClient.java
   trunk/wsas/java/modules/samples/NodeManagement/unloadservicegroups
Log:
Changing the logic in the admin client to be able to hanlde an array of service groups 



Modified: trunk/wsas/java/modules/clustering/nodemanager.wsdl
==============================================================================
--- trunk/wsas/java/modules/clustering/nodemanager.wsdl	(original)
+++ trunk/wsas/java/modules/clustering/nodemanager.wsdl	Wed Apr  4 22:25:41 2007
@@ -71,17 +71,40 @@
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
+            <xs:element name="loadServiceGroupsFault">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element name="loadServiceGroupsFault" type="xs:anyType"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="loadServiceGroups">
+                <xs:complexType>
+                    <xs:sequence>
+
+                        <xs:element maxOccurs="unbounded" name="serviceGroupNames" nillable="true"
+                                    type="xs:string"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="loadServiceGroupsResponse">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element name="return" nillable="true" type="xs:boolean"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
             <xs:element name="prepareFault">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element name="prepareFault" type="xs:anyType"/>
                     </xs:sequence>
                 </xs:complexType>
+
             </xs:element>
             <xs:element name="prepareResponse">
                 <xs:complexType>
                     <xs:sequence>
-
                         <xs:element name="return" nillable="true" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
@@ -95,11 +118,11 @@
             </xs:element>
             <xs:element name="reloadConfigurationResponse">
                 <xs:complexType>
+
                     <xs:sequence>
                         <xs:element name="return" nillable="true" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
-
             </xs:element>
             <xs:element name="unloadServiceGroupFault">
                 <xs:complexType>
@@ -113,11 +136,34 @@
                     <xs:sequence>
                         <xs:element name="serviceGroupName" nillable="true" type="xs:string"/>
                     </xs:sequence>
+
                 </xs:complexType>
             </xs:element>
             <xs:element name="unloadServiceGroupResponse">
                 <xs:complexType>
+                    <xs:sequence>
+                        <xs:element name="return" nillable="true" type="xs:boolean"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="unloadServiceGroupsFault">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element name="unloadServiceGroupsFault" type="xs:anyType"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="unloadServiceGroups">
 
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element maxOccurs="unbounded" name="serviceGroupNames" nillable="true"
+                                    type="xs:string"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="unloadServiceGroupsResponse">
+                <xs:complexType>
                     <xs:sequence>
                         <xs:element name="return" nillable="true" type="xs:boolean"/>
                     </xs:sequence>
@@ -141,6 +187,15 @@
     <wsdl:message name="prepareFault">
         <wsdl:part name="part1" element="ns0:prepareFault"/>
     </wsdl:message>
+    <wsdl:message name="loadServiceGroupsMessage">
+        <wsdl:part name="part1" element="ns0:loadServiceGroups"/>
+    </wsdl:message>
+    <wsdl:message name="loadServiceGroupsResponse">
+        <wsdl:part name="part1" element="ns0:loadServiceGroupsResponse"/>
+    </wsdl:message>
+    <wsdl:message name="loadServiceGroupsFault">
+        <wsdl:part name="part1" element="ns0:loadServiceGroupsFault"/>
+    </wsdl:message>
     <wsdl:message name="loadServiceGroupMessage">
         <wsdl:part name="part1" element="ns0:loadServiceGroup"/>
     </wsdl:message>
@@ -173,6 +228,15 @@
     <wsdl:message name="unloadServiceGroupFault">
         <wsdl:part name="part1" element="ns0:unloadServiceGroupFault"/>
     </wsdl:message>
+    <wsdl:message name="unloadServiceGroupsMessage">
+        <wsdl:part name="part1" element="ns0:unloadServiceGroups"/>
+    </wsdl:message>
+    <wsdl:message name="unloadServiceGroupsResponse">
+        <wsdl:part name="part1" element="ns0:unloadServiceGroupsResponse"/>
+    </wsdl:message>
+    <wsdl:message name="unloadServiceGroupsFault">
+        <wsdl:part name="part1" element="ns0:unloadServiceGroupsFault"/>
+    </wsdl:message>
     <wsdl:portType name="WSO2WSASNodeManagerPortType">
         <wsdl:operation name="applyPolicy">
             <wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
@@ -186,6 +250,12 @@
             <wsdl:output message="ns0:prepareResponse"/>
             <wsdl:fault message="ns0:prepareFault" name="prepareFault"/>
         </wsdl:operation>
+        <wsdl:operation name="loadServiceGroups">
+            <wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+                        message="ns0:loadServiceGroupsMessage" wsaw:Action="urn:loadServiceGroups"/>
+            <wsdl:output message="ns0:loadServiceGroupsResponse"/>
+            <wsdl:fault message="ns0:loadServiceGroupsFault" name="loadServiceGroupsFault"/>
+        </wsdl:operation>
         <wsdl:operation name="loadServiceGroup">
             <wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
                         message="ns0:loadServiceGroupMessage" wsaw:Action="urn:loadServiceGroup"/>
@@ -212,6 +282,13 @@
             <wsdl:output message="ns0:unloadServiceGroupResponse"/>
             <wsdl:fault message="ns0:unloadServiceGroupFault" name="unloadServiceGroupFault"/>
         </wsdl:operation>
+        <wsdl:operation name="unloadServiceGroups">
+            <wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+                        message="ns0:unloadServiceGroupsMessage"
+                        wsaw:Action="urn:unloadServiceGroups"/>
+            <wsdl:output message="ns0:unloadServiceGroupsResponse"/>
+            <wsdl:fault message="ns0:unloadServiceGroupsFault" name="unloadServiceGroupsFault"/>
+        </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="WSO2WSASNodeManagerSOAP11Binding" type="ns0:WSO2WSASNodeManagerPortType">
         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
@@ -239,6 +316,18 @@
                 <soap12:fault use="literal" name="prepareFault"/>
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="loadServiceGroups">
+            <soap:operation soapAction="urn:loadServiceGroups" style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="loadServiceGroupsFault">
+                <soap12:fault use="literal" name="loadServiceGroupsFault"/>
+            </wsdl:fault>
+        </wsdl:operation>
         <wsdl:operation name="loadServiceGroup">
             <soap:operation soapAction="urn:loadServiceGroup" style="document"/>
             <wsdl:input>
@@ -287,6 +376,18 @@
                 <soap12:fault use="literal" name="unloadServiceGroupFault"/>
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="unloadServiceGroups">
+            <soap:operation soapAction="urn:unloadServiceGroups" style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="unloadServiceGroupsFault">
+                <soap12:fault use="literal" name="unloadServiceGroupsFault"/>
+            </wsdl:fault>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="WSO2WSASNodeManagerSOAP12Binding" type="ns0:WSO2WSASNodeManagerPortType">
         <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
@@ -314,6 +415,18 @@
                 <soap12:fault use="literal" name="prepareFault"/>
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="loadServiceGroups">
+            <soap12:operation soapAction="urn:loadServiceGroups" style="document"/>
+            <wsdl:input>
+                <soap12:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="loadServiceGroupsFault">
+                <soap12:fault use="literal" name="loadServiceGroupsFault"/>
+            </wsdl:fault>
+        </wsdl:operation>
         <wsdl:operation name="loadServiceGroup">
             <soap12:operation soapAction="urn:loadServiceGroup" style="document"/>
             <wsdl:input>
@@ -362,6 +475,18 @@
                 <soap12:fault use="literal" name="unloadServiceGroupFault"/>
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="unloadServiceGroups">
+            <soap12:operation soapAction="urn:unloadServiceGroups" style="document"/>
+            <wsdl:input>
+                <soap12:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="unloadServiceGroupsFault">
+                <soap12:fault use="literal" name="unloadServiceGroupsFault"/>
+            </wsdl:fault>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="WSO2WSASNodeManagerHttpBinding" type="ns0:WSO2WSASNodeManagerPortType">
         <http:binding verb="POST"/>
@@ -383,6 +508,15 @@
                 <mime:content type="text/xml"/>
             </wsdl:output>
         </wsdl:operation>
+        <wsdl:operation name="loadServiceGroups">
+            <http:operation location="loadServiceGroups"/>
+            <wsdl:input>
+                <mime:content type="text/xml"/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml"/>
+            </wsdl:output>
+        </wsdl:operation>
         <wsdl:operation name="loadServiceGroup">
             <http:operation location="loadServiceGroup"/>
             <wsdl:input>
@@ -419,29 +553,38 @@
                 <mime:content type="text/xml"/>
             </wsdl:output>
         </wsdl:operation>
+        <wsdl:operation name="unloadServiceGroups">
+            <http:operation location="unloadServiceGroups"/>
+            <wsdl:input>
+                <mime:content type="text/xml"/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml"/>
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="WSO2WSASNodeManager">
         <wsdl:port name="WSO2WSASNodeManagerSOAP11port_https"
                    binding="ns0:WSO2WSASNodeManagerSOAP11Binding">
-            <soap:address location="https://10.100.1.118:9443/services/WSO2WSASNodeManager"/>
+            <soap:address location="https://172.16.207.1:9443/services/WSO2WSASNodeManager"/>
         </wsdl:port>
         <wsdl:port name="WSO2WSASNodeManagerSOAP11port_http1"
                    binding="ns0:WSO2WSASNodeManagerSOAP11Binding">
-            <soap:address location="http://10.100.1.118:9762/services/WSO2WSASNodeManager"/>
+            <soap:address location="http://172.16.207.1:9762/services/WSO2WSASNodeManager"/>
         </wsdl:port>
         <wsdl:port name="WSO2WSASNodeManagerSOAP12port_https"
                    binding="ns0:WSO2WSASNodeManagerSOAP12Binding">
-            <soap12:address location="https://10.100.1.118:9443/services/WSO2WSASNodeManager"/>
+            <soap12:address location="https://172.16.207.1:9443/services/WSO2WSASNodeManager"/>
         </wsdl:port>
         <wsdl:port name="WSO2WSASNodeManagerSOAP12port_http1"
                    binding="ns0:WSO2WSASNodeManagerSOAP12Binding">
-            <soap12:address location="http://10.100.1.118:9762/services/WSO2WSASNodeManager"/>
+            <soap12:address location="http://172.16.207.1:9762/services/WSO2WSASNodeManager"/>
         </wsdl:port>
         <wsdl:port name="WSO2WSASNodeManagerHttpport" binding="ns0:WSO2WSASNodeManagerHttpBinding">
-            <http:address location="https://10.100.1.118:9443/services/WSO2WSASNodeManager"/>
+            <http:address location="https://172.16.207.1:9443/services/WSO2WSASNodeManager"/>
         </wsdl:port>
         <wsdl:port name="WSO2WSASNodeManagerHttpport1" binding="ns0:WSO2WSASNodeManagerHttpBinding">
-            <http:address location="http://10.100.1.118:9762/services/WSO2WSASNodeManager"/>
+            <http:address location="http://172.16.207.1:9762/services/WSO2WSASNodeManager"/>
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>
\ No newline at end of file

Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManager.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManager.java	(original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManager.java	Wed Apr  4 22:25:41 2007
@@ -58,6 +58,30 @@
         return true;
     }
 
+    public boolean unloadServiceGroups(String[] serviceGroupNames) throws AxisFault {
+        init();
+        ConfigurationManager configMan = getConfigurationManager();
+        if (configMan == null) {
+            throw new AxisFault(CONFIG_MANAGER_NULL);
+        }
+        for (int i = 0; i < serviceGroupNames.length; i++) {
+            configMan.unloadServiceGroup(serviceGroupNames[i]);
+        }
+        return true;
+    }
+
+    public boolean loadServiceGroups(String[] serviceGroupNames) throws AxisFault {
+        init();
+        ConfigurationManager configMan = getConfigurationManager();
+        if (configMan == null) {
+            throw new AxisFault(CONFIG_MANAGER_NULL);
+        }
+        for (int i = 0; i < serviceGroupNames.length; i++) {
+            configMan.loadServiceGroup(serviceGroupNames[i]);
+        }
+        return true;
+    }
+
     public boolean applyPolicy(String serviceName, String policyId) throws AxisFault {
         init();
         ConfigurationManager configMan = getConfigurationManager();
@@ -89,7 +113,6 @@
         init();
         ConfigurationManager configMan = getConfigurationManager();
         if (configMan != null) {
-//            configMan.commit();
             return isCommitSuccessful(configMan);
         }
         return true;

Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManagerClient.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManagerClient.java	(original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManagerClient.java	Wed Apr  4 22:25:41 2007
@@ -17,6 +17,10 @@
 
 import org.apache.axis2.AxisFault;
 
+import java.util.StringTokenizer;
+import java.util.List;
+import java.util.ArrayList;
+
 /**
  * 
  */
@@ -31,19 +35,19 @@
         return stub.reloadConfiguration().get_return();
     }
 
-    private boolean loadServiceGroup(String serviceGroupName) throws Exception {
-        WSO2WSASNodeManagerStub.LoadServiceGroup req =
-                new WSO2WSASNodeManagerStub.LoadServiceGroup();
-        req.setServiceGroupName(serviceGroupName);
-        WSO2WSASNodeManagerStub.LoadServiceGroupResponse resp = stub.loadServiceGroup(req);
+    private boolean unloadServiceGroups(String[] serviceGroupNames) throws Exception {
+        WSO2WSASNodeManagerStub.UnloadServiceGroups req =
+                new WSO2WSASNodeManagerStub.UnloadServiceGroups();
+        req.setServiceGroupNames(serviceGroupNames);
+        WSO2WSASNodeManagerStub.UnloadServiceGroupsResponse resp = stub.unloadServiceGroups(req);
         return resp.get_return();
     }
 
-    private boolean unloadServiceGroup(String serviceGroupName) throws Exception {
-        WSO2WSASNodeManagerStub.UnloadServiceGroup req =
-                new WSO2WSASNodeManagerStub.UnloadServiceGroup();
-        req.setServiceGroupName(serviceGroupName);
-        WSO2WSASNodeManagerStub.UnloadServiceGroupResponse resp = stub.unloadServiceGroup(req);
+    private boolean loadServiceGroups(String[] serviceGroupNames) throws Exception {
+        WSO2WSASNodeManagerStub.LoadServiceGroups req =
+                new WSO2WSASNodeManagerStub.LoadServiceGroups();
+        req.setServiceGroupNames(serviceGroupNames);
+        WSO2WSASNodeManagerStub.LoadServiceGroupsResponse resp = stub.loadServiceGroups(req);
         return resp.get_return();
     }
 
@@ -72,10 +76,12 @@
             boolean isOperationSuccessful = false;
             if (operation.equals("reloadconfig")) {
                 isOperationSuccessful = client.reloadConfiguration();
-            } else if (operation.equals("loadsg")) {
-                isOperationSuccessful = client.loadServiceGroup(getParam("--service-group", args));
-            } else if (operation.equals("unloadsg")) {
-                isOperationSuccessful = client.unloadServiceGroup(getParam("--service-group", args));
+            } else if (operation.equals("loadsgs")) {
+                String[] serviceGroups = getServiceGroups(getParam("--service-groups", args));
+                isOperationSuccessful = client.loadServiceGroups(serviceGroups);
+            } else if (operation.equals("unloadsgs")) {
+                String[] serviceGroups = getServiceGroups(getParam("--service-groups", args));
+                isOperationSuccessful = client.unloadServiceGroups(serviceGroups);
             } else if (operation.equals("applypolicy")) {
                 isOperationSuccessful = client.applyServicePolicy();
             } else if (operation.equals("commit")) {
@@ -96,11 +102,20 @@
         }
     }
 
+    private static String[] getServiceGroups(String serviceGroups) {
+        StringTokenizer tokenizer = new StringTokenizer(serviceGroups, ",");
+        List list = new ArrayList();
+        while (tokenizer.hasMoreTokens()) {
+            list.add(tokenizer.nextToken().trim());
+        }
+        return (String[]) list.toArray(new String[list.size()]);
+    }
+
     private static void printUsage() {
         System.out.println("usage: admin --epr <epr> " +
-                           "--operation <reloadconfig|loadsg|unloadsg|applypolicy|commit> " +
+                           "--operation <reloadconfig|loadsgs|unloadsgs|applypolicy|commit> " +
                            "[options]");
-        System.out.println("options: --service-group <ServiceGroupName>");
+        System.out.println("options: --service-groups <ServiceGroupName1,ServiceGroupName2,...,ServiceGroupNameN>");
     }
 
     /**

Modified: trunk/wsas/java/modules/samples/NodeManagement/unloadservicegroups
==============================================================================
--- trunk/wsas/java/modules/samples/NodeManagement/unloadservicegroups	(original)
+++ trunk/wsas/java/modules/samples/NodeManagement/unloadservicegroups	Wed Apr  4 22:25:41 2007
@@ -2,15 +2,10 @@
 
 EPR=http://10.100.1.118:9762/services/WSO2WSASNodeManager
 
-./admin.sh --epr $EPR --operation unloadsg --service-group echo
+./admin.sh --epr $EPR --operation unloadsgs --service-groups echo,version
 if [ "$?" = "0" ]; then
-     ./admin.sh --epr $EPR --operation unloadsg --service-group version
-     if [ "$?" = "0" ]; then
-            ./admin.sh --epr $EPR --operation commit
-            echo Successfully committed.
-     else
-            echo Unloading service group "Version" failed
-     fi
+     ./admin.sh --epr $EPR --operation commit
+     echo Successfully committed.
 else
-     echo Unloading service group "Echo" failed
+     echo Unloading service groups failed
 fi
\ No newline at end of file




More information about the Wsas-java-dev mailing list