Author: dandiep
Date: Tue Mar 6 11:41:13 2007
New Revision: 515271
URL: http://svn.apache.org/viewvc?view=rev&rev=515271
Log:
o Roll back to JAXB 2.0.3
o Fix ServerFactoryBean so you can specify your own DestinationFactory and add
a test for it.
Added:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
(with props)
Modified:
incubator/cxf/trunk/parent/pom.xml
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java
Modified: incubator/cxf/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/parent/pom.xml?view=diff&rev=515271&r1=515270&r2=515271
==============================================================================
--- incubator/cxf/trunk/parent/pom.xml (original)
+++ incubator/cxf/trunk/parent/pom.xml Tue Mar 6 11:41:13 2007
@@ -42,8 +42,8 @@
<jsr181.version>1.0-MR1</jsr181.version>
- <jaxb.version>2.1</jaxb.version>
- <jaxb.impl.version>2.1.2</jaxb.impl.version>
+ <jaxb.version>2.0</jaxb.version>
+ <jaxb.impl.version>2.0.3</jaxb.impl.version>
<jaxws.version>2.0</jaxws.version>
<jetty.version>5.1.11</jetty.version>
<saaj.version>1.3</saaj.version>
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java?view=diff&rev=515271&r1=515270&r2=515271
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
Tue Mar 6 11:41:13 2007
@@ -42,18 +42,27 @@
public ServerImpl(Bus bus, Endpoint endpoint, MessageObserver observer)
throws BusException, IOException {
-
+ this(bus, endpoint, null, observer);
+ }
+
+ public ServerImpl(Bus bus,
+ Endpoint endpoint,
+ DestinationFactory destinationFactory,
+ MessageObserver observer) throws BusException,
IOException {
this.endpoint = endpoint;
this.messageObserver = observer;
this.bus = bus;
EndpointInfo ei = endpoint.getEndpointInfo();
- DestinationFactory destinationFactory =
bus.getExtension(DestinationFactoryManager.class)
- .getDestinationFactory(ei.getTransportId());
+ if (destinationFactory == null) {
+ destinationFactory =
bus.getExtension(DestinationFactoryManager.class)
+ .getDestinationFactory(ei.getTransportId());
+ }
+
destination = destinationFactory.getDestination(ei);
serverRegistry = bus.getExtension(ServerRegistry.class);
}
-
+
public Destination getDestination() {
return destination;
}
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java?view=diff&rev=515271&r1=515270&r2=515271
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
Tue Mar 6 11:41:13 2007
@@ -63,7 +63,7 @@
paramArray = params.toArray();
}
- insertExchange(m, paramArray, exchange);
+ paramArray = insertExchange(m, paramArray, exchange);
res = m.invoke(serviceObject, paramArray);
if (exchange.isOneWay()) {
Modified:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?view=diff&rev=515271&r1=515270&r2=515271
==============================================================================
---
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Tue Mar 6 11:41:13 2007
@@ -72,11 +72,6 @@
part.setElementQName(name);
}
part.setXmlSchema(el);
-
- /*else if (el.getRefName() != null) {
- MessagePartInfo mpi = wrapper.addMessagePart(el.getRefName());
- mpi.setTypeQName(el.getRefName());
- mpi.setXmlSchema(el);*/
} else {
Iterator<QName> itr = beanInfo.getTypeNames().iterator();
if (!itr.hasNext()) {
Modified:
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=515271&r1=515270&r2=515271
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
(original)
+++
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
Tue Mar 6 11:41:13 2007
@@ -89,8 +89,12 @@
protected EndpointInfo createEndpointInfo() throws BusException {
if (transportId == null) {
if (getAddress() != null) {
- DestinationFactoryManager dfm =
getBus().getExtension(DestinationFactoryManager.class);
- DestinationFactory df =
dfm.getDestinationFactoryForUri(getAddress());
+ DestinationFactory df = getDestinationFactory();
+ if (df == null) {
+ DestinationFactoryManager dfm =
getBus().getExtension(DestinationFactoryManager.class);
+ df = dfm.getDestinationFactoryForUri(getAddress());
+ }
+
if (df != null) {
transportId = df.getTransportIds().get(0);
}
@@ -117,8 +121,10 @@
setTransportId(transportId);
- DestinationFactoryManager dfm =
getBus().getExtension(DestinationFactoryManager.class);
- destinationFactory = dfm.getDestinationFactory(transportId);
+ if (destinationFactory == null) {
+ DestinationFactoryManager dfm =
getBus().getExtension(DestinationFactoryManager.class);
+ destinationFactory = dfm.getDestinationFactory(transportId);
+ }
EndpointInfo ei = new EndpointInfo(service.getServiceInfo(),
transportId);
ei.setName(endpointName);
Modified:
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?view=diff&rev=515271&r1=515270&r2=515271
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
(original)
+++
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
Tue Mar 6 11:41:13 2007
@@ -84,7 +84,10 @@
}
Endpoint ep = createEndpoint();
- server = new ServerImpl(getBus(), ep, new
ChainInitiationObserver(ep, getBus()));
+ server = new ServerImpl(getBus(),
+ ep,
+ getDestinationFactory(),
+ new ChainInitiationObserver(ep, getBus()));
if (serviceBean != null && ep.getService().getInvoker() == null) {
ep.getService().setInvoker(createInvoker());
Added:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java?view=auto&rev=515271
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
(added)
+++
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
Tue Mar 6 11:41:13 2007
@@ -0,0 +1,89 @@
+/**
+ * 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.service.factory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.frontend.ServerFactoryBean;
+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;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+
+public class ServerFactoryTest extends AbstractSimpleFrontendTest {
+
+ public void testSetDF() throws Exception {
+ ServerFactoryBean svrBean = new ServerFactoryBean();
+ svrBean.setAddress("http://localhost/Hello");
+ svrBean.setServiceClass(HelloService.class);
+ svrBean.setBus(getBus());
+ svrBean.setDestinationFactory(new CustomDestinationFactory());
+
+ ServerImpl server = (ServerImpl)svrBean.create();
+ assertTrue(server.getDestination() instanceof CustomDestination);
+ }
+
+ public class CustomDestinationFactory extends AbstractTransportFactory
implements DestinationFactory {
+
+ public Destination getDestination(EndpointInfo ei) throws IOException {
+ return new CustomDestination();
+ }
+
+ @Override
+ public List<String> getTransportIds() {
+ List<String> ids = new ArrayList<String>();
+ ids.add("id");
+ return ids;
+ }
+
+ }
+
+ public static class CustomDestination implements Destination {
+
+ public EndpointReferenceType getAddress() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Conduit getBackChannel(Message inMessage,
+ Message partialResponse,
+ EndpointReferenceType address) throws
IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void shutdown() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setMessageObserver(MessageObserver observer) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+}
Propchange:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java?view=diff&rev=515271&r1=515270&r2=515271
==============================================================================
---
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java
(original)
+++
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java
Tue Mar 6 11:41:13 2007
@@ -150,9 +150,7 @@
clzzs[i++] = (Class)typeref.type;
}
try {
- jaxbContext = JAXBRIContext.newInstance(clzzs, types, null,
- this.getTargetNameSpace(),
false, null);
-
+ jaxbContext = JAXBRIContext.newInstance(clzzs, types,
this.getTargetNameSpace(), false);
} catch (Exception e) {
Message message = new Message("CREATE_JAXBRICONTEXT_EXCEPTION",
LOG);
throw new ToolException(message, e);