Return-Path: Delivered-To: apmail-incubator-cxf-dev-archive@locus.apache.org Received: (qmail 99524 invoked from network); 12 Apr 2007 01:59:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Apr 2007 01:59:25 -0000 Received: (qmail 17098 invoked by uid 500); 12 Apr 2007 01:59:31 -0000 Delivered-To: apmail-incubator-cxf-dev-archive@incubator.apache.org Received: (qmail 17062 invoked by uid 500); 12 Apr 2007 01:59:30 -0000 Mailing-List: contact cxf-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-dev@incubator.apache.org Received: (qmail 17053 invoked by uid 99); 12 Apr 2007 01:59:30 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Apr 2007 18:59:30 -0700 X-ASF-Spam-Status: No, hits=0.8 required=10.0 tests=INFO_TLD,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of james.mao@iona.com designates 65.223.216.181 as permitted sender) Received: from [65.223.216.181] (HELO amereast-smg1.iona.com) (65.223.216.181) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Apr 2007 18:59:21 -0700 Received: from amer-ems1.IONAGLOBAL.COM ([10.65.6.25]) by amereast-smg1.iona.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id l3C1vHHt004858 for ; Wed, 11 Apr 2007 21:57:17 -0400 (EDT) Received: from [127.0.0.1] ([10.129.9.175]) by amer-ems1.IONAGLOBAL.COM with Microsoft SMTPSVC(6.0.3790.1830); Wed, 11 Apr 2007 21:58:52 -0400 Message-ID: <461D9258.60800@iona.com> Date: Thu, 12 Apr 2007 09:58:48 +0800 From: James Mao User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: cxf-dev@incubator.apache.org Subject: Re: 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/ References: <7b774c950704111142n4acaf71fi4f7369c3ed5556ed@mail.gmail.com> In-Reply-To: <7b774c950704111142n4acaf71fi4f7369c3ed5556ed@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 12 Apr 2007 01:58:53.0773 (UTC) FILETIME=[1F781FD0:01C77CA6] X-Virus-Checked: Checked by ClamAV on apache.org Hi Dan, > Hi James, > > Two quick things before I revert: > 1. How would I merge the various attributes from the > different xml > files? i.e. they both have different name attributes. What should I do > when > combining the different tools.xml into 1 xml file? Or is that > attribute not > even really used? To combine is not a good idea, databinding and fronetend they are different things, if you take a look at the svn log, i did it before, it's looks like this: ... ... it works, but i think it's not good, so i separated, and keep every part independent with each other. and also move the plugin description into META-INF dir. The plugin node actually just a wrap element, what really we care is the frontend and databinding inside the element. > 2. You'll still be able to use the tools separated, but as we agreed > on the > mailing list, it'd be great if we could produce a cxf.jar with > everything, > including the tools modules so users only need to manage one jar. It's ok to have a single jar, but i don't think we need put the plugins inside the jar, that does not make much sense to me. Take eclipse as an example, you can have a core eclipse, but other extensions are independent jars, you can download from eclipse/plugins I would suggest that we pack Common/Api/Rt/ToolCore and keep the plugins out side of the single jar, just like you are not going to put the codegen plugins/ eclipse plugins/ jdee plugins inside the single jar, right? For your reference Cheers, James. > > Regards, > - Dan > > On 4/10/07, James Mao wrote: >> >> >> Hi Dan, >> >> >> >> > 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! >> > >> >> You really don't need to do this! >> The plugin can contain frontend and databinding in it self >> You can write a plugin description file like this: >> >> >> >> ... >> >> >> >> >> >> So, >> Really is a redundant >> >> And i'm really not like to bundle the plugins in the one jar, >> I don't care you bundle other stuff, but i myself prefer the tools >> plugins being separated. >> >> If you don't mind, please revert tools part in this commit. >> >> If we really need to bundle, there already has a way to bundle it >> together, there is no need to have a >> >> Thanks >> James. >> >> >> >> > >> > 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 @@ >> > ${project.version} >> > >> > >> > + org.apache.cxf >> > + cxf-rt-transports-http-jetty >> > + ${project.version} >> > + test >> > + >> > + >> > junit >> > junit >> > test >> > >> > 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 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 activationNamespaces; >> > - >> > + private Bus bus; >> > + private boolean autoRegisterLocalEndpoint; >> > + private boolean initialized = true; >> > + private LocalServerListener listener; >> > + >> > public Collection getActivationNamespaces() { >> > return activationNamespaces; >> > } >> > @@ -44,7 +51,24 @@ >> > public void setActivationNamespaces(Collection 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"> >> > >> > > > - lazy-init="true"> >> > + lazy-init="true" depends-on=" >> org.apache.cxf.endpoint.ServerLifeCycleManager" > >> > + >> > >> > >> > >> http://cxf.apache.org/binding/object >> > >> > 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 content = new ArrayList(); >> > + 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 defaultFilter) { >> > + Set filter = CastUtils.cast >> ((Set)message.get(MESSAGE_FILTER_PROPERTIES)); >> > + if (filter == null) { >> > + filter = defaultFilter; >> > + } >> > + >> > + // copy all the contents >> > + for (Map.Entry 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 destinations = new >> HashMap> Destination>(); >> > private Bus bus; >> > - >> > + >> > + private Set messageFilterProperties; >> > + >> > public LocalTransportFactory() { >> > super(); >> > List ids = new ArrayList(); >> > ids.add(TRANSPORT_ID); >> > setTransportIds(ids); >> > + >> > + messageFilterProperties = new HashSet(); >> > + 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 getUriPrefixes() { >> > return URI_PREFIXES; >> > + } >> > + >> > + public Set getMessageFilterProperties() { >> > + return messageFilterProperties; >> > + } >> > + >> > + public void setMessageFilterProperties(Set >> 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 plugins = new LinkedHashMap> Plugin>(); >> > + private Map> plugins = new >> LinkedHashMap>(); >> > >> > private Map frontends = new >> LinkedHashMap> FrontEnd>(); >> > private Map frontendProfiles = new >> LinkedHashMap(); >> > @@ -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 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 getPlugins(URL url) >> > + throws IOException, JAXBException, FileNotFoundException { >> > + Collection 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 getPlugins(String resource) throws >> JAXBException, FileNotFoundException { >> > + Collection 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 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 getPlugins() { >> > + public Map> 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 @@ >> > >> > >> > -> > - xmlns="http://cxf.apache.org/tools/plugin" >> > - targetNamespace="http://cxf.apache.org/tools/plugin" >> > - elementFormDefault="qualified"> >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - > minOccurs="1"/> >> > - > minOccurs="1"/> >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - >> > - > maxOccurs="unbounded"/> >> > - > maxOccurs="unbounded"/> >> > - >> > - >> > - >> > - >> > - >> > +> > + xmlns="http://cxf.apache.org/tools/plugin" >> > + targetNamespace="http://cxf.apache.org/tools/plugin" >> > + elementFormDefault="qualified"> >> > >> > + >> > + > use="required" >> /> >> > + > use="required" /> >> > + > use="required" /> >> > + >> > + >> > + >> > + >> > + > type="Generators" /> >> > + > maxOccurs="1" >> > + minOccurs="1" /> >> > + > maxOccurs="1" >> > + minOccurs="1" /> >> > + > maxOccurs="1" /> >> > + >> > + > use="required" >> /> >> > + > use="required" /> >> > + > use="required" /> >> > + >> > + >> > + >> > + >> > + > use="required" >> /> >> > + >> > + >> > + >> > + > use="required" >> /> >> > + >> > + >> > + >> > + > use="required" >> /> >> > + >> > + >> > + >> > + > use="required" >> /> >> > + >> > + > use="required" /> >> > + >> > + >> > + >> > + >> > + > maxOccurs="unbounded" >> /> >> > + >> > + >> > + >> > + >> > + >> > + >> > + >> > + > > + maxOccurs="unbounded" /> >> > + > type="DataBinding" >> > + maxOccurs="unbounded" /> >> > + >> > + > use="required" >> /> >> > + > use="required" /> >> > + > use="required" /> >> > + >> > + >> > + >> > + >> > + >> > + > minOccurs="0"/> >> > + >> > + >> > + >> > >> > >> > 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. >> > --> >> > - >> > - >> > + >> > + >> > > profile="JAXBDataBinding"/> >> > - >> > \ No newline at end of file >> > + >> > + >> > \ 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. >> > --> >> > - >> > - >> > + >> > + >> > >> > >> > >> > @@ -33,4 +33,5 @@ >> > >> > >> > >> > - >> > \ No newline at end of file >> > + >> > + >> > \ 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 @@ >> > >> > + >> > + >> > + >> > >> > >> > >> > @@ -11,4 +29,5 @@ >> > >> > >> > >> > - >> > \ No newline at end of file >> > + >> > + >> > \ 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(); >> > } >> > } >> > >> > >> > >> > >> >> > >