axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r505189 - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/context/ src/org/apache/axis2/deployment/ src/org/apache/axis2/deployment/repository/util/ src/org/apache/axis2/deployment/util/ src/org/apache/axis2/engine/ te...
Date Fri, 09 Feb 2007 05:38:39 GMT
Author: deepal
Date: Thu Feb  8 21:38:38 2007
New Revision: 505189

URL: http://svn.apache.org/viewvc?view=rev&rev=505189
Log:
hmm , adding the code that I mentioned in the 

http://marc.theaimsgroup.com/?l=axis-dev&m=117099886501476&w=2

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/Deployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java   (contents, props changed)
      - copied, changed from r504800, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java
Removed:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java
Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/BadModuleTest.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java Thu Feb  8 21:38:38 2007
@@ -261,7 +261,7 @@
         InputStream in = cl.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE);
 
         AxisConfiguration axisConfig = new AxisConfiguration();
-        AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig);
+        AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig,null);
         builder.populateConfig();
         axisConfig.validateSystemPredefinedPhases();
         ConfigurationContext configContext = new ConfigurationContext(axisConfig);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Thu Feb  8 21:38:38 2007
@@ -32,8 +32,8 @@
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.TransportSender;
-import org.apache.axis2.util.TargetResolver;
 import org.apache.axis2.util.Loader;
+import org.apache.axis2.util.TargetResolver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -50,10 +50,13 @@
 public class AxisConfigBuilder extends DescriptionBuilder {
 
     protected static final Log log = LogFactory.getLog(AxisConfigBuilder.class);
+    private DeploymentEngine deploymentEngine;
 
     public AxisConfigBuilder(InputStream serviceInputStream,
-                             AxisConfiguration axisConfiguration) {
+                             AxisConfiguration axisConfiguration,
+                             DeploymentEngine deploymentEngine) {
         super(serviceInputStream, axisConfiguration);
+        this.deploymentEngine = deploymentEngine;
     }
 
     public void populateConfig() throws DeploymentException {
@@ -135,7 +138,7 @@
             if (defaultModuleVerionElement != null) {
                 processDefaultModuleVersions(defaultModuleVerionElement);
             }
-            
+
             // process MessageBuilders
             OMElement messageBuildersElement = config_element.getFirstChildWithName(new QName(TAG_MESSAGE_BUILDERS));
             if (messageBuildersElement != null) {
@@ -146,7 +149,7 @@
                     axisConfig.addMessageBuilder(key, (Class) builderSelector.get(key));
                 }
             }
-            
+
             // process MessageFormatters
             OMElement messageFormattersElement = config_element.getFirstChildWithName(new QName(TAG_MESSAGE_FORMATTERS));
             if (messageFormattersElement != null) {
@@ -157,7 +160,11 @@
                     axisConfig.addMessageFormatter(key, (MessageFormatter) messageFormatters.get(key));
                 }
             }
-
+            //Processing deployers.
+            Iterator deployerItr = config_element.getChildrenWithName(new QName(DEPLOYER));
+            if(deployerItr!=null){
+                processDeployers(deployerItr);
+            }
         } catch (XMLStreamException e) {
             throw new DeploymentException(e);
         }
@@ -183,6 +190,41 @@
         }
     }
 
+    private void processDeployers(Iterator deployerItr) {
+        HashMap directoryToExtensionMappingMap = new HashMap();
+        HashMap extensioToDeployerMappingMap = new HashMap();
+        while (deployerItr.hasNext()) {
+            OMElement element = (OMElement) deployerItr.next();
+            String directory = element.getAttributeValue(new QName(DIRECTORY));
+            if(directory!=null){
+                String extension = element.getAttributeValue(new QName(EXTENSION));
+                if(extension!=null){
+                    try {
+                        String deployerValue = element.getAttributeValue(new QName(TAG_CLASS_NAME));
+                        Class deployerClass;
+                        deployerClass = Loader.loadClass(deployerValue);
+                        Deployer deployer =
+                                (Deployer) deployerClass.newInstance();
+                        deployer.setDirctory(directory);
+                        deployer.setExtension(extension);
+                        directoryToExtensionMappingMap.put(directory, extension);
+                        extensioToDeployerMappingMap.put(extension,deployer);
+                    } catch (ClassNotFoundException e) {
+                        log.error(e);
+                    } catch (InstantiationException e) {
+                        log.error(e);
+                    } catch (IllegalAccessException e) {
+                        log.error(e);
+                    }
+                }
+            }
+        }
+        if(deploymentEngine!=null){
+            deploymentEngine.setDirectoryToExtensionMappingMap(directoryToExtensionMappingMap);
+            deploymentEngine.setExtensioToDeployerMappingMap(extensioToDeployerMappingMap);
+        }
+    }
+
     protected void processModuleConfig(Iterator moduleConfigs, ParameterInclude parent,
                                        AxisConfiguration config)
             throws DeploymentException {
@@ -238,13 +280,13 @@
 
                 Class observerclass;
                 try {
-                  observerclass = (Class) org.apache.axis2.java.security.AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() throws ClassNotFoundException {
-                      return Loader.loadClass(clasName);      
-                    }
-                  });  
+                    observerclass = (Class) org.apache.axis2.java.security.AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                        public Object run() throws ClassNotFoundException {
+                            return Loader.loadClass(clasName);
+                        }
+                    });
                 } catch (PrivilegedActionException e) {
-                  throw (ClassNotFoundException)e.getException();
+                    throw (ClassNotFoundException) e.getException();
                 }
                 observer = (AxisObserver) observerclass.newInstance();
                 // processing Parameters
@@ -363,7 +405,7 @@
                     try {
                         String clasName = trsClas.getAttributeValue();
                         Class receiverClass;
-                        receiverClass = Loader.loadClass(clasName); 
+                        receiverClass = Loader.loadClass(clasName);
 
                         TransportListener receiver =
                                 (TransportListener) receiverClass.newInstance();

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/Deployer.java?view=auto&rev=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/Deployer.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/Deployer.java Thu Feb  8 21:38:38 2007
@@ -0,0 +1,37 @@
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.context.ConfigurationContext;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+/**
+ * This interface is used to provide the custom deployment mechanism , where you
+ * can write your owm Deployer to process a particular type and make that to
+ * a service or a module.
+ */
+public interface Deployer {
+    //To initialize the deployer
+    void init(ConfigurationContext configCtx);
+
+    //Will process the file and add that to axisConfig
+    void deploy(DeploymentFileData deploymentFileData);
+    void setDirctory(String directory);
+    void setExtension(String extension);
+}

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Thu Feb  8 21:38:38 2007
@@ -31,9 +31,9 @@
     public static String MODULE_PATH = "modules";
     public static String MODULE_DRI_PATH = "ModulesDirectory";
 
-    int TYPE_SERVICE = 0;                // is it a service
-    int TYPE_DEFAULT = -1;                // is it a service
-    int TYPE_MODULE = 1;                // is it a module
+    String TYPE_SERVICE = "service";                // is it a service
+    String TYPE_DEFAULT = "none";                // is it a service
+    String TYPE_MODULE = "module";                // is it a module
 
     String TAG_AXISCONFIG = "axisconfig";
     String TAG_PHASE_ORDER = "phaseOrder";
@@ -92,6 +92,11 @@
     String TAG_BEFORE = "before";
     String TAG_SUPPORTED_POLICY_NAMESPACES = "supported-policy-namespaces";
     String TAG_NAMESPACES = "namespaces";
+
+    //Deployer related cons
+    String DIRECTORY ="directory";
+    String EXTENSION ="extension";
+    String DEPLOYER = "deployer";
 
     // for parameters
     String ATTRIBUTE_NAME = "name";

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Thu Feb  8 21:38:38 2007
@@ -20,7 +20,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.repository.util.ArchiveFileData;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.deployment.repository.util.WSInfo;
 import org.apache.axis2.deployment.scheduler.DeploymentIterator;
@@ -64,7 +64,7 @@
     protected List wsToUnDeploy = new ArrayList();
 
     //to keep the web resource location if any
-    protected String webLocationString = null;
+    protected static String webLocationString = null;
 
     /**
      * to keep a ref to engine register
@@ -81,6 +81,18 @@
     protected File servicesDir = null;
     protected String modulesPath = null;
     protected File modulesDir = null;
+    private File repositoryDir = null;
+    //to deploy service (both aar and expanded)
+    protected ServiceDeployer serviceDeployer;
+    //To deploy modules (both mar and expanded)
+    protected ModuleDeployer moduleDeployer;
+
+    //To keep the mapping that which directory will contain which type ,
+    // for exmaple directory services will contains .aar
+    private HashMap directoryToExtensionMappingMap = new HashMap();
+    //to keep map of which deployer can process which file extension ,
+    // for example ServiceDeployer will process .aar file
+    private HashMap extensioToDeployerMappingMap = new HashMap();
 
     public void loadServices() {
         repoListener.checkServices();
@@ -146,7 +158,7 @@
                     ArrayList servicelist = populateService(serviceGroup,
                             servicesURL,
                             fileUrl.substring(0, fileUrl.indexOf(".aar")));
-                    addServiceGroup(serviceGroup, servicelist, servicesURL, null);
+                    addServiceGroup(serviceGroup, servicelist, servicesURL, null,axisConfig);
                 }
             }
         } catch (MalformedURLException e) {
@@ -182,7 +194,7 @@
                     module.setName(new QName(moduleName));
                     populateModule(module, moduleurl);
                     module.setFileName(moduleurl);
-                    addNewModule(module);
+                    addNewModule(module,axisConfig);
                 }
             }
             org.apache.axis2.util.Utils.calculateDefaultModuleVersion(
@@ -345,7 +357,8 @@
         return axisConfig.getMessageReceiver(mepURL);
     }
 
-    protected void addNewModule(AxisModule modulemetadata) throws AxisFault {
+    public static void addNewModule(AxisModule modulemetadata ,
+                                    AxisConfiguration axisConfiguration) throws AxisFault {
 
         Flow inflow = modulemetadata.getInFlow();
         ClassLoader moduleClassLoader = modulemetadata.getModuleClassLoader();
@@ -372,19 +385,20 @@
             Utils.addFlowHandlers(faultOutFlow, moduleClassLoader);
         }
 
-        axisConfig.addModule(modulemetadata);
+        axisConfiguration.addModule(modulemetadata);
         log.debug(Messages.getMessage(DeploymentErrorMsgs.ADDING_NEW_MODULE));
     }
 
-    protected void addServiceGroup(AxisServiceGroup serviceGroup,
+    public static void addServiceGroup(AxisServiceGroup serviceGroup,
                                  ArrayList serviceList,
                                  URL serviceLocation,
-                                 ArchiveFileData currentArchiveFile)
+                                 DeploymentFileData currentDeploymentFile,
+                                 AxisConfiguration axisConfiguration)
             throws AxisFault {
-        fillServiceGroup(serviceGroup, serviceList, serviceLocation, axisConfig);
-        axisConfig.addServiceGroup(serviceGroup);
-        if (currentArchiveFile != null) {
-            addAsWebResources(currentArchiveFile.getFile(),
+        fillServiceGroup(serviceGroup, serviceList, serviceLocation, axisConfiguration);
+        axisConfiguration.addServiceGroup(serviceGroup);
+        if (currentDeploymentFile != null) {
+            addAsWebResources(currentDeploymentFile.getFile(),
                     serviceGroup.getServiceGroupName(), serviceGroup);
         }
     }
@@ -457,7 +471,9 @@
         }
     }
 
-    protected void addAsWebResources(File in, String serviceFileName, AxisServiceGroup serviceGroup) {
+    private static void addAsWebResources(File in,
+                                     String serviceFileName,
+                                     AxisServiceGroup serviceGroup) {
         try {
             if (webLocationString == null) {
                 return;
@@ -503,7 +519,7 @@
     /**
      * @param file ArchiveFileData
      */
-    public void addWSToDeploy(ArchiveFileData file) {
+    public void addWSToDeploy(DeploymentFileData file) {
         wsToDeploy.add(file);
     }
 
@@ -517,159 +533,21 @@
     public void doDeploy() {
         if (wsToDeploy.size() > 0) {
             for (int i = 0; i < wsToDeploy.size(); i++) {
-                ArchiveFileData currentArchiveFile = (ArchiveFileData) wsToDeploy.get(i);
-                boolean explodedDir = currentArchiveFile.getFile().isDirectory();
-                int type = currentArchiveFile.getType();
-                try {
-                    ArchiveReader archiveReader;
-                    StringWriter errorWriter = new StringWriter();
-                    switch (type) {
-                        case TYPE_SERVICE :
-                            currentArchiveFile.setClassLoader(explodedDir,
-                                    axisConfig.getServiceClassLoader());
-                            archiveReader = new ArchiveReader();
-                            String serviceStatus = "";
-                            try {
-                                HashMap wsdlservice = archiveReader.processWSDLs(currentArchiveFile);
-                                if (wsdlservice != null && wsdlservice.size() > 0) {
-                                    Iterator services = wsdlservice.values().iterator();
-                                    while (services.hasNext()) {
-                                        AxisService service = (AxisService) services.next();
-                                        Iterator operations = service.getOperations();
-                                        while (operations.hasNext()) {
-                                            AxisOperation axisOperation = (AxisOperation) operations.next();
-                                            axisConfig.getPhasesInfo().setOperationPhases(axisOperation);
-                                        }
-                                    }
-                                }
-                                AxisServiceGroup sericeGroup = new AxisServiceGroup(axisConfig);
-                                sericeGroup.setServiceGroupClassLoader(
-                                        currentArchiveFile.getClassLoader());
-                                ArrayList serviceList = archiveReader.processServiceGroup(
-                                        currentArchiveFile.getAbsolutePath(), currentArchiveFile,
-                                        sericeGroup, explodedDir, wsdlservice,
-                                        configContext);
-                                addServiceGroup(sericeGroup, serviceList, currentArchiveFile.getFile().toURL(), currentArchiveFile);
-                                log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
-                                        currentArchiveFile.getName()));
-                            } catch (DeploymentException de) {
-                                de.printStackTrace();
-                                log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
-                                        currentArchiveFile.getName(),
-                                        de.getMessage()),
-                                        de);
-                                PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
-                                de.printStackTrace(error_ptintWriter);
-                                serviceStatus = "Error:\n" + errorWriter.toString();
-                            } catch (AxisFault axisFault) {
-                                log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
-                                        currentArchiveFile.getName(),
-                                        axisFault.getMessage()),
-                                        axisFault);
-                                PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
-                                axisFault.printStackTrace(error_ptintWriter);
-                                serviceStatus = "Error:\n" + errorWriter.toString();
-                            } catch (Exception e) {
-                                if (log.isInfoEnabled()) {
-                                    StringWriter sw = new StringWriter();
-                                    PrintWriter pw = new PrintWriter(sw);
-                                    e.printStackTrace(pw);
-                                    log.info(Messages.getMessage(
-                                            DeploymentErrorMsgs.INVALID_SERVICE,
-                                            currentArchiveFile.getName(),
-                                            sw.getBuffer().toString()));
-                                }
-                                PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
-                                e.printStackTrace(error_ptintWriter);
-                                serviceStatus = "Error:\n" + errorWriter.toString();
-                            } catch (Throwable t) {
-                                if (log.isInfoEnabled()) {
-                                    StringWriter sw = new StringWriter();
-                                    PrintWriter pw = new PrintWriter(sw);
-                                    t.printStackTrace(pw);
-                                    log.info(Messages.getMessage(
-                                            DeploymentErrorMsgs.INVALID_SERVICE,
-                                            currentArchiveFile.getName(),
-                                            sw.getBuffer().toString()));
-                                }
-                                PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
-                                t.printStackTrace(error_ptintWriter);
-                                serviceStatus = "Error:\n" + errorWriter.toString();
-                            } finally {
-                                if (serviceStatus.startsWith("Error:")) {
-                                    axisConfig.getFaultyServices().put(currentArchiveFile.getFile().getAbsolutePath(),
-                                            serviceStatus);
-                                }
-                            }
-                            break;
-                        case TYPE_MODULE :
-                            currentArchiveFile.setClassLoader(explodedDir,
-                                    axisConfig.getModuleClassLoader());
-                            archiveReader = new ArchiveReader();
-                            String moduleStatus = "";
-                            try {
-                                AxisModule metaData = new AxisModule();
-                                metaData.setModuleClassLoader(currentArchiveFile.getClassLoader());
-                                metaData.setParent(axisConfig);
-                                archiveReader.readModuleArchive(currentArchiveFile, metaData, explodedDir,
-                                        axisConfig);
-                                metaData.setFileName(currentArchiveFile.getFile().toURL());
-                                addNewModule(metaData);
-                                log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
-                                        metaData.getName().getLocalPart()));
-                            } catch (DeploymentException e) {
-                                log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
-                                        currentArchiveFile.getName(),
-                                        e.getMessage()),
-                                        e);
-                                PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
-                                e.printStackTrace(error_ptintWriter);
-                                moduleStatus = "Error:\n" + errorWriter.toString();
-                            } catch (AxisFault axisFault) {
-                                log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
-                                        currentArchiveFile.getName(),
-                                        axisFault.getMessage()),
-                                        axisFault);
-                                PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
-                                axisFault.printStackTrace(error_ptintWriter);
-                                moduleStatus = "Error:\n" + errorWriter.toString();
-                            } catch (MalformedURLException e) {
-                                log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
-                                        currentArchiveFile.getName(),
-                                        e.getMessage()),
-                                        e);
-                                PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
-                                e.printStackTrace(error_ptintWriter);
-                                moduleStatus = "Error:\n" + errorWriter.toString();
-                            } catch (Throwable t) {
-                                if (log.isInfoEnabled()) {
-                                    StringWriter sw = new StringWriter();
-                                    PrintWriter pw = new PrintWriter(sw);
-                                    t.printStackTrace(pw);
-                                    log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
-                                            currentArchiveFile.getName(),
-                                            t.getMessage()),
-                                            t);
-                                }
-                                PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
-                                t.printStackTrace(error_ptintWriter);
-                                moduleStatus = "Error:\n" + errorWriter.toString();
-                            } finally {
-                                if (moduleStatus.startsWith("Error:")) {
-                                    axisConfig.getFaultyModules().put(
-                                            getAxisServiceName(currentArchiveFile.getName()), moduleStatus);
-                                }
-                            }
-                            break;
+                DeploymentFileData currentDeploymentFile = (DeploymentFileData) wsToDeploy.get(i);
+                String type = currentDeploymentFile.getType();
+                if(TYPE_SERVICE.equals(type)){
+                    serviceDeployer.deploy(currentDeploymentFile);
+                } else if (TYPE_MODULE.equals(type)){
+                    moduleDeployer.deploy(currentDeploymentFile);
+                } else{
+                    Deployer deployer = (Deployer) extensioToDeployerMappingMap.get(type);
+                    if(deployer!=null){
+                        deployer.deploy(currentDeploymentFile);
                     }
-                } catch (AxisFault axisFault) {
-                    log.info(Messages.getMessage(DeploymentErrorMsgs.ERROR_SETTING_CLIENT_HOME,
-                            axisFault.getMessage()),
-                            axisFault);
                 }
+
             }
         }
-
         wsToDeploy.clear();
     }
 
@@ -705,7 +583,7 @@
      */
     public AxisConfiguration populateAxisConfiguration(InputStream in) throws DeploymentException {
         axisConfig = new AxisConfiguration();
-        AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig);
+        AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig,this);
         builder.populateConfig();
         try {
             if (in != null) {
@@ -714,6 +592,7 @@
         } catch (IOException e) {
             log.info("error in closing input stream");
         }
+        moduleDeployer = new ModuleDeployer(axisConfig);
         return axisConfig;
     }
 
@@ -733,7 +612,7 @@
             if (wsToUnDeploy.size() > 0) {
                 for (int i = 0; i < wsToUnDeploy.size(); i++) {
                     WSInfo wsInfo = (WSInfo) wsToUnDeploy.get(i);
-                    if (wsInfo.getType() == TYPE_SERVICE) {
+                    if (TYPE_SERVICE.equals(wsInfo.getType())) {
                         if (isHotUpdate()) {
                             try {
                                 fileName = getAxisServiceName(wsInfo.getFileName());
@@ -772,7 +651,7 @@
      * @param fileName
      * @return Returns String.
      */
-    protected String getAxisServiceName(String fileName) {
+    public static String getAxisServiceName(String fileName) {
         char seperator = '.';
         String value;
         int index = fileName.indexOf(seperator);
@@ -890,28 +769,28 @@
      */
 
     protected void prepareRepository(String repositoryName) {
-        File repository = new File(repositoryName);
+        repositoryDir = new File(repositoryName);
         if (servicesPath != null) {
             servicesDir = new File(servicesPath);
             if (!servicesDir.exists()) {
-                servicesDir = new File(repository, servicesPath);
+                servicesDir = new File(repositoryDir, servicesPath);
             }
         } else {
-            servicesDir = new File(repository, DeploymentConstants.SERVICE_PATH);
+            servicesDir = new File(repositoryDir, DeploymentConstants.SERVICE_PATH);
         }
         if (!servicesDir.exists()) {
-            log.info(Messages.getMessage("noservicedirfound", getRepositoryPath(repository)));
+            log.info(Messages.getMessage("noservicedirfound", getRepositoryPath(repositoryDir)));
         }
         if (modulesPath != null) {
             modulesDir = new File(modulesPath);
             if (!modulesDir.exists()) {
-                modulesDir = new File(repository, modulesPath);
+                modulesDir = new File(repositoryDir, modulesPath);
             }
         } else {
-            modulesDir = new File(repository, DeploymentConstants.MODULE_PATH);
+            modulesDir = new File(repositoryDir, DeploymentConstants.MODULE_PATH);
         }
         if (!modulesDir.exists()) {
-            log.info(Messages.getMessage("nomoduledirfound", getRepositoryPath(repository)));
+            log.info(Messages.getMessage("nomoduledirfound", getRepositoryPath(repositoryDir)));
         }
     }
 
@@ -966,6 +845,17 @@
 
     public void setConfigContext(ConfigurationContext configContext) {
         this.configContext = configContext;
+        initializeDeployers(this.configContext);
+    }
+
+    private void initializeDeployers(ConfigurationContext configContext){
+        serviceDeployer = new ServiceDeployer();
+        serviceDeployer.init(configContext);
+        Iterator deployers = extensioToDeployerMappingMap.values().iterator();
+        while (deployers.hasNext()) {
+            Deployer deployer = (Deployer) deployers.next();
+            deployer.init(configContext);
+        }
     }
 
     /**
@@ -984,14 +874,14 @@
             throws DeploymentException {
         AxisModule axismodule;
         try {
-            ArchiveFileData currentArchiveFile = new ArchiveFileData(modulearchive,
+            DeploymentFileData currentDeploymentFile = new DeploymentFileData(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,
+            currentDeploymentFile.setClassLoader(false, config.getModuleClassLoader());
+            axismodule.setModuleClassLoader(currentDeploymentFile.getClassLoader());
+            archiveReader.readModuleArchive(currentDeploymentFile, axismodule,
                     false, config);
             ClassLoader moduleClassLoader = axismodule.getModuleClassLoader();
             Flow inflow = axismodule.getInFlow();
@@ -1051,9 +941,9 @@
                     antiJARLocking = false;
                 }
             }
-            ArchiveFileData currentArchiveFile = new ArchiveFileData(
+            DeploymentFileData currentDeploymentFile = new DeploymentFileData(
                     DeploymentConstants.TYPE_SERVICE, "", antiJARLocking);
-            currentArchiveFile.setClassLoader(classLoader);
+            currentDeploymentFile.setClassLoader(classLoader);
 
             ServiceBuilder builder = new ServiceBuilder(serviceInputStream, configCtx,
                     axisService);
@@ -1083,16 +973,16 @@
                                                      ConfigurationContext configCtx,
                                                      ArchiveReader archiveReader,
                                                      HashMap wsdlServices) throws AxisFault {
-        ArchiveFileData currentArchiveFile = new ArchiveFileData(
+        DeploymentFileData currentDeploymentFile = new DeploymentFileData(
                 DeploymentConstants.TYPE_SERVICE, "", false);
-        currentArchiveFile.setClassLoader(classLoader);
+        currentDeploymentFile.setClassLoader(classLoader);
         AxisServiceGroup serviceGroup = new AxisServiceGroup();
         serviceGroup.setServiceGroupClassLoader(classLoader);
         serviceGroup.setServiceGroupName(serviceGroupName);
         AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
         try {
             ArrayList serviceList = archiveReader.buildServiceGroup(servicesxml,
-                    currentArchiveFile, serviceGroup,
+                    currentDeploymentFile, serviceGroup,
                     wsdlServices, configCtx);
             fillServiceGroup(serviceGroup, serviceList, null, axisConfig);
             return serviceGroup;
@@ -1107,5 +997,23 @@
 
     public File getModulesDir() {
         return modulesDir;
+    }
+
+
+    public File getRepositoryDir() {
+        return repositoryDir;
+    }
+
+    public void setExtensioToDeployerMappingMap(HashMap extensioToDeployerMappingMap) {
+        this.extensioToDeployerMappingMap = extensioToDeployerMappingMap;
+    }
+
+    public void setDirectoryToExtensionMappingMap(HashMap directoryToExtensionMappingMap) {
+        this.directoryToExtensionMappingMap = directoryToExtensionMappingMap;
+    }
+
+
+    public HashMap getDirectoryToExtensionMappingMap() {
+        return directoryToExtensionMappingMap;
     }
 }

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java?view=auto&rev=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java Thu Feb  8 21:38:38 2007
@@ -0,0 +1,118 @@
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.repository.util.ArchiveReader;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+public class ModuleDeployer implements Deployer {
+
+    private static final Log log = LogFactory.getLog(ModuleDeployer.class);
+    private AxisConfiguration axisConfig;
+
+
+    public ModuleDeployer() {
+    }
+
+    public ModuleDeployer(AxisConfiguration axisConfig) {
+        this.axisConfig = axisConfig;
+    }
+
+    //To initialize the deployer
+    public void init(ConfigurationContext configCtx) {
+        this.axisConfig = configCtx.getAxisConfiguration();
+    }
+    //Will process the file and add that to axisConfig
+
+    public void deploy(DeploymentFileData deploymentFileData) {
+        ArchiveReader archiveReader = new ArchiveReader();
+        String moduleStatus = "";
+        StringWriter errorWriter = new StringWriter();
+        boolean explodedDir = deploymentFileData.getFile().isDirectory();
+        try {
+            deploymentFileData.setClassLoader(explodedDir,
+                    axisConfig.getModuleClassLoader());
+            AxisModule metaData = new AxisModule();
+            metaData.setModuleClassLoader(deploymentFileData.getClassLoader());
+            metaData.setParent(axisConfig);
+            archiveReader.readModuleArchive(deploymentFileData, metaData, explodedDir,
+                    axisConfig);
+            metaData.setFileName(deploymentFileData.getFile().toURL());
+            DeploymentEngine.addNewModule(metaData, axisConfig);
+            log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
+                    metaData.getName().getLocalPart()));
+        } catch (DeploymentException e) {
+            log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+                    deploymentFileData.getName(),
+                    e.getMessage()),
+                    e);
+            PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+            e.printStackTrace(error_ptintWriter);
+            moduleStatus = "Error:\n" + errorWriter.toString();
+        } catch (AxisFault axisFault) {
+            log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+                    deploymentFileData.getName(),
+                    axisFault.getMessage()),
+                    axisFault);
+            PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+            axisFault.printStackTrace(error_ptintWriter);
+            moduleStatus = "Error:\n" + errorWriter.toString();
+        } catch (MalformedURLException e) {
+            log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+                    deploymentFileData.getName(),
+                    e.getMessage()),
+                    e);
+            PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+            e.printStackTrace(error_ptintWriter);
+            moduleStatus = "Error:\n" + errorWriter.toString();
+        } catch (Throwable t) {
+            if (log.isInfoEnabled()) {
+                StringWriter sw = new StringWriter();
+                PrintWriter pw = new PrintWriter(sw);
+                t.printStackTrace(pw);
+                log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+                        deploymentFileData.getName(),
+                        t.getMessage()),
+                        t);
+            }
+            PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+            t.printStackTrace(error_ptintWriter);
+            moduleStatus = "Error:\n" + errorWriter.toString();
+        } finally {
+            if (moduleStatus.startsWith("Error:")) {
+                axisConfig.getFaultyModules().put(DeploymentEngine.getAxisServiceName(
+                        deploymentFileData.getName()), moduleStatus);
+            }
+        }
+    }
+
+    public void setDirctory(String directory) {}
+
+    public void setExtension(String extension) {}
+}

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java Thu Feb  8 21:38:38 2007
@@ -17,7 +17,7 @@
 
 package org.apache.axis2.deployment;
 
-import org.apache.axis2.deployment.repository.util.ArchiveFileData;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
 import org.apache.axis2.deployment.repository.util.WSInfoList;
 import org.apache.axis2.util.Loader;
 
@@ -25,9 +25,13 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Iterator;
 
 public class RepositoryListener implements DeploymentConstants {
+
     protected DeploymentEngine deploymentEngine;
+    private HashMap directoryToExtensionMappingMap;
 
     /**
      * The parent directory of the modules and services directories
@@ -70,7 +74,7 @@
                     continue;
                 }
                 if (!file.isDirectory()) {
-                    if (ArchiveFileData.isModuleArchiveFile(file.getName())) {
+                    if (DeploymentFileData.isModuleArchiveFile(file.getName())) {
                         wsInfoList.addWSInfoItem(file, TYPE_MODULE);
                     }
                 } else {
@@ -107,7 +111,7 @@
             for (int i = 0; i < files.length; i++) {
                 File file = files[i];
                 if (!file.isDirectory()) {
-                    if (ArchiveFileData.isModuleArchiveFile(file.getName())) {
+                    if (DeploymentFileData.isModuleArchiveFile(file.getName())) {
                         //adding modules in the class path
                         wsInfoList.addWSInfoItem(file, TYPE_MODULE);
                     }
@@ -127,7 +131,7 @@
                     java.io.File file = new java.io.File(URLDecoder.decode(urls[i].getPath()).replace('/',
                             File.separatorChar).replace('|', ':'));
                     if (file.isFile()) {
-                        if (ArchiveFileData.isModuleArchiveFile(file.getName())) {
+                        if (DeploymentFileData.isModuleArchiveFile(file.getName())) {
                             //adding modules in the class path
                             wsInfoList.addWSInfoItem(file, TYPE_MODULE);
                         }
@@ -171,6 +175,7 @@
      */
     public void checkServices() {
         findServicesInDirectory();
+        loadOtherDirectories();
         update();
     }
 
@@ -181,9 +186,45 @@
     public void init() {
         wsInfoList.init();
         checkModules();
+        directoryToExtensionMappingMap = deploymentEngine.getDirectoryToExtensionMappingMap();
         deploymentEngine.doDeploy();
     }
 
+    //This will load the files from the directories
+    // specified by axis2.xml (As <deployer>)
+    private void loadOtherDirectories(){
+       if(directoryToExtensionMappingMap.size()>0){
+          Iterator keys = directoryToExtensionMappingMap.keySet().iterator();
+           while (keys.hasNext()) {
+               String s = (String) keys.next();
+               findFileForGiveDirectory(s,(String)directoryToExtensionMappingMap.get(s));
+           }
+       }
+    }
+
+    private void findFileForGiveDirectory(String dir , String extension){
+        try {
+            File fileTobeSearch = new File(deploymentEngine.getRepositoryDir(),dir);
+            if(fileTobeSearch.exists()){
+                File[] files = fileTobeSearch.listFiles();
+                if (files != null && files.length > 0) {
+                    for (int i = 0; i < files.length; i++) {
+                        File file = files[i];
+                        if (isSourceControlDir(file)) {
+                            continue;
+                        }
+                        if (!file.isDirectory()&&DeploymentFileData.getFileExtension(
+                                file.getName()).equals(extension)) {
+                            wsInfoList.addWSInfoItem(file,extension);
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            //need to log the exception
+        }
+    }
+
     /**
      * Searches a given folder for jar files and adds them to a list in the
      * WSInfolist class.
@@ -199,7 +240,7 @@
                     continue;
                 }
                 if (!file.isDirectory()) {
-                    if (ArchiveFileData.isServiceArchiveFile(file.getName())) {
+                    if (DeploymentFileData.isServiceArchiveFile(file.getName())) {
                         wsInfoList.addWSInfoItem(file, TYPE_SERVICE);
                     }
                 } else {
@@ -217,6 +258,7 @@
      */
     public void startListener() {
         checkServices();
+        loadOtherDirectories();
         update();
     }
 

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java?view=auto&rev=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java Thu Feb  8 21:38:38 2007
@@ -0,0 +1,142 @@
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.repository.util.ArchiveReader;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+public class ServiceDeployer implements Deployer {
+    private static final Log log = LogFactory.getLog(ServiceDeployer.class);
+    private AxisConfiguration axisConfig;
+    private ConfigurationContext configCtx;
+
+    //To initialize the deployer
+    public void init(ConfigurationContext configCtx) {
+        this.configCtx = configCtx;
+        this.axisConfig = this.configCtx.getAxisConfiguration();
+    }
+
+    //Will process the file and add that to axisConfig
+
+    public void deploy(DeploymentFileData deploymentFileData) {
+        boolean explodedDir = deploymentFileData.getFile().isDirectory();
+        ArchiveReader archiveReader;
+        StringWriter errorWriter = new StringWriter();
+        archiveReader = new ArchiveReader();
+        String serviceStatus = "";
+        try {
+            deploymentFileData.setClassLoader(explodedDir,
+                    axisConfig.getServiceClassLoader());
+            HashMap wsdlservice = archiveReader.processWSDLs(deploymentFileData);
+            if (wsdlservice != null && wsdlservice.size() > 0) {
+                Iterator services = wsdlservice.values().iterator();
+                while (services.hasNext()) {
+                    AxisService service = (AxisService) services.next();
+                    Iterator operations = service.getOperations();
+                    while (operations.hasNext()) {
+                        AxisOperation axisOperation = (AxisOperation) operations.next();
+                        axisConfig.getPhasesInfo().setOperationPhases(axisOperation);
+                    }
+                }
+            }
+            AxisServiceGroup sericeGroup = new AxisServiceGroup(axisConfig);
+            sericeGroup.setServiceGroupClassLoader(
+                    deploymentFileData.getClassLoader());
+            ArrayList serviceList = archiveReader.processServiceGroup(
+                    deploymentFileData.getAbsolutePath(), deploymentFileData,
+                    sericeGroup, explodedDir, wsdlservice,
+                    configCtx);
+            DeploymentEngine.addServiceGroup(sericeGroup,
+                    serviceList,
+                    deploymentFileData.getFile().toURL(),
+                    deploymentFileData,
+                    axisConfig);
+            log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
+                    deploymentFileData.getName()));
+        } catch (DeploymentException de) {
+            de.printStackTrace();
+            log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
+                    deploymentFileData.getName(),
+                    de.getMessage()),
+                    de);
+            PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+            de.printStackTrace(error_ptintWriter);
+            serviceStatus = "Error:\n" + errorWriter.toString();
+        } catch (AxisFault axisFault) {
+            log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
+                    deploymentFileData.getName(),
+                    axisFault.getMessage()),
+                    axisFault);
+            PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+            axisFault.printStackTrace(error_ptintWriter);
+            serviceStatus = "Error:\n" + errorWriter.toString();
+        } catch (Exception e) {
+            if (log.isInfoEnabled()) {
+                StringWriter sw = new StringWriter();
+                PrintWriter pw = new PrintWriter(sw);
+                e.printStackTrace(pw);
+                log.info(Messages.getMessage(
+                        DeploymentErrorMsgs.INVALID_SERVICE,
+                        deploymentFileData.getName(),
+                        sw.getBuffer().toString()));
+            }
+            PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+            e.printStackTrace(error_ptintWriter);
+            serviceStatus = "Error:\n" + errorWriter.toString();
+        } catch (Throwable t) {
+            if (log.isInfoEnabled()) {
+                StringWriter sw = new StringWriter();
+                PrintWriter pw = new PrintWriter(sw);
+                t.printStackTrace(pw);
+                log.info(Messages.getMessage(
+                        DeploymentErrorMsgs.INVALID_SERVICE,
+                        deploymentFileData.getName(),
+                        sw.getBuffer().toString()));
+            }
+            PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+            t.printStackTrace(error_ptintWriter);
+            serviceStatus = "Error:\n" + errorWriter.toString();
+        } finally {
+            if (serviceStatus.startsWith("Error:")) {
+                axisConfig.getFaultyServices().put(deploymentFileData.getFile().getAbsolutePath(),
+                        serviceStatus);
+            }
+        }
+    }
+
+    public void setDirctory(String directory) {
+    }
+
+    public void setExtension(String extension) {
+    }
+}

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Thu Feb  8 21:38:38 2007
@@ -63,7 +63,7 @@
 public class ArchiveReader implements DeploymentConstants {
     private static final Log log = LogFactory.getLog(ArchiveReader.class);
 
-    public ArrayList buildServiceGroup(InputStream zin, ArchiveFileData currentFile,
+    public ArrayList buildServiceGroup(InputStream zin, DeploymentFileData currentFile,
                                        AxisServiceGroup axisServiceGroup, HashMap wsdlServices,
                                        ConfigurationContext configCtx)
             throws XMLStreamException, AxisFault {
@@ -117,7 +117,7 @@
      * @return Returns ArrayList.
      * @throws DeploymentException
      */
-    public ArrayList processServiceGroup(String filename, ArchiveFileData currentFile,
+    public ArrayList processServiceGroup(String filename, DeploymentFileData currentFile,
                                          AxisServiceGroup axisServiceGroup,
                                          boolean extractService,
                                          HashMap wsdls,
@@ -237,7 +237,7 @@
      * @param file <code>ArchiveFileData</code>
      * @throws DeploymentException <code>DeploymentException</code>
      */
-    public HashMap processWSDLs(ArchiveFileData file)
+    public HashMap processWSDLs(DeploymentFileData file)
             throws DeploymentException {
         File serviceFile = file.getFile();
         // to store service come from wsdl files
@@ -419,7 +419,7 @@
         }
     }
 
-    public void readModuleArchive(ArchiveFileData archiveFile,
+    public void readModuleArchive(DeploymentFileData deploymentFile,
                                   AxisModule module, boolean explodedDir,
                                   AxisConfiguration axisConfig)
             throws DeploymentException {
@@ -430,7 +430,7 @@
             ZipInputStream zin;
             FileInputStream fin;
             try {
-                fin = new FileInputStream(archiveFile.getAbsolutePath());
+                fin = new FileInputStream(deploymentFile.getAbsolutePath());
                 zin = new ZipInputStream(fin);
                 ZipEntry entry;
                 while ((entry = zin.getNextEntry()) != null) {
@@ -441,7 +441,7 @@
                         module.setName(
                                 new QName(
                                         DescriptionBuilder.getShortFileName(
-                                                archiveFile.getServiceName())));
+                                                deploymentFile.getServiceName())));
                         builder.populateModule();
                         break;
                     }
@@ -451,15 +451,15 @@
                 if (!moduleXMLFound) {
                     throw new DeploymentException(
                             Messages.getMessage(
-                                    DeploymentErrorMsgs.MODULE_XML_MISSING, archiveFile.getAbsolutePath()));
+                                    DeploymentErrorMsgs.MODULE_XML_MISSING, deploymentFile.getAbsolutePath()));
                 }
             } catch (Exception e) {
                 throw new DeploymentException(e);
             }
         } else {
-            File file = new File(archiveFile.getAbsolutePath(), MODULE_XML);
+            File file = new File(deploymentFile.getAbsolutePath(), MODULE_XML);
 
-            if (file.exists() || (file = new File(archiveFile.getAbsolutePath(), MODULE_XML.toLowerCase())).exists()) {
+            if (file.exists() || (file = new File(deploymentFile.getAbsolutePath(), MODULE_XML.toLowerCase())).exists()) {
                 InputStream in = null;
                 try {
                     in = new FileInputStream(file);
@@ -468,7 +468,7 @@
                     module.setName(
                             new QName(
                                     DescriptionBuilder.getShortFileName(
-                                            archiveFile.getServiceName())));
+                                            deploymentFile.getServiceName())));
                     builder.populateModule();
                 } catch (FileNotFoundException e) {
                     throw new DeploymentException(
@@ -485,7 +485,7 @@
             } else {
                 throw new DeploymentException(
                         Messages.getMessage(
-                                DeploymentErrorMsgs.MODULE_XML_MISSING, archiveFile.getAbsolutePath()));
+                                DeploymentErrorMsgs.MODULE_XML_MISSING, deploymentFile.getAbsolutePath()));
             }
         }
     }

Copied: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java (from r504800, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java?view=diff&rev=505189&p1=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java&r1=504800&p2=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java Thu Feb  8 21:38:38 2007
@@ -30,7 +30,7 @@
 /**
  * ArchiveFileData stores information about the module or service item to be deployed.
  */
-public class ArchiveFileData {
+public class DeploymentFileData {
     private File file = null;
     private ArrayList deployableServices = new ArrayList();
     private ClassLoader classLoader;
@@ -38,15 +38,15 @@
     private boolean lock;
 
     private String name;
-    private int type;
+    private String type;
 
-    public ArchiveFileData(File file, int type, boolean lock) {
+    public DeploymentFileData(File file, String type, boolean lock) {
         this.file = file;
         this.type = type;
         this.lock = lock;
     }
 
-    public ArchiveFileData(int type, String name, boolean lock) {
+    public DeploymentFileData(String type, String name, boolean lock) {
         this.type = type;
         this.name = name;
         this.lock = lock;
@@ -84,7 +84,7 @@
         }
     }
 
-    public int getType() {
+    public String getType() {
         return type;
     }
 
@@ -102,6 +102,10 @@
         return ((filename.endsWith(".jar")) | (filename.endsWith(".aar")));
     }
 
+    public static  String getFileExtension(String fileName){
+        int index = fileName.lastIndexOf('.');
+        return fileName.substring(index+1);
+    }
     public void setClassLoader(ClassLoader classLoader) {
         this.classLoader = classLoader;
     }

Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java Thu Feb  8 21:38:38 2007
@@ -24,14 +24,14 @@
     /**
      * To check whether the file is a module or a servise
      */
-    private int type;
+    private String type;
 
     public WSInfo(String filename, long lastmodifieddate) {
         this.fileName = filename;
         this.lastModifiedDate = lastmodifieddate;
     }
 
-    public WSInfo(String filename, long lastmodifieddate, int type) {
+    public WSInfo(String filename, long lastmodifieddate, String type) {
         this.fileName = filename;
         this.lastModifiedDate = lastmodifieddate;
         this.type = type;
@@ -45,7 +45,7 @@
         return lastModifiedDate;
     }
 
-    public int getType() {
+    public String getType() {
         return type;
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java Thu Feb  8 21:38:38 2007
@@ -62,60 +62,62 @@
      * @param file actual jar files for either Module or service
      * @param type indicate either Service or Module
      */
-    public synchronized void addWSInfoItem(File file, int type) {
-        switch (type) {
-            case TYPE_SERVICE : {
-                if (!isFileExist(file.getName())) {    // checking whether the file is already deployed
-                    WSInfo wsInfo = new WSInfo(file.getName(), file.lastModified(), TYPE_SERVICE);
-
+    public synchronized void addWSInfoItem(File file, String type) {
+        if(TYPE_SERVICE.equals(type)){
+            if (!isFileExist(file.getName())) {    // checking whether the file is already deployed
+                WSInfo wsInfo = new WSInfo(file.getName(), file.lastModified(), TYPE_SERVICE);
+                jarList.add(wsInfo);
+                DeploymentFileData deploymentFileData = new DeploymentFileData(file, TYPE_SERVICE, deployer.isAntiJARLocking());
+                deployer.addWSToDeploy(deploymentFileData);    // inform that new web service is deployed
+            } else {
+                if (deployer.isHotUpdate()) {
+                    WSInfo tempWSInfo = getFileItem(file.getName());
+                    if (isModified(file, tempWSInfo)) {    // check whether file is updated
+                        tempWSInfo.setLastModifiedDate(file.lastModified());
+                        WSInfo wsInfo = new WSInfo(tempWSInfo.getFileName(),
+                                tempWSInfo.getLastModifiedDate(), TYPE_SERVICE);
+                        deployer.addWSToUndeploy(wsInfo);           // add entry to undeploy list
+                        DeploymentFileData deploymentFileData = new DeploymentFileData(file, TYPE_SERVICE, deployer.isAntiJARLocking());
+                        deployer.addWSToDeploy(deploymentFileData);    // add entry to deploylist
+                    }
+                }
+            }
+        } else if (TYPE_MODULE.equals(type)){
+            if (!isFileExist(file.getName())) {                     // checking whether the file is already deployed
+                WSInfo wsInfo = new WSInfo(file.getName(), file.lastModified(), TYPE_MODULE);
+                jarList.add(wsInfo);
+                DeploymentFileData deploymentFileData = new DeploymentFileData(file, TYPE_MODULE, false);
+                deployer.addWSToDeploy(deploymentFileData);    // inform that new web service is deployed
+            }
+        } else {
+            if(file!=null){
+                String extension = DeploymentFileData.getFileExtension(file.getName());
+                if (!isFileExist(file.getName())) {
+                    WSInfo wsInfo = new WSInfo(file.getName(), file.lastModified(), extension);
                     jarList.add(wsInfo);
-
-                    ArchiveFileData archiveFileData = new ArchiveFileData(file, TYPE_SERVICE, deployer.isAntiJARLocking());
-
-                    deployer.addWSToDeploy(archiveFileData);    // inform that new web service is deployed
+                    DeploymentFileData deploymentFileData = new DeploymentFileData(file, extension, deployer.isAntiJARLocking());
+                    deployer.addWSToDeploy(deploymentFileData);    // inform that new web service is deployed
                 } else {
                     if (deployer.isHotUpdate()) {
                         WSInfo tempWSInfo = getFileItem(file.getName());
                         if (isModified(file, tempWSInfo)) {    // check whether file is updated
                             tempWSInfo.setLastModifiedDate(file.lastModified());
-
                             WSInfo wsInfo = new WSInfo(tempWSInfo.getFileName(),
-                                    tempWSInfo.getLastModifiedDate(), TYPE_SERVICE);
-
+                                    tempWSInfo.getLastModifiedDate(), extension);
                             deployer.addWSToUndeploy(wsInfo);           // add entry to undeploy list
-
-                            ArchiveFileData archiveFileData = new ArchiveFileData(file, TYPE_SERVICE, deployer.isAntiJARLocking());
-
-                            deployer.addWSToDeploy(archiveFileData);    // add entry to deploylist
+                            DeploymentFileData deploymentFileData = new DeploymentFileData(file, extension, deployer.isAntiJARLocking());
+                            deployer.addWSToDeploy(deploymentFileData);    // add entry to deploylist
                         }
                     }
                 }
-
-                break;
-            }
-
-            case TYPE_MODULE : {
-                if (!isFileExist(file.getName())) {                     // checking whether the file is already deployed
-                    WSInfo wsInfo = new WSInfo(file.getName(), file.lastModified(), TYPE_MODULE);
-
-                    jarList.add(wsInfo);
-
-                    ArchiveFileData archiveFileData = new ArchiveFileData(file, TYPE_MODULE, false);
-
-                    deployer.addWSToDeploy(archiveFileData);    // inform that new web service is deployed
-                }
-
-                break;
-            }
-            default : {
+            } else {
                 check = true;
-                return;
             }
         }
-
-        String jarname = file.getName();
-
-        currentJars.add(jarname);
+        if(file!=null){
+            String jarname = file.getName();
+            currentJars.add(jarname);
+        }
         check = true;
     }
 
@@ -143,38 +145,27 @@
 
         while (iter.hasNext()) {
             WSInfo fileitem = (WSInfo) iter.next();
-
-            if (fileitem.getType() == TYPE_MODULE) {
+            if (TYPE_MODULE.equals(fileitem.getType())) {
                 continue;
             }
-
             exist = false;
-
             for (int i = 0; i < size; i++) {
                 filename = (String) currentJars.get(i);
-
                 if (filename.equals(fileitem.getFileName())) {
                     exist = true;
-
                     break;
                 }
             }
-
             if (!exist) {
                 tempvector.add(fileitem);
-
                 WSInfo wsInfo = new WSInfo(fileitem.getFileName(), fileitem.getLastModifiedDate());
-
                 deployer.addWSToUndeploy(wsInfo);    // this is to be undeployed
             }
         }
-
         for (int i = 0; i < tempvector.size(); i++) {
             WSInfo fileItem = (WSInfo) tempvector.get(i);
-
             jarList.remove(fileItem);
         }
-
         tempvector.clear();
         currentJars.clear();
     }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Thu Feb  8 21:38:38 2007
@@ -8,7 +8,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 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.DeploymentFileData;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
@@ -430,7 +430,8 @@
                         throw new AxisFault("No service archiev found : " + servicename);
                     }
                     File inputFile = Utils.createTempFile(servicename, fin);
-                    ArchiveFileData filedata = new ArchiveFileData(inputFile, DeploymentConstants.TYPE_SERVICE, false);
+                    DeploymentFileData filedata = new DeploymentFileData(inputFile,
+                            DeploymentConstants.TYPE_SERVICE, false);
 
                     filedata.setClassLoader(false,
                             moduleClassLoader);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Thu Feb  8 21:38:38 2007
@@ -84,7 +84,6 @@
     private URL axis2Repository = null;
 
     private HashMap allServices = new HashMap();
-
     /**
      * Stores the module specified in the server.xml at the document parsing time.
      */

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/BadModuleTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/BadModuleTest.java?view=diff&rev=505189&r1=505188&r2=505189
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/BadModuleTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/BadModuleTest.java Thu Feb  8 21:38:38 2007
@@ -36,7 +36,7 @@
             InputStream in = new FileInputStream(
                     getTestResourceFile("deployment/Badmodule.xml"));
             AxisConfiguration glabl = new AxisConfiguration();
-            AxisConfigBuilder builder =new AxisConfigBuilder(in, glabl);
+            AxisConfigBuilder builder =new AxisConfigBuilder(in, glabl,null);
             builder.populateConfig();
             fail(
                     "this must failed gracefully with DeploymentException or FileNotFoundException");



---------------------------------------------------------------------
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