axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r428157 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/deployment/repository/util/ core/src/org/apache/axis2/deployment/util/ integration/test/org/apache/axis2/integration/ saaj/t...
Date Wed, 02 Aug 2006 21:31:09 GMT
Author: dims
Date: Wed Aug  2 14:31:09 2006
New Revision: 428157

URL: http://svn.apache.org/viewvc?rev=428157&view=rev
Log:
- Move 2 utility methods to Utils.java (they have AxisConfiguration as a parameter and do
not have to live in DeploymentEngine.java which already has a local axisConfig parameter)
- Collapse the first 2 parameters into 1 parameter to reduce unnecessary usage of DeploymentEngine
in ArchiveReader  


Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=428157&r1=428156&r2=428157&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
Wed Aug  2 14:31:09 2006
@@ -483,94 +483,6 @@
         wsToUnDeploy.add(file);
     }
 
-    /**
-     * Builds ModuleDescription for a given module archive file. This does not
-     * called the init method since there is no refernce to configuration context
-     * so who ever create module usieng this has to called module.init if it is
-     * required
-     *
-     * @param modulearchive : Actual module archive file
-     * @param config        : AxisConfiguration : for get classs loders etc..
-     * @return
-     * @throws DeploymentException
-     */
-    public AxisModule buildModule(File modulearchive, AxisConfiguration config)
-            throws DeploymentException {
-        AxisModule axismodule;
-        try {
-            currentArchiveFile = new ArchiveFileData(modulearchive, TYPE_MODULE, false);
-            axismodule = new AxisModule();
-            ArchiveReader archiveReader = new ArchiveReader();
-
-            currentArchiveFile.setClassLoader(false, config.getModuleClassLoader());
-            axismodule.setModuleClassLoader(currentArchiveFile.getClassLoader());
-            archiveReader.readModuleArchive(currentArchiveFile.getAbsolutePath(), this, axismodule,
-                    false, config);
-            ClassLoader moduleClassLoader = axismodule.getModuleClassLoader();
-            Flow inflow = axismodule.getInFlow();
-
-            if (inflow != null) {
-                Utils.addFlowHandlers(inflow, moduleClassLoader);
-            }
-
-            Flow outFlow = axismodule.getOutFlow();
-
-            if (outFlow != null) {
-                Utils.addFlowHandlers(outFlow, moduleClassLoader);
-            }
-
-            Flow faultInFlow = axismodule.getFaultInFlow();
-
-            if (faultInFlow != null) {
-                Utils.addFlowHandlers(faultInFlow, moduleClassLoader);
-            }
-
-            Flow faultOutFlow = axismodule.getFaultOutFlow();
-
-            if (faultOutFlow != null) {
-                Utils.addFlowHandlers(faultOutFlow, moduleClassLoader);
-            }
-        } catch (AxisFault axisFault) {
-            throw new DeploymentException(axisFault);
-        }
-
-        currentArchiveFile = null;
-
-        return axismodule;
-    }
-
-    /**
-     * Fills an axisservice object using services.xml. First creates
-     * an axisservice object using WSDL and then fills it using the given services.xml.
-     * Loads all the required class and builds the chains, finally adds the
-     * servicecontext to EngineContext and axisservice into EngineConfiguration.
-     *
-     * @param axisService
-     * @param serviceInputStream
-     * @param classLoader
-     * @return Returns AxisService.
-     * @throws DeploymentException
-     */
-    public AxisService buildService(AxisService axisService, InputStream serviceInputStream,
-                                    ClassLoader classLoader, AxisConfiguration axisConfig)
-            throws DeploymentException {
-        try {
-            currentArchiveFile = new ArchiveFileData(TYPE_SERVICE, "", antiJARLocking);
-            currentArchiveFile.setClassLoader(classLoader);
-
-            ServiceBuilder builder = new ServiceBuilder(serviceInputStream, axisConfig,
-                    axisService);
-
-            builder.populateService(builder.buildOM());
-        } catch (AxisFault axisFault) {
-            throw new DeploymentException(axisFault);
-        } catch (XMLStreamException e) {
-            throw new DeploymentException(e);
-        }
-
-        return axisService;
-    }
-
     public void doDeploy() {
         if (wsToDeploy.size() > 0) {
             for (int i = 0; i < wsToDeploy.size(); i++) {
@@ -668,8 +580,7 @@
                                 AxisModule metaData = new AxisModule();
                                 metaData.setModuleClassLoader(currentArchiveFile.getClassLoader());
                                 metaData.setParent(axisConfig);
-                                archiveReader.readModuleArchive(currentArchiveFile.getAbsolutePath(),
-                                        this, metaData, explodedDir,
+                                archiveReader.readModuleArchive(currentArchiveFile, metaData,
explodedDir,
                                         axisConfig);
                                 metaData.setFileName(currentArchiveFile.getFile().toURL());
                                 addNewModule(metaData);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=428157&r1=428156&r2=428157&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
Wed Aug  2 14:31:09 2006
@@ -22,7 +22,6 @@
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.deployment.DeploymentConstants;
-import org.apache.axis2.deployment.DeploymentEngine;
 import org.apache.axis2.deployment.DeploymentErrorMsgs;
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.DescriptionBuilder;
@@ -338,7 +337,7 @@
         return servicesMap;
     }
 
-    public void readModuleArchive(String filename, DeploymentEngine engine,
+    public void readModuleArchive(ArchiveFileData archiveFile,
                                   AxisModule module, boolean explodedDir,
                                   AxisConfiguration axisConfig)
             throws DeploymentException {
@@ -348,7 +347,7 @@
         if (!explodedDir) {
             ZipInputStream zin;
             try {
-                zin = new ZipInputStream(new FileInputStream(filename));
+                zin = new ZipInputStream(new FileInputStream(archiveFile.getAbsolutePath()));
                 ZipEntry entry;
                 while ((entry = zin.getNextEntry()) != null) {
                     if (entry.getName().equalsIgnoreCase(MODULE_XML)) {
@@ -358,7 +357,7 @@
                         module.setName(
                                 new QName(
                                         DescriptionBuilder.getShortFileName(
-                                                engine.getCurrentFileItem().getServiceName())));
+                                                archiveFile.getServiceName())));
                         builder.populateModule();
                         break;
                     }
@@ -367,15 +366,15 @@
                 if (!foundmoduleXML) {
                     throw new DeploymentException(
                             Messages.getMessage(
-                                    DeploymentErrorMsgs.MODULE_XML_MISSING, filename));
+                                    DeploymentErrorMsgs.MODULE_XML_MISSING, archiveFile.getAbsolutePath()));
                 }
             } catch (Exception e) {
                 throw new DeploymentException(e);
             }
         } else {
-            File file = new File(filename, MODULE_XML);
+            File file = new File(archiveFile.getAbsolutePath(), MODULE_XML);
 
-            if (file.exists() || (file = new File(filename, MODULE_XML.toLowerCase())).exists())
{
+            if (file.exists() || (file = new File(archiveFile.getAbsolutePath(), MODULE_XML.toLowerCase())).exists())
{
                 InputStream in;
                 try {
                     in = new FileInputStream(file);
@@ -384,7 +383,7 @@
                     module.setName(
                             new QName(
                                     DescriptionBuilder.getShortFileName(
-                                            engine.getCurrentFileItem().getServiceName())));
+                                            archiveFile.getServiceName())));
                     builder.populateModule();
                 } catch (FileNotFoundException e) {
                     throw new DeploymentException(
@@ -393,7 +392,7 @@
             } else {
                 throw new DeploymentException(
                         Messages.getMessage(
-                                DeploymentErrorMsgs.MODULE_XML_MISSING, filename));
+                                DeploymentErrorMsgs.MODULE_XML_MISSING, archiveFile.getAbsolutePath()));
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java?rev=428157&r1=428156&r2=428157&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
Wed Aug  2 14:31:09 2006
@@ -7,6 +7,8 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.ServiceBuilder;
 import org.apache.axis2.deployment.repository.util.ArchiveFileData;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.description.*;
@@ -21,6 +23,7 @@
 import org.codehaus.jam.JMethod;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import java.io.*;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -394,5 +397,91 @@
         } catch (IOException e) {
             throw new AxisFault(e);
         }
+    }
+
+    /**
+     * Builds ModuleDescription for a given module archive file. This does not
+     * called the init method since there is no refernce to configuration context
+     * so who ever create module usieng this has to called module.init if it is
+     * required
+     *
+     * @param modulearchive : Actual module archive file
+     * @param config        : AxisConfiguration : for get classs loders etc..
+     * @return
+     * @throws org.apache.axis2.deployment.DeploymentException
+     */
+    public static AxisModule buildModule(File modulearchive, DeploymentEngine engine, AxisConfiguration
config)
+            throws DeploymentException {
+        AxisModule axismodule;
+        try {
+            ArchiveFileData currentArchiveFile = new ArchiveFileData(modulearchive, DeploymentConstants.TYPE_MODULE,
false);
+            axismodule = new AxisModule();
+            ArchiveReader archiveReader = new ArchiveReader();
+
+            currentArchiveFile.setClassLoader(false, config.getModuleClassLoader());
+            axismodule.setModuleClassLoader(currentArchiveFile.getClassLoader());
+            archiveReader.readModuleArchive(currentArchiveFile, axismodule,
+                    false, config);
+            ClassLoader moduleClassLoader = axismodule.getModuleClassLoader();
+            Flow inflow = axismodule.getInFlow();
+
+            if (inflow != null) {
+                Utils.addFlowHandlers(inflow, moduleClassLoader);
+            }
+
+            Flow outFlow = axismodule.getOutFlow();
+
+            if (outFlow != null) {
+                Utils.addFlowHandlers(outFlow, moduleClassLoader);
+            }
+
+            Flow faultInFlow = axismodule.getFaultInFlow();
+
+            if (faultInFlow != null) {
+                Utils.addFlowHandlers(faultInFlow, moduleClassLoader);
+            }
+
+            Flow faultOutFlow = axismodule.getFaultOutFlow();
+
+            if (faultOutFlow != null) {
+                Utils.addFlowHandlers(faultOutFlow, moduleClassLoader);
+            }
+        } catch (AxisFault axisFault) {
+            throw new DeploymentException(axisFault);
+        }
+        return axismodule;
+    }
+
+    /**
+     * Fills an axisservice object using services.xml. First creates
+     * an axisservice object using WSDL and then fills it using the given services.xml.
+     * Loads all the required class and builds the chains, finally adds the
+     * servicecontext to EngineContext and axisservice into EngineConfiguration.
+     *
+     * @param axisService
+     * @param serviceInputStream
+     * @param classLoader
+     * @return Returns AxisService.
+     * @throws DeploymentException
+     */
+    public AxisService buildService(AxisService axisService, InputStream serviceInputStream,
+                                    ClassLoader classLoader, AxisConfiguration axisConfig,
+                                    boolean antiJARLocking)
+            throws DeploymentException {
+        try {
+            ArchiveFileData currentArchiveFile = new ArchiveFileData(DeploymentConstants.TYPE_SERVICE,
"", antiJARLocking);
+            currentArchiveFile.setClassLoader(classLoader);
+
+            ServiceBuilder builder = new ServiceBuilder(serviceInputStream, axisConfig,
+                    axisService);
+
+            builder.populateService(builder.buildOM());
+        } catch (AxisFault axisFault) {
+            throw new DeploymentException(axisFault);
+        } catch (XMLStreamException e) {
+            throw new DeploymentException(e);
+        }
+
+        return axisService;
     }
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java?rev=428157&r1=428156&r2=428157&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
Wed Aug  2 14:31:09 2006
@@ -24,11 +24,18 @@
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.deployment.repository.util.ArchiveFileData;
+import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.Flow;
 import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 
 import javax.xml.namespace.QName;
@@ -184,7 +191,7 @@
         ConfigurationContext configContext = ConfigurationContextFactory
                 .createConfigurationContextFromFileSystem(
                         "target/test-resources/integrationRepo", null);
-        AxisModule axisModule = deploymentEngine.buildModule(file,
+        AxisModule axisModule = Utils.buildModule(file, deploymentEngine,
                 configContext.getAxisConfiguration());
         configContext.getAxisConfiguration().addModule(axisModule);
 
@@ -217,7 +224,7 @@
         ConfigurationContext configContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem(
                 "target/test-resources/integrationRepo",
                 "target/test-resources/integrationRepo/conf/axis2.xml");
-        AxisModule axisModule = deploymentEngine.buildModule(file,
+        AxisModule axisModule = Utils.buildModule(file, deploymentEngine,
                 configContext.getAxisConfiguration());
         configContext.getAxisConfiguration().addModule(axisModule);
         return configContext;
@@ -238,7 +245,7 @@
 
         ConfigurationContext configContext = ConfigurationContextFactory
                 .createConfigurationContextFromFileSystem(clientHome, null);
-        AxisModule axisModule = deploymentEngine.buildModule(file,
+        AxisModule axisModule = Utils.buildModule(file, deploymentEngine,
                 configContext.getAxisConfiguration());
 
         configContext.getAxisConfiguration().addModule(axisModule);

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java?rev=428157&r1=428156&r2=428157&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java
Wed Aug  2 14:31:09 2006
@@ -22,6 +22,7 @@
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
@@ -138,7 +139,7 @@
 
         ConfigurationContext configContext = ConfigurationContextFactory
                 .createConfigurationContextFromFileSystem("target/test-resources/integrationRepo",
null);
-        AxisModule axisModule = deploymentEngine.buildModule(file,
+        AxisModule axisModule = Utils.buildModule(file, deploymentEngine,
                 configContext.getAxisConfiguration());
         configContext.getAxisConfiguration().addModule(axisModule);
 
@@ -154,7 +155,7 @@
         DeploymentEngine deploymentEngine = new DeploymentEngine();
 
         ConfigurationContext configContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem("target/test-resources/integrationRepo",
null);
-        AxisModule axisModule = deploymentEngine.buildModule(file,
+        AxisModule axisModule = Utils.buildModule(file, deploymentEngine,
                 configContext.getAxisConfiguration());
         configContext.getAxisConfiguration().addModule(axisModule);
         configContext.getAxisConfiguration().engageModule(new QName("addressing"));
@@ -169,7 +170,7 @@
 
         ConfigurationContext configContext = ConfigurationContextFactory
                 .createConfigurationContextFromFileSystem(clientHome, null);
-        AxisModule axisModule = deploymentEngine.buildModule(file,
+        AxisModule axisModule = Utils.buildModule(file, deploymentEngine,
                 configContext.getAxisConfiguration());
 
         configContext.getAxisConfiguration().addModule(axisModule);
@@ -180,4 +181,5 @@
         return new ServiceGroupContext(configContext, (AxisServiceGroup) service.getParent())
                 .getServiceContext(service);
     }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message