You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/06/27 14:38:40 UTC

svn commit: r417444 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: context/ deployment/ deployment/repository/util/ deployment/util/

Author: deepal
Date: Tue Jun 27 05:38:40 2006
New Revision: 417444

URL: http://svn.apache.org/viewvc?rev=417444&view=rev
Log:
fixing http://issues.apache.org/jira/browse/AXIS2-468
- you can add service archive files inside module
   - add folder called "services"
   - then add file called services.list adding all the services that you want to add
   - then put all the services archive files into the services directory of the module

:)

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.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

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java?rev=417444&r1=417443&r2=417444&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java Tue Jun 27 05:38:40 2006
@@ -21,6 +21,7 @@
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.FileSystemConfigurator;
 import org.apache.axis2.deployment.URLBasedAxisConfigurator;
+import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportOutDescription;
@@ -62,7 +63,19 @@
         init(configContext);
         axisConfigurator.engageGlobalModules();
         axisConfigurator.loadServices();
+        addModuleService(axisConfig);
         return configContext;
+    }
+
+    public static void addModuleService(AxisConfiguration axisConfig) throws AxisFault {
+        HashMap modules = axisConfig.getModules();
+        if (modules != null && modules.size() > 0) {
+            Iterator mpduleItr = modules.values().iterator();
+            while (mpduleItr.hasNext()) {
+                AxisModule axisModule = (AxisModule) mpduleItr.next();
+                Utils.deployModuelServics(axisModule, axisConfig);
+            }
+        }
     }
 
     private static void configureTransportSessionManagement(AxisConfiguration axisConfig) {

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=417444&r1=417443&r2=417444&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 Tue Jun 27 05:38:40 2006
@@ -602,8 +602,7 @@
                             archiveReader = new ArchiveReader();
                             String serviceStatus = "";
                             try {
-                                HashMap wsdlservice = archiveReader.processWSDLs(currentArchiveFile,
-                                        this);
+                                HashMap wsdlservice = archiveReader.processWSDLs(currentArchiveFile);
                                 if (wsdlservice != null && wsdlservice.size() > 0) {
                                     Iterator services = wsdlservice.values().iterator();
                                     while (services.hasNext()) {
@@ -619,7 +618,7 @@
                                 sericeGroup.setServiceGroupClassLoader(
                                         currentArchiveFile.getClassLoader());
                                 ArrayList serviceList = archiveReader.processServiceGroup(
-                                        currentArchiveFile.getAbsolutePath(), this,
+                                        currentArchiveFile.getAbsolutePath(), currentArchiveFile,
                                         sericeGroup, explodedDir, wsdlservice,
                                         axisConfig);
                                 addServiceGroup(sericeGroup, serviceList, currentArchiveFile.getFile().toURL());

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java?rev=417444&r1=417443&r2=417444&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java Tue Jun 27 05:38:40 2006
@@ -8,8 +8,10 @@
 import org.apache.commons.logging.LogFactory;
 
 import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 /*
@@ -31,57 +33,57 @@
 */
 
 /**
-* Processes the init parameters for the AxisServlet.
-This allows the location of the axis2.xml and the module repository to be different from the default locations.
-The init parameters support alternate file, or URL values for both of these.
-*/
+ * Processes the init parameters for the AxisServlet.
+ * This allows the location of the axis2.xml and the module repository to be different from the default locations.
+ * The init parameters support alternate file, or URL values for both of these.
+ */
 public class WarBasedAxisConfigurator implements AxisConfigurator {
 
     private AxisConfiguration axisConfig;
-	private static final Log log = LogFactory.getLog(WarBasedAxisConfigurator.class);
+    private static final Log log = LogFactory.getLog(WarBasedAxisConfigurator.class);
     private ServletConfig config;
     private DeploymentEngine deploymentEngine;
 
 
     /**
-    * The name of the init parameter (axis2.xml.path) that can be used to override the default location for the axis2.xml file. When both this init parameter, and the axis2.xml.url init parameters are not specified in the axis servlet init-parameter, the default location of ${app}/WEB-INF/conf/axis2.xml is used.
-    * The value of this path is interpreted as a file system absolute path.
-    * This parameter takes precidence over the axis2.xml.url init parameter.
-    */
+     * The name of the init parameter (axis2.xml.path) that can be used to override the default location for the axis2.xml file. When both this init parameter, and the axis2.xml.url init parameters are not specified in the axis servlet init-parameter, the default location of ${app}/WEB-INF/conf/axis2.xml is used.
+     * The value of this path is interpreted as a file system absolute path.
+     * This parameter takes precidence over the axis2.xml.url init parameter.
+     */
     public static final String PARAM_AXIS2_XML_PATH = "axis2.xml.path";
 
 
     /**
-    * The name of the init parameter (axis2.xml.url) that when specified indicates the axis2.xml should be loaded using the URL specified as the value of this init parameter. If the axis2.xml.path init parameter is present, this init parameter has no effect.
-    */
+     * The name of the init parameter (axis2.xml.url) that when specified indicates the axis2.xml should be loaded using the URL specified as the value of this init parameter. If the axis2.xml.path init parameter is present, this init parameter has no effect.
+     */
     public static final String PARAM_AXIS2_XML_URL = "axis2.xml.url";
 
 
     /**
-    * The name of the init parameter (axis2.repository.path) that when specified indicates the path to the
-    */
+     * The name of the init parameter (axis2.repository.path) that when specified indicates the path to the
+     */
     public static final String PARAM_AXIS2_REPOSITORY_PATH = "axis2.repository.path";
 
 
     /**
-    * The name of the init parameter (axis2.repository.url) that when specified indicates the url to be used
-    */
+     * The name of the init parameter (axis2.repository.url) that when specified indicates the url to be used
+     */
     public static final String PARAM_AXIS2_REPOSITORY_URL = "axis2.repository.url";
 
 
     /**
-    * Default constructor for configurator.
-    * This determines the axis2.xml file to be used from the init parametes for the AxisServlet in the web.xml.
-    * The order of initialization is according the the following precidence:
-    * <ul>
-    * <li>If the parameter axis2.xml.path is present, the value is webapp relative path to be used as the location to the axis2.xml file.
-    * <li>Otherwise, if the parameter axis2.xml.url is present, the URL is used as the location to the axis2.xml file.
-    * <li>Otherwise, when both of the above init parameters are not present, file is attempted to be loaded from &lt;repo&gt;/WEB-INF/axis2.xml.
-    * <li> When none of the above could be found, the axis2.xml is loaded from the classpath resource, the value of DeploymenConstants.AXIS2_CONFIGURATION_RESOURCE.
-    * </ul>
-    *
-    * @param svconfig the ServletConfig object from the AxisServlet. This method is called from the init() of the AxisServlet.
-    */
+     * Default constructor for configurator.
+     * This determines the axis2.xml file to be used from the init parametes for the AxisServlet in the web.xml.
+     * The order of initialization is according the the following precidence:
+     * <ul>
+     * <li>If the parameter axis2.xml.path is present, the value is webapp relative path to be used as the location to the axis2.xml file.
+     * <li>Otherwise, if the parameter axis2.xml.url is present, the URL is used as the location to the axis2.xml file.
+     * <li>Otherwise, when both of the above init parameters are not present, file is attempted to be loaded from &lt;repo&gt;/WEB-INF/axis2.xml.
+     * <li> When none of the above could be found, the axis2.xml is loaded from the classpath resource, the value of DeploymenConstants.AXIS2_CONFIGURATION_RESOURCE.
+     * </ul>
+     *
+     * @param svconfig the ServletConfig object from the AxisServlet. This method is called from the init() of the AxisServlet.
+     */
     public WarBasedAxisConfigurator(ServletConfig svconfig) {
         try {
             this.config = svconfig;
@@ -121,13 +123,12 @@
                 // not there, use default configuration from class path resource.
             } // catch
 
-			if(axis2Stream == null) {
+            if (axis2Stream == null) {
                 ClassLoader cl = Thread.currentThread().getContextClassLoader();
                 axis2Stream = cl.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE);
-			}
+            }
             axisConfig = deploymentEngine.populateAxisConfiguration(axis2Stream);
 
-
             // when the module is an unpacked war file,
             // we can set the web location path in the deployment engine.
             // This will let us
@@ -148,8 +149,7 @@
                 Parameter enableHttp = new Parameter("enableHTTP", "true");
                 if (axisConfig != null) {
                     axisConfig.addParameter(enableHttp);
-                }
-                else {
+                } else {
                     log.error("axisConfig was null after initialization");
                 }
             } catch (AxisFault axisFault) {
@@ -159,19 +159,18 @@
     }
 
 
-
     /**
-    * Gets the axis configuration object by loading the repository.
-    * The order of initialization is according the the following precidence:
-    * <ul>
-    * <li>If the parameter axis2.repository.path is present, this folder is used as the location to the repository.
-    * <li>Otherwise, if the parameter axis2.repository.url is present, the URL is used as the location to the repository.
-    * <li>Otherwise, when both of the above init parameters are not present, the web applications WEB-INF folder is used as the folder for the repository.
-    * </ul>
-    *
-    * @return the instance of the AxisConfiguration object that reflects the repository according to the rules above.
-    * @throws AxisFault when an error occured in the initialization of the AxisConfiguration.
-    */
+     * Gets the axis configuration object by loading the repository.
+     * The order of initialization is according the the following precidence:
+     * <ul>
+     * <li>If the parameter axis2.repository.path is present, this folder is used as the location to the repository.
+     * <li>Otherwise, if the parameter axis2.repository.url is present, the URL is used as the location to the repository.
+     * <li>Otherwise, when both of the above init parameters are not present, the web applications WEB-INF folder is used as the folder for the repository.
+     * </ul>
+     *
+     * @return the instance of the AxisConfiguration object that reflects the repository according to the rules above.
+     * @throws AxisFault when an error occured in the initialization of the AxisConfiguration.
+     */
     public AxisConfiguration getAxisConfiguration() throws AxisFault {
         try {
             String repository = null;
@@ -224,30 +223,27 @@
         return axisConfig;
     }
 
-
     //to load services
+
     /**
-    * Loads the services within the repository.
-    * When the axis2.repository.path init parameter was present, we just call loadServices() in the deployment engine.<br/>
-    * When the axis2.repository.url init parameter was present we load services from the respective URL value of the init parameter.<br/>
-    * Otherwise, try to load the services from the /WEB-INF folder within the web application.
-    */
+     * Loads the services within the repository.
+     * When the axis2.repository.path init parameter was present, we just call loadServices() in the deployment engine.<br/>
+     * When the axis2.repository.url init parameter was present we load services from the respective URL value of the init parameter.<br/>
+     * Otherwise, try to load the services from the /WEB-INF folder within the web application.
+     */
     public void loadServices() {
         try {
-            String repository = null;
-
+            String repository ;
 
-            if (repository == null) {
-                repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_PATH);
-                if (repository != null) {
-                    deploymentEngine.loadServices();
-                    log.debug("loaded services from path: " + repository);
-                }
+            repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_PATH);
+            if (repository != null) {
+                deploymentEngine.loadServices();
+                log.debug("loaded services from path: " + repository);
             }
 
             if (repository == null) {
                 repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_URL);
-                if (repository!= null) {
+                if (repository != null) {
                     deploymentEngine.loadServicesFromUrl(new URL(repository));
                     log.debug("loaded services from URL: " + repository);
                 }

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=417444&r1=417443&r2=417444&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 Tue Jun 27 05:38:40 2006
@@ -21,22 +21,10 @@
 import org.apache.axiom.om.OMNamespace;
 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;
-import org.apache.axis2.deployment.ModuleBuilder;
-import org.apache.axis2.deployment.ServiceBuilder;
-import org.apache.axis2.deployment.ServiceGroupBuilder;
+import org.apache.axis2.deployment.*;
 import org.apache.axis2.deployment.resolver.AARBasedWSDLLocator;
 import org.apache.axis2.deployment.resolver.AARFileBasedURIResolver;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
-import org.apache.axis2.description.WSDL20ToAxisServiceBuilder;
-import org.apache.axis2.description.WSDLToAxisServiceBuilder;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.namespace.Constants;
@@ -46,13 +34,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.zip.ZipEntry;
@@ -61,7 +43,7 @@
 public class ArchiveReader implements DeploymentConstants {
     private static final Log log = LogFactory.getLog(ArchiveReader.class);
 
-    private ArrayList buildServiceGroup(InputStream zin, DeploymentEngine engine,
+    private ArrayList buildServiceGroup(InputStream zin, ArchiveFileData currentFile,
                                         AxisServiceGroup axisServiceGroup, HashMap wsdlServices,
                                         AxisConfiguration axisConfig)
             throws XMLStreamException, AxisFault {
@@ -73,14 +55,13 @@
         if (TAG_SERVICE.equals(elementName)) {
             AxisService axisService = null;
 //            OMAttribute serviceNameatt = rootElement.getAttribute(new QName(ATTRIBUTE_NAME));
-            String serviceName = DescriptionBuilder.getShortFileName(engine.getCurrentFileItem().getName());
+            String serviceName = DescriptionBuilder.getShortFileName(currentFile.getName());
             if (serviceName != null) {
                 axisService = (AxisService) wsdlServices.get(serviceName);
             }
             if (axisService == null) {
                 axisService = (AxisService) wsdlServices.get(
-                        DescriptionBuilder.getShortFileName(
-                                engine.getCurrentFileItem().getName()));
+                        DescriptionBuilder.getShortFileName(currentFile.getName()));
             }
             if (axisService == null) {
                 axisService = new AxisService(serviceName);
@@ -89,7 +70,7 @@
             }
 
             axisService.setParent(axisServiceGroup);
-            axisService.setClassLoader(engine.getCurrentFileItem().getClassLoader());
+            axisService.setClassLoader(currentFile.getClassLoader());
 
             ServiceBuilder serviceBuilder = new ServiceBuilder(axisConfig, axisService);
             AxisService service = serviceBuilder.populateService(rootElement);
@@ -109,7 +90,6 @@
      * Extracts Service XML files and builds the service groups.
      *
      * @param filename
-     * @param engine
      * @param axisServiceGroup
      * @param extractService
      * @param wsdls
@@ -117,7 +97,7 @@
      * @return Returns ArrayList.
      * @throws DeploymentException
      */
-    public ArrayList processServiceGroup(String filename, DeploymentEngine engine,
+    public ArrayList processServiceGroup(String filename, ArchiveFileData currentFile,
                                          AxisServiceGroup axisServiceGroup,
                                          boolean extractService,
                                          HashMap wsdls,
@@ -132,9 +112,8 @@
                 while ((entry = zin.getNextEntry()) != null) {
                     if (entry.getName().equalsIgnoreCase(SERVICES_XML)) {
                         axisServiceGroup.setServiceGroupName(
-                                DescriptionBuilder.getShortFileName(
-                                        engine.getCurrentFileItem().getName()));
-                        return buildServiceGroup(zin, engine, axisServiceGroup, wsdls, axisConfig);
+                                DescriptionBuilder.getShortFileName(currentFile.getName()));
+                        return buildServiceGroup(zin, currentFile, axisServiceGroup, wsdls, axisConfig);
                     }
                 }
                 throw new DeploymentException(
@@ -160,8 +139,8 @@
                 InputStream in = null;
                 try {
                     in = new FileInputStream(file);
-                    axisServiceGroup.setServiceGroupName(engine.getCurrentFileItem().getName());
-                    return buildServiceGroup(in, engine, axisServiceGroup, wsdls, axisConfig);
+                    axisServiceGroup.setServiceGroupName(currentFile.getName());
+                    return buildServiceGroup(in, currentFile, axisServiceGroup, wsdls, axisConfig);
                 } catch (FileNotFoundException e) {
                     throw new DeploymentException(
                             Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND, e.getMessage()));
@@ -218,11 +197,10 @@
     /**
      * Creates service objects from wsdl file inside a service archive file.
      *
-     * @param file      <code>ArchiveFileData</code>
-     * @param depengine <code>DeploymentEngine</code>
+     * @param file <code>ArchiveFileData</code>
      * @throws DeploymentException <code>DeploymentException</code>
      */
-    public HashMap processWSDLs(ArchiveFileData file, DeploymentEngine depengine)
+    public HashMap processWSDLs(ArchiveFileData file)
             throws DeploymentException {
         File serviceFile = file.getFile();
         // to store service come from wsdl files
@@ -250,8 +228,7 @@
                         OMNamespace documentElementNS = new StAXOMBuilder(in).getDocumentElement().getNamespace();
                         if (documentElementNS != null) {
                             WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
-                            if (WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.equals(documentElementNS.getName()))
-                            {
+                            if (WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.equals(documentElementNS.getName())) {
                                 // we have a WSDL 2.0 document here.
                                 wsdlToAxisServiceBuilder = new WSDL20ToAxisServiceBuilder(new FileInputStream(file1), null, null);
 
@@ -309,8 +286,7 @@
                         OMNamespace documentElementNS = new StAXOMBuilder(in).getDocumentElement().getNamespace();
                         if (documentElementNS != null) {
                             WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
-                            if (WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.equals(documentElementNS.getName()))
-                            {
+                            if (WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.equals(documentElementNS.getName())) {
                                 // we have a WSDL 2.0 document here.
                                 wsdlToAxisServiceBuilder = new WSDL20ToAxisServiceBuilder(new ByteArrayInputStream(out.toByteArray()), null, null);
                                 wsdlToAxisServiceBuilder.setBaseUri(entryName);
@@ -403,4 +379,4 @@
             }
         }
     }
-}
+}
\ No newline at end of file

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=417444&r1=417443&r2=417444&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 Tue Jun 27 05:38:40 2006
@@ -5,7 +5,10 @@
 import org.apache.axiom.om.OMFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.repository.util.ArchiveFileData;
+import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.DependencyManager;
@@ -18,18 +21,11 @@
 import org.codehaus.jam.JMethod;
 
 import javax.xml.namespace.QName;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.FileInputStream;
+import java.io.*;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
@@ -97,7 +93,7 @@
             String urlString = url.toString();
             InputStream in = url.openStream();
             ZipInputStream zin = null;
-            if(antiJARLocking) {
+            if (antiJARLocking) {
                 File inputFile = createTempFile(urlString.substring(urlString.length() - 4), in);
                 in.close();
                 array.add(inputFile.toURL());
@@ -316,5 +312,83 @@
         parameter.addAttribute("locked", Boolean.toString(locked), null);
         parameter.setText(value);
         return parameter;
+    }
+
+    /**
+     * This method is to get the list of services there in a module
+     * if module want to add services then the way of doing that is
+     * 1. Add a foldere called services inside the module (both in mar case and expanded case)
+     * 2. Then add a services.list file into that directory adding all the modules
+     * you want to add
+     * 3. Then put all the services into services directory in the module
+     * 4. All the class is module can be access via a the module services.
+     */
+
+    public static void deployModuelServics(AxisModule module,
+                                           AxisConfiguration axisConfig) throws AxisFault {
+        try {
+            ArchiveReader archiveReader = new ArchiveReader();
+            PhasesInfo phasesInfo = axisConfig.getPhasesInfo();
+            ClassLoader moduleClassLoader = module.getModuleClassLoader();
+            ArrayList services = new ArrayList();
+            InputStream in = moduleClassLoader.getResourceAsStream("services/services.list");
+            if (in != null) {
+                BufferedReader input;
+                try {
+                    input = new BufferedReader(new InputStreamReader(in));
+                    String line;
+                    while ((line = input.readLine()) != null) {
+                        services.add(line);
+                    }
+                    input.close();
+                } catch (IOException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            if (services.size() > 0) {
+                for (int i = 0; i < services.size(); i++) {
+                    String servicename = (String) services.get(i);
+                    if (servicename == null || "".equals(servicename)) {
+                        continue;
+                    }
+                    InputStream fin = moduleClassLoader.getResourceAsStream("services/" + servicename);
+                    if (fin == null) {
+                        throw new AxisFault("No service archiev found : " + servicename);
+                    }
+                    File inputFile = Utils.createTempFile(servicename, fin);
+                    ArchiveFileData filedata = new ArchiveFileData(inputFile, DeploymentConstants.TYPE_SERVICE, false);
+
+                    filedata.setClassLoader(false,
+                            moduleClassLoader);
+                    HashMap wsdlservice = archiveReader.processWSDLs(filedata);
+                    if (wsdlservice != null && wsdlservice.size() > 0) {
+                        Iterator servicesitr = wsdlservice.values().iterator();
+                        while (servicesitr.hasNext()) {
+                            AxisService service = (AxisService) servicesitr.next();
+                            Iterator operations = service.getOperations();
+                            while (operations.hasNext()) {
+                                AxisOperation axisOperation = (AxisOperation) operations.next();
+                                phasesInfo.setOperationPhases(axisOperation);
+                            }
+                        }
+                    }
+                    AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig);
+                    serviceGroup.setServiceGroupClassLoader(
+                            filedata.getClassLoader());
+                    ArrayList serviceList = archiveReader.processServiceGroup(
+                            filedata.getAbsolutePath(), filedata,
+                            serviceGroup, false, wsdlservice,
+                            axisConfig);
+                    for (int j = 0; j < serviceList.size(); j++) {
+                        AxisService axisService = (AxisService) serviceList.get(j);
+                        serviceGroup.addService(axisService);
+                    }
+                    axisConfig.addServiceGroup(serviceGroup);
+                    fin.close();
+                }
+            }
+        } catch (IOException e) {
+            throw new AxisFault(e);
+        }
     }
 }



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