[wsas-java-dev] svn commit r1742 - in trunk/wsas/java/modules: admin/src/org/wso2/wsas/admin/service admin/src/org/wso2/wsas/admin/service/util admin/test-resources/repository/conf clustering/src/org/wso2/wsas/clustering core/src/org/wso2/wsas core/src/org/wso2/wsas/deployment servlet-edition/conf standalone-edition/conf

svn at wso2.org svn at wso2.org
Wed Apr 4 00:28:27 PDT 2007


Author: azeez
Date: Wed Apr  4 00:26:05 2007
New Revision: 1742

Modified:
   trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
   trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServerData.java
   trunk/wsas/java/modules/admin/test-resources/repository/conf/axis2.xml
   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/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java
   trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java
   trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/ServerConfigurator.java
   trunk/wsas/java/modules/servlet-edition/conf/axis2.xml
   trunk/wsas/java/modules/standalone-edition/conf/axis2.xml
Log:
1. URL Repo is completely working now
2. More improvements to NodeManagement
3. No need to globally engage addressing anymore
4. Show the proper repo location in the admin console when a URL repo is used



Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java	(original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java	Wed Apr  4 00:26:05 2007
@@ -35,7 +35,7 @@
 
     public ServerData getServerData() throws AxisFault {
         return new ServerData(ServerConstants.WSO2WSAS_INSTANCE,
-                              getAxisConfig().getRepository().getPath());
+                              getAxisConfig().getRepository().toString());
     }
 
     public ServerStatus getStatus() throws AxisFault {

Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServerData.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServerData.java	(original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServerData.java	Wed Apr  4 00:26:05 2007
@@ -17,6 +17,8 @@
 
 import org.wso2.utils.ServerConfiguration;
 
+import java.net.URL;
+
 public class ServerData {
     private String javaRuntimeName;
     private String javaVMVersion;

Modified: trunk/wsas/java/modules/admin/test-resources/repository/conf/axis2.xml
==============================================================================
--- trunk/wsas/java/modules/admin/test-resources/repository/conf/axis2.xml	(original)
+++ trunk/wsas/java/modules/admin/test-resources/repository/conf/axis2.xml	Wed Apr  4 00:26:05 2007
@@ -204,12 +204,6 @@
    </transportSender>
    -->
 
-    <!-- ================================================= -->
-    <!-- Global Modules  -->
-    <!-- ================================================= -->
-    <!-- Comment this to disable Addressing -->
-    <module ref="addressing"/>
-
     <!--Configuring module , providing parameters for modules whether they refer or not-->
     <!--<moduleConfig name="addressing">-->
     <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->

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 00:26:05 2007
@@ -41,10 +41,10 @@
         ConfigurationManager configMan = getConfigurationManager();
         if (configMan != null) {
             configMan.loadServiceGroup(serviceGroupName);
-            return isPrepareSuccessful(configMan);
         } else {
             throw new AxisFault(CONFIG_MANAGER_NULL);
         }
+        return true;
     }
 
     public boolean unloadServiceGroup(String serviceGroupName) throws AxisFault {
@@ -52,10 +52,10 @@
         ConfigurationManager configMan = getConfigurationManager();
         if (configMan != null) {
             configMan.unloadServiceGroup(serviceGroupName);
-            return isPrepareSuccessful(configMan);
         } else {
             throw new AxisFault(CONFIG_MANAGER_NULL);
         }
+        return true;
     }
 
     public boolean applyPolicy(String serviceName, String policyId) throws AxisFault {
@@ -64,10 +64,10 @@
         if (configMan != null) {
 //            configMan.applyPolicy(serviceName, policyId);
 
-            return isPrepareSuccessful(configMan);
         } else {
             throw new AxisFault(CONFIG_MANAGER_NULL);
         }
+        return true;
     }
 
     public boolean reloadConfiguration() throws AxisFault {
@@ -75,10 +75,14 @@
         ConfigurationManager configMan = getConfigurationManager();
         if (configMan != null) {
             configMan.reloadConfiguration();
-            return isPrepareSuccessful(configMan);
         } else {
             throw new AxisFault(CONFIG_MANAGER_NULL);
         }
+        return true;
+    }
+
+    public boolean prepare() throws AxisFault{
+        return isPrepareSuccessful(getConfigurationManager());
     }
 
     public boolean commit() throws AxisFault {

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 00:26:05 2007
@@ -80,8 +80,17 @@
         }
     }
 
+    private void prepare() throws Exception {
+        NodeManagerStub.CommitResponse commitResponse = stub.commit();
+        if (commitResponse.get_return()) {
+            System.out.println("Successfully committed");
+        } else {
+            System.out.println("Commit failed");
+        }
+    }
+
     /**
-     * Usage: admin --epr <epr> --operation <reloadConfig | loadSG | unloadSG | applyPolicy>
+     * Usage: admin --epr <epr> --operation <reloadConfig | loadSG | unloadSG | applyPolicy | prepare | commit>
      *
      * @param args
      */
@@ -100,6 +109,10 @@
                 client.unloadServiceGroup(getParam("--service-group", args));
             } else if (operation.equals("applypolicy")) {
                 client.applyServicePolicy();
+            } else if (operation.equals("prepare")) {
+                client.prepare();
+            } else if (operation.equals("commit")) {
+                client.commit();
             } else {
                 printUsage();
             }

Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java	(original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java	Wed Apr  4 00:26:05 2007
@@ -160,10 +160,8 @@
         ServerConfiguration config = ServerConfiguration.getInstance();
         String repoLocation =
                 config.getFirstProperty(ServerConfiguration.AXIS2_CONFIG_REPO_LOCATION);
-        String axis2XML = Utils.getAxis2Xml();
         try {
             ServerConfigurator.getInstance().init(repoLocation,
-                                                  axis2XML,
                                                   System.getProperty(ServerConstants.WEB_RESOURCE_LOCATION));
             ConfigurationContext newConfigurationContext =
                     ConfigurationContextFactory

Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java	(original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java	Wed Apr  4 00:26:05 2007
@@ -97,7 +97,6 @@
 
     public void start() throws ServerException {
         // ------------------------------------------------------------------------------------------
-        String axis2XML = Utils.getAxis2Xml();
 
         wso2wsasHome = System.getProperty(ServerConstants.WSO2WSAS_HOME);
 
@@ -117,7 +116,6 @@
             ServerConfigurator serverConfigurator = ServerConfigurator.getInstance();
             if (!serverConfigurator.isInitialized()) {
                 serverConfigurator.init(axis2RepoLocation,
-                                        axis2XML,
                                         System.getProperty(ServerConstants.WEB_RESOURCE_LOCATION));
             }
 

Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/ServerConfigurator.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/ServerConfigurator.java	(original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/ServerConfigurator.java	Wed Apr  4 00:26:05 2007
@@ -79,10 +79,8 @@
      * Load an AxisConfiguration from the repository directory specified
      *
      * @param repoLocation
-     * @param axis2xml
      */
     public void init(String repoLocation,
-                     String axis2xml,
                      String weblocation) throws ServerException {
         this.webLocation = weblocation;
         if (repoLocation == null) {
@@ -93,7 +91,8 @@
             throw new ServerException("Axis2 repository not specified!");
         }
 
-        isUrlRepo = repoLocation.indexOf("://") != -1;
+        // Check whether this is a URL
+        isUrlRepo = isURL(repoLocation);
 
         if (isUrlRepo) { // Is repoLocation a URL Repo?
             this.repoLocation = repoLocation;
@@ -115,23 +114,14 @@
         }
 
         axis2xml = Utils.getAxis2Xml();
-        
-        isUrlAxis2Xml = axis2xml.indexOf("://") != -1;
-        if (isUrlAxis2Xml) { // Is axis2xml a URL to the axis2.xml file?
-            this.axis2xml = axis2xml;
-        } else { // Is axis2xml a file in the local file system?
+
+        isUrlAxis2Xml = isURL(axis2xml);
+
+        if (!isUrlAxis2Xml) { // Is axis2xml a URL to the axis2.xml file?
             File configFile = new File(axis2xml);
             if (!configFile.exists()) {
-                this.axis2xml =
-                        System.getProperty(ServerConstants.WSO2WSAS_HOME) + File.separator +
-                        "conf" + File.separator + "axis2.xml";
-                configFile = new File(this.axis2xml);
-                if (!configFile.exists()) {
-                    this.axis2xml = null;
-                    throw new ServerException("axis2.xml '" + axis2xml + "' not found!");
-                }
-            } else {
-                this.axis2xml = axis2xml;
+                this.axis2xml = null;
+                throw new ServerException("axis2.xml '" + axis2xml + "' not found!");
             }
         }
         isInitialized = true;
@@ -173,14 +163,17 @@
             repoLocation = (String) axis2repoPara.getValue();
         }
         if (repoLocation != null && repoLocation.trim().length() != 0) {
-            if (isUrlRepo) {
-                try {
-                    loadRepositoryFromURL(new URL(repoLocation));
-                } catch (MalformedURLException e) {
-                    throw new AxisFault("Invalid URL", e);
+            try {
+                if (isUrlRepo) {
+                    URL axis2Repository = new URL(repoLocation);
+                    axisConfiguration.setRepository(axis2Repository);
+                    loadRepositoryFromURL(axis2Repository);
+                } else {
+                    axisConfiguration.setRepository(new URL("file://" + repoLocation));
+                    loadRepository(repoLocation);
                 }
-            } else {
-                loadRepository(repoLocation);
+            } catch (MalformedURLException e) {
+                throw new AxisFault("Invalid URL", e);
             }
         } else {
             loadFromClassPath();
@@ -304,4 +297,13 @@
             }
         }
     }
+
+    private boolean isURL(String location) {
+        try {
+            new URL(location);
+            return true;
+        } catch (MalformedURLException e) {
+            return false;
+        }
+    }
 }

Modified: trunk/wsas/java/modules/servlet-edition/conf/axis2.xml
==============================================================================
--- trunk/wsas/java/modules/servlet-edition/conf/axis2.xml	(original)
+++ trunk/wsas/java/modules/servlet-edition/conf/axis2.xml	Wed Apr  4 00:26:05 2007
@@ -3,7 +3,6 @@
     <!-- ================================================= -->
     <!-- Globally engaged modules -->
     <!-- ================================================= -->
-    <module ref="addressing"/>
     <module ref="wso2statistics"/>
     <module ref="wso2tracer"/>
 

Modified: trunk/wsas/java/modules/standalone-edition/conf/axis2.xml
==============================================================================
--- trunk/wsas/java/modules/standalone-edition/conf/axis2.xml	(original)
+++ trunk/wsas/java/modules/standalone-edition/conf/axis2.xml	Wed Apr  4 00:26:05 2007
@@ -3,7 +3,6 @@
     <!-- ================================================= -->
     <!-- Globally engaged modules -->
     <!-- ================================================= -->
-    <module ref="addressing"/>
     <module ref="wso2statistics"/>
     <module ref="wso2tracer"/>
 




More information about the Wsas-java-dev mailing list