You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2007/06/10 13:42:22 UTC

svn commit: r545866 [2/7] - in /webservices/axis2/branches/java/jaxws21: modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb/src/org/apache/axis2/databinding/types/ modules/adb/src/org/apache/axis2/databinding/utils/ modules/adb/src/org/apache...

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java Sun Jun 10 04:42:12 2007
@@ -15,28 +15,38 @@
  */
 package org.apache.axis2.clustering.context.commands;
 
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.clustering.context.PropertyUpdater;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.PropertyDifference;
-import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.AxisFault;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.HashMap;
-
 /**
  * 
  */
-public class UpdateServiceContextCommand
-        extends ServiceContextCommand implements UpdateContextCommand {
+public class UpdateServiceContextCommand extends UpdateContextCommand {
 
     private static final Log log = LogFactory.getLog(UpdateServiceContextCommand.class);
 
-    private PropertyUpdater propertyUpdater = new PropertyUpdater();
+    protected String serviceGroupName;
+    protected String serviceGroupContextId;
+    protected String serviceName;
+
+    public void setServiceGroupName(String serviceGroupName) {
+        this.serviceGroupName = serviceGroupName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public void setServiceGroupContextId(String serviceGroupContextId) {
+        this.serviceGroupContextId = serviceGroupContextId;
+    }
 
     public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
         log.debug("Updating service context properties...");
@@ -46,30 +56,43 @@
             try {
                 AxisService axisService =
                         configurationContext.getAxisConfiguration().getService(serviceName);
-                ServiceContext serviceContext = sgCtx.getServiceContext(axisService, false);
+                ServiceContext serviceContext = sgCtx.getServiceContext(axisService);
                 propertyUpdater.updateProperties(serviceContext);
             } catch (AxisFault e) {
                 throw new ClusteringFault(e);
             }
+        } else {
+            sgCtx = configurationContext.getServiceGroupContext(serviceGroupContextId);
+            AxisService axisService;
+            try {
+                axisService = configurationContext.getAxisConfiguration().getService(serviceName);
+            } catch (AxisFault axisFault) {
+                throw new ClusteringFault(axisFault);
+            }
+            String scope = axisService.getScope();
+            if (sgCtx == null) {
+                sgCtx = new ServiceGroupContext(configurationContext,
+                                                configurationContext.getAxisConfiguration().
+                                                        getServiceGroup(serviceGroupName));
+                sgCtx.setId(serviceGroupContextId);
+                if (scope.equals(Constants.SCOPE_APPLICATION)) {
+                    configurationContext.
+                            addServiceGroupContextIntoApplicationScopeTable(sgCtx);
+                } else if (scope.equals(Constants.SCOPE_SOAP_SESSION)) {
+                    configurationContext.
+                            addServiceGroupContextIntoSoapSessionTable(sgCtx);
+                }
+            }
+            try {
+                ServiceContext serviceContext = sgCtx.getServiceContext(axisService);
+                propertyUpdater.updateProperties(serviceContext);
+            } catch (AxisFault axisFault) {
+                throw new ClusteringFault(axisFault);
+            }
         }
     }
 
-    public boolean isPropertiesEmpty() {
-        if (propertyUpdater.getProperties() == null) {
-            propertyUpdater.setProperties(new HashMap());
-            return true;
-        }
-        return propertyUpdater.getProperties().isEmpty();
-    }
-
-    public int getCommandType() {
-        return UPDATE_SERVICE_CONTEXT;
-    }
-
-    public void addProperty(PropertyDifference diff) {
-        if (propertyUpdater.getProperties() == null) {
-            propertyUpdater.setProperties(new HashMap());
-        }
-        propertyUpdater.addContextProperty(diff);
+    public String toString() {
+        return "UpdateServiceContextCommand(" + uniqueId + ")";
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java Sun Jun 10 04:42:12 2007
@@ -16,45 +16,56 @@
 package org.apache.axis2.clustering.context.commands;
 
 import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.clustering.context.PropertyUpdater;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.PropertyDifference;
 import org.apache.axis2.context.ServiceGroupContext;
-
-import java.util.HashMap;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * 
  */
-public class UpdateServiceGroupContextCommand
-        extends ServiceGroupContextCommand implements UpdateContextCommand {
+public class UpdateServiceGroupContextCommand extends UpdateContextCommand {
 
-    private PropertyUpdater propertyUpdater = new PropertyUpdater();
+    private static Log log = LogFactory.getLog(UpdateServiceGroupContextCommand.class);
 
-    public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
-        ServiceGroupContext sgCtx =
-                configurationContext.getServiceGroupContext(serviceGroupContextId);
-        if (sgCtx != null) {
-            propertyUpdater.updateProperties(sgCtx);
-        }
+    protected String serviceGroupName;
+    protected String serviceGroupContextId;
+
+    public String getServiceGroupName() {
+        return serviceGroupName;
     }
 
-    public int getCommandType() {
-        return UPDATE_SERVICE_GROUP_CONTEXT;
+    public void setServiceGroupName(String serviceGroupName) {
+        this.serviceGroupName = serviceGroupName;
     }
 
-    public boolean isPropertiesEmpty() {
-        if (propertyUpdater.getProperties() == null) {
-            propertyUpdater.setProperties(new HashMap());
-            return true;
-        }
-        return propertyUpdater.getProperties().isEmpty();
+    public String getServiceGroupContextId() {
+        return serviceGroupContextId;
     }
 
-    public void addProperty(PropertyDifference diff) {
-        if (propertyUpdater.getProperties() == null) {
-            propertyUpdater.setProperties(new HashMap());
+    public void setServiceGroupContextId(String serviceGroupContextId) {
+        this.serviceGroupContextId = serviceGroupContextId;
+    }
+
+    public void execute(ConfigurationContext configContext) throws ClusteringFault {
+        ServiceGroupContext sgCtx =
+                configContext.getServiceGroupContext(serviceGroupContextId);
+
+        // If the ServiceGroupContext is not found, create it
+        if (sgCtx == null) {
+            AxisServiceGroup axisServiceGroup =
+                    configContext.getAxisConfiguration()
+                            .getServiceGroup(serviceGroupName);
+            sgCtx = new ServiceGroupContext(configContext, axisServiceGroup);
+            sgCtx.setId(serviceGroupContextId);
+            configContext.addServiceGroupContextIntoSoapSessionTable(sgCtx);  // TODO: Check this
         }
-        propertyUpdater.addContextProperty(diff);
+        log.debug("###### Gonna update SG prop in " + serviceGroupContextId + "===" + sgCtx);
+        propertyUpdater.updateProperties(sgCtx);
+    }
+
+    public String toString() {
+        return "UpdateServiceGroupContextCommand(" + uniqueId + ")";
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/ControlCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/ControlCommand.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/ControlCommand.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/ControlCommand.java Sun Jun 10 04:42:12 2007
@@ -20,13 +20,15 @@
 import org.apache.axis2.context.ConfigurationContext;
 
 /**
- * 
+ * Represents a Control command sent from one Node to another
  */
 public abstract class ControlCommand extends ClusteringCommand {
-    public int getCommandType() {
-        //TODO: Method implementation
-        return 0;
-    }
 
+    /**
+     * Execute this command
+     *
+     * @param configurationContext
+     * @throws ClusteringFault
+     */
     public abstract void execute(ConfigurationContext configurationContext) throws ClusteringFault;
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java Sun Jun 10 04:42:12 2007
@@ -47,27 +47,26 @@
             List cmdList = new ArrayList();
 
             // Add the service group contexts, service contexts & their respective properties
-            for (Iterator iter = configCtx.getServiceGroupContexts().keySet().iterator();
-                 iter.hasNext();) {
-                String id = (String) iter.next();
-                ServiceGroupContext sgCtx = configCtx.getServiceGroupContext(id);
-                cmdList.add(ContextClusteringCommandFactory.getCreateCommand(sgCtx));
-                ContextClusteringCommand updateCmd =
+            String[] sgCtxIDs = configCtx.getServiceGroupContextIDs();
+            for (int i  = 0; i < sgCtxIDs.length; i ++) {
+                ServiceGroupContext sgCtx = configCtx.getServiceGroupContext(sgCtxIDs[i]);
+                ContextClusteringCommand updateServiceGroupCtxCmd =
                         ContextClusteringCommandFactory.getUpdateCommand(sgCtx,
                                                                          excludedPropPatterns,
                                                                          true);
-                if (updateCmd != null) {
-                    cmdList.add(updateCmd);
+                if (updateServiceGroupCtxCmd != null) {
+                    cmdList.add(updateServiceGroupCtxCmd);
                 }
-                for (Iterator iter2 = sgCtx.getServiceContexts(); iter2.hasNext();) {
-                    ServiceContext serviceCtx = (ServiceContext) iter2.next();
-                    cmdList.add(ContextClusteringCommandFactory.getCreateCommand(serviceCtx));
-                    ContextClusteringCommand updateServiceCtxCmd =
-                            ContextClusteringCommandFactory.getUpdateCommand(serviceCtx,
-                                                                             excludedPropPatterns,
-                                                                             true);
-                    if (updateServiceCtxCmd != null) {
-                        cmdList.add(updateServiceCtxCmd);
+                if (sgCtx.getServiceContexts() != null) {
+                    for (Iterator iter2 = sgCtx.getServiceContexts(); iter2.hasNext();) {
+                        ServiceContext serviceCtx = (ServiceContext) iter2.next();
+                        ContextClusteringCommand updateServiceCtxCmd =
+                                ContextClusteringCommandFactory.getUpdateCommand(serviceCtx,
+                                                                                 excludedPropPatterns,
+                                                                                 true);
+                        if (updateServiceCtxCmd != null) {
+                            cmdList.add(updateServiceCtxCmd);
+                        }
                     }
                 }
             }
@@ -88,5 +87,9 @@
 
     public ContextClusteringCommand[] getCommands() {
         return commands;
+    }
+
+    public String toString() {
+        return "GetStateCommand";
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java Sun Jun 10 04:42:12 2007
@@ -28,6 +28,8 @@
     private ContextClusteringCommand[] commands;
 
     public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+
+        // Run this code only if this node is not already initialized
         if (configurationContext.
                 getPropertyNonReplicable(ClusteringConstants.CLUSTER_INITIALIZED) == null) {
             configurationContext.
@@ -42,5 +44,9 @@
 
     public void setCommands(ContextClusteringCommand[] commands) {
         this.commands = commands;
+    }
+
+    public String toString() {
+        return "GetStateResponseCommand";
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/handlers/ReplicationHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/handlers/ReplicationHandler.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/handlers/ReplicationHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/handlers/ReplicationHandler.java Sun Jun 10 04:42:12 2007
@@ -20,37 +20,74 @@
 import org.apache.axis2.clustering.ClusterManager;
 import org.apache.axis2.clustering.ClusteringFault;
 import org.apache.axis2.clustering.context.ContextManager;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.context.*;
+import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class ReplicationHandler extends AbstractHandler {
 
     private static final Log log = LogFactory.getLog(ReplicationHandler.class);
 
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-        log.debug("Going to replicate state on invoke");
-        replicateState(msgContext);
-        return InvocationResponse.CONTINUE;
-    }
-
-    public void flowComplete(MessageContext msgContext) {
-        log.debug("Going to replicate state on flowComplete");
+//        System.err.println("### [INVOKE] Going to replicate state. Flow:" + msgContext.getFLOW());
+        /* log.debug("Going to replicate state on invoke");
         try {
             replicateState(msgContext);
         } catch (Exception e) {
+            System.err.println("###########################");
             String message = "Could not replicate the state";
             log.error(message, e);
+            System.err.println("###########################");
+        }*/
+        return InvocationResponse.CONTINUE;
+    }
+
+    public void flowComplete(MessageContext msgContext) {
+
+        // If there are no members, we need not do any replication
+        ClusterManager clusterManager =
+                msgContext.getConfigurationContext().getAxisConfiguration().getClusterManager();
+        if(clusterManager != null && clusterManager.getMemberCount() == 0){
+             return;
+        }
+
+        int flow = msgContext.getFLOW();
+        String mep = msgContext.getAxisOperation().getMessageExchangePattern();
+
+        // The ReplicationHandler should be added to all 4 flows. We will replicate on flowComplete
+        // only during one of the flows
+        boolean replicateOnInFLow =
+                ((mep.equals(WSDL2Constants.MEP_URI_IN_ONLY) ||
+                  mep.equals(WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT) ||
+                  mep.equals(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY))
+                 && (flow == MessageContext.IN_FLOW || flow == MessageContext.IN_FAULT_FLOW));
+
+        boolean replicateOnOutFlow =
+                (mep.equals(WSDL2Constants.MEP_URI_IN_OUT) ||
+                 mep.equals(WSDL2Constants.MEP_URI_OUT_ONLY) ||
+                 mep.equals(WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN) ||
+                 mep.equals(WSDL2Constants.MEP_URI_OUT_IN) ||
+                 mep.equals(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY))
+                && (flow == MessageContext.OUT_FLOW || flow == MessageContext.OUT_FAULT_FLOW);
+
+        if (replicateOnInFLow || replicateOnOutFlow) {
+            log.debug("### [FLOW COMPLETE] Going to replicate state. Flow:" + flow);
+            try {
+                replicateState(msgContext);
+            } catch (Exception e) {
+                String message = "Could not replicate the state";
+                log.error(message, e);
+            }
         }
     }
 
     private void replicateState(MessageContext message) throws ClusteringFault {
-
         ConfigurationContext configurationContext = message.getConfigurationContext();
         AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
         ClusterManager clusterManager = axisConfiguration.getClusterManager();
@@ -61,30 +98,52 @@
             if (contextManager == null) {
                 String msg = "Cannot replicate contexts since " +
                              "ContextManager is not specified in the axis2.xml file.";
-                log.error(msg);
-                return;
+                throw new ClusteringFault(msg);
             }
 
-            // Replicate state stored in ConfigurationContext
+            List contexts = new ArrayList();
+
+            // Do we need to replicate state stored in ConfigurationContext?
             if (!configurationContext.getPropertyDifferences().isEmpty()) {
-                contextManager.updateContext(configurationContext);
+                contexts.add(configurationContext);
             }
 
-            // Replicate state stored in ServiceGroupContext
-            ServiceGroupContext serviceGroupContext = message.getServiceGroupContext();
-            if (serviceGroupContext != null) {
-                if (!serviceGroupContext.getPropertyDifferences().isEmpty()) {
-                    contextManager.updateContext(serviceGroupContext);
-                }
+            // Do we need to replicate state stored in ServiceGroupContext?
+            ServiceGroupContext sgContext = message.getServiceGroupContext();
+            if (sgContext != null && !sgContext.getPropertyDifferences().isEmpty()) {
+                contexts.add(sgContext);
             }
 
-            // Replicate state stored in ServiceContext
+            // Do we need to replicate state stored in ServiceContext?
             ServiceContext serviceContext = message.getServiceContext();
-            if (serviceContext != null) {
-                if (!serviceContext.getPropertyDifferences().isEmpty()) {
-                    contextManager.updateContext(serviceContext);
-                }
+            if (serviceContext != null && !serviceContext.getPropertyDifferences().isEmpty()) {
+                contexts.add(serviceContext);
+            }
+
+            // Do the actual replication here
+            if (!contexts.isEmpty()) {
+                String msgUUID =
+                        contextManager.updateContexts((AbstractContext[]) contexts.
+                                toArray(new AbstractContext[contexts.size()]));
+
+                long start = System.currentTimeMillis();
+
+                // Wait till all members have ACKed receipt & successful processing of
+                // the message with UUID 'msgUUID'
+                do {
+                    try {
+                        Thread.sleep(50);
+                    } catch (InterruptedException e) {
+                        log.error(e);
+                        break;
+                    }
+                    if (System.currentTimeMillis() - start > 20000) {
+                        throw new ClusteringFault("ACKs not received from all members within 20 sec. " +
+                                                  "Aborting wait.");
+                    }
+                } while (!contextManager.isMessageAcknowledged(msgUUID));
             }
+
         } else {
             String msg = "Cannot replicate contexts since " +
                          "ClusterManager is not specified in the axis2.xml file.";

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java Sun Jun 10 04:42:12 2007
@@ -16,16 +16,22 @@
 
 package org.apache.axis2.clustering.tribes;
 
+import org.apache.axis2.clustering.ClusteringConstants;
 import org.apache.axis2.clustering.ClusteringFault;
 import org.apache.axis2.clustering.configuration.ConfigurationClusteringCommand;
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManager;
 import org.apache.axis2.clustering.context.ContextClusteringCommand;
 import org.apache.axis2.clustering.context.DefaultContextManager;
+import org.apache.axis2.clustering.context.commands.ContextClusteringCommandCollection;
+import org.apache.axis2.clustering.context.commands.UpdateContextCommand;
+import org.apache.axis2.clustering.control.AckCommand;
 import org.apache.axis2.clustering.control.ControlCommand;
-import org.apache.axis2.util.threadpool.ThreadPool;
+import org.apache.axis2.clustering.control.GetStateResponseCommand;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.catalina.tribes.Member;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import sun.misc.Queue;
 
 import java.io.Serializable;
 
@@ -33,19 +39,35 @@
 public class ChannelListener implements org.apache.catalina.tribes.ChannelListener {
     private static final Log log = LogFactory.getLog(ChannelListener.class);
 
-    private ThreadPool threadPool;
-
     private DefaultContextManager contextManager;
     private DefaultConfigurationManager configurationManager;
     private TribesControlCommandProcessor controlCommandProcessor;
+    private ChannelSender sender;
+
+    /**
+     * The messages received are enqued. Another thread, messageProcessor, will
+     * process these messages in the order that they were received.
+     */
+    private final Queue cmdQueue = new Queue();
+
+    /**
+     * The thread which picks up messages from the cmdQueue and processes them.
+     */
+    private Thread messageProcessor;
+
+    private ConfigurationContext configurationContext;
 
-    public ChannelListener(DefaultConfigurationManager configurationManager,
+    public ChannelListener(ConfigurationContext configurationContext,
+                           DefaultConfigurationManager configurationManager,
                            DefaultContextManager contextManager,
-                           TribesControlCommandProcessor controlCommandProcessor) {
+                           TribesControlCommandProcessor controlCommandProcessor,
+                           ChannelSender sender) {
         this.configurationManager = configurationManager;
         this.contextManager = contextManager;
         this.controlCommandProcessor = controlCommandProcessor;
-        this.threadPool = new ThreadPool();
+        this.sender = sender;
+        this.configurationContext = configurationContext;
+        startMessageProcessor();
     }
 
     public void setContextManager(DefaultContextManager contextManager) {
@@ -56,42 +78,111 @@
         this.configurationManager = configurationManager;
     }
 
+    public void setConfigurationContext(ConfigurationContext configurationContext) {
+        this.configurationContext = configurationContext;
+    }
+
     public boolean accept(Serializable msg, Member sender) {
         return true;
     }
 
     public void messageReceived(Serializable msg, Member sender) {
-        log.debug("Message received : " + msg);
-        threadPool.execute(new MessageHandler(msg, sender));
+
+        // If the system has not still been intialized, reject all incoming messages, except the
+        // GetStateResponseCommand message
+        if (configurationContext.
+                getPropertyNonReplicable(ClusteringConstants.CLUSTER_INITIALIZED) == null
+            && !(msg instanceof GetStateResponseCommand)) {
+            return;
+        }
+        log.debug("RECEIVED MESSAGE " + msg + " from " + sender.getName());
+
+        // Need to process ACKs as soon as they are received since otherwise,
+        // unnecessary retransmissions will take place
+        if(msg instanceof AckCommand){
+            try {
+                controlCommandProcessor.process((AckCommand) msg, sender);
+            } catch (Exception e) {
+                log.error(e);
+            }
+            return;
+        }
+
+        // Add the commands to be precessed to the cmdQueue
+        synchronized (cmdQueue) {
+            cmdQueue.enqueue(new MemberMessage(msg, sender));
+        }
+        if (!messageProcessor.isAlive()) {
+            startMessageProcessor();
+        }
+    }
+
+    private void startMessageProcessor() {
+        messageProcessor = new Thread(new MessageProcessor(), "ClusteringInComingMessageProcessor");
+        messageProcessor.setDaemon(true);
+        messageProcessor.setPriority(Thread.MAX_PRIORITY);
+        messageProcessor.start();
     }
 
-    private class MessageHandler implements Runnable {
-        private Serializable msg;
+    /**
+     * A container to hold a message and its sender
+     */
+    private class MemberMessage {
+        private Serializable message;
         private Member sender;
 
-        public MessageHandler(Serializable msg, Member sender) {
-            this.msg = msg;
+        public MemberMessage(Serializable msg, Member sender) {
+            this.message = msg;
             this.sender = sender;
         }
 
+        public Serializable getMessage() {
+            return message;
+        }
+
+        public Member getSender() {
+            return sender;
+        }
+    }
+
+    /**
+     * A processor which continuously polls for messages in the cmdQueue and processes them
+     */
+    private class MessageProcessor implements Runnable {
         public void run() {
-            if (msg instanceof ContextClusteringCommand) {
-                try {
-                    contextManager.notifyListener((ContextClusteringCommand) msg);
-                } catch (ClusteringFault e) {
-                    log.error("Could not process ContextCommand", e);
-                }
-            } else if (msg instanceof ConfigurationClusteringCommand) {
-                try {
-                    configurationManager.notifyListener((ConfigurationClusteringCommand) msg);
-                } catch (ClusteringFault e) {
-                    log.error("Could not process ConfigurationCommand", e);
-                }
-            } else if (msg instanceof ControlCommand) {
+            while (true) {
+                MemberMessage memberMessage = null;
                 try {
-                    controlCommandProcessor.process((ControlCommand) msg, sender);
-                } catch (ClusteringFault e) {
-                    log.error("Could not process ControlCommand", e);
+                    if (!cmdQueue.isEmpty()) {
+                        memberMessage = (MemberMessage) cmdQueue.dequeue();
+                    } else {
+                        Thread.sleep(1);
+                        continue;
+                    }
+
+                    Serializable msg = memberMessage.getMessage();
+                    if (msg instanceof ContextClusteringCommand && contextManager != null) {
+                        ContextClusteringCommand ctxCmd = (ContextClusteringCommand) msg;
+                        contextManager.process(ctxCmd);
+
+                        // Sending ACKs for ContextClusteringCommandCollection or
+                        // UpdateContextCommand is sufficient
+                        if (msg instanceof ContextClusteringCommandCollection ||
+                            msg instanceof UpdateContextCommand) {
+                            AckCommand ackCmd = new AckCommand(ctxCmd.getUniqueId());
+
+                            // Send the ACK
+                            sender.sendToMember(ackCmd, memberMessage.getSender());
+                        }
+                    } else if (msg instanceof ConfigurationClusteringCommand &&
+                               configurationManager != null) {
+                        configurationManager.process((ConfigurationClusteringCommand) msg);
+                    } else if (msg instanceof ControlCommand && controlCommandProcessor != null) {
+                        controlCommandProcessor.process((ControlCommand) msg,
+                                                        memberMessage.getSender());
+                    }
+                } catch (Throwable e) {
+                    log.error("Could not process message ", e);
                 }
             }
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java Sun Jun 10 04:42:12 2007
@@ -27,63 +27,76 @@
 
 public class ChannelSender implements MessageSender {
 
+    private Log log = LogFactory.getLog(ChannelSender.class);
     private Channel channel;
 
-    private static final Log log = LogFactory.getLog(ChannelSender.class);
-
     public void sendToGroup(ClusteringCommand msg) throws ClusteringFault {
-        if(channel == null) return;
-        Member[] members = channel.getMembers();
+        if (channel == null) {
+            return;
+        }
 
-        // send the message
-        if (members.length > 0) {
-            try {
-                channel.send(members, msg, 0);
-            } catch (ChannelException e) {
-                log.error("" + msg, e);
-                String message = "Error sending command message : " + msg;
-                throw new ClusteringFault(message, e);
+        // Keep retrying, since at the point of trying to send the msg, a member may leave the group
+        while (true) {
+            if (channel.getMembers().length > 0) {
+                try {
+                    channel.send(channel.getMembers(), msg, Channel.DEFAULT);
+                    log.debug("Sent " + msg + " to group");
+                    break;
+                } catch (ChannelException e) {
+                    String message = "Error sending command message : " + msg +
+                                     ". Reason " + e.getMessage();
+                    log.warn(message);
+                }
+            } else {
+                break;
             }
         }
     }
 
     public void sendToSelf(ClusteringCommand msg) throws ClusteringFault {
-        if(channel == null) return;
+        if (channel == null) {
+            return;
+        }
         try {
             channel.send(new Member[]{channel.getLocalMember(true)},
                          msg,
-                         Channel.SEND_OPTIONS_USE_ACK);
+                         Channel.DEFAULT);
+            log.debug("Sent " + msg + " to self");
         } catch (ChannelException e) {
             throw new ClusteringFault(e);
         }
     }
 
     public void sendToGroup(Throwable throwable) throws ClusteringFault {
-        if(channel == null) return;
-        Member[] group = channel.getMembers();
-        log.debug("Group size " + group.length);
-        // send the message
-
-        /*for (int i = 0; i < group.length; i++) {
-            printMember(group[i]);
-        }*/
-
-        if (group.length > 0) {
-            try {
-                channel.send(group, throwable, 0);
-            } catch (ChannelException e) {
-                log.error("" + throwable, e);
-                String message = "Error sending exception message : " + throwable;
-                throw new ClusteringFault(message, e);
+        if (channel == null) {
+            return;
+        }
+
+        // Keep retrying, since at the point of trying to send the msg, a member may leave the group
+        while (true) {
+            if (channel.getMembers().length > 0) {
+                try {
+                    channel.send(channel.getMembers(), throwable, 0);
+                    log.debug("Sent " + throwable + " to group");
+                } catch (ChannelException e) {
+                    String message = "Error sending exception message : " + throwable +
+                                     ". Reason " + e.getMessage();
+                    log.warn(message);
+                }
+            } else {
+                break;
             }
         }
     }
 
     public void sendToMember(ClusteringCommand cmd, Member member) throws ClusteringFault {
         try {
-            channel.send(new Member[]{member}, cmd, Channel.SEND_OPTIONS_USE_ACK);
+            channel.send(new Member[]{member}, cmd, Channel.DEFAULT);
+            log.debug("Sent " + cmd + " to " + member.getName());
         } catch (ChannelException e) {
-            throw new ClusteringFault(e);
+            String message = "Could not send message to " + member.getName() +
+                             ". Reason " + e.getMessage();
+            log.warn(message);
         }
     }
 
@@ -93,14 +106,5 @@
 
     public void setChannel(Channel channel) {
         this.channel = channel;
-    }
-
-    private void printMember(Member member) {
-        member.getUniqueId();
-        log.debug("\n===============================");
-        log.debug("Member Name " + member.getName());
-        log.debug("Member Host" + member.getHost());
-        log.debug("Member Payload" + member.getPayload());
-        log.debug("===============================\n");
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java Sun Jun 10 04:42:12 2007
@@ -26,8 +26,6 @@
 import org.apache.axis2.clustering.context.ContextManager;
 import org.apache.axis2.clustering.context.DefaultContextManager;
 import org.apache.axis2.clustering.control.GetStateCommand;
-import org.apache.axis2.clustering.tribes.info.TransientTribesChannelInfo;
-import org.apache.axis2.clustering.tribes.info.TransientTribesMemberInfo;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.Parameter;
 import org.apache.catalina.tribes.Channel;
@@ -39,10 +37,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Random;
+import java.util.*;
 
 public class TribesClusterManager implements ClusterManager {
     private static final Log log = LogFactory.getLog(TribesClusterManager.class);
@@ -54,6 +49,7 @@
     private ManagedChannel channel;
     private ConfigurationContext configurationContext;
     private TribesControlCommandProcessor controlCmdProcessor;
+    private ChannelListener channelListener;
 
     public TribesClusterManager() {
         parameters = new HashMap();
@@ -71,15 +67,15 @@
     public void init() throws ClusteringFault {
         ChannelSender sender = new ChannelSender();
 
-        ChannelListener listener = new ChannelListener(configurationManager,
-                                                       contextManager,
-                                                       controlCmdProcessor);
+        channelListener = new ChannelListener(configurationContext,
+                                              configurationManager,
+                                              contextManager,
+                                              controlCmdProcessor,
+                                              sender);
 
-        TransientTribesChannelInfo channelInfo = new TransientTribesChannelInfo();
-        TransientTribesMemberInfo memberInfo = new TransientTribesMemberInfo();
-
-        contextManager.setSender(sender);
-        configurationManager.setSender(sender);
+        if (configurationManager != null) {
+            configurationManager.setSender(sender);
+        }
         controlCmdProcessor.setChannelSender(sender);
 
         try {
@@ -91,11 +87,10 @@
             byte[] domain;
             if (domainParam != null) {
                 domain = ((String) domainParam.getValue()).getBytes();
-                channel.getMembershipService().setDomain(domain);
             } else {
                 domain = "apache.axis2.domain".getBytes();
-                channel.getMembershipService().setDomain(domain);
             }
+            channel.getMembershipService().setDomain(domain);
             DomainFilterInterceptor dfi = new DomainFilterInterceptor();
             dfi.setDomain(domain);
             channel.addInterceptor(dfi);
@@ -111,50 +106,67 @@
             nbc.setPrevious(dfi);
             channel.addInterceptor(nbc);*/
 
+            /*Properties mcastProps = channel.getMembershipService().getProperties();
+            mcastProps.setProperty("mcastPort", "5555");
+            mcastProps.setProperty("mcastAddress", "224.10.10.10");
+            mcastProps.setProperty("mcastClusterDomain", "catalina");
+            mcastProps.setProperty("bindAddress", "localhost");
+            mcastProps.setProperty("memberDropTime", "20000");
+            mcastProps.setProperty("mcastFrequency", "500");
+            mcastProps.setProperty("tcpListenPort", "4000");
+            mcastProps.setProperty("tcpListenHost", "127.0.0.1");*/
+
 //            TcpFailureDetector tcpFailureDetector = new TcpFailureDetector();
 //            tcpFailureDetector.setPrevious(nbc);
 //            channel.addInterceptor(tcpFailureDetector);
 
-            channel.addChannelListener(listener);
-            channel.addChannelListener(channelInfo);
-            channel.addMembershipListener(memberInfo);
+            channel.addChannelListener(channelListener);
             TribesMembershipListener membershipListener = new TribesMembershipListener();
             channel.addMembershipListener(membershipListener);
             channel.start(Channel.DEFAULT);
             sender.setChannel(channel);
-            contextManager.setSender(sender);
-            configurationManager.setSender(sender);
-
-            listener.setContextManager(contextManager);
 
-            Member[] members = channel.getMembers();
-            TribesUtil.printMembers(members);
-
-            // If there is at least one member in the Tribe, get the current state from a member
-            Random random = new Random();
-            int numberOfTries = 0;
-            while (members.length > 0 &&
-                   configurationContext.
-                           getPropertyNonReplicable(ClusteringConstants.
-                                   CLUSTER_INITIALIZED) == null &&
-                                                                numberOfTries < 50){ // Don't keep on trying infinitely
-
-                // While there are members and GetStateResponseCommand is not received do the following
-                try {
-                    members = channel.getMembers();
-                    int memberIndex = random.nextInt(members.length);
-                    sender.sendToMember(new GetStateCommand(), members[memberIndex]);
-                    System.out.println("### WAITING FOR STATE UPDATE");
-                    Thread.sleep(200);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    break;
+            if (contextManager != null) {
+                contextManager.setSender(sender);
+                channelListener.setContextManager(contextManager);
+
+                Member[] members = channel.getMembers();
+                log.info("Local Tribes Member " + channel.getLocalMember(true).getName());
+                TribesUtil.printMembers(members);
+
+                // If there is at least one member in the Tribe, get the current state from a member
+                Random random = new Random();
+                int numberOfTries = 0; // Don't keep on trying infinitely
+
+                // Keep track of members to whom we already sent a GetStateCommand
+                // Do not send another request to these members
+                List sentMembersList = new ArrayList();
+                while (members.length > 0 &&
+                       configurationContext.
+                               getPropertyNonReplicable(ClusteringConstants.CLUSTER_INITIALIZED) == null
+                       && numberOfTries < 50) {
+
+                    // While there are members and GetStateResponseCommand is not received do the following
+                    try {
+                        members = channel.getMembers();
+                        int memberIndex = random.nextInt(members.length);
+                        Member member = members[memberIndex];
+                        if (!sentMembersList.contains(member.getName())) {
+                            sender.sendToMember(new GetStateCommand(), member);
+                            sentMembersList.add(member.getName());
+                            log.debug("WAITING FOR STATE UPDATE...");
+                            Thread.sleep(1000);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        break;
+                    }
+                    numberOfTries ++;
                 }
-                numberOfTries ++;
+                configurationContext.
+                        setNonReplicableProperty(ClusteringConstants.CLUSTER_INITIALIZED,
+                                                 "true");
             }
-            configurationContext.
-                    setNonReplicableProperty(ClusteringConstants.CLUSTER_INITIALIZED,
-                                             "true");
         } catch (ChannelException e) {
             String message = "Error starting Tribes channel";
             throw new ClusteringFault(message, e);
@@ -223,5 +235,15 @@
     public void setConfigurationContext(ConfigurationContext configurationContext) {
         this.configurationContext = configurationContext;
         controlCmdProcessor.setConfigurationContext(configurationContext);
+        if (channelListener != null) {
+            channelListener.setConfigurationContext(configurationContext);
+        }
+    }
+
+    public int getMemberCount() {
+        if (channel != null) {
+            return channel.getMembers().length;
+        }
+        return 0;
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java Sun Jun 10 04:42:12 2007
@@ -17,6 +17,7 @@
 
 import org.apache.axis2.clustering.ClusteringConstants;
 import org.apache.axis2.clustering.ClusteringFault;
+import org.apache.axis2.clustering.control.AckCommand;
 import org.apache.axis2.clustering.control.ControlCommand;
 import org.apache.axis2.clustering.control.GetStateCommand;
 import org.apache.axis2.clustering.control.GetStateResponseCommand;
@@ -58,6 +59,10 @@
             GetStateResponseCommand getStateRespCmd = new GetStateResponseCommand();
             getStateRespCmd.setCommands(((GetStateCommand) command).getCommands());
             channelSender.sendToMember(getStateRespCmd, sender);
+        } else if (command instanceof AckCommand) {
+            AckCommand cmd = (AckCommand) command;
+            cmd.setMemberId(sender.getName());
+            cmd.execute(configurationContext);
         } else {
             command.execute(configurationContext);
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java Sun Jun 10 04:42:12 2007
@@ -17,10 +17,8 @@
 
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.MembershipListener;
-import org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.axis2.context.ConfigurationContext;
 
 /**
  * 
@@ -28,32 +26,14 @@
 public class TribesMembershipListener implements MembershipListener {
 
     private static Log log = LogFactory.getLog(TribesMembershipListener.class);
-//    private ConfigurationContext configContext;
 
     public void memberAdded(Member member) {
-        log.info("New member " + getHostSocket(member) + " added to Tribes group.");
-        /* TODO: Send state information to this member.
-        But if all of the members start sending these messages, there is
-        it is going to be messy. Need to ensure that only one node send this message*/
-
-//        System.err.println("++++++ IS COORD="+TribesClusterManager.nbc.isCoordinator());
+        log.info("New member " + member.getName() + " joined cluster.");
+       //        System.err.println("++++++ IS COORD="+TribesClusterManager.nbc.isCoordinator());
     }
 
     public void memberDisappeared(Member member) {
-        log.info("Member " + getHostSocket(member) + " left Tribes group");
+        log.info("Member " + member.getName() + " left cluster");
 //        System.err.println("++++++ IS COORD="+TribesClusterManager.nbc.isCoordinator());
     }
-
-    private String getHostSocket(Member member) {
-        String host = null;
-        byte[] hostBytes = member.getHost();
-        for (int i = 0; i < hostBytes.length; i++) {
-            host = (host == null) ? ("" + hostBytes[i]) : (host + "." + hostBytes[i]);
-        }
-        return host + ":" + member.getPort();
-    }/*
-
-    public void setConfigContext(ConfigurationContext configContext) {
-        this.configContext = configContext;
-    }*/
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java Sun Jun 10 04:42:12 2007
@@ -30,7 +30,7 @@
         if (members != null) {
             int length = members.length;
             if (length > 0) {
-                log.info("Members of current Tribes...");
+                log.info("Members of current cluster");
                 for (int i = 0; i < length; i++) {
                     byte[] hostBts = members[i].getHost();
                     String host = null;
@@ -39,14 +39,10 @@
                             host = host == null ? ("" + hostBts[j]) : (host + "." + hostBts[j]);
                         }
                     }
-
-                    String port = "" + members[i].getPort();
-                    log.info("Member " + (i + 1) + " NAME:" + members[i].getName() + " HOST:"
-                             + host + "  PORT:" + port);
-
+                    log.info("Member" + (i + 1) + " " + members[i].getName());
                 }
             } else {
-                log.info("No members in current Tribe");
+                log.info("No members in current cluster");
             }
         }
     }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java Sun Jun 10 04:42:12 2007
@@ -68,9 +68,6 @@
         serviceGroupContext1.setProperty(key2, val2);
         serviceContext1.setProperty(key3, val3);
 
-        clusterManager1.getContextManager().addContext(serviceGroupContext1);
-        clusterManager1.getContextManager().addContext(serviceContext1);
-
         clusterManager1.getContextManager().updateContext(configurationContext1);
         clusterManager1.getContextManager().updateContext(serviceGroupContext1);
         clusterManager1.getContextManager().updateContext(serviceContext1);

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/pom.xml?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/pom.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/pom.xml Sun Jun 10 04:42:12 2007
@@ -38,10 +38,6 @@
 			<version>${version}</version>
 		</dependency>
 		<dependency>
-			<groupId>xmlbeans</groupId>
-			<artifactId>xbean</artifactId>
-		</dependency>
-		<dependency>
 			<groupId>xmlunit</groupId>
 			<artifactId>xmlunit</artifactId>
 			<scope>test</scope>

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Sun Jun 10 04:42:12 2007
@@ -208,7 +208,9 @@
     private boolean serverSide = false;
     private boolean generateDeployementDescriptor = true;
     private boolean writeTestCase = false;
-    private boolean writeMessageReceiver = true;
+    private boolean skipMessageReceiver = false;
+    private boolean skipWriteWSDLs = false;
+    private boolean skipBuildXML = false;
     private String packageName = URLProcessor.DEFAULT_PACKAGE;
 
     // Default packClasses is true, which means the classes generated
@@ -413,17 +415,33 @@
         return generateDeployementDescriptor;
     }
 
+
+    public boolean isSkipBuildXML() {
+        return skipBuildXML;
+    }
+
+    public void setSkipBuildXML(boolean skipBuildXML) {
+        this.skipBuildXML = skipBuildXML;
+    }
+
     public boolean isWriteTestCase() {
         return writeTestCase;
     }
 
+    public boolean isSkipWriteWSDLs() {
+        return skipWriteWSDLs;
+    }
+
+    public void setSkipWriteWSDLs(boolean writeWriteWSDLs) {
+        this.skipWriteWSDLs = writeWriteWSDLs;
+    }
 
-    public boolean isWriteMessageReceiver() {
-        return writeMessageReceiver;
+    public boolean isSkipMessageReceiver() {
+        return skipMessageReceiver;
     }
 
-    public void setWriteMessageReceiver(boolean writeMessageReceiver) {
-        this.writeMessageReceiver = writeMessageReceiver;
+    public void setSkipMessageReceiver(boolean skipMessageReceiver) {
+        this.skipMessageReceiver = skipMessageReceiver;
     }
 
     public void setRepositoryPath(String repositoryPath) {

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Sun Jun 10 04:42:12 2007
@@ -62,6 +62,15 @@
         config.setWriteTestCase(loadOption(WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION,
                                            WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION_LONG,
                                            optionMap) != null);
+        config.setSkipWriteWSDLs(loadOption(null,
+                                           WSDL2JavaConstants.NO_WSDLS_OPTION_LONG,
+                                           optionMap) != null);
+        config.setSkipMessageReceiver(loadOption(null,
+                                           WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG,
+                                           optionMap) != null);
+        config.setSkipBuildXML(loadOption(null,
+                                           WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG,
+                                           optionMap) != null);
 
         boolean asyncFlagPresent =
                 (loadOption(WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION,

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties Sun Jun 10 04:42:12 2007
@@ -64,7 +64,7 @@
 # The emiiters need to implement the org.apache.axis2.wsdl.codegen.emitter.Emitter interface
 # Note - The emitters should appear in the lexical order of the languages. So the language java in the above
 # list corresponds to the org.apache.axis2.wsdl.codegen.emitter.JavaEmitter
-codegen.emitters=org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter,org.apache.axis2.wsdl.codegen.emitter.CSharpEmitter,org.apache.axis2.wsdl.codegen.emitter.CEmitter
+codegen.emitters=org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter,org.apache.axis2.wsdl.codegen.emitter.CEmitter
 # Default language, this is the default language that would be picked when no language is specified. it should be
 # one of the languages specified above
 codegen.languages.default=java
@@ -102,18 +102,6 @@
 # file extension for generated files from this language
 java.filename.extension=java
 #
-# ##################################################################################################################
-# C sharp section - Templates
-c-sharp.interface.template=org.apache.axis2.wsdl.codegen.writer.InterfaceWriter,/org/apache/axis2/wsdl/template/csharp/InterfaceTemplate.xsl
-c-sharp.interface.impl.template=org.apache.axis2.wsdl.codegen.writer.InterfaceImplementationWriter,/org/apache/axis2/wsdl/template/csharp/InterfaceImplementationTemplate.xsl
-c-sharp.bean.template=org.apache.axis2.wsdl.codegen.writer.BeanWriter,/org/apache/axis2/wsdl/template/csharp/BeanTemplate.xsl
-c-sharp.callback.template=org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter,/org/apache/axis2/wsdl/template/csharp/CallbackHandlerTemplate.xsl
-c-sharp.skeleton.template=org.apache.axis2.wsdl.codegen.writer.SkeletonWriter,/org/apache/axis2/wsdl/template/csharp/SkeletonTemplate.xsl
-c-sharp.testclass.template=org.apache.axis2.wsdl.codegen.writer.TestClassWriter,/org/apache/axis2/wsdl/template/csharp/TestClassTemplate.xsl
-c-sharp.service.template=org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter,/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
-c-sharp.message.receiver.template=org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter,/org/apache/axis2/wsdl/template/csharp/MessageReceiverTemplate.xsl
-c-sharp.filename.extension=cs
-
 #####################################################################################################################
 # C section  - Templates.
 # The format of the templates is <writer-class-name>,<template-name>

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Sun Jun 10 04:42:12 2007
@@ -10,7 +10,6 @@
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.PolicyInclude;
 import org.apache.axis2.description.WSDL20DefaultValueHolder;
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.util.CommandLineOptionConstants;
@@ -53,8 +52,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Text;
 
-import com.ibm.wsdl.util.xml.DOM2Writer;
-
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -106,7 +103,6 @@
     protected static final String SKELETON_INTERFACE_SUFFIX_BACK = "";
     protected static final String STUB_INTERFACE_SUFFIX_BACK = "Stub";
     protected static final String MESSAGE_RECEIVER_SUFFIX = "MessageReceiver";
-    protected static final String FAULT_SUFFIX = "Exception";
     protected static final String DATABINDING_SUPPORTER_NAME_SUFFIX = "DatabindingSupporter";
 
     protected static Map mepToClassMap;
@@ -380,8 +376,7 @@
                 if (!fullyQualifiedFaultClassNameMap.
                         containsKey(faultMessage.getElementQName())) {
                     //make a name
-                    String className = makeJavaClassName(faultMessage.getName()
-                            + FAULT_SUFFIX);
+                    String className = makeJavaClassName(faultMessage.getName());
                     while (fullyQualifiedFaultClassNameMap.containsValue(className)) {
                         className = makeJavaClassName(className + (uniqueFaultNameCounter++));
                     }
@@ -483,18 +478,19 @@
                 copyMap(originalTypeMap, this.mapper.getAllMappedNames());
             }
 
-            // write an ant build file
-            // Note that ant build is generated only once
-            // and that has to happen here only if the
-            // client side code is required
-            if (!codeGenConfiguration.isGenerateAll()) {
-                //our logic for the build xml is that it will
-                //only be written when not flattened
-                if (!codeGenConfiguration.isFlattenFiles()) {
-                    writeAntBuild();
+            if(!codeGenConfiguration.isSkipBuildXML()){
+                // write an ant build file
+                // Note that ant build is generated only once
+                // and that has to happen here only if the
+                // client side code is required
+                if (!codeGenConfiguration.isGenerateAll()) {
+                    //our logic for the build xml is that it will
+                    //only be written when not flattened
+                    if (!codeGenConfiguration.isFlattenFiles()) {
+                        writeAntBuild();
+                    }
                 }
             }
-
         } catch (CodeGenerationException ce) {
             throw ce;
         } catch (Exception e) {
@@ -1246,15 +1242,19 @@
                     writeSkeleton();
                 }
 
-                // write a MessageReceiver for this particular service.
-                writeMessageReceiver();
+                if(!codeGenConfiguration.isSkipMessageReceiver()){
+                    // write a MessageReceiver for this particular service.
+                    writeMessageReceiver();
+                }
 
                 // write the Exceptions
                 writeExceptions();
 
-                //for the server side codegen
-                //we need to serialize the WSDL's
-                writeWSDLFiles();
+                if(!codeGenConfiguration.isSkipWriteWSDLs()){
+                    //for the server side codegen
+                    //we need to serialize the WSDL's
+                    writeWSDLFiles();
+                }
             }
 
             // save back type map
@@ -1268,10 +1268,12 @@
                 writeServiceXml();
             }
 
-            //write the ant build
-            //we skip this for the flattened case
-            if (!codeGenConfiguration.isFlattenFiles()) {
-                writeAntBuild();
+            if(!codeGenConfiguration.isSkipBuildXML()){
+                //write the ant build
+                //we skip this for the flattened case
+                if (!codeGenConfiguration.isFlattenFiles()) {
+                    writeAntBuild();
+                }
             }
 
 
@@ -1382,32 +1384,29 @@
      * @throws Exception
      */
     protected void writeMessageReceiver() throws Exception {
+        //loop through the meps and generate code for each mep
+        Iterator it = mepToClassMap.keySet().iterator();
+        while (it.hasNext()) {
+            String mep = (String) it.next();
+            Document classModel = createDocumentForMessageReceiver(
+                    mep,
+                    codeGenConfiguration.isServerSideInterface());
+            debugLogDocument("Document for message receiver (mep=" + mep +
+                    "):", classModel);
+            //write the class only if any methods are found
+            if (Boolean.TRUE.equals(infoHolder.get(mep))) {
+                MessageReceiverWriter writer =
+                        new MessageReceiverWriter(
+                                codeGenConfiguration.isFlattenFiles() ?
+                                        getOutputDirectory(
+                                                codeGenConfiguration.getOutputLocation(),
+                                                null) :
+                                        getOutputDirectory(
+                                                codeGenConfiguration.getOutputLocation(),
+                                                codeGenConfiguration.getSourceLocation()),
+                                codeGenConfiguration.getOutputLanguage());
 
-        if (codeGenConfiguration.isWriteMessageReceiver()) {
-            //loop through the meps and generate code for each mep
-            Iterator it = mepToClassMap.keySet().iterator();
-            while (it.hasNext()) {
-                String mep = (String)it.next();
-                Document classModel = createDocumentForMessageReceiver(
-                        mep,
-                        codeGenConfiguration.isServerSideInterface());
-                debugLogDocument("Document for message receiver (mep=" + mep +
-                        "):", classModel);
-                //write the class only if any methods are found
-                if (Boolean.TRUE.equals(infoHolder.get(mep))) {
-                    MessageReceiverWriter writer =
-                            new MessageReceiverWriter(
-                                    codeGenConfiguration.isFlattenFiles() ?
-                                            getOutputDirectory(
-                                                    codeGenConfiguration.getOutputLocation(),
-                                                    null) :
-                                            getOutputDirectory(
-                                                    codeGenConfiguration.getOutputLocation(),
-                                                    codeGenConfiguration.getSourceLocation()),
-                                    codeGenConfiguration.getOutputLanguage());
-
-                    writeClass(classModel, writer);
-                }
+                writeClass(classModel, writer);
             }
         }
     }

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java Sun Jun 10 04:42:12 2007
@@ -13,22 +13,7 @@
 import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
 import org.apache.axis2.wsdl.util.Constants;
 import org.apache.axis2.wsdl.util.MessagePartInformationHolder;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaAll;
-import org.apache.ws.commons.schema.XmlSchemaAny;
-import org.apache.ws.commons.schema.XmlSchemaAttribute;
-import org.apache.ws.commons.schema.XmlSchemaChoice;
-import org.apache.ws.commons.schema.XmlSchemaComplexContent;
-import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
-import org.apache.ws.commons.schema.XmlSchemaContent;
-import org.apache.ws.commons.schema.XmlSchemaContentModel;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaObject;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
-import org.apache.ws.commons.schema.XmlSchemaParticle;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
-import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.ws.commons.schema.*;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
@@ -131,11 +116,24 @@
         XmlSchemaElement schemaElement = message.getSchemaElement();
         XmlSchemaType schemaType = schemaElement.getSchemaType();
 
-
-        handleAllCasesOfComplexTypes(schemaType,
+        if (schemaType instanceof XmlSchemaComplexType){
+             handleAllCasesOfComplexTypes(schemaType,
                                      message,
                                      partNameList,
                                      qnameSuffix);
+        } else if (schemaType instanceof XmlSchemaSimpleType){
+            XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) schemaType;
+            QName opName = ((AxisOperation)message.getParent()).getName();
+            partNameList.add(WSDLUtil.getPartQName(opName.getLocalPart(),
+                                                  qnameSuffix,
+                                                  schemaElement.getQName().getLocalPart()));
+        } else {
+            //we've no idea how to unwrap a non complexType!!!!!!
+            throw new CodeGenerationException(
+                    CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
+                                               "unknown", "complexType"));
+        }
+
 
 
         try {
@@ -182,11 +180,6 @@
             // handle attributes here
             processAttributes(cmplxType, message, partNameList, qnameSuffix);
 
-        } else {
-            //we've no idea how to unwrap a non complexType!!!!!!
-            throw new CodeGenerationException(
-                    CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
-                                               "unknown", "complexType"));
         }
     }
 
@@ -221,8 +214,7 @@
             XmlSchemaComplexContent xmlSchemaComplexContent = (XmlSchemaComplexContent)contentModel;
             XmlSchemaContent content = xmlSchemaComplexContent.getContent();
             if (content instanceof XmlSchemaComplexContentExtension) {
-                XmlSchemaComplexContentExtension schemaExtension =
-                        (XmlSchemaComplexContentExtension)content;
+                XmlSchemaComplexContentExtension schemaExtension =  (XmlSchemaComplexContentExtension)content;
 
                 // process particles inside this extension, if any
                 if (schemaExtension.getParticle() != null) {
@@ -237,23 +229,52 @@
 
                 XmlSchema parentSchema = null;
 
-                for (int i = 0; i < schemasList.size() || parentSchema == null; i++) {
-                    XmlSchema schema = (XmlSchema)schemasList.get(i);
-                    if (schema.getTargetNamespace()
-                            .equals(schemaExtension.getBaseTypeName().getNamespaceURI())) {
-                        parentSchema = schema;
+                XmlSchema schema = null;
+                XmlSchemaType extensionSchemaType = null;
+                for (Iterator iter = schemasList.iterator();iter.hasNext();){
+                    schema = (XmlSchema) iter.next();
+                    extensionSchemaType = getSchemaType(schema, schemaExtension.getBaseTypeName());
+                    if (extensionSchemaType != null){
+                        break;
                     }
                 }
 
                 // ok now we got the parent schema. Now let's get the extension's schema type
 
-                XmlSchemaType extensionSchemaType =
-                        parentSchema.getTypeByName(schemaExtension.getBaseTypeName());
-
                 handleAllCasesOfComplexTypes(extensionSchemaType, message, partNameList,
                                              qnameSuffix);
             }
         }
+    }
+
+    private XmlSchemaType getSchemaType(XmlSchema schema, QName typeName) {
+        XmlSchemaType xmlSchemaType = null;
+        if (schema != null) {
+            xmlSchemaType = schema.getTypeByName(typeName);
+            if (xmlSchemaType == null) {
+                // try to find in an import or an include
+                XmlSchemaObjectCollection includes = schema.getIncludes();
+                if (includes != null) {
+                    Iterator includesIter = includes.getIterator();
+                    Object object = null;
+                    while (includesIter.hasNext()) {
+                        object = includesIter.next();
+                        if (object instanceof XmlSchemaImport) {
+                            XmlSchema schema1 = ((XmlSchemaImport) object).getSchema();
+                            xmlSchemaType = getSchemaType(schema1,typeName);
+                        }
+                        if (object instanceof XmlSchemaInclude) {
+                            XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema();
+                            xmlSchemaType = getSchemaType(schema1,typeName);
+                        }
+                        if (xmlSchemaType != null){
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        return xmlSchemaType;
     }
 
     private void processXMLSchemaSequence(XmlSchemaParticle schemaParticle,

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties Sun Jun 10 04:42:12 2007
@@ -19,7 +19,7 @@
 wsdl2code.arg3=\t  -a                       Generate async style code only (Default: off).
 wsdl2code.arg4=\t  -s                       Generate sync style code only (Default: off). Takes precedence over -a.
 wsdl2code.arg5=\t  -p <pkg1>                Specify a custom package name for the generated code.
-wsdl2code.arg6=\t  -l <language>            Valid languages are java and csharp (Default: java).
+wsdl2code.arg6=\t  -l <language>            Valid languages are java and c (Default: java).
 wsdl2code.arg7=\t  -t                       Generate a test case for the generated code.
 wsdl2code.arg8=\t  -ss                      Generate server side code (i.e. skeletons) (Default: off).
 wsdl2code.arg9=\t  -sd                      Generate service descriptor (i.e. services.xml). (Default: off). Valid with -ss.

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl Sun Jun 10 04:42:12 2007
@@ -28,8 +28,13 @@
 
      <xsl:for-each select="method">
          <xsl:if test="@mep='12'">
+
           <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
-          <xsl:if test="$isSync='1'">
+          <xsl:variable name="outParamType" select="output/param[@location='body']/@type"></xsl:variable>
+          <xsl:variable name="outParamComplexType" select="output/param[@location='body']/@complextype"></xsl:variable>
+          <xsl:variable name="outParamCount" select="count(output/param[@location='body']/param)"></xsl:variable>
+
+        <xsl:if test="$isSync='1'">
         /**
          * Auto generated test method
          */
@@ -165,8 +170,19 @@
         private class <xsl:value-of select="$tempCallbackName"/>  extends <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>{
             public <xsl:value-of select="$tempCallbackName"/>(){ super(null);}
 
-            public void receiveResult<xsl:value-of select="@name"/>(org.apache.axis2.client.async.AsyncResult result) {
-                assertNotNull(result.getResponseEnvelope().getBody().getFirstElement());
+            public void receiveResult<xsl:value-of select="@name"/>(
+                         <xsl:choose>
+                            <xsl:when test="$outParamCount=1">
+                                 <xsl:value-of select="output/param[@location='body']/param/@type"/><xsl:text> </xsl:text>result
+                            </xsl:when>
+                            <xsl:when test="string-length(normalize-space($outParamComplexType)) > 0">
+                                <xsl:value-of select="$outParamComplexType"/><xsl:text> </xsl:text>result
+                            </xsl:when>
+                            <xsl:when test="string-length(normalize-space($outParamType)) > 0">
+                                <xsl:value-of select="$outParamType"/><xsl:text> </xsl:text>result
+                            </xsl:when>
+                        </xsl:choose>) {
+                
             }
 
             public void receiveError<xsl:value-of select="@name"/>(java.lang.Exception e) {

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java Sun Jun 10 04:42:12 2007
@@ -124,7 +124,14 @@
                                     .equalsIgnoreCase(optionType) ||
                             (WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION_LONG)
                                     .equalsIgnoreCase(optionType) ||
-                            (WSDL2JavaConstants.XSDCONFIG_OPTION_LONG).equalsIgnoreCase(optionType)
+                            (WSDL2JavaConstants.XSDCONFIG_OPTION_LONG)
+                                    .equalsIgnoreCase(optionType) ||
+                            (WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG)
+                                    .equalsIgnoreCase(optionType) ||
+                            (WSDL2JavaConstants.NO_WSDLS_OPTION_LONG)
+                                    .equalsIgnoreCase(optionType) ||
+                            (WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG)
+                                    .equalsIgnoreCase(optionType)
                     );
 
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java Sun Jun 10 04:42:12 2007
@@ -70,13 +70,9 @@
                         configContext.getAxisConfiguration().addService(service);
                         OutputStream out =
                                 new FileOutputStream(new File(outLocation, file1.getName()));
-                        service.printWSDL(out, "http://google.com/axis2/services", "services");
+                        service.printWSDL(out, "http://google.com/axis2/services");
                         out.flush();
                         out.close();
-//                        URL wsdlURL = new URL("http://localhost:" + 6060 +
-//                                "/axis2/services/" + service.getName() + "?wsdl");
-//                        builder = new WSDL11ToAxisServiceBuilder(wsdlURL.openStream(), null, null);
-//                        service = builder.populateService();
                         configContext.getAxisConfiguration().removeService(service.getName());
                     } catch (Exception e) {
                         System.out.println("Error in WSDL : " + file1.getName());

Modified: webservices/axis2/branches/java/jaxws21/modules/integration/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/integration/conf/axis2.xml?view=diff&rev=545866&r1=545865&r2=545866
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/integration/conf/axis2.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/integration/conf/axis2.xml Sun Jun 10 04:42:12 2007
@@ -212,6 +212,7 @@
             <handler name="SOAPMessageBodyBasedDispatcher"
                      class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"/>
         </phase>
+        <phase name="RMPhase"/>
         <!--  System pre defined phases       -->
         <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
         <phase name="OperationInPhase"/>
@@ -221,6 +222,7 @@
         <phase name="OperationOutPhase"/>
         <!--system predefined phase-->
         <!--these phase will run irrespective of the service-->
+        <phase name="RMPhase"/>
         <phase name="PolicyDetermination"/>
         <phase name="MessageOut"/>
         <phase name="Security"/>
@@ -242,12 +244,14 @@
             <handler name="SOAPMessageBodyBasedDispatcher"
                      class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"/>
         </phase>
+        <phase name="RMPhase"/>
         <!--      user can add his own phases to this area  -->
         <phase name="OperationInFaultPhase"/>
     </phaseOrder>
     <phaseOrder type="OutFaultFlow">
         <!--      user can add his own phases to this area  -->
         <phase name="OperationOutFaultPhase"/>
+        <phase name="RMPhase"/>
         <phase name="PolicyDetermination"/>
         <phase name="MessageOut"/>
     </phaseOrder>



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