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 de...@apache.org on 2004/12/10 12:43:09 UTC

svn commit: r111497 - in webservices/axis/trunk/java/dev/scratch/prototype2/src: java/org/apache/axis/deployment java/org/apache/axis/deployment/metadata java/org/apache/axis/deployment/metadata/phaserule samples/deployment/service2/META-INF test-resources/deployment test-resources/soap test/org/apache/axis/deployment

Author: deepal
Date: Fri Dec 10 03:43:07 2004
New Revision: 111497

URL: http://svn.apache.org/viewcvs?view=rev&rev=111497
Log:
refectoring and phaseRule reolving
Removed:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/metadata/phaserule/
Modified:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentParser.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/metadata/ServerMetaData.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/deployment/service2/META-INF/service.xml
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/deployment/server.xml
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/reallyReallyBigMessage.xml
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/ServiceTest.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java?view=diff&rev=111497&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java&r1=111496&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java&r2=111497
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java	Fri Dec 10 03:43:07 2004
@@ -2,7 +2,7 @@
 
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.deployment.metadata.ServerMetaData;
-import org.apache.axis.deployment.metadata.phaserule.PhaseException;
+import org.apache.axis.deployment.metadata.phaseresolver.PhaseException;
 import org.apache.axis.deployment.repository.utill.HDFileItem;
 import org.apache.axis.deployment.repository.utill.UnZipJAR;
 import org.apache.axis.deployment.repository.utill.WSInfo;
@@ -18,6 +18,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import java.io.File;
 import java.io.FileInputStream;
@@ -67,9 +68,6 @@
      */
     private EngineRegistry engineRegistry = null;
 
-    private Vector modulelist = new Vector();
-
-    private Vector servicelist = new Vector();
     /**
      * this constaructor for the testing
      */
@@ -126,28 +124,29 @@
         }
         engineRegistry = createEngineRegistry();
         startSearch(this);
+        valideServerModule() ;
         return engineRegistry;
     }
 
+    /**
+     * This methode used to check the modules referd by server.xml
+     * are exist , or they have deployed
+     */
+    private void valideServerModule() throws AxisFault{
+        int moduleCount = server.getModuleCount();
+        QName moduleName;
+        for (int i = 0; i < moduleCount ; i++) {
+            moduleName = server.getModule(i);
+            if(getModule(moduleName) == null ){
+                throw new AxisFault(server.getName() + " Refer to invalid module " + moduleName + " has not bean deployed yet !");
+            }
+        }
 
-    public void addService(AxisService serviceMetaData) throws PhaseException, AxisFault {
-        servicelist.add(serviceMetaData);
-        addnewService(serviceMetaData);
     }
 
-    public void addModule(AxisModule module) throws AxisFault {
-        modulelist.add(module);
-        addNewModule(module);
-    }
-
-    public AxisModule getModule(String moduleName) {
-        for (int i = 0; i < modulelist.size(); i++) {
-            AxisModule metaData = (AxisModule) modulelist.elementAt(i);
-            if (metaData.getName().equals(moduleName)) {
-                return metaData;
-            }
-        }
-        return null;
+    public AxisModule getModule(QName moduleName) throws AxisFault {
+        AxisModule metaData = engineRegistry.getModule(moduleName);
+        return metaData;
     }
 
     /**
@@ -158,7 +157,7 @@
         scheduler.schedule(new SchedulerTask(engine, folderName), new DeploymentIterator());
     }
 
-    private EngineRegistry createEngineRegistry() throws AxisFault {
+    private EngineRegistry createEngineRegistry()  {
         EngineRegistry newEngineRegisty;
 
         AxisGlobal global = new AxisGlobal();
@@ -168,17 +167,23 @@
     }
 
 
-    private void addnewService(AxisService serviceMetaData) throws AxisFault, PhaseException {
+    private void addnewService(AxisService serviceMetaData) throws AxisFault {
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
 
         Flow inflow = serviceMetaData.getInFlow();
-        addFlowHandlers(inflow,classLoader);
+        if(inflow != null ){
+            addFlowHandlers(inflow,classLoader);
+        }
 
         Flow outFlow = serviceMetaData.getOutFlow();
-        addFlowHandlers(outFlow,classLoader);
+        if(outFlow != null){
+            addFlowHandlers(outFlow,classLoader);
+        }
 
         Flow faultFlow = serviceMetaData.getFaultFlow();
-        addFlowHandlers(faultFlow,classLoader);
+        if(faultFlow != null) {
+            addFlowHandlers(faultFlow,classLoader);
+        }
 
     }
 
@@ -294,14 +299,12 @@
                             unZipJAR.unzipService(currentFileItem.getAbsolutePath(), this, service);
                             try {
                                 if (service != null) {
-                                    addService(service);
+                                    addnewService(service);
                                     log.info("Deployement WS Name  " + currentFileItem.getName());
                                     currentFileItem = null;
                                     break;
                                 }
-                            } catch (PhaseException e) {
-                                e.printStackTrace();  //To change body of catch statement use Options | File Templates.
-                            } catch (AxisFault axisFault) {
+                            }catch (AxisFault axisFault) {
                                 axisFault.printStackTrace();  //To change body of catch statement use Options | File Templates.
                             }
                         }
@@ -311,7 +314,7 @@
                             unZipJAR.unzipModule(currentFileItem.getAbsolutePath(), this,metaData);
                             try {
                                 if (metaData != null) {
-                                    addModule(metaData);
+                                    addNewModule(metaData);
                                     log.info("Moduel WS Name  " + currentFileItem.getName() + " modulename :" + metaData.getName());
                                     currentFileItem = null;
                                     break;

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentParser.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentParser.java?view=diff&rev=111497&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentParser.java&r1=111496&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentParser.java&r2=111497
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentParser.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentParser.java	Fri Dec 10 03:43:07 2004
@@ -1,13 +1,14 @@
 package org.apache.axis.deployment;
 
 import org.apache.axis.deployment.metadata.ServerMetaData;
-import org.apache.axis.deployment.metadata.phaserule.PhaseException;
-import org.apache.axis.deployment.metadata.phaserule.PhaseMetaData;
+import org.apache.axis.deployment.metadata.phaseresolver.PhaseException;
+import org.apache.axis.deployment.metadata.phaseresolver.PhaseMetaData;
 import org.apache.axis.description.*;
 import org.apache.axis.impl.description.FlowImpl;
 import org.apache.axis.impl.description.ParameterImpl;
 import org.apache.axis.impl.description.SimpleAxisOperationImpl;
 import org.apache.axis.impl.providers.SimpleJavaProvider;
+import org.apache.axis.engine.AxisFault;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
@@ -160,9 +161,16 @@
                     } else if (ST.equals(TYPEMAPPINGST)) {
                         processTypeMapping();
                     } else if (ST.equals(MODULEST)) {
-                        throw new UnsupportedOperationException("This is to be implemented");
-                       // AxisModule metaData = processModule();
-                      //  serverMetaData.addModule(metaData);
+                        int attribCount = pullparser.getAttributeCount();
+                        if (attribCount > 0) {
+                            for (int i = 0; i < attribCount; i++) {
+                                String attname = pullparser.getAttributeLocalName(i);
+                                String attvalue = pullparser.getAttributeValue(i);
+                                if (attname.equals(REF)) {
+                                    serverMetaData.addModule(new QName(attvalue));
+                                }
+                            }
+                        }
                     } else if (ST.equals(HANDERST)) {
                         HandlerMetaData handler = processHandler();
                         serverMetaData.addHandlers(handler);
@@ -227,11 +235,11 @@
                     } else if (ST.equals(TYPEMAPPINGST)) {
                         throw new UnsupportedOperationException();
                         // todo this should implemnt latter
-                      //  processTypeMapping();
+                        //  processTypeMapping();
                     } else if (ST.equals(BEANMAPPINGST)) {
                         throw new UnsupportedOperationException();
                         // todo this should implemnt latter
-                       // processBeanMapping();
+                        // processBeanMapping();
                     } else if (ST.equals(OPRATIONST)) {
                         AxisOperation  operation = processOperation();
                         axisService.addOperation(operation);
@@ -246,15 +254,15 @@
                         axisService.setFaultFlow(faultFlow);
                     } else if (ST.equals(MODULEST)) {
                         attribCount = pullparser.getAttributeCount();
-                        //   boolean ref_name = false;
-
                         if (attribCount > 0) {
                             for (int i = 0; i < attribCount; i++) {
                                 String attname = pullparser.getAttributeLocalName(i);
                                 String attvalue = pullparser.getAttributeValue(i);
-
                                 if (attname.equals(REF)) {
-                                    axisService.addModule(new QName(attvalue));
+                                    if(dpengine.getModule(new QName(attvalue)) == null){
+                                        throw new DeploymentException(ST + " module is invalid or dose not have bean deployed");
+                                    } else
+                                        axisService.addModule(new QName(attvalue));
                                 }
                             }
                         }
@@ -264,6 +272,8 @@
             }
         } catch (XMLStreamException e) {
             throw new DeploymentException("parser Exception", e);
+        } catch (AxisFault axisFault) {
+            throw new DeploymentException("Module referece error , module dosenoot exist !!");
         }
     }
 
@@ -482,7 +492,7 @@
                     //operation.setStyle(attvalue);
                 } else if (attname.equals(ATUSE)) {
                     //TODO this is to be implemnt
-                  //  operation.setUse(attvalue);
+                    //  operation.setUse(attvalue);
                 }
             }
         } else {
@@ -502,7 +512,7 @@
                 } else if (eventType == XMLStreamConstants.START_ELEMENT) {
                     String ST = pullparser.getLocalName();
                     if (ST.equals(moduleXMLST)) {
-                       throw new UnsupportedOperationException("nexted elements are not allowed for M1");
+                        throw new UnsupportedOperationException("nexted elements are not allowed for M1");
                     } else if (ST.equals(FAILTFLOWST)) {
                         throw new UnsupportedOperationException("nexted elements are not allowed for M1");
                     } else if (ST.equals(INFLOWST)) {
@@ -572,7 +582,7 @@
                 String attname = pullparser.getAttributeLocalName(i);
                 String attvalue = pullparser.getAttributeValue(i);
 
-               if (attname.equals(ATTNAME)) {
+                if (attname.equals(ATTNAME)) {
                     if (ref_name) {
                         throw new DeploymentException("Module canot have both name and ref  " + attvalue);
                     } else {
@@ -584,7 +594,7 @@
                         throw new DeploymentException("Module canot have both name and ref  " + attvalue);
                     } else {
                         //TODO implement this , boz this is not complete
-                      //  module.setRef(attvalue);
+                        //  module.setRef(attvalue);
                         ref_name = true;
                         throw new UnsupportedOperationException("This should be implemented");
                     }
@@ -758,9 +768,8 @@
                     if (tagnae.equals(PHASEST)) {
                         String attname = pullparser.getAttributeLocalName(0);
                         String attvalue = pullparser.getAttributeValue(0);
-                        if (attname.equals(PhaseMetaData.PHASE_NAME)) {
-                            PhaseMetaData phase = new PhaseMetaData(attvalue);
-                            server.addPhases(phase);
+                        if (attname.equals(ATTNAME)) {
+                            server.addPhases(attvalue);
                         }
                     }
                 } else if (eventType == XMLStreamConstants.END_ELEMENT) {
@@ -813,7 +822,7 @@
                     String ST = pullparser.getLocalName();
                     if (ST.equals(moduleXMLST)) {
                         processModule(module);
-                       // module.setArchiveName(archiveName);
+                        // module.setArchiveName(archiveName);
                         // module.setName(archiveName);
                     }
                     //processStartElement();

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/metadata/ServerMetaData.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/metadata/ServerMetaData.java?view=diff&rev=111497&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/metadata/ServerMetaData.java&r1=111496&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/metadata/ServerMetaData.java&r2=111497
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/metadata/ServerMetaData.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/metadata/ServerMetaData.java	Fri Dec 10 03:43:07 2004
@@ -1,9 +1,10 @@
 package org.apache.axis.deployment.metadata;
 
-import org.apache.axis.deployment.metadata.phaserule.PhaseMetaData;
+import org.apache.axis.deployment.metadata.phaseresolver.PhaseMetaData;
 import org.apache.axis.description.*;
 import org.apache.axis.description.HandlerMetaData;
 
+import javax.xml.namespace.QName;
 import java.util.Vector;
 
 /**
@@ -85,27 +86,31 @@
             return null;
     }
 
-    public void addModule(AxisModule module) {
-        modules.add(module);
+    public void addModule(QName moduleName) {
+        modules.add(moduleName);
         moduleCount++;
     }
 
-    public AxisModule getModule(int index) {
+    public QName getModule(int index) {
         if (index <= moduleCount) {
-            return (AxisModule) modules.get(index);
+            return (QName) modules.get(index);
         } else
             return null;
     }
 
-    public void addPhases(PhaseMetaData phase) {
-        phases.add(phase);
+    public int getModuleCount() {
+        return moduleCount;
+    }
+
+    public void addPhases(String phaseName) {
+        phases.add(phaseName);
         phaseCount++;
     }
 
     public boolean isPhaseExist(String phaseName) {
         for (int i = 0; i < phases.size(); i++) {
-            PhaseMetaData phase = (PhaseMetaData) phases.elementAt(i);
-            if (phase.getName().equals(phaseName)) {
+            String phase = (String) phases.elementAt(i);
+            if (phase.equals(phaseName)) {
                 return true;
             }
         }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/deployment/service2/META-INF/service.xml
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/deployment/service2/META-INF/service.xml?view=diff&rev=111497&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/deployment/service2/META-INF/service.xml&r1=111496&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/deployment/service2/META-INF/service.xml&r2=111497
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/deployment/service2/META-INF/service.xml	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/deployment/service2/META-INF/service.xml	Fri Dec 10 03:43:07 2004
@@ -53,6 +53,6 @@
 
 
     <operation name="opname" qname="opqname" style="anyStyle" use="anyUse">
-        
+
     </operation>
 </service>

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/deployment/server.xml
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/deployment/server.xml?view=diff&rev=111497&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/deployment/server.xml&r1=111496&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/deployment/server.xml&r2=111497
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/deployment/server.xml	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/deployment/server.xml	Fri Dec 10 03:43:07 2004
@@ -8,6 +8,7 @@
         <parameter name="para10" locked="xsd:true">789</parameter>
     </handler>
     <handler name="h2" class="org.apache.axis.engine.registry.SpeakingHandler"/>
+    <module ref="module1"> </module>
   <!--
     <module ref="uri">
         <parameter name="para3" locked="xsd:true">10</parameter>

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/reallyReallyBigMessage.xml
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/reallyReallyBigMessage.xml?view=diff&rev=111497&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/reallyReallyBigMessage.xml&r1=111496&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/reallyReallyBigMessage.xml&r2=111497
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/reallyReallyBigMessage.xml	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/reallyReallyBigMessage.xml	Fri Dec 10 03:43:07 2004
@@ -29,13 +29,13 @@
 <wsdl:message name="echoResponse">
 <wsdl:part element="tns1:MyElement" name="MyElement" /> 
 </wsdl:message>
-<wsdl:portType name="Echo">
+<wsdl:portType name="Echo1">
 <wsdl:operation name="echo" parameterOrder="MyElement">
 <wsdl:input message="intf:echoRequest" name="echoRequest" /> 
 <wsdl:output message="intf:echoResponse" name="echoResponse" /> 
 </wsdl:operation>
 </wsdl:portType>
-<wsdl:binding name="ComplexEchoServiceSoapBinding" type="intf:Echo">
+<wsdl:binding name="ComplexEchoServiceSoapBinding" type="intf:Echo1">
 <wsdlsoap:binding style="document" 
 transport="http://schemas.xmlsoap.org/soap/http" /> 
 <wsdl:operation name="echo">

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/ServiceTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/ServiceTest.java?view=diff&rev=111497&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/ServiceTest.java&r1=111496&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/ServiceTest.java&r2=111497
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/ServiceTest.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/ServiceTest.java	Fri Dec 10 03:43:07 2004
@@ -4,7 +4,7 @@
 
 import junit.framework.TestCase;
 
-import org.apache.axis.deployment.metadata.phaserule.PhaseException;
+import org.apache.axis.deployment.metadata.phaseresolver.PhaseException;
 import org.apache.axis.engine.AxisFault;
 import org.apache.axis.engine.EngineRegistry;