cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r527347 - in /incubator/cxf/trunk: rt/bindings/object/ rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ rt/bindings/object/src/main/resources/META-INF/cxf/ rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ rt/co...
Date Wed, 11 Apr 2007 00:17:39 GMT
Author: dandiep
Date: Tue Apr 10 17:17:37 2007
New Revision: 527347

URL: http://svn.apache.org/viewvc?view=rev&rev=527347
Log:
o Switch the tools plugin files to allow multiple plugins within a single
  file. This makes it easier to combine mutliple tools.xml files for the
  bundle jar which we are (hopefully) producing.
  Tools people: please let me know if this is an OK thing to do!
o Add a LocalServerListener class which can auto-register a local endpoint
  when any server is registered. The endpoint URL becomse local:// +
  server.toString(); This is turned off by default right now, but it my
  be good to turn on by default. Feedback welcome.
o Add the ability to configure which message properties are filtered within
  the LocalTransport for the direct dispatch case.


Added:
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/LocalServerListener.java   (with props)
    incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java   (with props)
Modified:
    incubator/cxf/trunk/rt/bindings/object/pom.xml
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfiguration.java
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectDispatchInInterceptor.java
    incubator/cxf/trunk/rt/bindings/object/src/main/resources/META-INF/cxf/cxf-extension-object-binding.xml
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/OutgoingChainInterceptorTest.java
    incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
    incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
    incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/resources/schemas/plugin.xsd
    incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/resources/META-INF/tools-plugin.xml
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-plugin.xml
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java

Modified: incubator/cxf/trunk/rt/bindings/object/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/pom.xml?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/pom.xml (original)
+++ incubator/cxf/trunk/rt/bindings/object/pom.xml Tue Apr 10 17:17:37 2007
@@ -61,6 +61,12 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

Added: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/LocalServerListener.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/LocalServerListener.java?view=auto&rev=527347
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/LocalServerListener.java (added)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/LocalServerListener.java Tue Apr 10 17:17:37 2007
@@ -0,0 +1,138 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.object;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.BindingFactory;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerLifeCycleListener;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.transport.local.LocalTransportFactory;
+
+public class LocalServerListener implements ServerLifeCycleListener {
+    private static final Logger LOG = LogUtils.getL7dLogger(LocalServerListener.class);
+
+    private DestinationFactory destinationFactory;
+    private BindingFactory bindingFactory;
+    private ObjectBindingConfiguration configuration = new ObjectBindingConfiguration();
+    private Bus bus;
+
+    public LocalServerListener(Bus bus,
+                               BindingFactory bindingFactory) {
+        super();
+        this.bindingFactory = bindingFactory;
+        this.bus = bus;
+    }
+    
+    public void startServer(Server server) {
+        Endpoint endpoint = server.getEndpoint();
+        Service service = endpoint.getService();
+
+        // synthesize a new binding
+        BindingInfo bi = bindingFactory.createBindingInfo(service, 
+                                                          ObjectBindingFactory.BINDING_ID, 
+                                                          configuration);
+        
+        Binding binding = bindingFactory.createBinding(bi);
+        
+        String uri = "local://" + server.toString();
+        EndpointInfo ei = new EndpointInfo();
+        ei.setAddress(uri);
+        
+        try {
+            // Register a new Destination locally for the Server
+            Destination destination = getDestinationFactory().getDestination(ei);
+            
+            destination.setMessageObserver(new OverrideBindingObserver(endpoint, binding, bus));
+        } catch (IOException e1) {
+            LOG.log(Level.WARNING, "Could not create local destination.", e1);
+        }
+    }
+
+    public void stopServer(Server server) {
+        String uri = "local://" + server.toString();
+        EndpointInfo ei = new EndpointInfo();
+        ei.setAddress(uri);
+        
+        try {
+            Destination destination = getDestinationFactory().getDestination(ei);
+            
+            destination.shutdown();
+        } catch (IOException e) {
+            LOG.log(Level.WARNING, "Could not shutdown local destination.", e);
+        }
+        
+    }
+
+    public DestinationFactory getDestinationFactory() {
+        if (destinationFactory == null) {
+            retrieveDF();
+        }
+        return destinationFactory;
+    }
+    
+    private synchronized void retrieveDF() {
+        if (destinationFactory == null) {
+            DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+            try {
+                destinationFactory = dfm.getDestinationFactory(LocalTransportFactory.TRANSPORT_ID);
+            } catch (BusException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public ObjectBindingConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(ObjectBindingConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    public static class OverrideBindingObserver extends ChainInitiationObserver {
+
+        private Binding binding;
+
+        public OverrideBindingObserver(Endpoint endpoint, Binding binding, Bus bus) {
+            super(endpoint, bus);
+            this.binding = binding;
+        }
+
+        @Override
+        protected Binding getBinding() {
+            return binding;
+        }
+        
+    }
+}

Propchange: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/LocalServerListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/LocalServerListener.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/LocalServerListener.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfiguration.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfiguration.java (original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfiguration.java Tue Apr 10 17:17:37 2007
@@ -23,7 +23,7 @@
 import org.apache.cxf.binding.BindingConfiguration;
 
 public class ObjectBindingConfiguration extends BindingConfiguration {
-    private boolean stopAfterLogicalPhases = true;
+    private boolean nonLogicalPhasesEnabled = true;
     private Set<String> skipPhases;
     
     @Override
@@ -39,12 +39,12 @@
         this.skipPhases = skipPhases;
     }
 
-    public boolean isStopAfterLogicalPhases() {
-        return stopAfterLogicalPhases;
+    public boolean isNonLogicalPhasesEnabled() {
+        return nonLogicalPhasesEnabled;
     }
 
-    public void setStopAfterLogicalPhases(boolean stopAfterLogicalPhases) {
-        this.stopAfterLogicalPhases = stopAfterLogicalPhases;
+    public void setNonLogicalPhasesEnabled(boolean nonLogicalPhasesEnabled) {
+        this.nonLogicalPhasesEnabled = nonLogicalPhasesEnabled;
     }
     
 }

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java Tue Apr 10 17:17:37 2007
@@ -20,11 +20,14 @@
 
 import java.util.Collection;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
+import org.apache.cxf.endpoint.ServerLifeCycleManager;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.OperationInfo;
@@ -32,10 +35,14 @@
 
 public class ObjectBindingFactory extends AbstractBindingFactory {
     public static final String BINDING_ID = "http://cxf.apache.org/binding/object";
-    public static final String STOP_AFTER_LOGICAL  = "objectBinding.stopAfterLogical";
+    public static final String RUN_NON_LOGICAL  = "objectBinding.stopAfterLogical";
     
     private Collection<String> activationNamespaces;    
-
+    private Bus bus;
+    private boolean autoRegisterLocalEndpoint;
+    private boolean initialized = true;
+    private LocalServerListener listener;
+    
     public Collection<String> getActivationNamespaces() {
         return activationNamespaces;
     }
@@ -44,7 +51,24 @@
     public void setActivationNamespaces(Collection<String> ans) {
         activationNamespaces = ans;
     }
+    
+    @Resource(name = "bus")
+    public void setBus(Bus bus) {
+        this.bus = bus;
+    }
 
+    @PostConstruct
+    public void initialize() {
+        if (autoRegisterLocalEndpoint) {
+            ServerLifeCycleManager manager = bus.getExtension(ServerLifeCycleManager.class);
+            if (manager != null) {
+                listener = new LocalServerListener(bus, this);
+                manager.registerListener(listener);
+            }
+        }
+        initialized = true;
+    }
+    
     public Binding createBinding(BindingInfo bi) {
         ObjectBinding binding = new ObjectBinding();
         binding.getOutInterceptors().add(new ObjectDispatchOutInterceptor());
@@ -59,7 +83,7 @@
         if (config instanceof ObjectBindingConfiguration) {
             ObjectBindingConfiguration c = (ObjectBindingConfiguration) config;
             
-            info.setProperty(STOP_AFTER_LOGICAL, c.isStopAfterLogicalPhases());
+            info.setProperty(RUN_NON_LOGICAL, c.isNonLogicalPhasesEnabled());
         }
         
         info.setName(new QName(si.getName().getNamespaceURI(), 
@@ -70,6 +94,19 @@
             info.addOperation(bop);
         }
         return info;
+    }
+
+    public boolean isAutoRegisterLocalEndpoint() {
+        return autoRegisterLocalEndpoint;
+    }
+
+    public void setAutoRegisterLocalEndpoint(boolean autoRegisterLocalEndpoint) {
+        this.autoRegisterLocalEndpoint = autoRegisterLocalEndpoint;
+        
+        if (initialized && listener == null) {
+            // register the lifecycle listener
+            initialize();
+        }
     }
 
 }

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectDispatchInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectDispatchInInterceptor.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectDispatchInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectDispatchInInterceptor.java Tue Apr 10 17:17:37 2007
@@ -50,14 +50,17 @@
         if (opName == null) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION", BUNDLE));
         }
+
+        Endpoint ep = message.getExchange().get(Endpoint.class);
+        
+        BindingInfo binding = null;
         
         if (bindingName == null) {
-            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_BINDING", BUNDLE));
+            binding = ep.getEndpointInfo().getBinding(); 
+        } else {
+            binding = ep.getService().getServiceInfo().getBinding(bindingName);
         }
         
-        Endpoint ep = message.getExchange().get(Endpoint.class);
-        
-        BindingInfo binding = ep.getService().getServiceInfo().getBinding(bindingName);
         BindingOperationInfo bop = binding.getOperation(opName);
         
         message.getExchange().put(BindingOperationInfo.class, bop);

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/resources/META-INF/cxf/cxf-extension-object-binding.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/resources/META-INF/cxf/cxf-extension-object-binding.xml?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/resources/META-INF/cxf/cxf-extension-object-binding.xml (original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/resources/META-INF/cxf/cxf-extension-object-binding.xml Tue Apr 10 17:17:37 2007
@@ -25,7 +25,8 @@
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
 	<bean class="org.apache.cxf.binding.object.ObjectBindingFactory"
-		lazy-init="true">
+		lazy-init="true" depends-on="org.apache.cxf.endpoint.ServerLifeCycleManager" >
+		<property name="bus" ref="cxf"/>
 		<property name="activationNamespaces">
 			<set>
 				<value>http://cxf.apache.org/binding/object</value>

Added: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java?view=auto&rev=527347
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java (added)
+++ incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java Tue Apr 10 17:17:37 2007
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.object;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.BusException;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.test.AbstractCXFTest;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.local.LocalConduit;
+import org.apache.cxf.transport.local.LocalTransportFactory;
+import org.junit.Test;
+
+public class LocalServerRegistrationTest extends AbstractCXFTest {
+    private Message response;
+
+    @Test
+    public void testServer() throws Exception {
+        // Enable the auto registration of a default local endpoint when we use other transports
+        BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
+        ObjectBindingFactory obj = (ObjectBindingFactory)
+            bfm.getBindingFactory(ObjectBindingFactory.BINDING_ID);
+        obj.setAutoRegisterLocalEndpoint(true);
+        
+        // Create an HTTP endpoint
+        ServerFactoryBean sfb = new ServerFactoryBean();
+        sfb.setServiceClass(EchoImpl.class);
+        sfb.setAddress("http://localhost:9001/echo");
+        Server server = sfb.create();
+
+        List<Object> content = new ArrayList<Object>();
+        content.add("Hello");
+
+        ServiceInfo serviceInfo = server.getEndpoint().getService().getServiceInfo();
+        BindingInfo bi = serviceInfo.getBindings().iterator().next();
+        BindingOperationInfo bop = bi.getOperations().iterator().next();
+
+        assertNotNull(bop.getOperationInfo());
+
+        MessageImpl m = new MessageImpl();
+        m.setContent(List.class, content);
+        m.put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+        m.put(ObjectBinding.BINDING, bop.getBinding().getName());
+        m.put(ObjectBinding.OPERATION, bop.getName());
+
+        ExchangeImpl ex = new ExchangeImpl();
+        ex.setInMessage(m);
+
+        Conduit c = getLocalConduit("local://" + server);
+        m.setConduit(c);
+
+        c.setMessageObserver(new MessageObserver() {
+            public void onMessage(Message message) {
+                response = message;
+            }
+        });
+        c.prepare(m);
+        c.close(m);
+        
+        Thread.sleep(1000);
+        assertNotNull(response);
+
+        List<?> content2 = CastUtils.cast((List<?>)response.getContent(List.class));
+        assertNotNull(content2);
+        assertEquals(1, content2.size());
+
+    }
+
+    private Conduit getLocalConduit(String string) throws BusException, IOException {
+        ConduitInitiatorManager cim = getBus().getExtension(ConduitInitiatorManager.class);
+
+        ConduitInitiator ci = cim.getConduitInitiator(LocalTransportFactory.TRANSPORT_ID);
+        EndpointInfo ei = new EndpointInfo();
+        ei.setAddress(string);
+        return ci.getConduit(ei);
+    }
+}

Propchange: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java Tue Apr 10 17:17:37 2007
@@ -25,6 +25,7 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.binding.Binding;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -87,6 +88,7 @@
     
     public static InterceptorChain getOutInterceptorChain(Exchange ex) {
         Bus bus = ex.get(Bus.class);
+        Binding binding = ex.get(Binding.class);
         PhaseManager pm = bus.getExtension(PhaseManager.class);
         PhaseInterceptorChain chain = new PhaseInterceptorChain(pm.getOutPhases());
         
@@ -106,8 +108,8 @@
             LOG.fine("Interceptors contributed by bus: " + il);
         }
         chain.add(il);        
-        if (ep.getBinding() != null) {
-            il = ep.getBinding().getOutInterceptors();
+        if (binding != null) {
+            il = binding.getOutInterceptors();
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("Interceptors contributed by binding: " + il);
             }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java Tue Apr 10 17:17:37 2007
@@ -24,6 +24,7 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.binding.Binding;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -50,11 +51,11 @@
             return;
         }
         
-        Endpoint ep = ex.get(Endpoint.class);
+        Binding binding = ex.get(Binding.class);
         
         Message outMessage = message.getExchange().getOutMessage();
         if (outMessage == null) {
-            outMessage = ep.getBinding().createMessage();
+            outMessage = binding.createMessage();
             ex.setOutMessage(outMessage);
         }
         
@@ -62,7 +63,7 @@
 
         Message faultMessage = message.getExchange().getOutFaultMessage();
         if (faultMessage == null) {
-            faultMessage = ep.getBinding().createMessage();            
+            faultMessage = binding.createMessage();            
             ex.setOutFaultMessage(faultMessage);
         }
         outMessage.setInterceptorChain(getOutInterceptorChain(ex));
@@ -70,6 +71,7 @@
     
     public static InterceptorChain getOutInterceptorChain(Exchange ex) {
         Bus bus = ex.get(Bus.class);
+        Binding binding = ex.get(Binding.class);
         PhaseManager pm = bus.getExtension(PhaseManager.class);
         PhaseInterceptorChain chain = new PhaseInterceptorChain(pm.getOutPhases());
         
@@ -89,8 +91,8 @@
             LOG.fine("Interceptors contributed by bus: " + il);
         }
         chain.add(il);        
-        if (ep.getBinding() != null) {
-            il = ep.getBinding().getOutInterceptors();
+        if (binding != null) {
+            il = binding.getOutInterceptors();
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("Interceptors contributed by binding: " + il);
             }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java Tue Apr 10 17:17:37 2007
@@ -40,7 +40,7 @@
     }
 
     public void onMessage(Message m) {
-        Message message = endpoint.getBinding().createMessage(m);
+        Message message = getBinding().createMessage(m);
         Exchange exchange = message.getExchange();
         if (exchange == null) {
             exchange = new ExchangeImpl();
@@ -49,25 +49,34 @@
         setExchangeProperties(exchange, message);
         
         // setup chain
-        PhaseInterceptorChain chain = new PhaseInterceptorChain(bus.getExtension(PhaseManager.class)
-            .getInPhases());
+        PhaseInterceptorChain chain = createChain();
         
         message.setInterceptorChain(chain);
         
         chain.add(bus.getInInterceptors());
         chain.add(endpoint.getInInterceptors());
-        chain.add(endpoint.getBinding().getInInterceptors());
+        chain.add(getBinding().getInInterceptors());
         chain.add(endpoint.getService().getInInterceptors());
 
         chain.setFaultObserver(endpoint.getOutFaultObserver());
        
         chain.doIntercept(message);        
     }
+
+    protected PhaseInterceptorChain createChain() {
+        PhaseInterceptorChain chain = new PhaseInterceptorChain(bus.getExtension(PhaseManager.class)
+            .getInPhases());
+        return chain;
+    }
+
+    protected Binding getBinding() {
+        return endpoint.getBinding();
+    }
     
     protected void setExchangeProperties(Exchange exchange, Message m) {
         exchange.put(Endpoint.class, endpoint);
         exchange.put(Service.class, endpoint.getService());
-        exchange.put(Binding.class, endpoint.getBinding());
+        exchange.put(Binding.class, getBinding());
         exchange.put(Bus.class, bus);
         if (exchange.getDestination() == null) {
             exchange.setDestination(m.getDestination());

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/OutgoingChainInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/OutgoingChainInterceptorTest.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/OutgoingChainInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/OutgoingChainInterceptorTest.java Tue Apr 10 17:17:37 2007
@@ -106,6 +106,7 @@
         m.setExchange(exchange);
         exchange.put(Bus.class, bus);
         exchange.put(Endpoint.class, endpoint);
+        exchange.put(Binding.class, binding);
         exchange.put(BindingOperationInfo.class, bopInfo);
         exchange.setOutMessage(m);
         setupIntc.handleMessage(m);

Modified: incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java (original)
+++ incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java Tue Apr 10 17:17:37 2007
@@ -23,10 +23,13 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PipedInputStream;
+import java.util.Map;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import org.apache.cxf.attachment.CachedOutputStream;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.io.AbstractCachedOutputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
@@ -40,14 +43,17 @@
     public static final String RESPONSE_CONDUIT = LocalConduit.class.getName() + ".inConduit";
     public static final String IN_EXCHANGE = LocalConduit.class.getName() + ".inExchange";
     public static final String DIRECT_DISPATCH = LocalConduit.class.getName() + ".directDispatch";
+    public static final String MESSAGE_FILTER_PROPERTIES = LocalConduit.class.getName() + ".filterProperties";
 
     private static final Logger LOG = LogUtils.getL7dLogger(LocalConduit.class);
     
     private LocalDestination destination;
+    private LocalTransportFactory transportFactory;
 
-    public LocalConduit(LocalDestination destination) {
+    public LocalConduit(LocalTransportFactory transportFactory, LocalDestination destination) {
         super(destination.getAddress());
         this.destination = destination;
+        this.transportFactory = transportFactory;
     }
     
     public void prepare(final Message message) throws IOException {
@@ -75,10 +81,7 @@
         copy.put(IN_CONDUIT, this);
         copy.setDestination(destination);
         
-        // copy all the contents
-        copy.putAll(message);
-        MessageImpl.copyContent(message, copy);
-        copy.remove(Message.REQUESTOR_ROLE);
+        copy(message, copy, transportFactory.getMessageFilterProperties());
         
         // Create a new incoming exchange and store the original exchange for the response
         ExchangeImpl ex = new ExchangeImpl();
@@ -87,6 +90,22 @@
         ex.setDestination(destination);
         
         destination.getMessageObserver().onMessage(copy);
+    }
+
+    public static void copy(Message message, MessageImpl copy, Set<String> defaultFilter) {
+        Set<String> filter = CastUtils.cast((Set)message.get(MESSAGE_FILTER_PROPERTIES));
+        if (filter == null) {
+            filter = defaultFilter;
+        }
+        
+        // copy all the contents
+        for (Map.Entry<String, Object> e : message.entrySet()) {
+            if (!filter.contains(e.getKey())) {
+                copy.put(e.getKey(), e.getValue());
+            }
+        }
+        
+        MessageImpl.copyContent(message, copy);
     }
 
     private void dispatchViaPipe(final Message message) throws IOException {

Modified: incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java Tue Apr 10 17:17:37 2007
@@ -74,9 +74,32 @@
         }
 
         public void prepare(final Message message) throws IOException {
-            final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE);
-            
+            if (!Boolean.TRUE.equals(message.get(LocalConduit.DIRECT_DISPATCH))) {
+                final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE);
+                
+                final PipedInputStream stream = new PipedInputStream();
+                final Runnable receiver = new Runnable() {
+                    public void run() {
+                        MessageImpl m = new MessageImpl();
+                        if (exchange != null) {
+                            exchange.setInMessage(m);
+                        }
+                        m.setContent(InputStream.class, stream);
+                        conduit.getMessageObserver().onMessage(m);
+                    }
+                };
+    
+                PipedOutputStream outStream = new PipedOutputStream(stream);
+                message.setContent(OutputStream.class, outStream);
+    
+                new Thread(receiver).start();
+            }
+        }
+
+        @Override
+        public void close(Message message) throws IOException {
             if (Boolean.TRUE.equals(message.get(LocalConduit.DIRECT_DISPATCH))) {
+                final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE);
                 MessageImpl copy = new MessageImpl();
                 copy.putAll(message);
                 MessageImpl.copyContent(message, copy);
@@ -88,23 +111,8 @@
                 conduit.getMessageObserver().onMessage(copy);
                 return;
             }
-
-            final PipedInputStream stream = new PipedInputStream();
-            final Runnable receiver = new Runnable() {
-                public void run() {
-                    MessageImpl m = new MessageImpl();
-                    if (exchange != null) {
-                        exchange.setInMessage(m);
-                    }
-                    m.setContent(InputStream.class, stream);
-                    conduit.getMessageObserver().onMessage(m);
-                }
-            };
-
-            PipedOutputStream outStream = new PipedOutputStream(stream);
-            message.setContent(OutputStream.class, outStream);
-
-            new Thread(receiver).start();
+            
+            super.close(message);
         }
 
         protected Logger getLogger() {

Modified: incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java Tue Apr 10 17:17:37 2007
@@ -31,6 +31,7 @@
 import javax.annotation.Resource;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.AbstractTransportFactory;
 import org.apache.cxf.transport.Conduit;
@@ -54,12 +55,17 @@
     
     private Map<String, Destination> destinations = new HashMap<String, Destination>();
     private Bus bus;
-     
+
+    private Set<String> messageFilterProperties;
+    
     public LocalTransportFactory() {
         super();
         List<String> ids = new ArrayList<String>();
         ids.add(TRANSPORT_ID);
         setTransportIds(ids);
+        
+        messageFilterProperties = new HashSet<String>();
+        messageFilterProperties.add(Message.REQUESTOR_ROLE);
     }
     
     @Resource(name = "bus")
@@ -96,11 +102,11 @@
     }
 
     public Conduit getConduit(EndpointInfo ei) throws IOException {
-        return new LocalConduit((LocalDestination)getDestination(ei));
+        return new LocalConduit(this, (LocalDestination)getDestination(ei));
     }
 
     public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target) throws IOException {
-        return new LocalConduit((LocalDestination)getDestination(ei, target));
+        return new LocalConduit(this, (LocalDestination)getDestination(ei, target));
     }
 
     EndpointReferenceType createReference(EndpointInfo ei) {
@@ -113,6 +119,14 @@
 
     public Set<String> getUriPrefixes() {
         return URI_PREFIXES;
+    }
+
+    public Set<String> getMessageFilterProperties() {
+        return messageFilterProperties;
+    }
+
+    public void setMessageFilterProperties(Set<String> messageFilterProperties) {
+        this.messageFilterProperties = messageFilterProperties;
     }
 
 }

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java Tue Apr 10 17:17:37 2007
@@ -27,14 +27,15 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+
 import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 
@@ -48,6 +49,7 @@
 import org.apache.cxf.tools.plugin.FrontEnd;
 import org.apache.cxf.tools.plugin.Generator;
 import org.apache.cxf.tools.plugin.Plugin;
+import org.apache.cxf.tools.plugin.Plugins;
 
 public final class PluginLoader {
     public static final Logger LOG = LogUtils.getL7dLogger(PluginLoader.class);
@@ -55,7 +57,7 @@
     private static PluginLoader pluginLoader;
     private static final String PLUGIN_FILE_NAME = "META-INF/tools-plugin.xml";
     
-    private Map<String, Plugin> plugins = new LinkedHashMap<String, Plugin>();
+    private Map<String, Collection<Plugin>> plugins = new LinkedHashMap<String, Collection<Plugin>>();
 
     private Map<String, FrontEnd> frontends = new LinkedHashMap<String, FrontEnd>();
     private Map<String, FrontEndProfile> frontendProfiles = new LinkedHashMap<String, FrontEndProfile>();
@@ -103,7 +105,7 @@
     public void loadPlugin(URL url) throws IOException {
         try {
             LOG.log(Level.INFO, "PLUGIN_LOADING", url);
-            loadPlugin(getPlugin(url));
+            loadPlugins(getPlugins(url));
         } catch (JAXBException e) {
             Message msg = new Message("PLUGIN_LOAD_FAIL", LOG, url);
             LOG.log(Level.SEVERE, msg.toString());
@@ -114,7 +116,7 @@
     public void loadPlugin(String resource) {
         try {
             LOG.log(Level.INFO, "PLUGIN_LOADING", resource);
-            loadPlugin(getPlugin(resource));
+            loadPlugins(getPlugins(resource));
         } catch (JAXBException e) {
             Message msg = new Message("PLUGIN_LOAD_FAIL", LOG, resource);
             LOG.log(Level.SEVERE, msg.toString());
@@ -127,6 +129,12 @@
 
     }
     
+    protected void loadPlugins(Collection<Plugin> ps) {
+        for (Plugin p : ps) {
+            loadPlugin(p);
+        }
+    }
+    
     protected void loadPlugin(Plugin plugin) {
         if (plugin.getFrontend().size() > 0) {
             LOG.log(Level.INFO, "FOUND_FRONTENDS", new Object[]{plugin.getName(),
@@ -170,28 +178,29 @@
         }
     }
 
-    protected Plugin getPlugin(URL url) throws IOException, JAXBException, FileNotFoundException {
-        Plugin plugin = plugins.get(url.getFile());
+    protected Collection<Plugin> getPlugins(URL url) 
+        throws IOException, JAXBException, FileNotFoundException {
+        Collection<Plugin> p = plugins.get(url.getFile());
         InputStream is = null;
-        if (plugin == null) {
+        if (p == null) {
             is = url.openStream();
-            plugin = getPlugin(is);
-            if (plugin == null || StringUtils.isEmpty(plugin.getName())) {
+            p = getPlugins(is);
+            if (p == null) {
                 Message msg = new Message("PLUGIN_LOAD_FAIL", LOG, url);
                 LOG.log(Level.SEVERE, msg.toString());
                 throw new ToolException(msg);
             }
-            plugins.put(url.getFile(), plugin);
+            plugins.put(url.getFile(), p);
         }        
         if (is == null) {
-            return getPlugin(url.getFile());
+            return getPlugins(url.getFile());
         }
-        return plugin;
+        return p;
     }
     
-    protected Plugin getPlugin(String resource) throws JAXBException, FileNotFoundException {
-        Plugin plugin = plugins.get(resource);
-        if (plugin == null) {
+    protected Collection<Plugin> getPlugins(String resource) throws JAXBException, FileNotFoundException {
+        Collection<Plugin> p = plugins.get(resource);
+        if (p == null) {
             InputStream is = null;
             if (new File(resource).exists()) {
                 is = new BufferedInputStream(new FileInputStream(new File(resource)));
@@ -204,19 +213,23 @@
                 LOG.log(Level.SEVERE, msg.toString());
                 throw new ToolException(msg);
             }
-            plugin = getPlugin(is);
-            if (plugin == null || StringUtils.isEmpty(plugin.getName())) {
+            p = getPlugins(is);
+            if (p == null) {
                 Message msg = new Message("PLUGIN_LOAD_FAIL", LOG, resource);
                 LOG.log(Level.SEVERE, msg.toString());
                 throw new ToolException(msg);
             }
-            plugins.put(resource, plugin);
+            plugins.put(resource, p);
         }
-        return plugin;
+        return p;
     }
 
-    private Plugin getPlugin(InputStream is) throws JAXBException {
-        return (Plugin) ((JAXBElement<?>)unmarshaller.unmarshal(is)).getValue();
+    private Collection<Plugin> getPlugins(InputStream is) throws JAXBException {
+        Plugins ps = (Plugins) unmarshaller.unmarshal(is);
+        if (ps != null) {
+            return ps.getPlugin();
+        }
+        return null;
     }
 
     public FrontEnd getFrontEnd(String name) {
@@ -417,7 +430,7 @@
         return this.databindings;
     }
 
-    public Map<String, Plugin> getPlugins() {
+    public Map<String, Collection<Plugin>> getPlugins() {
         return this.plugins;
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/resources/schemas/plugin.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/resources/schemas/plugin.xsd?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/resources/schemas/plugin.xsd (original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/resources/schemas/plugin.xsd Tue Apr 10 17:17:37 2007
@@ -1,63 +1,74 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
-	   xmlns="http://cxf.apache.org/tools/plugin" 
-	   targetNamespace="http://cxf.apache.org/tools/plugin" 
-	   elementFormDefault="qualified">
-
-    <xs:complexType name="DataBinding">
-	<xs:attribute name="name" type="xs:string" use="required"/>
-	<xs:attribute name="package" type="xs:string" use="required"/>
-	<xs:attribute name="profile" type="xs:string" use="required"/>
-    </xs:complexType>
-    
-    <xs:complexType name="FrontEnd">
-	<xs:sequence>
-	    <xs:element name="generators" type="Generators"/>
-	    <xs:element name="processor" type="Processor" maxOccurs="1" minOccurs="1"/>
-	    <xs:element name="container" type="Container" maxOccurs="1" minOccurs="1"/>
-	    <xs:element name="builder" type="Builder" maxOccurs="1"/>
-	</xs:sequence>
-	<xs:attribute name="name" type="xs:string" use="required"/>
-	<xs:attribute name="package" type="xs:string" use="required"/>
-	<xs:attribute name="profile" type="xs:string" use="required"/>
-    </xs:complexType>
-    
-    <xs:element name="generator" type="Generator"/>
-    <xs:complexType name="Generator">
-	<xs:attribute name="name" type="xs:string" use="required"/>
-	<xs:attribute name="package" type="xs:string"/>
-    </xs:complexType>
-    <xs:complexType name="Processor">
-	<xs:attribute name="name" type="xs:string" use="required"/>
-	<xs:attribute name="package" type="xs:string"/>
-    </xs:complexType>
-    <xs:complexType name="Builder">
-	<xs:attribute name="name" type="xs:string" use="required"/>
-	<xs:attribute name="package" type="xs:string"/>
-    </xs:complexType>
-    <xs:complexType name="Container">
-	<xs:attribute name="name" type="xs:string" use="required"/>
-	<xs:attribute name="package" type="xs:string"/>
-	<xs:attribute name="toolspec" type="xs:string" use="required"/>
-    </xs:complexType>
-
-    <xs:complexType name="Generators">
-	<xs:sequence>
-	    <xs:element ref="generator" maxOccurs="unbounded"/>
-	</xs:sequence>
-	<xs:attribute name="package" type="xs:string"/>
-    </xs:complexType>
-
-    <xs:element name="plugin" type="Plugin"/>
-    <xs:complexType name="Plugin">
-	<xs:sequence>
-	    <xs:element name="frontend" type="FrontEnd" maxOccurs="unbounded"/>
-	    <xs:element name="databinding" type="DataBinding" maxOccurs="unbounded"/>
-	</xs:sequence>
-	<xs:attribute name="name" type="xs:string" use="required"/>
-	<xs:attribute name="version" type="xs:string" use="required"/>
-	<xs:attribute name="provider" type="xs:string" use="required"/>
-    </xs:complexType>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns="http://cxf.apache.org/tools/plugin"
+	targetNamespace="http://cxf.apache.org/tools/plugin"
+	elementFormDefault="qualified">
 
+	<xs:complexType name="DataBinding">
+		<xs:attribute name="name" type="xs:string" use="required" />
+		<xs:attribute name="package" type="xs:string" use="required" />
+		<xs:attribute name="profile" type="xs:string" use="required" />
+	</xs:complexType>
+
+	<xs:complexType name="FrontEnd">
+		<xs:sequence>
+			<xs:element name="generators" type="Generators" />
+			<xs:element name="processor" type="Processor" maxOccurs="1"
+				minOccurs="1" />
+			<xs:element name="container" type="Container" maxOccurs="1"
+				minOccurs="1" />
+			<xs:element name="builder" type="Builder" maxOccurs="1" />
+		</xs:sequence>
+		<xs:attribute name="name" type="xs:string" use="required" />
+		<xs:attribute name="package" type="xs:string" use="required" />
+		<xs:attribute name="profile" type="xs:string" use="required" />
+	</xs:complexType>
+
+	<xs:element name="generator" type="Generator" />
+	<xs:complexType name="Generator">
+		<xs:attribute name="name" type="xs:string" use="required" />
+		<xs:attribute name="package" type="xs:string" />
+	</xs:complexType>
+	<xs:complexType name="Processor">
+		<xs:attribute name="name" type="xs:string" use="required" />
+		<xs:attribute name="package" type="xs:string" />
+	</xs:complexType>
+	<xs:complexType name="Builder">
+		<xs:attribute name="name" type="xs:string" use="required" />
+		<xs:attribute name="package" type="xs:string" />
+	</xs:complexType>
+	<xs:complexType name="Container">
+		<xs:attribute name="name" type="xs:string" use="required" />
+		<xs:attribute name="package" type="xs:string" />
+		<xs:attribute name="toolspec" type="xs:string" use="required" />
+	</xs:complexType>
+
+	<xs:complexType name="Generators">
+		<xs:sequence>
+			<xs:element ref="generator" maxOccurs="unbounded" />
+		</xs:sequence>
+		<xs:attribute name="package" type="xs:string" />
+	</xs:complexType>
+
+	<xs:element name="plugin" type="Plugin" />
+	<xs:complexType name="Plugin">
+		<xs:sequence>
+			<xs:element name="frontend" type="FrontEnd"
+				maxOccurs="unbounded" />
+			<xs:element name="databinding" type="DataBinding"
+				maxOccurs="unbounded" />
+		</xs:sequence>
+		<xs:attribute name="name" type="xs:string" use="required" />
+		<xs:attribute name="version" type="xs:string" use="required" />
+		<xs:attribute name="provider" type="xs:string" use="required" />
+	</xs:complexType>
+
+    <xs:element name="plugins">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element ref="plugin" maxOccurs="unbounded" minOccurs="0"/>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
 </xs:schema>

Modified: incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java Tue Apr 10 17:17:37 2007
@@ -180,7 +180,7 @@
             return;
         } catch (IOException e) {
             Message msg = new Message("FAIL_TO_GENERATE_TYPES", LOG);
-            throw new ToolException(msg);
+            throw new ToolException(msg, e);
         }
     }
 

Modified: incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/resources/META-INF/tools-plugin.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/resources/META-INF/tools-plugin.xml?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/resources/META-INF/tools-plugin.xml (original)
+++ incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/resources/META-INF/tools-plugin.xml Tue Apr 10 17:17:37 2007
@@ -17,7 +17,8 @@
 specific language governing permissions and limitations
 under the License.
 -->
-
-<plugin name="jaxb" version="" provider="cxf.apache.org" xmlns="http://cxf.apache.org/tools/plugin">
+<plugins xmlns="http://cxf.apache.org/tools/plugin">
+  <plugin name="jaxb" version="" provider="cxf.apache.org">
     <databinding name="jaxb" package="org.apache.cxf.tools.wsdlto.databinding.jaxb" profile="JAXBDataBinding"/>
-</plugin>
\ No newline at end of file
+  </plugin>
+</plugins>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml Tue Apr 10 17:17:37 2007
@@ -17,8 +17,8 @@
 specific language governing permissions and limitations
 under the License.
 -->
-
-<plugin name="jaxws" version="" provider="cxf.apache.org" xmlns="http://cxf.apache.org/tools/plugin">
+<plugins xmlns="http://cxf.apache.org/tools/plugin">
+  <plugin name="jaxws" version="" provider="cxf.apache.org">
     <frontend name="jaxws" package="org.apache.cxf.tools.wsdlto.frontend.jaxws" profile="JAXWSProfile">
 	<container name="JAXWSContainer" toolspec="jaxws-toolspec.xml"/>
 	<processor name="WSDLToJavaProcessor" package="org.apache.cxf.tools.wsdlto.frontend.jaxws.processor"/>
@@ -33,4 +33,5 @@
 	    <generator name="ServiceGenerator"/>
 	</generators>
     </frontend>
-</plugin>
\ No newline at end of file
+  </plugin>
+</plugins>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java Tue Apr 10 17:17:37 2007
@@ -19,10 +19,10 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws;
 
+import java.util.Collection;
 import java.util.Map;
 
 import junit.framework.TestCase;
-
 import org.apache.cxf.tools.common.Processor;
 import org.apache.cxf.tools.plugin.FrontEnd;
 import org.apache.cxf.tools.plugin.Generator;
@@ -92,7 +92,8 @@
     }
 
     protected Plugin getPlugin(PluginLoader loader, int index) {
-        int size = loader.getPlugins().size();
-        return loader.getPlugins().values().toArray(new Plugin[size])[index];
+        Collection plugins = (Collection) loader.getPlugins().values().toArray()[index];
+        
+        return (Plugin) plugins.iterator().next();
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-plugin.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-plugin.xml?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-plugin.xml (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-plugin.xml Tue Apr 10 17:17:37 2007
@@ -1,6 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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
 
-<plugin name="tools-jaxws-frontend" version="2.0" provider="apache cxf" xmlns="http://cxf.apache.org/tools/plugin">
+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.
+-->
+<plugins xmlns="http://cxf.apache.org/tools/plugin">
+<plugin name="tools-jaxws-frontend" version="2.0" provider="apache cxf">
     <frontend name="jaxws" package="org.apache.cxf.tools.wsdlto.frontend.jaxws" profile="JAXWSProfile">
 	<container name="JAXWSContainer" toolspec="jaxws-toolspec.xml"/>
 	<processor name="WSDLToJavaProcessor" package="org.apache.cxf.tools.wsdlto.frontend.jaxws.processor"/>
@@ -11,4 +29,5 @@
 	</generators>
     </frontend>
     <databinding name="jaxb" package="org.apache.cxf.tools.wsdlto.frontend.jaxws" profile="DummyDataBinding"/>
-</plugin>
\ No newline at end of file
+</plugin>
+</plugins>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java?view=diff&rev=527347&r1=527346&r2=527347
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java Tue Apr 10 17:17:37 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.tools.wsdlto.core;
 
+import java.util.Collection;
 import java.util.Map;
 
 import junit.framework.TestCase;
@@ -85,7 +86,8 @@
     }
     
     protected Plugin getPlugin(PluginLoader loader, int index) {
-        int size = loader.getPlugins().size();
-        return loader.getPlugins().values().toArray(new Plugin[size])[index];
+        Collection plugins = (Collection) loader.getPlugins().values().toArray()[index];
+        
+        return (Plugin) plugins.iterator().next();
     }
 }



Mime
View raw message