ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r366076 - in /webservices/axis2/trunk/java/modules: codegen/test/org/apache/axis2/rpc/ core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/deployment/util/ core/src/org/apache/axis2/description/ core/src/org/apache/axis2/engine/...
Date Thu, 05 Jan 2006 04:14:18 GMT
Author: deepal
Date: Wed Jan  4 20:13:45 2006
New Revision: 366076

URL: http://svn.apache.org/viewcvs?rev=366076&view=rev
Log:
- module version complete
- support Java class into AxisService (I will send a mail soon)

Added:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MyService.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java
Modified:
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/rpc/SimpleTest.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/PolicyInclude.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/PolicyUtil.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModuleversionTest.java

Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/rpc/SimpleTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/rpc/SimpleTest.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/rpc/SimpleTest.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/rpc/SimpleTest.java Wed Jan  4 20:13:45 2006
@@ -18,20 +18,17 @@
 import junit.framework.TestCase;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.databinding.DeserializationContext;
 import org.apache.axis2.databinding.deserializers.SimpleDeserializerFactory;
 import org.apache.axis2.databinding.serializers.CollectionSerializer;
 import org.apache.axis2.databinding.serializers.SimpleSerializer;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.ParameterImpl;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.receivers.AbstractMessageReceiver;
@@ -39,6 +36,7 @@
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.transport.local.LocalTransportReceiver;
+import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 import java.lang.reflect.Method;
@@ -47,7 +45,6 @@
  * SimpleTest
  */
 public class SimpleTest extends TestCase {
-    private AxisService service;
 
     /**
      * Here's our test service which we'll be calling with the local transport
@@ -96,11 +93,12 @@
 
     /**
      * Get everything (metadata, engine) set up
+     *
      * @throws Exception
      */
     protected void setUp() throws Exception {
         // Set up method/param metadata
-
+        AxisService service;
         String methodName = "echoArray";
         method = new RPCMethod(new QName(methodName));
         method.setResponseQName(new QName(methodName + "Response"));
@@ -121,7 +119,7 @@
 
         param.setQName(new QName("string"));
         param.setDeserializerFactory(new SimpleDeserializerFactory(String.class,
-                                                                   new QName("xsd", "string")));
+                new QName("xsd", "string")));
         param.setSerializer(new CollectionSerializer(new QName("string"), false, new SimpleSerializer()));
         param.setMaxOccurs(-1);
         param.setDestClass(String [].class);
@@ -130,10 +128,10 @@
         param = new RPCParameter();
         param.setQName(new QName("return"));
         param.setDeserializerFactory(new SimpleDeserializerFactory(String.class,
-                                                                   new QName("xsd", "string")));
+                new QName("xsd", "string")));
         param.setSerializer(new CollectionSerializer(new QName("return"),
-                                                     false,
-                                                     new SimpleSerializer()));
+                false,
+                new SimpleSerializer()));
         param.setMode(RPCParameter.MODE_OUT);
         param.setMaxOccurs(-1);
         param.setDestClass(String [].class);
@@ -156,6 +154,7 @@
                 new ParameterImpl(AbstractMessageReceiver.SERVICE_CLASS,
                         Test.class.getName()));
         AxisOperation axisOperation = new InOutAxisOperation(new QName(methodName));
+        axisOperation.setMessageExchangePattern(WSDLConstants.MEP_URI_IN_OUT);
         axisOperation.setMessageReceiver(new RPCInOutMessageReceiver());
         service.addOperation(axisOperation);
         Parameter parameter = new ParameterImpl();
@@ -168,7 +167,10 @@
     }
 
     public void testRPC() throws Exception {
-        Call call = new Call("test-resources/xmls");
+//        Call call = new Call("test-resources/xmls");
+        ConfigurationContext configcontext = new ConfigurationContextFactory()
+                .createConfigurationContextFromFileSystem("test-resources/xmls");
+        ServiceClient client = new ServiceClient(configcontext, null);
 //        Call call = new Call(".");
 
         // Make the SOAP envelope
@@ -180,16 +182,24 @@
         // Now set up an RPCRequestElement containing the metadat for our
         // method and an actual set of instance values to serialize.
         RPCValues values = new RPCValues();
-        String [] array = new String [] { "one", "two" };
+        String [] array = new String []{"one", "two"};
         values.setValue(new QName("string"), array);
         new RPCRequestElement(method, values, body);
 
         // Ready to go - set the To address and make the call
         Options options = new Options();
-        call.setClientOptions(options);
+        client.setOptions(options);
+        OperationClient opClient = client.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClient.setOptions(options);
+        MessageContext msgConetxt = new MessageContext(configcontext);
         options.setTo(new EndpointReference("local://services/testService"));
-        
-        SOAPEnvelope respEnv = call.invokeBlocking("echoArray", env);
+
+        msgConetxt.setEnvelope(env);
+        opClient.addMessageContext(msgConetxt);
+        opClient.execute(true);
+        MessageContext resMsgCtx = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope respEnv = resMsgCtx.getEnvelope();
         assertNotNull("No response envelope!", respEnv);
 
         RPCInOutMessageReceiver receiver = new RPCInOutMessageReceiver();
@@ -200,7 +210,7 @@
         Object ret = method.getResponseParameter().getValue(values);
         assertNotNull("No return parameter value", ret);
         assertTrue("Return wasn't a String []", ret instanceof String []);
-        String [] retArray = (String[])ret;
+        String [] retArray = (String[]) ret;
         assertEquals("Array was wrong size", 2, retArray.length);
         for (int i = 0; i < 2; i++) {
             assertEquals("Value #" + i + " not correct!", array[i], retArray[i]);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java Wed Jan  4 20:13:45 2006
@@ -25,13 +25,11 @@
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMAttribute;
 import org.apache.axis2.om.OMElement;
-import org.apache.ws.policy.util.PolicyRegistry;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import java.io.InputStream;
 import java.io.StringWriter;
-import java.security.cert.PolicyNode;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -52,7 +50,7 @@
     public ServiceBuilder(InputStream serviceInputStream, AxisConfiguration axisConfig,
                           AxisService service) {
         super(serviceInputStream, axisConfig);
-        this.service = service;       
+        this.service = service;
     }
 
     /**
@@ -90,20 +88,20 @@
                     service.setServiceDescription(serviceNameatt.getAttributeValue());
                 }
             }
-            
+
             // setting the PolicyInclude
-            PolicyInclude policyInclude = service.getPolicyInclude();
-            
+//            PolicyInclude policyInclude = service.getPolicyInclude();
+
             // processing <wsp:Policy> .. </..> elements
             Iterator policyElements = service_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY));
-            
+
             if (policyElements != null) {
                 processPolicyElements(PolicyInclude.AXIS_SERVICE_POLICY, policyElements, service.getPolicyInclude());
             }
-            
+
             // processing <wsp:PolicyReference> .. </..> elements
             Iterator policyRefElements = service_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF));
-            
+
             if (policyRefElements != null) {
                 processPolicyRefElements(PolicyInclude.AXIS_SERVICE_POLICY, policyRefElements, service.getPolicyInclude());
             }
@@ -150,10 +148,8 @@
 
             Iterator moduleConfigs = service_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
             processServiceModuleConfig(moduleConfigs, service, service);
-            
-            
-            
-            
+
+
         } catch (XMLStreamException e) {
             throw new DeploymentException(e);
         } catch (AxisFault axisFault) {
@@ -177,26 +173,26 @@
             AxisMessage message = operation.getMessage(lable.getAttributeValue());
 
             Iterator parameters = messageElement.getChildrenWithName(new QName(TAG_PARAMETER));
-            
+
             // setting the PolicyInclude
-            PolicyInclude policyInclude = message.getPolicyInclude();
-            
+//            PolicyInclude policyInclude = message.getPolicyInclude();
+
             // processing <wsp:Policy> .. </..> elements
             Iterator policyElements = messageElement.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY));
-            
+
             if (policyElements != null) {
                 processPolicyElements(PolicyInclude.AXIS_MESSAGE_POLICY, policyElements, message.getPolicyInclude());
             }
-            
+
             // processing <wsp:PolicyReference> .. </..> elements
             Iterator policyRefElements = messageElement.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF));
-            
+
             if (policyRefElements != null) {
                 processPolicyRefElements(PolicyInclude.AXIS_MESSAGE_POLICY, policyRefElements, message.getPolicyInclude());
             }
 
             processParameters(parameters, message, operation);
-            
+
         }
     }
 
@@ -282,30 +278,30 @@
                     // assumed MEP is in-out
                     op_descrip = new InOutAxisOperation();
                     op_descrip.setParent(service);
-                    
+
                 } else {
                     op_descrip = AxisOperationFactory.getOperationDescription(mepurl);
                 }
                 op_descrip.setName(new QName(opname));
             }
-            
+
             // setting the PolicyInclude
-            PolicyInclude policyInclude = op_descrip.getPolicyInclude();
-        
+//            PolicyInclude policyInclude = op_descrip.getPolicyInclude();
+
             // processing <wsp:Policy> .. </..> elements
             Iterator policyElements = operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY));
-            
+
             if (policyElements != null) {
                 processPolicyElements(PolicyInclude.AXIS_OPERATION_POLICY, policyElements, op_descrip.getPolicyInclude());
             }
-            
+
             // processing <wsp:PolicyReference> .. </..> elements
             Iterator policyRefElements = operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF));
-            
+
             if (policyRefElements != null) {
                 processPolicyRefElements(PolicyInclude.AXIS_OPERATION_POLICY, policyRefElements, op_descrip.getPolicyInclude());
             }
-            
+
             // Operation Parameters
             Iterator parameters = operation.getChildrenWithName(new QName(TAG_PARAMETER));
             ArrayList wsamappings = processParameters(parameters, op_descrip, service);
@@ -346,7 +342,7 @@
             Iterator moduleConfigs = operation.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
 
             processOperationModuleConfig(moduleConfigs, op_descrip, op_descrip);
-            
+
             // adding the operation
             operations.add(op_descrip);
         }
@@ -374,6 +370,6 @@
                 service.addModuleConfig(moduleConfiguration);
             }
         }
-    }    
-  
+    }
+
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java Wed Jan  4 20:13:45 2006
@@ -37,6 +37,13 @@
     private ArrayList OUTPhases;
     private ArrayList OUT_FaultPhases;
 
+    public PhasesInfo() {
+        INPhases = new ArrayList();
+        IN_FaultPhases = new ArrayList();
+        OUTPhases = new ArrayList();
+        OUT_FaultPhases = new ArrayList();
+    }
+
     /**
      * To copy phase informatoin from one to another
      *

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java Wed Jan  4 20:13:45 2006
@@ -1,191 +1,280 @@
-package org.apache.axis2.deployment.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.deployment.DeploymentException;
-import org.apache.axis2.description.*;
-import org.apache.axis2.engine.Handler;
-import org.apache.axis2.wsdl.java2wsdl.SchemaGenerator;
-import org.apache.axis2.wsdl.java2wsdl.TypeTable;
-import org.apache.wsdl.WSDLConstants;
-import org.codehaus.jam.JMethod;
-
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
-
-public class Utils {
-    public static void addFlowHandlers(Flow flow, ClassLoader clsLoader) throws AxisFault {
-        int count = flow.getHandlerCount();
-
-        for (int j = 0; j < count; j++) {
-            HandlerDescription handlermd = flow.getHandler(j);
-            Class handlerClass;
-            Handler handler;
-
-            handlerClass = getHandlerClass(handlermd.getClassName(), clsLoader);
-
-            try {
-                handler = (Handler) handlerClass.newInstance();
-                handler.init(handlermd);
-                handlermd.setHandler(handler);
-            } catch (InstantiationException e) {
-                throw new AxisFault(e);
-            } catch (IllegalAccessException e) {
-                throw new AxisFault(e);
-            }
-        }
-    }
-
-    public static void loadHandler(ClassLoader loader1, HandlerDescription desc)
-            throws DeploymentException {
-        String handlername = desc.getClassName();
-        Handler handler;
-        Class handlerClass;
-
-        try {
-            handlerClass = Class.forName(handlername, true, loader1);
-            handler = (Handler) handlerClass.newInstance();
-            handler.init(desc);
-            desc.setHandler(handler);
-        } catch (ClassNotFoundException e) {
-            throw new DeploymentException(e);
-        } catch (Exception e) {
-            throw new DeploymentException(e);
-        }
-    }
-
-    public static ClassLoader getClassLoader(ClassLoader parent, String path)
-            throws DeploymentException {
-        return getClassLoader(parent, new File(path));
-    }
-    
-    public static ClassLoader getClassLoader(ClassLoader parent, File file)
-            throws DeploymentException {
-        URLClassLoader classLoader;
-
-        if (file != null) {
-            try {
-                ArrayList urls = new ArrayList();
-
-                urls.add(file.toURL());
-
-                // lower case directory name
-                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());
-                        }
-                    }
-                }
-
-                // upper case directory name
-                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);
-
-                return classLoader;
-            } catch (MalformedURLException e) {
-                throw new DeploymentException(e);
-            }
-        }
-
-        return null;
-    }
-
-    private static Class getHandlerClass(String className, ClassLoader loader1) throws AxisFault {
-        Class handlerClass;
-
-        try {
-            handlerClass = Class.forName(className, true, loader1);
-        } catch (ClassNotFoundException e) {
-            throw new AxisFault(e.getMessage());
-        }
-
-        return handlerClass;
-    }
-
-    /**
-     * Creates an AxisService using java reflection.
-     */
-    public static void fillAxisService(AxisService axisService) throws Exception {
-        Parameter implInfoParam = axisService.getParameter(Constants.SERVICE_CLASS);
-        String serviceClass = (String) implInfoParam.getValue();
-        ClassLoader serviceClassLoader = axisService.getClassLoader();
-        SchemaGenerator schemaGenerator = new SchemaGenerator(serviceClassLoader,
-                serviceClass, null, null);
-        axisService.setSchema(schemaGenerator.generateSchema());
-
-        JMethod [] method = schemaGenerator.getMethods();
-        TypeTable table = schemaGenerator.getTypeTable();
-
-        for (int i = 0; i < method.length; i++) {
-            JMethod jmethod = method[i];
-            String opName = jmethod.getSimpleName();
-            AxisOperation operation = axisService.getOperation(new QName(opName));
-            if (operation != null) {
-                AxisMessage inMessage = operation.getMessage(
-                        WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-                if (inMessage != null) {
-                    inMessage.setElementQName(table.getComplexScheamType(jmethod.getSimpleName() +
-                            SchemaGenerator.METHOD_REQUEST_WRAPPER));
-                }
-                if (!jmethod.getReturnType().isVoidType()) {
-                    AxisMessage outMessage = operation.getMessage(
-                            WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
-                    outMessage.setElementQName(table.getQNamefortheType(jmethod.getSimpleName() +
-                            SchemaGenerator.METHOD_RESPONSE_WRAPPER));
-                }
-            }
-
-        }
-    }
-}
+package org.apache.axis2.deployment.util;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.description.*;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.Handler;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.wsdl.java2wsdl.SchemaGenerator;
+import org.apache.axis2.wsdl.java2wsdl.TypeTable;
+import org.apache.wsdl.WSDLConstants;
+import org.codehaus.jam.JMethod;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+public class Utils {
+    public static void addFlowHandlers(Flow flow, ClassLoader clsLoader) throws AxisFault {
+        int count = flow.getHandlerCount();
+
+        for (int j = 0; j < count; j++) {
+            HandlerDescription handlermd = flow.getHandler(j);
+            Class handlerClass;
+            Handler handler;
+
+            handlerClass = getHandlerClass(handlermd.getClassName(), clsLoader);
+
+            try {
+                handler = (Handler) handlerClass.newInstance();
+                handler.init(handlermd);
+                handlermd.setHandler(handler);
+            } catch (InstantiationException e) {
+                throw new AxisFault(e);
+            } catch (IllegalAccessException e) {
+                throw new AxisFault(e);
+            }
+        }
+    }
+
+    public static void loadHandler(ClassLoader loader1, HandlerDescription desc)
+            throws DeploymentException {
+        String handlername = desc.getClassName();
+        Handler handler;
+        Class handlerClass;
+
+        try {
+            handlerClass = Class.forName(handlername, true, loader1);
+            handler = (Handler) handlerClass.newInstance();
+            handler.init(desc);
+            desc.setHandler(handler);
+        } catch (ClassNotFoundException e) {
+            throw new DeploymentException(e);
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+    public static ClassLoader getClassLoader(ClassLoader parent, String path)
+            throws DeploymentException {
+        return getClassLoader(parent, new File(path));
+    }
+
+    public static ClassLoader getClassLoader(ClassLoader parent, File file)
+            throws DeploymentException {
+        URLClassLoader classLoader;
+
+        if (file != null) {
+            try {
+                ArrayList urls = new ArrayList();
+
+                urls.add(file.toURL());
+
+                // lower case directory name
+                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());
+                        }
+                    }
+                }
+
+                // upper case directory name
+                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);
+
+                return classLoader;
+            } catch (MalformedURLException e) {
+                throw new DeploymentException(e);
+            }
+        }
+
+        return null;
+    }
+
+    private static Class getHandlerClass(String className, ClassLoader loader1) throws AxisFault {
+        Class handlerClass;
+
+        try {
+            handlerClass = Class.forName(className, true, loader1);
+        } catch (ClassNotFoundException e) {
+            throw new AxisFault(e.getMessage());
+        }
+
+        return handlerClass;
+    }
+
+    /**
+     * This guy will create a AxisService using java replection
+     */
+    public static void fillAxisService(AxisService axisService) throws Exception {
+        Parameter implInfoParam = axisService.getParameter(Constants.SERVICE_CLASS);
+        String serviceClass = (String) implInfoParam.getValue();
+        ClassLoader serviceClassLoader = axisService.getClassLoader();
+        SchemaGenerator schemaGenerator = new SchemaGenerator(serviceClassLoader,
+                serviceClass, null, null);
+        axisService.setSchema(schemaGenerator.generateSchema());
+
+        JMethod [] method = schemaGenerator.getMethods();
+        TypeTable table = schemaGenerator.getTypeTable();
+
+        for (int i = 0; i < method.length; i++) {
+            JMethod jmethod = method[i];
+            String opName = jmethod.getSimpleName();
+            AxisOperation operation = axisService.getOperation(new QName(opName));
+            if (operation != null) {
+                AxisMessage inMessage = operation.getMessage(
+                        WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                if (inMessage != null) {
+                    inMessage.setElementQName(table.getComplexScheamType(jmethod.getSimpleName() +
+                            SchemaGenerator.METHOD_REQUEST_WRAPPER));
+                }
+                if (!jmethod.getReturnType().isVoidType()) {
+                    AxisMessage outMessage = operation.getMessage(
+                            WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                    outMessage.setElementQName(table.getQNamefortheType(jmethod.getSimpleName() +
+                            SchemaGenerator.METHOD_RESPONSE_WRAPPER));
+                }
+            }
+
+        }
+    }
+
+    /**
+     * To create an AxisService using given service impl class name
+     * fisrt generate schema corresponding to the given java class , next for each methods AxisOperation
+     * will be created.
+     * <p/>
+     * Note : Inorder to work this properly RPCMessageReceiver should be availble in the class path
+     * otherewise operation can not continue
+     *
+     * @param implClass
+     * @param axisConfig
+     * @return return created AxisSrevice
+     */
+    public static AxisService createService(String implClass,
+                                            AxisConfiguration axisConfig) throws AxisFault {
+        Parameter parameter = new ParameterImpl(Constants.SERVICE_CLASS, implClass);
+        AxisService axisService = new AxisService();
+        axisService.addParameter(parameter);
+
+        int index = implClass.lastIndexOf(".");
+        String serviceName;
+        if (index > 0) {
+            serviceName = implClass.substring(index + 1, implClass.length());
+        } else {
+            serviceName = implClass;
+        }
+
+        axisService.setName(serviceName);
+        axisService.setClassLoader(axisConfig.getServiceClassLoader());
+
+        ClassLoader serviceClassLoader = axisService.getClassLoader();
+        SchemaGenerator schemaGenerator = new SchemaGenerator(serviceClassLoader,
+                implClass, null, null);
+        try {
+            axisService.setSchema(schemaGenerator.generateSchema());
+        } catch (Exception e) {
+            throw new AxisFault(e);
+        }
+
+        JMethod [] method = schemaGenerator.getMethods();
+        TypeTable table = schemaGenerator.getTypeTable();
+
+        PhasesInfo pinfo = axisConfig.getPhasesInfo();
+
+        for (int i = 0; i < method.length; i++) {
+            JMethod jmethod = method[i];
+            String opName = jmethod.getSimpleName();
+            AxisOperation operation;
+            if (jmethod.getReturnType().isVoidType()) {
+                operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_ONLY);
+            } else {
+                operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT);
+                AxisMessage outMessage = operation.getMessage(
+                        WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                outMessage.setElementQName(table.getQNamefortheType(jmethod.getSimpleName() +
+                        SchemaGenerator.METHOD_RESPONSE_WRAPPER));
+            }
+
+            operation.setName(new QName(opName));
+            AxisMessage inMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+            if (inMessage != null) {
+                inMessage.setElementQName(table.getComplexScheamType(jmethod.getSimpleName() +
+                        SchemaGenerator.METHOD_REQUEST_WRAPPER));
+            }
+
+            // loading message recivers
+            try {
+                Class clazz = Class.forName("org.apache.axis2.rpc.receivers.RPCMessageReceiver");
+                MessageReceiver messageReceiver = (MessageReceiver) clazz.newInstance();
+                operation.setMessageReceiver(messageReceiver);
+            } catch (ClassNotFoundException e) {
+                throw new AxisFault("ClassNotFoundException occurd during message receiver loading"
+                        + e.getMessage());
+            } catch (IllegalAccessException e) {
+                throw new AxisFault("IllegalAccessException occurd during message receiver loading"
+                        + e.getMessage());
+            } catch (InstantiationException e) {
+                throw new AxisFault("InstantiationException occurd during message receiver loading"
+                        + e.getMessage());
+            }
+
+            pinfo.setOperationPhases(operation);
+            axisService.addOperation(operation);
+        }
+        return axisService;
+
+    }
+}
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java Wed Jan  4 20:13:45 2006
@@ -29,63 +29,53 @@
         switch (mepURI) {
             case MEP_CONSTANT_IN_ONLY : {
                 abOpdesc = new InOnlyAxisOperation();
-
+                abOpdesc.setMessageExchangePattern(MEP_URI_IN_ONLY);
                 break;
             }
-
             case MEP_CONSTANT_OUT_ONLY : {
                 abOpdesc = new OutOnlyAxisOperation();
-
+                abOpdesc.setMessageExchangePattern(MEP_URI_OUT_ONLY);
                 break;
             }
-
             case MEP_CONSTANT_IN_OUT : {
                 abOpdesc = new InOutAxisOperation();
-
+                abOpdesc.setMessageExchangePattern(MEP_URI_IN_OUT);
                 break;
             }
-
             case MEP_CONSTANT_IN_OPTIONAL_OUT : {
                 abOpdesc = new InOutAxisOperation();
-
+                abOpdesc.setMessageExchangePattern(MEP_URI_IN_OPTIONAL_OUT);
                 break;
             }
-
             case MEP_CONSTANT_ROBUST_IN_ONLY : {
                 abOpdesc = new InOutAxisOperation();
-
+                abOpdesc.setMessageExchangePattern(MEP_URI_ROBUST_IN_ONLY);
                 break;
             }
-
             case MEP_CONSTANT_OUT_IN : {
                 abOpdesc = new OutInAxisOperation();
-
+                abOpdesc.setMessageExchangePattern(MEP_URI_OUT_IN);
                 break;
             }
-
             case MEP_CONSTANT_OUT_OPTIONAL_IN : {
                 abOpdesc = new OutInAxisOperation();
-
+                abOpdesc.setMessageExchangePattern(MEP_URI_OUT_OPTIONAL_IN);
                 break;
             }
-
             case MEP_CONSTANT_ROBUST_OUT_ONLY : {
                 abOpdesc = new RobustOutOnlyAxisOperation();
-
+                abOpdesc.setMessageExchangePattern(MEP_URI_ROBUST_OUT_ONLY);
                 break;
             }
-
             default : {
                 throw new AxisFault(Messages.getMessage("unSupportedMEP", "ID is " + mepURI));
             }
         }
-
         return abOpdesc;
     }
 
     public static AxisOperation getOperationDescription(String mepURI) throws AxisFault {
         AxisOperation abOpdesc;
-
         if (MEP_URI_IN_ONLY.equals(mepURI)) {
             abOpdesc = new InOnlyAxisOperation();
         } else if (MEP_URI_OUT_ONLY.equals(mepURI)) {
@@ -103,7 +93,7 @@
         } else {
             throw new AxisFault(Messages.getMessage("unSupportedMEP", "ID is " + mepURI));
         }
-
+        abOpdesc.setMessageExchangePattern(mepURI);
         return abOpdesc;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java Wed Jan  4 20:13:45 2006
@@ -133,12 +133,16 @@
                 wsdlOperation.setInputMessage(messageRefinput);
             }
 
-            AxisMessage outaxisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
-            if (outaxisMessage != null && outaxisMessage.getElementQName() != null) {
-                MessageReference messageRefout = wsdlComponentFactory.createMessageReference();
-                messageRefout.setElementQName(outaxisMessage.getElementQName());
-                messageRefout.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
-                wsdlOperation.setOutputMessage(messageRefout);
+            try {
+                AxisMessage outaxisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                if (outaxisMessage != null && outaxisMessage.getElementQName() != null) {
+                    MessageReference messageRefout = wsdlComponentFactory.createMessageReference();
+                    messageRefout.setElementQName(outaxisMessage.getElementQName());
+                    messageRefout.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
+                    wsdlOperation.setOutputMessage(messageRefout);
+                }
+            } catch (UnsupportedOperationException e) {
+                // operation does not have an out message so , no need to do anything here
             }
             portType.setOperation(wsdlOperation);
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java Wed Jan  4 20:13:45 2006
@@ -53,13 +53,13 @@
         inMessage = new AxisMessage();
         inMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
         inMessage.setParent(this);
-        
+
         inFaultMessage = new AxisMessage();
         inFaultMessage.setParent(this);
-        
+
         outFaultMessage = new AxisMessage();
         outFaultMessage.setParent(this);
-        
+
         outPhase = new ArrayList();
     }
 
@@ -67,7 +67,7 @@
         if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(label)) {
             return inMessage;
         } else {
-            throw new UnsupportedOperationException("Not yet implemented");
+            throw new UnsupportedOperationException("In valid acess");
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/PolicyInclude.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/PolicyInclude.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/PolicyInclude.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/PolicyInclude.java Wed Jan  4 20:13:45 2006
@@ -16,15 +16,12 @@
 
 package org.apache.axis2.description;
 
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-
 import org.apache.ws.policy.Policy;
 import org.apache.ws.policy.PolicyReference;
-import org.apache.ws.policy.util.PolicyFactory;
 import org.apache.ws.policy.util.PolicyRegistry;
-import org.apache.ws.policy.util.PolicyWriter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
 
 /**
  * @author Sanka Samaranayake (sanka@apache.org)
@@ -36,9 +33,9 @@
     public static final int AXIS_POLICY = 1;
 
     public static final int AXIS_SERVICE_POLICY = 2;
-    
+
     public static final int AXIS_OPERATION_POLICY = 14;
-    
+
     public static final int AXIS_MESSAGE_POLICY = 15;
 
     public static final int MODULE_POLICY = 3;
@@ -83,7 +80,7 @@
         reg = new PolicyRegistry();
         setParent(parent);
     }
-    
+
     public void setParent(PolicyInclude parent) {
         this.parent = parent;
         reg.setParent(parent.getPolicyRegistry());
@@ -105,7 +102,7 @@
 
         if (policy == null) {
             Iterator iterator = policyElements.iterator();
-            
+
             while (iterator.hasNext()) {
 
                 Object policyElement = ((PolicyElement) iterator.next()).value;
@@ -136,7 +133,7 @@
         }
 
         Policy parentEffectivePolicy = parent.getEffectivePolicy();
-        
+
         if (parent == null || parentEffectivePolicy == null) {
             return getPolicy();
         }
@@ -163,31 +160,31 @@
         }
         return policyElementsList;
     }
-    
-    
-    public ArrayList getPolicyElements(int type) { 
+
+
+    public ArrayList getPolicyElements(int type) {
         ArrayList policyElementList = new ArrayList();
         Iterator policyElementIterator = policyElements.iterator();
-        
+
         PolicyElement policyElement;
-        
+
         while (policyElementIterator.hasNext()) {
             policyElement = (PolicyElement) policyElementIterator.next();
-        
+
             if (policyElement.type == type) {
                 policyElementList.add(policyElement.value);
             }
         }
-        
+
         return policyElementList;
-        
+
     }
 
     public void registerPolicy(Policy policy) {
         reg.register(policy.getPolicyURI(), policy);
     }
-    
-    public Policy getPolicy(String policyURI){
+
+    public Policy getPolicy(String policyURI) {
         return reg.lookup(policyURI);
     }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java Wed Jan  4 20:13:45 2006
@@ -112,6 +112,8 @@
         serviceClassLoader = Thread.currentThread().getContextClassLoader();
         moduleClassLoader = Thread.currentThread().getContextClassLoader();
 
+        this.phasesinfo = new PhasesInfo();
+
         // setting the default flow , if some one creating AxisConfig programatically
         // most required handles will be there in the flow.
 
@@ -319,6 +321,8 @@
         if (module == null) {
             module = loadModulefromResources(moduleQName.getLocalPart());
             engageModule(module, moduleQName);
+        } else {
+            engageModule(module, moduleQName);
         }
 
     }
@@ -669,5 +673,14 @@
 
     public String getDefaultModuleVersion(String moduleName) {
         return (String) nameToverionMap.get(moduleName);
+    }
+
+    public ModuleDescription getDefaultModule(String moduleName) {
+        String defualtModuleVersion = getDefaultModuleVersion(moduleName);
+        if (defualtModuleVersion == null) {
+            return (ModuleDescription) allModules.get(new QName(moduleName));
+        } else {
+            return (ModuleDescription) allModules.get(new QName(moduleName + "-" + defualtModuleVersion));
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/PolicyUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/PolicyUtil.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/PolicyUtil.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/PolicyUtil.java Wed Jan  4 20:13:45 2006
@@ -16,52 +16,36 @@
 
 package org.apache.axis2.util;
 
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.description.AxisDescWSDLComponentFactory;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.wsdl.builder.WSDLComponentFactory;
-import org.apache.ws.policy.Policy;
 import org.apache.ws.policy.PolicyConstants;
 import org.apache.ws.policy.PolicyReference;
-import org.apache.wsdl.Component;
-import org.apache.wsdl.WSDLBinding;
-import org.apache.wsdl.WSDLBindingOperation;
-import org.apache.wsdl.WSDLConstants;
-import org.apache.wsdl.WSDLDescription;
-import org.apache.wsdl.WSDLEndpoint;
-import org.apache.wsdl.WSDLExtensibilityAttribute;
-import org.apache.wsdl.WSDLInterface;
-import org.apache.wsdl.WSDLOperation;
-import org.apache.wsdl.WSDLService;
+import org.apache.wsdl.*;
 import org.apache.wsdl.extensions.ExtensionConstants;
 import org.apache.wsdl.extensions.PolicyExtensibilityElement;
 import org.apache.wsdl.extensions.impl.ExtensionFactoryImpl;
 import org.apache.wsdl.impl.WSDLProcessingException;
 
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * @author Sanka Samaranayake (sanka@apache.org)
  */
 public class PolicyUtil {
     public static void populatePolicy(WSDLDescription description,
-            AxisService axisService) {
+                                      AxisService axisService) {
         WSDLService wsdlService = description.getService(new QName(axisService
                 .getName()));
         populatePolicy(description, wsdlService, axisService);
     }
 
     private static void populatePolicy(WSDLDescription description,
-            WSDLService wsdlService, AxisService axisService) {
+                                       WSDLService wsdlService, AxisService axisService) {
 
         AxisServiceGroup axisServiceGroup = axisService.getParent();
+        //TODO : Sanka please be carefull , your code given NPEs all over the places
         AxisConfiguration axisConfiguration = axisServiceGroup.getParent();
 
         PolicyInclude servicePolicyInclude = axisService.getPolicyInclude();
@@ -90,7 +74,7 @@
     }
 
     private static void populatePolicy(WSDLDescription description,
-            WSDLEndpoint wsdlEndpoint, AxisService axisService) {
+                                       WSDLEndpoint wsdlEndpoint, AxisService axisService) {
         PolicyInclude policyInclude = axisService.getPolicyInclude();
         List policyList = policyInclude
                 .getPolicyElements(PolicyInclude.PORT_POLICY);
@@ -105,7 +89,7 @@
     }
 
     private static void populatePolicy(WSDLDescription description,
-            WSDLInterface wsdlInterface, AxisService axisService) {
+                                       WSDLInterface wsdlInterface, AxisService axisService) {
         PolicyInclude policyInclude = axisService.getPolicyInclude();
         List policyList = policyInclude
                 .getPolicyElements(PolicyInclude.PORT_TYPE_POLICY);
@@ -125,7 +109,7 @@
     }
 
     private static void populatePolicy(WSDLDescription description,
-            WSDLOperation wsdlOperation, AxisOperation axisOperation) {
+                                       WSDLOperation wsdlOperation, AxisOperation axisOperation) {
 
         PolicyInclude policyInclude = axisOperation.getPolicyInclude();
 
@@ -175,7 +159,7 @@
     }
 
     private static void populatePolicy(WSDLDescription description,
-            WSDLBinding wsdlBinding, AxisService axisService) {
+                                       WSDLBinding wsdlBinding, AxisService axisService) {
         PolicyInclude policyInclude = axisService.getPolicyInclude();
 
         List policyList = policyInclude
@@ -200,8 +184,8 @@
     }
 
     private static void populatePolicy(WSDLDescription description,
-            WSDLBindingOperation wsdlBindingOperation,
-            AxisOperation axisOperation) {
+                                       WSDLBindingOperation wsdlBindingOperation,
+                                       AxisOperation axisOperation) {
 
         PolicyInclude policyInclude = axisOperation.getPolicyInclude();
         List policyList = policyInclude
@@ -295,7 +279,7 @@
     }
 
     private static void addPolicyAsExtElements(WSDLDescription description,
-            List policyList, Component component, PolicyInclude policyInclude) {
+                                               List policyList, Component component, PolicyInclude policyInclude) {
         Iterator policyElementIterator = policyList.iterator();
         Object policyElement;
 
@@ -316,7 +300,7 @@
     }
 
     private static void addPolicyAsExtAttributes(WSDLDescription description,
-            List policyList, Component component, PolicyInclude policyInclude) {
+                                                 List policyList, Component component, PolicyInclude policyInclude) {
         Iterator policyElementIterator = policyList.iterator();
         Object policyElement;
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java Wed Jan  4 20:13:45 2006
@@ -275,7 +275,7 @@
         return new QName(name + "-" + versionID);
     }
 
-    public static void calculateDefaultModuleVersion(HashMap modules) {
+    public static void calculateDefaultModuleVersion(HashMap modules, AxisConfiguration axisConfig) {
         Iterator allModules = modules.values().iterator();
         HashMap defaultModules = new HashMap();
         while (allModules.hasNext()) {
@@ -283,7 +283,26 @@
             QName moduleName = moduleDescription.getName();
             String moduleNameString = getModuleName(moduleName.getLocalPart());
             String moduleVersionString = getModuleVersion(moduleName.getLocalPart());
-            
+            String currentDefaultVerison = (String) defaultModules.get(moduleNameString);
+            if (currentDefaultVerison != null) {
+                if (isLatest(moduleVersionString, currentDefaultVerison)) {
+                    defaultModules.put(moduleNameString, moduleVersionString);
+                }
+            } else {
+                defaultModules.put(moduleNameString, moduleVersionString);
+            }
+
         }
+        Iterator def_mod_itr = defaultModules.keySet().iterator();
+        while (def_mod_itr.hasNext()) {
+            String moduleName = (String) def_mod_itr.next();
+            axisConfig.addDefaultModuleVersion(moduleName, (String) defaultModules.get(moduleName));
+        }
+    }
+
+    public static boolean isLatest(String moduleVersion, String currentDefaultVersion) {
+        float m_version = Float.parseFloat(moduleVersion);
+        float m_c_vresion = Float.parseFloat(currentDefaultVersion);
+        return m_version > m_c_vresion;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModuleversionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModuleversionTest.java?rev=366076&r1=366075&r2=366076&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModuleversionTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModuleversionTest.java Wed Jan  4 20:13:45 2006
@@ -3,7 +3,12 @@
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.description.ModuleDescription;
 import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.util.Utils;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
@@ -32,5 +37,72 @@
         assertNotNull(ac);
         assertEquals(ac.getDefaultModuleVersion("abc"), "1.23");
         assertEquals(ac.getDefaultModuleVersion("foo"), "0.89");
+    }
+
+    public void testCalculateDefaultModuleVersions() throws AxisFault {
+        AxisConfiguration axiConfiguration = new AxisConfiguration();
+        ModuleDescription module1 = new ModuleDescription();
+        module1.setName(new QName("Module1"));
+        axiConfiguration.addModule(module1);
+
+        ModuleDescription module2 = new ModuleDescription();
+        module2.setName(new QName("Module2-0.94"));
+        axiConfiguration.addModule(module2);
+
+        ModuleDescription module3 = new ModuleDescription();
+        module3.setName(new QName("Module2-0.95"));
+        axiConfiguration.addModule(module3);
+
+        ModuleDescription module4 = new ModuleDescription();
+        module4.setName(new QName("Module2-0.93"));
+        axiConfiguration.addModule(module4);
+
+        ModuleDescription module5 = new ModuleDescription();
+        module5.setName(new QName("testModule-1.93"));
+        axiConfiguration.addModule(module5);
+
+        Utils.calculateDefaultModuleVersion(axiConfiguration.getModules(), axiConfiguration);
+        assertEquals(module1, axiConfiguration.getDefaultModule("Module1"));
+        assertEquals(module3, axiConfiguration.getDefaultModule("Module2"));
+        assertEquals(module5, axiConfiguration.getDefaultModule("testModule"));
+        axiConfiguration.engageModule(new QName("Module2"));
+        axiConfiguration.engageModule(new QName("Module1"));
+        axiConfiguration.engageModule("testModule", "1.93");
+
+        Iterator engaeModuels = axiConfiguration.getEngagedModules().iterator();
+        boolean found1 = false;
+        boolean found2 = false;
+        boolean found3 = false;
+        while (engaeModuels.hasNext()) {
+            QName qName = (QName) engaeModuels.next();
+            if (qName.getLocalPart().equals("Module2-0.95")) {
+                found1 = true;
+            }
+        }
+        engaeModuels = axiConfiguration.getEngagedModules().iterator();
+        while (engaeModuels.hasNext()) {
+            QName qName = (QName) engaeModuels.next();
+            if (qName.getLocalPart().equals("Module1")) {
+                found2 = true;
+            }
+        }
+        engaeModuels = axiConfiguration.getEngagedModules().iterator();
+        while (engaeModuels.hasNext()) {
+            QName qName = (QName) engaeModuels.next();
+            if (qName.getLocalPart().equals("testModule-1.93")) {
+                found3 = true;
+            }
+        }
+
+
+        if (!found1) {
+            fail("this should fail");
+        }
+        if (!found2) {
+            fail("this should fail");
+        }
+        if (!found3) {
+            fail("this should fail");
+        }
     }
 }

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MyService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MyService.java?rev=366076&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MyService.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MyService.java Wed Jan  4 20:13:45 2006
@@ -0,0 +1,30 @@
+package org.apache.axis2.engine;
+/*
+* 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.
+*
+* @author : Deepal Jayasinghe (deepal@apache.org)
+*
+*/
+
+public class MyService {
+
+    public int add(int a, int b) {
+        return a + b;
+    }
+
+    public void putValue(String value) {
+
+    }
+}

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java?rev=366076&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java Wed Jan  4 20:13:45 2006
@@ -0,0 +1,79 @@
+package org.apache.axis2.engine;
+
+import junit.framework.TestCase;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.integration.UtilServer;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.rpc.client.RPCServiceClient;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+/*
+* 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.
+*
+* @author : Deepal Jayasinghe (deepal@apache.org)
+*
+*/
+
+public class ServiceCreateTest extends TestCase {
+
+    ConfigurationContext configContext;
+    ConfigurationContext clinetConfigurationctx;
+
+
+    protected void setUp() throws Exception {
+        UtilServer.start();
+        configContext = UtilServer.getConfigurationContext();
+        ConfigurationContextFactory factory = new ConfigurationContextFactory();
+        clinetConfigurationctx = factory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo");
+    }
+
+    public void testServiceCreate() throws AxisFault {
+        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
+        AxisService service = Utils.createService("org.apache.axis2.engine.MyService", axisConfig);
+        assertNotNull(service);
+        axisConfig.addService(service);
+        assertEquals("MyService", service.getName());
+        assertNotNull(service.getOperation(new QName("add")));
+        assertNotNull(service.getOperation(new QName("putValue")));
+        assertNotNull(axisConfig.getService("MyService"));
+        service.printWSDL(System.out, "http://127.0.0.1:8080/axis2/services/");
+
+        RPCServiceClient client = new RPCServiceClient(clinetConfigurationctx, null);
+
+        EndpointReference targetEPR = new EndpointReference(
+                "http://127.0.0.1:" + (UtilServer.TESTING_PORT)
+                        + "/axis2/services/MyService/add");
+        Options options = new Options();
+
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+        client.setOptions(options);
+        ArrayList args = new ArrayList();
+        args.add("100");
+        args.add("200");
+
+        OMElement response = client.invokeBlocking(new QName("add"), args.toArray());
+        assertEquals(Integer.parseInt(response.getFirstElement().getText()), 300);
+        client.finalizeInvoke();
+    }
+}



Mime
View raw message