You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/09/15 21:07:03 UTC

svn commit: r289289 [14/134] - in /webservices/axis2/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/META-INF/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/ap...

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml Thu Sep 15 11:52:11 2005
@@ -1,123 +1,123 @@
-<axisconfig name="AxisJava2.0">
-    <!-- ================================================= -->
-    <!-- Parameters -->
-    <!-- ================================================= -->
-    <parameter name="hotdeployment" locked="false">true</parameter>
-    <parameter name="hotupdate" locked="false">false</parameter>
-    <parameter name="enableMTOM" locked="false">true</parameter>
-    <!-- Uncomment this to enable REST support -->
-    <!--    <parameter name="enableREST" locked="false">true</parameter>-->
-
-
-    <parameter name="userName" locked="false">admin</parameter>
-    <parameter name="password" locked="false">axis2</parameter>
-
-
-    <!--if you want to extract the service archive file and work with that please uncomment this-->
-    <!--else , it wont extract archive file or does not take into consideration if someone drop-->
-    <!--exploded directory into /service directory-->
-    <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
-
-
-<!--    The way of adding listener to the system-->
-<!--    <listener class="org.apache.axis2.ObserverIMPL">-->
-<!--        <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
-<!--    </listener>-->
-
-    <!--Registering Axis Storage Class if you comment this default one will -->
-    <!--does the job (org.apache.axis2.storage.impl.AxisMemoryStorage) , if you-->
-    <!--want to register new one write a class by extanding AbastractStorage-->
-    <!--and put that name here-->
-    <axisStorage class="org.apache.axis2.storage.impl.AxisMemoryStorage">
-        <parameter name="StoreLocation" locked="false">N:S</parameter>
-    </axisStorage>
-
-
-
-    <!-- ================================================= -->
-    <!-- Message Receivers -->
-    <!-- ================================================= -->
-    <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
-    <messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
-
-    <!-- ================================================= -->
-    <!-- Transport Ins -->
-    <!-- ================================================= -->
-    <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
-        <parameter name="port" locked="false">6060</parameter>
-    </transportReceiver>
-
-    <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
-    <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
-          <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
-          <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
-          <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
-          <parameter name="transport.mail.pop3.port" locked="false">110</parameter>
-          <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
-      </transportReceiver> -->
-
-    <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
-        <parameter name="port" locked="false">6060</parameter>
-    </transportReceiver>
-
-    <!-- ================================================= -->
-    <!-- Transport Outs -->
-    <!-- ================================================= -->
-
-    <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
-    <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
-    <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
-        <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
-    </transportSender>
-    <transportSender name="https" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
-        <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
-    </transportSender>
-
-    <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
-   <transportSender name="mail" class="org.apache.axis2.transport.mail.MailTransportSender">
-       <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
-       <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
-       <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
-       <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
-   </transportSender>
-   -->
-
-    <!-- ================================================= -->
-    <!-- Global Modules  -->
-    <!-- ================================================= -->
-    <!-- Comment this to disable Addressing -->
-    <module ref="addressing"/>
-
-
-    <!--Configuring module , providing paramters for modules whether they refer or not-->
-    <!--<moduleConfig name="addressing">-->
-         <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
-    <!--</moduleConfig>-->
-    
-    <!-- ================================================= -->
-    <!-- Phases  -->
-    <!-- ================================================= -->
-    <phaseOrder type="inflow">
-        <!--  System pre defined phases       -->
-        <phase name="TransportIn"/>
-        <phase name="PreDispatch"/>
-        <phase name="Dispatch"/>
-        <phase name="PostDispatch"/>
-        <!--  System pre defined phases       -->
-        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
-        <phase name="userphase1"/>
-    </phaseOrder>
-    <phaseOrder type="outflow">
-        <!--      user can add his own phases to this area  -->
-        <phase name="userphase1"/>
-    </phaseOrder>
-    <phaseOrder type="INfaultflow">
-        <!--      user can add his own phases to this area  -->
-        <phase name="userphase1"/>
-    </phaseOrder>
-    <phaseOrder type="Outfaultflow">
-        <!--      user can add his own phases to this area  -->
-        <phase name="userphase1"/>
-    </phaseOrder>
-</axisconfig>
-
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Parameters -->
+    <!-- ================================================= -->
+    <parameter name="hotdeployment" locked="false">true</parameter>
+    <parameter name="hotupdate" locked="false">false</parameter>
+    <parameter name="enableMTOM" locked="false">true</parameter>
+    <!-- Uncomment this to enable REST support -->
+    <!--    <parameter name="enableREST" locked="false">true</parameter>-->
+
+
+    <parameter name="userName" locked="false">admin</parameter>
+    <parameter name="password" locked="false">axis2</parameter>
+
+
+    <!--if you want to extract the service archive file and work with that please uncomment this-->
+    <!--else , it wont extract archive file or does not take into consideration if someone drop-->
+    <!--exploded directory into /service directory-->
+    <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
+
+
+<!--    The way of adding listener to the system-->
+<!--    <listener class="org.apache.axis2.ObserverIMPL">-->
+<!--        <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+<!--    </listener>-->
+
+    <!--Registering Axis Storage Class if you comment this default one will -->
+    <!--does the job (org.apache.axis2.storage.impl.AxisMemoryStorage) , if you-->
+    <!--want to register new one write a class by extanding AbastractStorage-->
+    <!--and put that name here-->
+    <axisStorage class="org.apache.axis2.storage.impl.AxisMemoryStorage">
+        <parameter name="StoreLocation" locked="false">N:S</parameter>
+    </axisStorage>
+
+
+
+    <!-- ================================================= -->
+    <!-- Message Receivers -->
+    <!-- ================================================= -->
+    <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+    <messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+    <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
+        <parameter name="port" locked="false">6060</parameter>
+    </transportReceiver>
+
+    <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+    <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+          <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
+          <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
+          <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
+          <parameter name="transport.mail.pop3.port" locked="false">110</parameter>
+          <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
+      </transportReceiver> -->
+
+    <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+        <parameter name="port" locked="false">6060</parameter>
+    </transportReceiver>
+
+    <!-- ================================================= -->
+    <!-- Transport Outs -->
+    <!-- ================================================= -->
+
+    <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+    <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
+    <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
+    </transportSender>
+    <transportSender name="https" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+    </transportSender>
+
+    <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+   <transportSender name="mail" class="org.apache.axis2.transport.mail.MailTransportSender">
+       <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+       <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+       <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+       <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+   </transportSender>
+   -->
+
+    <!-- ================================================= -->
+    <!-- Global Modules  -->
+    <!-- ================================================= -->
+    <!-- Comment this to disable Addressing -->
+    <module ref="addressing"/>
+
+
+    <!--Configuring module , providing paramters for modules whether they refer or not-->
+    <!--<moduleConfig name="addressing">-->
+         <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+    <!--</moduleConfig>-->
+    
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="inflow">
+        <!--  System pre defined phases       -->
+        <phase name="TransportIn"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch"/>
+        <phase name="PostDispatch"/>
+        <!--  System pre defined phases       -->
+        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="outflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="INfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="Outfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+</axisconfig>
+

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java Thu Sep 15 11:52:11 2005
@@ -1,46 +1,46 @@
-/*
- * 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.
- */
-
-package org.apache.axis2.deployment.listener;
-
-/**
- * RepositaryListener is no listent to a specific folder whether the folder is
- * update eg: remove , added or modified files
- */
-public interface RepositoryListener {
-
-    /**
-     * this method is to check whether new module is added (or modules)
-     */
-    void checkModules();
-
-    /**
-     * this method is to check whether new service is added (or services)
-     */
-    void checkServices();
-
-    /**
-     * If new services or modules(service or module) are added then this method will call
-     */
-    void update();
-
-    /**
-     * this is to Initialize the Deployment , this only call when the Axis engine start up
-     * Then it should deploy all the WS and modules , and should initialize the WSInfoList
-     */
-    void init();
-
+/*
+ * 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.
+ */
+
+package org.apache.axis2.deployment.listener;
+
+/**
+ * RepositaryListener is no listent to a specific folder whether the folder is
+ * update eg: remove , added or modified files
+ */
+public interface RepositoryListener {
+
+    /**
+     * this method is to check whether new module is added (or modules)
+     */
+    void checkModules();
+
+    /**
+     * this method is to check whether new service is added (or services)
+     */
+    void checkServices();
+
+    /**
+     * If new services or modules(service or module) are added then this method will call
+     */
+    void update();
+
+    /**
+     * this is to Initialize the Deployment , this only call when the Axis engine start up
+     * Then it should deploy all the WS and modules , and should initialize the WSInfoList
+     */
+    void init();
+
 }

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java Thu Sep 15 11:52:11 2005
@@ -1,330 +1,330 @@
-/*
- * 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.
- */
-
-package org.apache.axis2.deployment.listener;
-
-import org.apache.axis2.deployment.DeploymentConstants;
-import org.apache.axis2.deployment.DeploymentEngine;
-import org.apache.axis2.deployment.repository.util.ArchiveFileData;
-import org.apache.axis2.deployment.repository.util.WSInfoList;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-public class RepositoryListenerImpl implements RepositoryListener,
-        DeploymentConstants {
-
-    protected Log log = LogFactory.getLog(getClass());
-
-    /**
-     * to store curreently checking jars
-     */
-    private List currentJars;
-    /**
-     * Referance to a WSInfoList
-     */
-    private WSInfoList wsinfoList;
-
-    private int BUFFER = 2048;
-
-    /**
-     * The parent directory of the modules and services directories
-     * taht the listentner should listent
-     */
-    private String folderName;
-
-
-    private boolean extarctServiceArchive = false;
-
-    /**
-     * This constructor take two argumnets folder name and referance to Deployment Engine
-     * Fisrt it initilize the syetm , by loading all the modules in the /modules directory
-     * and also create a WSInfoList to keep infor about available modules and services
-     *
-     * @param folderName    path to parent directory that the listener should listent
-     * @param deploy_engine refearnce to engine registry  inorder to inform the updates
-     */
-    public RepositoryListenerImpl(String folderName,
-                                  DeploymentEngine deploy_engine, boolean serviceExtarct) {
-        this.folderName = folderName;
-        wsinfoList = new WSInfoList(deploy_engine);
-        this.extarctServiceArchive = serviceExtarct;
-        init();
-    }
-
-    /**
-     * this method ask serachWS to serch for the folder to caheck
-     * for updates
-     */
-    public void checkModules() {
-        String modulepath = folderName + MODULE_PATH;
-        String files[];
-        currentJars = new ArrayList();
-        File root = new File(modulepath);
-        // adding the root folder to the vector
-        currentJars.add(root);
-
-        while (currentJars.size() > 0) {        // loop until empty
-            File dir = (File) currentJars.get(0); // get first dir
-            currentJars.remove(0);       // remove it
-            files = dir.list();              // get list of files
-            if (files == null) {
-                continue;
-            }
-            for (int i = 0; i < files.length; i++) { // iterate
-                File f = new File(dir, files[i]);
-                if (f.isDirectory()) {        // see if it's a directory
-                    currentJars.add(0, f);
-                } // add dir to start of agenda
-                else if (ArchiveFileData.isModuleArchiveFile(f.getName())) {
-                    wsinfoList.addWSInfoItem(f, MODULE);
-                }
-            }
-        }
-    }
-
-    /**
-     * this method ask serachWS to serch for the folder to caheck
-     * for updates
-     */
-    public void checkServices() {
-        String modulepath = folderName + SERVICE_PATH;
-        if(extarctServiceArchive){
-            searchExploedServies(modulepath);
-        }else {
-            searchWS(modulepath, SERVICE);
-        }
-    }
-
-    /**
-     * call to update method of WSInfoList object
-     */
-    public void update() {
-        //todo completet this
-        // this call the update method of WSInfoList
-        wsinfoList.update();
-    }
-
-    /**
-     * First it call to initalize method of WSInfoList to initilizat that
-     * then it call to checkModules to load all the module.jar s
-     * and then it call to update() method inorder to update the Deployment engine and
-     * engine regsitry
-     */
-    public void init() {
-        wsinfoList.init();
-        checkModules();
-        checkServices();
-        update();
-    }
-
-    /**
-     * this is the actual method that is call from scheduler
-     */
-    public void startListent() {
-        // checkModules();
-        checkServices();
-        update();
-    }
-
-    /**
-     * This method is to search a given folder  for jar files
-     * and added them to a list wich is in the WSInfolist class
-     */
-    private void searchWS(String folderName, int type) {
-        String files[];
-        currentJars = new ArrayList();
-        File root = new File(folderName);
-        // adding the root folder to the vector
-        currentJars.add(root);
-
-        while (currentJars.size() > 0) {        // loop until empty
-            File dir = (File) currentJars.get(0); // get first dir
-            currentJars.remove(0);       // remove it
-            files = dir.list();              // get list of files
-            if (files == null) {
-                continue;
-            }
-            for (int i = 0; i < files.length; i++) { // iterate
-                File f = new File(dir, files[i]);
-                if (f.isDirectory()) {        // see if it's a directory
-                    currentJars.add(0, f);
-                } // add dir to start of agenda
-                else if (ArchiveFileData.isServiceArchiveFile(f.getName())) {
-                    wsinfoList.addWSInfoItem(f, type);
-                }
-            }
-        }
-    }
-
-
-    private void searchExploedServies(String rootDirName){
-        File rootDir = new File(rootDirName);
-        File [] fileList = rootDir.listFiles();
-        ArrayList tobedelete = new ArrayList();
-        ArrayList tobeextarct = new ArrayList();
-        ArrayList allFiles = new ArrayList();
-        for (int i = 0; fileList != null && i < fileList.length; i++) {
-            File file_first = fileList[i];
-            boolean isservice = ArchiveFileData.isServiceArchiveFile(file_first.getName());
-            boolean found = false;
-            if(isservice){
-                for (int j = 0; j < fileList.length; j++) {
-                    File file_second = fileList[j];
-                    if(file_second.getName().equalsIgnoreCase(
-                            getShortFileName(file_first.getName()))){
-                        if(file_second.lastModified() >= file_first.lastModified()){
-                            found = true;
-                            allFiles.add(file_second);
-                            break;
-                        } else if (file_second.lastModified() < file_first.lastModified()){
-                            tobedelete.add(file_second);
-                            tobeextarct.add(file_first);
-                            found = true;
-                        }
-                    }
-                }
-                if(!found){
-                    tobeextarct.add(file_first);
-                }
-            }
-        }
-        for (int i = 0; i < tobedelete.size(); i++) {
-            File file1 = (File) tobedelete.get(i);
-            deleteDir(file1);
-        }
-
-        for (int i = 0; i < tobeextarct.size(); i++) {
-            File file1 = (File) tobeextarct.get(i);
-            File outFile = new File(rootDirName,getShortFileName(file1.getName()));
-            if(!outFile.exists()){
-                outFile.mkdir();
-            }
-            extarctServiceArchive(file1,outFile);
-            allFiles.add(outFile);
-        }
-
-        for (int i = 0; fileList != null && i < fileList.length; i++) {
-            File file = fileList[i];
-            boolean found = false;
-            boolean todo = ArchiveFileData.isServiceArchiveFile(file.getName());
-            if (!todo) {
-                for (int j = 0; j < allFiles.size(); j++) {
-                    File file1 = (File) allFiles.get(j);
-                    if(file1.getName().equals(file.getName())){
-                        found = true;
-                    }
-                }
-                if(!found){
-                    allFiles.add(file);
-                }
-            }
-        }
-
-        for (int i = 0; i < allFiles.size(); i++) {
-            File file = (File) allFiles.get(i);
-            wsinfoList.addWSInfoItem(file, SERVICE);
-        }
-    }
-
-    /**
-     * To delete a given directory with its all childerns
-     * @param dir
-     * @return  boolean
-     */
-    private boolean deleteDir(File dir) {
-        if (dir.isDirectory()) {
-            String[] children = dir.list();
-            for (int i=0; i<children.length; i++) {
-                boolean success = deleteDir(new File(dir, children[i]));
-                if (!success) {
-                    return false;
-                }
-            }
-        }
-        // The directory is now empty so delete it
-        return dir.delete();
-    }
-
-
-    /**
-     * To get the file name without exetension
-     * @param fileName
-     * @return boolean
-     */
-    private String getShortFileName(String fileName) {
-        char seperator = '.';
-        String value;
-        int index = fileName.lastIndexOf(seperator);
-        if (index > 0) {
-            value = fileName.substring(0, index);
-            return value;
-        }
-        return fileName;
-    }
-
-    /**
-     * Will extarct given file , into same dirctory with the name of archive file (removing file
-     * extension)
-     * @param infile  <code>java.io.File</code>   Archive file
-     * @param outdirctory <code>java.io.File</code>  output file
-     */
-    public void extarctServiceArchive(File infile , File outdirctory ) {
-        try{
-            BufferedOutputStream dest;
-            FileInputStream fis = new  FileInputStream(infile);
-            ZipInputStream zis = new
-                    ZipInputStream(new BufferedInputStream(fis));
-            ZipEntry entry;
-
-            outdirctory.mkdir();
-            File outFile ;
-            String outPath =  outdirctory.getAbsolutePath() + "/";
-            while((entry = zis.getNextEntry()) != null) {
-                int count;
-                byte data[] = new byte[BUFFER];
-                // write the files to the disk
-                outFile = new File(outPath + entry.getName());
-                if(entry.isDirectory()){
-                    if(!outFile.exists()){
-                        outFile.mkdir();
-                    }
-                    continue;
-                }
-                FileOutputStream fos = new
-                        FileOutputStream(outFile);
-                dest = new
-                        BufferedOutputStream(fos, BUFFER);
-                while ((count = zis.read(data, 0, BUFFER))
-                        != -1) {
-                    dest.write(data, 0, count);
-                }
-                dest.flush();
-                dest.close();
-            }
-            zis.close();
-        } catch(Exception e) {
-            log.error(e);
-        }
-    }
-
-
-}
+/*
+ * 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.
+ */
+
+package org.apache.axis2.deployment.listener;
+
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.repository.util.ArchiveFileData;
+import org.apache.axis2.deployment.repository.util.WSInfoList;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class RepositoryListenerImpl implements RepositoryListener,
+        DeploymentConstants {
+
+    protected Log log = LogFactory.getLog(getClass());
+
+    /**
+     * to store curreently checking jars
+     */
+    private List currentJars;
+    /**
+     * Referance to a WSInfoList
+     */
+    private WSInfoList wsinfoList;
+
+    private int BUFFER = 2048;
+
+    /**
+     * The parent directory of the modules and services directories
+     * taht the listentner should listent
+     */
+    private String folderName;
+
+
+    private boolean extarctServiceArchive = false;
+
+    /**
+     * This constructor take two argumnets folder name and referance to Deployment Engine
+     * Fisrt it initilize the syetm , by loading all the modules in the /modules directory
+     * and also create a WSInfoList to keep infor about available modules and services
+     *
+     * @param folderName    path to parent directory that the listener should listent
+     * @param deploy_engine refearnce to engine registry  inorder to inform the updates
+     */
+    public RepositoryListenerImpl(String folderName,
+                                  DeploymentEngine deploy_engine, boolean serviceExtarct) {
+        this.folderName = folderName;
+        wsinfoList = new WSInfoList(deploy_engine);
+        this.extarctServiceArchive = serviceExtarct;
+        init();
+    }
+
+    /**
+     * this method ask serachWS to serch for the folder to caheck
+     * for updates
+     */
+    public void checkModules() {
+        String modulepath = folderName + MODULE_PATH;
+        String files[];
+        currentJars = new ArrayList();
+        File root = new File(modulepath);
+        // adding the root folder to the vector
+        currentJars.add(root);
+
+        while (currentJars.size() > 0) {        // loop until empty
+            File dir = (File) currentJars.get(0); // get first dir
+            currentJars.remove(0);       // remove it
+            files = dir.list();              // get list of files
+            if (files == null) {
+                continue;
+            }
+            for (int i = 0; i < files.length; i++) { // iterate
+                File f = new File(dir, files[i]);
+                if (f.isDirectory()) {        // see if it's a directory
+                    currentJars.add(0, f);
+                } // add dir to start of agenda
+                else if (ArchiveFileData.isModuleArchiveFile(f.getName())) {
+                    wsinfoList.addWSInfoItem(f, MODULE);
+                }
+            }
+        }
+    }
+
+    /**
+     * this method ask serachWS to serch for the folder to caheck
+     * for updates
+     */
+    public void checkServices() {
+        String modulepath = folderName + SERVICE_PATH;
+        if(extarctServiceArchive){
+            searchExploedServies(modulepath);
+        }else {
+            searchWS(modulepath, SERVICE);
+        }
+    }
+
+    /**
+     * call to update method of WSInfoList object
+     */
+    public void update() {
+        //todo completet this
+        // this call the update method of WSInfoList
+        wsinfoList.update();
+    }
+
+    /**
+     * First it call to initalize method of WSInfoList to initilizat that
+     * then it call to checkModules to load all the module.jar s
+     * and then it call to update() method inorder to update the Deployment engine and
+     * engine regsitry
+     */
+    public void init() {
+        wsinfoList.init();
+        checkModules();
+        checkServices();
+        update();
+    }
+
+    /**
+     * this is the actual method that is call from scheduler
+     */
+    public void startListent() {
+        // checkModules();
+        checkServices();
+        update();
+    }
+
+    /**
+     * This method is to search a given folder  for jar files
+     * and added them to a list wich is in the WSInfolist class
+     */
+    private void searchWS(String folderName, int type) {
+        String files[];
+        currentJars = new ArrayList();
+        File root = new File(folderName);
+        // adding the root folder to the vector
+        currentJars.add(root);
+
+        while (currentJars.size() > 0) {        // loop until empty
+            File dir = (File) currentJars.get(0); // get first dir
+            currentJars.remove(0);       // remove it
+            files = dir.list();              // get list of files
+            if (files == null) {
+                continue;
+            }
+            for (int i = 0; i < files.length; i++) { // iterate
+                File f = new File(dir, files[i]);
+                if (f.isDirectory()) {        // see if it's a directory
+                    currentJars.add(0, f);
+                } // add dir to start of agenda
+                else if (ArchiveFileData.isServiceArchiveFile(f.getName())) {
+                    wsinfoList.addWSInfoItem(f, type);
+                }
+            }
+        }
+    }
+
+
+    private void searchExploedServies(String rootDirName){
+        File rootDir = new File(rootDirName);
+        File [] fileList = rootDir.listFiles();
+        ArrayList tobedelete = new ArrayList();
+        ArrayList tobeextarct = new ArrayList();
+        ArrayList allFiles = new ArrayList();
+        for (int i = 0; fileList != null && i < fileList.length; i++) {
+            File file_first = fileList[i];
+            boolean isservice = ArchiveFileData.isServiceArchiveFile(file_first.getName());
+            boolean found = false;
+            if(isservice){
+                for (int j = 0; j < fileList.length; j++) {
+                    File file_second = fileList[j];
+                    if(file_second.getName().equalsIgnoreCase(
+                            getShortFileName(file_first.getName()))){
+                        if(file_second.lastModified() >= file_first.lastModified()){
+                            found = true;
+                            allFiles.add(file_second);
+                            break;
+                        } else if (file_second.lastModified() < file_first.lastModified()){
+                            tobedelete.add(file_second);
+                            tobeextarct.add(file_first);
+                            found = true;
+                        }
+                    }
+                }
+                if(!found){
+                    tobeextarct.add(file_first);
+                }
+            }
+        }
+        for (int i = 0; i < tobedelete.size(); i++) {
+            File file1 = (File) tobedelete.get(i);
+            deleteDir(file1);
+        }
+
+        for (int i = 0; i < tobeextarct.size(); i++) {
+            File file1 = (File) tobeextarct.get(i);
+            File outFile = new File(rootDirName,getShortFileName(file1.getName()));
+            if(!outFile.exists()){
+                outFile.mkdir();
+            }
+            extarctServiceArchive(file1,outFile);
+            allFiles.add(outFile);
+        }
+
+        for (int i = 0; fileList != null && i < fileList.length; i++) {
+            File file = fileList[i];
+            boolean found = false;
+            boolean todo = ArchiveFileData.isServiceArchiveFile(file.getName());
+            if (!todo) {
+                for (int j = 0; j < allFiles.size(); j++) {
+                    File file1 = (File) allFiles.get(j);
+                    if(file1.getName().equals(file.getName())){
+                        found = true;
+                    }
+                }
+                if(!found){
+                    allFiles.add(file);
+                }
+            }
+        }
+
+        for (int i = 0; i < allFiles.size(); i++) {
+            File file = (File) allFiles.get(i);
+            wsinfoList.addWSInfoItem(file, SERVICE);
+        }
+    }
+
+    /**
+     * To delete a given directory with its all childerns
+     * @param dir
+     * @return  boolean
+     */
+    private boolean deleteDir(File dir) {
+        if (dir.isDirectory()) {
+            String[] children = dir.list();
+            for (int i=0; i<children.length; i++) {
+                boolean success = deleteDir(new File(dir, children[i]));
+                if (!success) {
+                    return false;
+                }
+            }
+        }
+        // The directory is now empty so delete it
+        return dir.delete();
+    }
+
+
+    /**
+     * To get the file name without exetension
+     * @param fileName
+     * @return boolean
+     */
+    private String getShortFileName(String fileName) {
+        char seperator = '.';
+        String value;
+        int index = fileName.lastIndexOf(seperator);
+        if (index > 0) {
+            value = fileName.substring(0, index);
+            return value;
+        }
+        return fileName;
+    }
+
+    /**
+     * Will extarct given file , into same dirctory with the name of archive file (removing file
+     * extension)
+     * @param infile  <code>java.io.File</code>   Archive file
+     * @param outdirctory <code>java.io.File</code>  output file
+     */
+    public void extarctServiceArchive(File infile , File outdirctory ) {
+        try{
+            BufferedOutputStream dest;
+            FileInputStream fis = new  FileInputStream(infile);
+            ZipInputStream zis = new
+                    ZipInputStream(new BufferedInputStream(fis));
+            ZipEntry entry;
+
+            outdirctory.mkdir();
+            File outFile ;
+            String outPath =  outdirctory.getAbsolutePath() + "/";
+            while((entry = zis.getNextEntry()) != null) {
+                int count;
+                byte data[] = new byte[BUFFER];
+                // write the files to the disk
+                outFile = new File(outPath + entry.getName());
+                if(entry.isDirectory()){
+                    if(!outFile.exists()){
+                        outFile.mkdir();
+                    }
+                    continue;
+                }
+                FileOutputStream fos = new
+                        FileOutputStream(outFile);
+                dest = new
+                        BufferedOutputStream(fos, BUFFER);
+                while ((count = zis.read(data, 0, BUFFER))
+                        != -1) {
+                    dest.write(data, 0, count);
+                }
+                dest.flush();
+                dest.close();
+            }
+            zis.close();
+        } catch(Exception e) {
+            log.error(e);
+        }
+    }
+
+
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java Thu Sep 15 11:52:11 2005
@@ -1,200 +1,200 @@
-/*
-* 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.
-*/
-
-package org.apache.axis2.deployment.repository.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.deployment.DeploymentClassLoader;
-
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-/**
- * ArchiveFileData = Hot Deployment File Item , to store infromation of the module or servise
- * item to be deploy
- */
-public class ArchiveFileData {
-
-    private ClassLoader classLoader;
-    private File file = null;
-    private int type;
-    private String messgeReceiver;
-    private String moduleClass;
-    private String name;
-
-
-    //To store services in a serviceGroup , if there are wsdl for those servics ,
-    //so wsdl service will be created for each wsdl an those will be temeororaly store
-    //in this table
-    private HashMap service = new HashMap();
-
-    public ArchiveFileData(int type, String name) {
-        this.type = type;
-        this.name = name;
-    }
-
-    public String getMessgeReceiver() {
-        return messgeReceiver;
-    }
-
-    public void setMessgeReceiver(String messgeReceiver) {
-        this.messgeReceiver = messgeReceiver;
-    }
-
-    public ArchiveFileData(File file, int type) {
-        this.file = file;
-        this.type = type;
-    }
-
-    public String getName() {
-        return file.getName();
-    }
-
-    public String getServiceName() {
-        if (file != null) {
-            return file.getName();
-        } else
-            return name;
-    }
-
-    public String getAbsolutePath() {
-        return file.getAbsolutePath();
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public File getFile() {
-        return file;
-    }
-
-    public ClassLoader getClassLoader() {
-        return classLoader;
-    }
-
-    public void setClassLoader(ClassLoader classLoader) {
-        this.classLoader = classLoader;
-    }
-
-    public String getModuleClass() {
-        return moduleClass;
-    }
-
-    public void setModuleClass(String moduleClass) {
-        this.moduleClass = moduleClass;
-    }
-
-    public void setClassLoader(boolean extarctArichive) throws AxisFault {
-        ClassLoader parent = Thread.currentThread().getContextClassLoader();
-        if (! extarctArichive) {
-            // has to be craeted taking that file to the account
-            if (file != null) {
-                URL[] urlsToLoadFrom;
-                try {
-                    if (!file.exists()) {
-                        throw new RuntimeException("file not found !!!!!!!!!!!!!!!");
-                    }
-                    urlsToLoadFrom = new URL[]{file.toURL()};
-                    classLoader =
-                            new DeploymentClassLoader(urlsToLoadFrom, parent);
-                    //                classLoader = new URLClassLoader(urlsToLoadFrom, parent);
-                } catch (Exception e) {
-                    throw new AxisFault(e);
-                }
-            }
-        } else {
-            if (file != null) {
-                try {
-                    ArrayList urls = new ArrayList();
-                    urls.add(file.toURL());
-
-                    //if lib is simple
-                    File libfiles = new File(file, "lib");
-                    if(libfiles.exists()){
-                        urls.add(libfiles.toURL());
-                        File jarfiles [] = libfiles.listFiles();
-                        for (int i = 0; i < jarfiles.length; i++) {
-                            File jarfile = jarfiles[i];
-                            if(jarfile.getName().endsWith(".jar")){
-                                urls.add(jarfile.toURL());
-                            }
-                        }
-                    }
-
-                    //if lib is capital
-                    libfiles = new File(file, "Lib");
-                    if(libfiles.exists()){
-                        urls.add(libfiles.toURL());
-                        File jarfiles [] = libfiles.listFiles();
-                        for (int i = 0; i < jarfiles.length; i++) {
-                            File jarfile = jarfiles[i];
-                            if(jarfile.getName().endsWith(".jar")){
-                                urls.add(jarfile.toURL());
-                            }
-                        }
-                    }
-
-                    URL urllist [] = new URL[urls.size()];
-                    for (int i = 0; i < urls.size(); i++) {
-                        urllist[i] = (URL) urls.get(i);
-                    }
-                    classLoader = new URLClassLoader(urllist,parent);
-
-
-                } catch (MalformedURLException e) {
-                    throw new AxisFault(e);
-                }
-
-            }
-        }
-
-    }
-
-    /**
-     * to check whthere a given file is  a  jar file
-     *
-     * @param filename
-     * @return boolean
-     */
-    public static  boolean isServiceArchiveFile(String filename) {
-        return ((filename.endsWith(".jar")) | (filename.endsWith(".aar")));
-    }
-
-    public static  boolean isModuleArchiveFile(String filename) {
-        return ((filename.endsWith(".jar")) || (filename.endsWith(".mar")));
-    }
-
-
-    public void addService(ServiceDescription servicedesc){
-        service.put(servicedesc.getName(),servicedesc);
-    }
-
-    public ServiceDescription getService(QName serviceName){
-        return (ServiceDescription)service.get(serviceName);
-    }
-
-    public HashMap getService() {
-        return service;
-    }
-
-}
+/*
+* 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.
+*/
+
+package org.apache.axis2.deployment.repository.util;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.deployment.DeploymentClassLoader;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * ArchiveFileData = Hot Deployment File Item , to store infromation of the module or servise
+ * item to be deploy
+ */
+public class ArchiveFileData {
+
+    private ClassLoader classLoader;
+    private File file = null;
+    private int type;
+    private String messgeReceiver;
+    private String moduleClass;
+    private String name;
+
+
+    //To store services in a serviceGroup , if there are wsdl for those servics ,
+    //so wsdl service will be created for each wsdl an those will be temeororaly store
+    //in this table
+    private HashMap service = new HashMap();
+
+    public ArchiveFileData(int type, String name) {
+        this.type = type;
+        this.name = name;
+    }
+
+    public String getMessgeReceiver() {
+        return messgeReceiver;
+    }
+
+    public void setMessgeReceiver(String messgeReceiver) {
+        this.messgeReceiver = messgeReceiver;
+    }
+
+    public ArchiveFileData(File file, int type) {
+        this.file = file;
+        this.type = type;
+    }
+
+    public String getName() {
+        return file.getName();
+    }
+
+    public String getServiceName() {
+        if (file != null) {
+            return file.getName();
+        } else
+            return name;
+    }
+
+    public String getAbsolutePath() {
+        return file.getAbsolutePath();
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public File getFile() {
+        return file;
+    }
+
+    public ClassLoader getClassLoader() {
+        return classLoader;
+    }
+
+    public void setClassLoader(ClassLoader classLoader) {
+        this.classLoader = classLoader;
+    }
+
+    public String getModuleClass() {
+        return moduleClass;
+    }
+
+    public void setModuleClass(String moduleClass) {
+        this.moduleClass = moduleClass;
+    }
+
+    public void setClassLoader(boolean extarctArichive) throws AxisFault {
+        ClassLoader parent = Thread.currentThread().getContextClassLoader();
+        if (! extarctArichive) {
+            // has to be craeted taking that file to the account
+            if (file != null) {
+                URL[] urlsToLoadFrom;
+                try {
+                    if (!file.exists()) {
+                        throw new RuntimeException("file not found !!!!!!!!!!!!!!!");
+                    }
+                    urlsToLoadFrom = new URL[]{file.toURL()};
+                    classLoader =
+                            new DeploymentClassLoader(urlsToLoadFrom, parent);
+                    //                classLoader = new URLClassLoader(urlsToLoadFrom, parent);
+                } catch (Exception e) {
+                    throw new AxisFault(e);
+                }
+            }
+        } else {
+            if (file != null) {
+                try {
+                    ArrayList urls = new ArrayList();
+                    urls.add(file.toURL());
+
+                    //if lib is simple
+                    File libfiles = new File(file, "lib");
+                    if(libfiles.exists()){
+                        urls.add(libfiles.toURL());
+                        File jarfiles [] = libfiles.listFiles();
+                        for (int i = 0; i < jarfiles.length; i++) {
+                            File jarfile = jarfiles[i];
+                            if(jarfile.getName().endsWith(".jar")){
+                                urls.add(jarfile.toURL());
+                            }
+                        }
+                    }
+
+                    //if lib is capital
+                    libfiles = new File(file, "Lib");
+                    if(libfiles.exists()){
+                        urls.add(libfiles.toURL());
+                        File jarfiles [] = libfiles.listFiles();
+                        for (int i = 0; i < jarfiles.length; i++) {
+                            File jarfile = jarfiles[i];
+                            if(jarfile.getName().endsWith(".jar")){
+                                urls.add(jarfile.toURL());
+                            }
+                        }
+                    }
+
+                    URL urllist [] = new URL[urls.size()];
+                    for (int i = 0; i < urls.size(); i++) {
+                        urllist[i] = (URL) urls.get(i);
+                    }
+                    classLoader = new URLClassLoader(urllist,parent);
+
+
+                } catch (MalformedURLException e) {
+                    throw new AxisFault(e);
+                }
+
+            }
+        }
+
+    }
+
+    /**
+     * to check whthere a given file is  a  jar file
+     *
+     * @param filename
+     * @return boolean
+     */
+    public static  boolean isServiceArchiveFile(String filename) {
+        return ((filename.endsWith(".jar")) | (filename.endsWith(".aar")));
+    }
+
+    public static  boolean isModuleArchiveFile(String filename) {
+        return ((filename.endsWith(".jar")) || (filename.endsWith(".mar")));
+    }
+
+
+    public void addService(ServiceDescription servicedesc){
+        service.put(servicedesc.getName(),servicedesc);
+    }
+
+    public ServiceDescription getService(QName serviceName){
+        return (ServiceDescription)service.get(serviceName);
+    }
+
+    public HashMap getService() {
+        return service;
+    }
+
+}

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

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=289289&r1=289288&r2=289289&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 Thu Sep 15 11:52:11 2005
@@ -1,378 +1,378 @@
-/*
-* 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.
-*/
-
-package org.apache.axis2.deployment.repository.util;
-
-import org.apache.axis2.deployment.*;
-import org.apache.axis2.description.AxisDescWSDLComponentFactory;
-import org.apache.axis2.description.ModuleDescription;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.description.ServiceGroupDescription;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.wsdl.WSDLVersionWrapper;
-import org.apache.axis2.wsdl.builder.WOMBuilder;
-import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.wsdl.WSDLDescription;
-import org.apache.wsdl.impl.WSDLServiceImpl;
-
-import javax.wsdl.WSDLException;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import java.io.*;
-import java.util.Iterator;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-public class ArchiveReader implements DeploymentConstants {
-
-    private Log log = LogFactory.getLog(getClass());
-
-    /**
-     * To create a ServiceDescrption <code>ServiceDescription</code>   using given wsdl , if the
-     * service.wsdl there in the arcive file ServiceDescription will be creted using that else
-     * default ServiceDescription will be crated
-     *
-     * @param file
-     * @return
-     * @throws DeploymentException
-     */
-    public ServiceDescription createService(ArchiveFileData file) throws DeploymentException {
-        ServiceDescription service = null;
-        InputStream in = file.getClassLoader().getResourceAsStream(SERVICEWSDL);
-        boolean foundservice = false;
-        try {
-            if (in != null) {
-                WOMBuilder builder = WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11);
-                WSDLVersionWrapper wsdlVersionWrapper = builder.build(in,
-                        new AxisDescWSDLComponentFactory());
-                WSDLDescription womDescription = wsdlVersionWrapper.getDescription();
-                Iterator iterator = womDescription.getServices().keySet()
-                        .iterator();
-                if (iterator.hasNext()) {
-                    foundservice = true;
-                    // remove <wsdl:service> and <wsdl:binding> elements from the service
-                    // description we read in as we will be replacing them anyway.
-
-                    WSDLServiceImpl serviceimpl = (WSDLServiceImpl) womDescription.getServices().get(iterator.next());
-                    service = new ServiceDescription(serviceimpl);
-//                    service =
-//                            (ServiceDescription) womDescription.getServices()
-//                            .get(iterator.next());
-                }
-                if (!foundservice) {
-                    service = new ServiceDescription();
-                }
-                service.setWSDLDefinition(wsdlVersionWrapper.getDefinition());
-                in.close();
-            } else {
-                service = new ServiceDescription();
-                log.info(Messages.getMessage(DeploymentErrorMsgs.WSDL_FILE_NOT_FOUND,
-                        file.getName()));
-//                        "WSDL file not found for the service :  " +
-//                        file.getName());
-            }
-        } catch (Exception e) {
-            throw new DeploymentException(e);
-        }
-
-        return service;
-    }
-
-
-    private void processWSDLFile(InputStream in , DeploymentEngine depengine) throws DeploymentException {
-        try {
-            WOMBuilder builder = WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11);
-            WSDLVersionWrapper wsdlVersionWrapper = builder.build(in,
-                    new AxisDescWSDLComponentFactory());
-            WSDLDescription womDescription = wsdlVersionWrapper.getDescription();
-            Iterator iterator = womDescription.getServices().keySet()
-                    .iterator();
-            if (iterator.hasNext()) {
-                // remove <wsdl:service> and <wsdl:binding> elements from the service
-                // description we read in as we will be replacing them anyway.
-                WSDLServiceImpl serviceimpl = (WSDLServiceImpl)
-                        womDescription.getServices().get(iterator.next());
-                ServiceDescription service = new ServiceDescription(serviceimpl);
-                service.setName(serviceimpl.getName());
-                service.setWSDLDefinition(wsdlVersionWrapper.getDefinition());
-                depengine.getCurrentFileItem().addService(service);
-            }
-        } catch (WSDLException e) {
-            throw new DeploymentException(e);
-        }
-    }
-
-    /**
-     * To create service objects out form wsdls file inside a service archive file
-     * @param file <code>ArchiveFileData</code>
-     * @param depengine <code>DeploymentEngine</code>
-     * @throws DeploymentException  <code>DeploymentException</code>
-     */
-    public void processWSDLs(ArchiveFileData file , DeploymentEngine depengine) throws DeploymentException {
-        File serviceFile = file.getFile();
-        boolean isDirectory = serviceFile.isDirectory();
-        if(isDirectory){
-            try {
-                File meta_inf = new File(serviceFile,META_INF);
-                if(meta_inf.exists()){
-                    File files [] = meta_inf.listFiles();
-                    for (int i = 0; i < files.length; i++) {
-                        File file1 = files[i];
-                        String fileName = file1.getName();
-                        if(fileName.endsWith(".wsdl") || fileName.endsWith(".WSDL")){
-                            InputStream in = new FileInputStream(file1);
-                            processWSDLFile(in,depengine);
-                            in.close();
-                        }
-                    }
-                } else {
-                    throw new DeploymentException("In valid service META-INF file not found");
-                }
-            } catch (FileNotFoundException e) {
-                throw new DeploymentException(e);
-            } catch (IOException e) {
-                throw new DeploymentException(e);
-            }
-        }   else {
-
-            ZipInputStream zin;
-            try {
-                zin = new ZipInputStream(new FileInputStream(serviceFile));
-                ZipEntry entry;
-                while ((entry = zin.getNextEntry()) != null) {
-                    String entryName = entry.getName();
-                    if (entryName.startsWith(META_INF) && (entryName.endsWith(".wsdl")
-                            || entryName.endsWith(".WSDL"))) {
-                        processWSDLFile(zin,depengine);
-                    }
-                }
-                zin.close();
-            } catch (FileNotFoundException e) {
-                throw new DeploymentException(e);
-            } catch (IOException e) {
-                throw new DeploymentException(e);
-            }
-        }
-
-    }
-
-    /**
-     * This method will readServiceArchive the given jar or aar.
-     * it take two arguments filename and refereance to DeployEngine
-     *
-     * @param filename
-     * @param engine
-     */
-    public void processServiceGroup(String filename,
-                                    DeploymentEngine engine,
-                                    ServiceGroupDescription serviceGroupDesc, boolean extarctService)
-            throws DeploymentException {
-        // get attribute values
-        boolean foundServiceXML = false;
-        if (! extarctService) {
-            ZipInputStream zin;
-            try {
-                zin = new ZipInputStream(new FileInputStream(filename));
-                ZipEntry entry;
-                while ((entry = zin.getNextEntry()) != null) {
-                    if (entry.getName().equals(SERVICEXML)) {
-                        foundServiceXML = true;
-                        buildServiceGroup(zin, engine, serviceGroupDesc);
-                        serviceGroupDesc.setServiceGroupName(DescriptionBuilder.getShortFileName(
-                                engine.getCurrentFileItem().getName()));
-                        break;
-                    }
-                }
-            //    zin.close();
-                if (!foundServiceXML) {
-                    throw new DeploymentException(
-                            Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND));
-                }
-            } catch (Exception e) {
-                throw new DeploymentException(e);
-            }
-        } else {
-            File file = new File(filename, SERVICEXML);
-            if (file.exists()) {
-                InputStream in = null;
-                try {
-                    in = new FileInputStream(file);
-                    buildServiceGroup(in,engine,serviceGroupDesc);
-                    serviceGroupDesc.setServiceGroupName(engine.getCurrentFileItem().getName());
-                } catch (FileNotFoundException e) {
-                    throw new DeploymentException("FileNotFound : " + e);
-                } catch (XMLStreamException e) {
-                    throw new DeploymentException("XMLStreamException : " + e);
-                }
-            } else {
-                throw new DeploymentException(
-                        Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND));
-            }
-        }
-    }
-
-    private void buildServiceGroup(InputStream zin, DeploymentEngine engine,
-                                   ServiceGroupDescription serviceGroupDesc)
-            throws XMLStreamException, DeploymentException {
-        DescriptionBuilder builder;
-        String rootelementName;
-        builder = new DescriptionBuilder(zin, engine);
-        OMElement services = builder.buildOM();
-        rootelementName = services.getLocalName();
-        if(SERVICE_ELEMENT.equals(rootelementName)){
-            ServiceDescription serviceDesc = engine.getCurrentFileItem().
-                    getService(new QName(builder.getShortFileName(
-                            engine.getCurrentFileItem().getName())));
-            if(serviceDesc == null){
-                serviceDesc = new ServiceDescription(
-                        new QName(builder.getShortFileName(
-                                engine.getCurrentFileItem().getName())));
-                engine.getCurrentFileItem().addService(serviceDesc);
-            }
-            serviceDesc.setParent(serviceGroupDesc);
-            serviceDesc.setClassLoader(engine.getCurrentFileItem().getClassLoader());
-            ServiceBuilder serviceBuilder = new ServiceBuilder(engine,serviceDesc);
-            serviceBuilder.populateService(services);
-            //todo fix me deepal
-            //serviceGroupDesc.addService(serviceDesc);
-        } else if(SERVICE_GROUP_ELEMENT.equals(rootelementName)){
-            ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(services,engine);
-            groupBuilder.populateServiceGroup(serviceGroupDesc);
-        }
-    }
-
-    public void readModuleArchive(String filename,
-                                  DeploymentEngine engine,
-                                  ModuleDescription module) throws DeploymentException {
-        // get attribute values
-        boolean foundmoduleXML = false;
-        ZipInputStream zin;
-        try {
-            zin = new ZipInputStream(new FileInputStream(filename));
-            ZipEntry entry;
-            while ((entry = zin.getNextEntry()) != null) {
-                if (entry.getName().equals(MODULEXML)) {
-                    foundmoduleXML = true;
-                    ModuleBuilder builder = new ModuleBuilder(zin, engine, module);
-                    builder.populateModule();
-                    break;
-                }
-            }
-            zin.close();
-            if (!foundmoduleXML) {
-                throw new DeploymentException(Messages.getMessage(
-                        DeploymentErrorMsgs.MODULEXML_NOT_FOUND_FOR_THE_MODULE, filename));
-            }
-        } catch (Exception e) {
-            throw new DeploymentException(e);
-        }
-    }
-
-
-    /**
-     * This method first check whether the given module is there in the user home dirctory if so return
-     * that , else try to read the given module form classpath (from resources ) if found first get the module.mar
-     * file from the resourceStream and write that into user home/axis2home/nodule directory
-     *
-     * @param moduleName
-     * @return
-     * @throws DeploymentException
-     */
-    public File creatModuleArchivefromResource(String moduleName,
-                                               String axis2repository) throws DeploymentException {
-        File modulearchiveFile;
-        File modules;
-        try {
-            int BUFFER = 2048;
-            if (axis2repository == null) {
-                String userHome = System.getProperty("user.home");
-                File userHomedir = new File(userHome);
-                File repository = new File(userHomedir, ".axis2home");
-                if (!repository.exists()) {
-                    repository.mkdirs();
-                    modules = new File(repository, "modules");
-                    modules.mkdirs();
-                } else {
-                    modules = new File(repository, "modules");
-                    if (!modules.exists()) {
-                        modules.mkdirs();
-                    }
-                }
-            } else {
-                modules = new File(axis2repository, "modules");
-                if (!modules.exists()) {
-                    modules = new File(axis2repository, "modules");
-                    modules.mkdirs();
-                }
-            }
-            String modulearchiveName = moduleName + ".mar";
-            modulearchiveFile = new File(modules, modulearchiveName);
-            if (modulearchiveFile.exists()) {
-                return modulearchiveFile;
-            }
-//
-//            else {
-//                modulearchiveFile.createNewFile();
-//            }
-//
-            ClassLoader cl = Thread.currentThread().getContextClassLoader();
-            InputStream in = cl.getResourceAsStream("modules/" + moduleName + ".mar");
-            if (in == null) {
-                in = cl.getResourceAsStream("modules/" + moduleName + ".jar");
-            }
-            if (in == null) {
-                throw new DeploymentException(moduleName + " module is not found");
-            } else {
-                modulearchiveFile.createNewFile();
-                FileOutputStream dest = new
-                        FileOutputStream(modulearchiveFile);
-                ZipOutputStream out = new ZipOutputStream(new
-                        BufferedOutputStream(dest));
-                byte data[] = new byte[BUFFER];
-                ZipInputStream zin;
-                zin = new ZipInputStream(in);
-                ZipEntry entry;
-                while ((entry = zin.getNextEntry()) != null) {
-                    ZipEntry zip = new ZipEntry(entry);
-                    out.putNextEntry(zip);
-                    int count;
-                    while ((count = zin.read(data, 0, BUFFER)) != -1) {
-                        out.write(data, 0, count);
-                    }
-                }
-                out.close();
-                zin.close();
-            }
-
-        } catch (Exception e) {
-            throw new DeploymentException(e);
-        }
-        return modulearchiveFile;
-    }
-
-}
-
-
-
-
-
-
-
-
+/*
+* 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.
+*/
+
+package org.apache.axis2.deployment.repository.util;
+
+import org.apache.axis2.deployment.*;
+import org.apache.axis2.description.AxisDescWSDLComponentFactory;
+import org.apache.axis2.description.ModuleDescription;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.description.ServiceGroupDescription;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.wsdl.WSDLVersionWrapper;
+import org.apache.axis2.wsdl.builder.WOMBuilder;
+import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.wsdl.WSDLDescription;
+import org.apache.wsdl.impl.WSDLServiceImpl;
+
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import java.io.*;
+import java.util.Iterator;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+public class ArchiveReader implements DeploymentConstants {
+
+    private Log log = LogFactory.getLog(getClass());
+
+    /**
+     * To create a ServiceDescrption <code>ServiceDescription</code>   using given wsdl , if the
+     * service.wsdl there in the arcive file ServiceDescription will be creted using that else
+     * default ServiceDescription will be crated
+     *
+     * @param file
+     * @return
+     * @throws DeploymentException
+     */
+    public ServiceDescription createService(ArchiveFileData file) throws DeploymentException {
+        ServiceDescription service = null;
+        InputStream in = file.getClassLoader().getResourceAsStream(SERVICEWSDL);
+        boolean foundservice = false;
+        try {
+            if (in != null) {
+                WOMBuilder builder = WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11);
+                WSDLVersionWrapper wsdlVersionWrapper = builder.build(in,
+                        new AxisDescWSDLComponentFactory());
+                WSDLDescription womDescription = wsdlVersionWrapper.getDescription();
+                Iterator iterator = womDescription.getServices().keySet()
+                        .iterator();
+                if (iterator.hasNext()) {
+                    foundservice = true;
+                    // remove <wsdl:service> and <wsdl:binding> elements from the service
+                    // description we read in as we will be replacing them anyway.
+
+                    WSDLServiceImpl serviceimpl = (WSDLServiceImpl) womDescription.getServices().get(iterator.next());
+                    service = new ServiceDescription(serviceimpl);
+//                    service =
+//                            (ServiceDescription) womDescription.getServices()
+//                            .get(iterator.next());
+                }
+                if (!foundservice) {
+                    service = new ServiceDescription();
+                }
+                service.setWSDLDefinition(wsdlVersionWrapper.getDefinition());
+                in.close();
+            } else {
+                service = new ServiceDescription();
+                log.info(Messages.getMessage(DeploymentErrorMsgs.WSDL_FILE_NOT_FOUND,
+                        file.getName()));
+//                        "WSDL file not found for the service :  " +
+//                        file.getName());
+            }
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        }
+
+        return service;
+    }
+
+
+    private void processWSDLFile(InputStream in , DeploymentEngine depengine) throws DeploymentException {
+        try {
+            WOMBuilder builder = WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11);
+            WSDLVersionWrapper wsdlVersionWrapper = builder.build(in,
+                    new AxisDescWSDLComponentFactory());
+            WSDLDescription womDescription = wsdlVersionWrapper.getDescription();
+            Iterator iterator = womDescription.getServices().keySet()
+                    .iterator();
+            if (iterator.hasNext()) {
+                // remove <wsdl:service> and <wsdl:binding> elements from the service
+                // description we read in as we will be replacing them anyway.
+                WSDLServiceImpl serviceimpl = (WSDLServiceImpl)
+                        womDescription.getServices().get(iterator.next());
+                ServiceDescription service = new ServiceDescription(serviceimpl);
+                service.setName(serviceimpl.getName());
+                service.setWSDLDefinition(wsdlVersionWrapper.getDefinition());
+                depengine.getCurrentFileItem().addService(service);
+            }
+        } catch (WSDLException e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+    /**
+     * To create service objects out form wsdls file inside a service archive file
+     * @param file <code>ArchiveFileData</code>
+     * @param depengine <code>DeploymentEngine</code>
+     * @throws DeploymentException  <code>DeploymentException</code>
+     */
+    public void processWSDLs(ArchiveFileData file , DeploymentEngine depengine) throws DeploymentException {
+        File serviceFile = file.getFile();
+        boolean isDirectory = serviceFile.isDirectory();
+        if(isDirectory){
+            try {
+                File meta_inf = new File(serviceFile,META_INF);
+                if(meta_inf.exists()){
+                    File files [] = meta_inf.listFiles();
+                    for (int i = 0; i < files.length; i++) {
+                        File file1 = files[i];
+                        String fileName = file1.getName();
+                        if(fileName.endsWith(".wsdl") || fileName.endsWith(".WSDL")){
+                            InputStream in = new FileInputStream(file1);
+                            processWSDLFile(in,depengine);
+                            in.close();
+                        }
+                    }
+                } else {
+                    throw new DeploymentException("In valid service META-INF file not found");
+                }
+            } catch (FileNotFoundException e) {
+                throw new DeploymentException(e);
+            } catch (IOException e) {
+                throw new DeploymentException(e);
+            }
+        }   else {
+
+            ZipInputStream zin;
+            try {
+                zin = new ZipInputStream(new FileInputStream(serviceFile));
+                ZipEntry entry;
+                while ((entry = zin.getNextEntry()) != null) {
+                    String entryName = entry.getName();
+                    if (entryName.startsWith(META_INF) && (entryName.endsWith(".wsdl")
+                            || entryName.endsWith(".WSDL"))) {
+                        processWSDLFile(zin,depengine);
+                    }
+                }
+                zin.close();
+            } catch (FileNotFoundException e) {
+                throw new DeploymentException(e);
+            } catch (IOException e) {
+                throw new DeploymentException(e);
+            }
+        }
+
+    }
+
+    /**
+     * This method will readServiceArchive the given jar or aar.
+     * it take two arguments filename and refereance to DeployEngine
+     *
+     * @param filename
+     * @param engine
+     */
+    public void processServiceGroup(String filename,
+                                    DeploymentEngine engine,
+                                    ServiceGroupDescription serviceGroupDesc, boolean extarctService)
+            throws DeploymentException {
+        // get attribute values
+        boolean foundServiceXML = false;
+        if (! extarctService) {
+            ZipInputStream zin;
+            try {
+                zin = new ZipInputStream(new FileInputStream(filename));
+                ZipEntry entry;
+                while ((entry = zin.getNextEntry()) != null) {
+                    if (entry.getName().equals(SERVICEXML)) {
+                        foundServiceXML = true;
+                        buildServiceGroup(zin, engine, serviceGroupDesc);
+                        serviceGroupDesc.setServiceGroupName(DescriptionBuilder.getShortFileName(
+                                engine.getCurrentFileItem().getName()));
+                        break;
+                    }
+                }
+            //    zin.close();
+                if (!foundServiceXML) {
+                    throw new DeploymentException(
+                            Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND));
+                }
+            } catch (Exception e) {
+                throw new DeploymentException(e);
+            }
+        } else {
+            File file = new File(filename, SERVICEXML);
+            if (file.exists()) {
+                InputStream in = null;
+                try {
+                    in = new FileInputStream(file);
+                    buildServiceGroup(in,engine,serviceGroupDesc);
+                    serviceGroupDesc.setServiceGroupName(engine.getCurrentFileItem().getName());
+                } catch (FileNotFoundException e) {
+                    throw new DeploymentException("FileNotFound : " + e);
+                } catch (XMLStreamException e) {
+                    throw new DeploymentException("XMLStreamException : " + e);
+                }
+            } else {
+                throw new DeploymentException(
+                        Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND));
+            }
+        }
+    }
+
+    private void buildServiceGroup(InputStream zin, DeploymentEngine engine,
+                                   ServiceGroupDescription serviceGroupDesc)
+            throws XMLStreamException, DeploymentException {
+        DescriptionBuilder builder;
+        String rootelementName;
+        builder = new DescriptionBuilder(zin, engine);
+        OMElement services = builder.buildOM();
+        rootelementName = services.getLocalName();
+        if(SERVICE_ELEMENT.equals(rootelementName)){
+            ServiceDescription serviceDesc = engine.getCurrentFileItem().
+                    getService(new QName(builder.getShortFileName(
+                            engine.getCurrentFileItem().getName())));
+            if(serviceDesc == null){
+                serviceDesc = new ServiceDescription(
+                        new QName(builder.getShortFileName(
+                                engine.getCurrentFileItem().getName())));
+                engine.getCurrentFileItem().addService(serviceDesc);
+            }
+            serviceDesc.setParent(serviceGroupDesc);
+            serviceDesc.setClassLoader(engine.getCurrentFileItem().getClassLoader());
+            ServiceBuilder serviceBuilder = new ServiceBuilder(engine,serviceDesc);
+            serviceBuilder.populateService(services);
+            //todo fix me deepal
+            //serviceGroupDesc.addService(serviceDesc);
+        } else if(SERVICE_GROUP_ELEMENT.equals(rootelementName)){
+            ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(services,engine);
+            groupBuilder.populateServiceGroup(serviceGroupDesc);
+        }
+    }
+
+    public void readModuleArchive(String filename,
+                                  DeploymentEngine engine,
+                                  ModuleDescription module) throws DeploymentException {
+        // get attribute values
+        boolean foundmoduleXML = false;
+        ZipInputStream zin;
+        try {
+            zin = new ZipInputStream(new FileInputStream(filename));
+            ZipEntry entry;
+            while ((entry = zin.getNextEntry()) != null) {
+                if (entry.getName().equals(MODULEXML)) {
+                    foundmoduleXML = true;
+                    ModuleBuilder builder = new ModuleBuilder(zin, engine, module);
+                    builder.populateModule();
+                    break;
+                }
+            }
+            zin.close();
+            if (!foundmoduleXML) {
+                throw new DeploymentException(Messages.getMessage(
+                        DeploymentErrorMsgs.MODULEXML_NOT_FOUND_FOR_THE_MODULE, filename));
+            }
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+
+    /**
+     * This method first check whether the given module is there in the user home dirctory if so return
+     * that , else try to read the given module form classpath (from resources ) if found first get the module.mar
+     * file from the resourceStream and write that into user home/axis2home/nodule directory
+     *
+     * @param moduleName
+     * @return
+     * @throws DeploymentException
+     */
+    public File creatModuleArchivefromResource(String moduleName,
+                                               String axis2repository) throws DeploymentException {
+        File modulearchiveFile;
+        File modules;
+        try {
+            int BUFFER = 2048;
+            if (axis2repository == null) {
+                String userHome = System.getProperty("user.home");
+                File userHomedir = new File(userHome);
+                File repository = new File(userHomedir, ".axis2home");
+                if (!repository.exists()) {
+                    repository.mkdirs();
+                    modules = new File(repository, "modules");
+                    modules.mkdirs();
+                } else {
+                    modules = new File(repository, "modules");
+                    if (!modules.exists()) {
+                        modules.mkdirs();
+                    }
+                }
+            } else {
+                modules = new File(axis2repository, "modules");
+                if (!modules.exists()) {
+                    modules = new File(axis2repository, "modules");
+                    modules.mkdirs();
+                }
+            }
+            String modulearchiveName = moduleName + ".mar";
+            modulearchiveFile = new File(modules, modulearchiveName);
+            if (modulearchiveFile.exists()) {
+                return modulearchiveFile;
+            }
+//
+//            else {
+//                modulearchiveFile.createNewFile();
+//            }
+//
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            InputStream in = cl.getResourceAsStream("modules/" + moduleName + ".mar");
+            if (in == null) {
+                in = cl.getResourceAsStream("modules/" + moduleName + ".jar");
+            }
+            if (in == null) {
+                throw new DeploymentException(moduleName + " module is not found");
+            } else {
+                modulearchiveFile.createNewFile();
+                FileOutputStream dest = new
+                        FileOutputStream(modulearchiveFile);
+                ZipOutputStream out = new ZipOutputStream(new
+                        BufferedOutputStream(dest));
+                byte data[] = new byte[BUFFER];
+                ZipInputStream zin;
+                zin = new ZipInputStream(in);
+                ZipEntry entry;
+                while ((entry = zin.getNextEntry()) != null) {
+                    ZipEntry zip = new ZipEntry(entry);
+                    out.putNextEntry(zip);
+                    int count;
+                    while ((count = zin.read(data, 0, BUFFER)) != -1) {
+                        out.write(data, 0, count);
+                    }
+                }
+                out.close();
+                zin.close();
+            }
+
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        }
+        return modulearchiveFile;
+    }
+
+}
+
+
+
+
+
+
+
+

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