You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/05/15 16:49:24 UTC
svn commit: r538192 [1/2] - in /incubator/cxf/branches/headerwork: ./
distribution/src/main/release/samples/handlers/src/demo/handlers/common/
rt/core/src/main/java/org/apache/cxf/bus/
rt/core/src/test/java/org/apache/cxf/bus/ rt/frontend/jaxws/src/mai...
Author: dkulp
Date: Tue May 15 07:49:20 2007
New Revision: 538192
URL: http://svn.apache.org/viewvc?view=rev&rev=538192
Log:
Merge a bunch of stuff from trunk to branch to test
Added:
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerFaultOutInterceptor.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerFaultOutInterceptor.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerFaultOutInterceptor.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerFaultOutInterceptor.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/CounterRepository.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/CounterRepository.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/MessageHandlingTimeRecorder.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/MessageHandlingTimeRecorder.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/Messages.properties
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/Messages.properties
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/PerformanceCounter.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/PerformanceCounter.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/PerformanceCounterMBean.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/PerformanceCounterMBean.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounterMBean.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounterMBean.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/interceptor/
- copied from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/interceptor/Messages.properties
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/Messages.properties
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeFeature.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeFeature.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptor.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptor.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInvokerInterceptor.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInvokerInterceptor.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageOutInterceptor.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageOutInterceptor.java
incubator/cxf/branches/headerwork/rt/management/src/test/java/org/apache/cxf/management/counters/CounterRepositoryTest.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/counters/CounterRepositoryTest.java
incubator/cxf/branches/headerwork/rt/management/src/test/java/org/apache/cxf/management/interceptor/
- copied from r538172, incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/interceptor/
incubator/cxf/branches/headerwork/rt/management/src/test/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTestBase.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTestBase.java
incubator/cxf/branches/headerwork/rt/management/src/test/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptorTest.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptorTest.java
incubator/cxf/branches/headerwork/rt/management/src/test/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInvokerInterceptorTest.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInvokerInterceptorTest.java
incubator/cxf/branches/headerwork/rt/management/src/test/java/org/apache/cxf/management/interceptor/ResponseTimeMessageOutInterceptorTest.java
- copied unchanged from r538172, incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/interceptor/ResponseTimeMessageOutInterceptorTest.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java
- copied unchanged from r538172, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/management/counter-spring.xml
- copied unchanged from r538172, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/counter-spring.xml
incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/test_chars.wsdl
- copied unchanged from r538172, incubator/cxf/trunk/testutils/src/main/resources/wsdl/test_chars.wsdl
Removed:
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/Messages.properties
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/TransportClientCounters.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/TransportServerCounters.java
incubator/cxf/branches/headerwork/rt/management/src/test/java/org/apache/cxf/management/counters/CountersTest.java
incubator/cxf/branches/headerwork/tools/eclipse-plugin/
Modified:
incubator/cxf/branches/headerwork/ (props changed)
incubator/cxf/branches/headerwork/distribution/src/main/release/samples/handlers/src/demo/handlers/common/SmallNumberHandler.java
incubator/cxf/branches/headerwork/pom.xml
incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/bus/CXFBusImplTest.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractJAXWSHandlerInterceptor.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java
incubator/cxf/branches/headerwork/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/Counter.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
incubator/cxf/branches/headerwork/testutils/pom.xml
incubator/cxf/branches/headerwork/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java
incubator/cxf/branches/headerwork/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
incubator/cxf/branches/headerwork/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/soap_header.wsdl
Propchange: incubator/cxf/branches/headerwork/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May 15 07:49:20 2007
@@ -1 +1 @@
-/incubator/cxf/trunk:1-537244
+/incubator/cxf/trunk:1-538185
Modified: incubator/cxf/branches/headerwork/distribution/src/main/release/samples/handlers/src/demo/handlers/common/SmallNumberHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/distribution/src/main/release/samples/handlers/src/demo/handlers/common/SmallNumberHandler.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/distribution/src/main/release/samples/handlers/src/demo/handlers/common/SmallNumberHandler.java (original)
+++ incubator/cxf/branches/headerwork/distribution/src/main/release/samples/handlers/src/demo/handlers/common/SmallNumberHandler.java Tue May 15 07:49:20 2007
@@ -21,14 +21,18 @@
import java.util.Map;
import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
+import javax.xml.transform.Source;
import javax.xml.ws.LogicalMessage;
import javax.xml.ws.ProtocolException;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.LogicalHandler;
import javax.xml.ws.handler.LogicalMessageContext;
import javax.xml.ws.handler.MessageContext;
import org.apache.handlers.types.AddNumbers;
import org.apache.handlers.types.AddNumbersResponse;
+import org.apache.handlers.types.ObjectFactory;
@@ -53,8 +57,11 @@
// check the payload, if its an AddNumbers request, we'll intervene
//
- JAXBContext jaxbContext = JAXBContext.newInstance(AddNumbers.class);
+ JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
Object payload = msg.getPayload(jaxbContext);
+ if (payload instanceof JAXBElement) {
+ payload = ((JAXBElement)payload).getValue();
+ }
if (payload instanceof AddNumbers) {
AddNumbers req = (AddNumbers)payload;
@@ -67,12 +74,27 @@
if (isSmall(a) && isSmall(b)) {
int answer = a + b;
- System.out.printf("SmallNumberHandler addNumbers(%d, %d) == %d\n", a, b, answer);
+ //System.out.printf("SmallNumberHandler addNumbers(%d, %d) == %d\n", a, b, answer);
// ok, we've done the calculation, so build the
// response and set it as the payload of the message
+
AddNumbersResponse resp = new AddNumbersResponse();
resp.setReturn(answer);
- msg.setPayload(resp, jaxbContext);
+ msg.setPayload(new ObjectFactory().createAddNumbersResponse(resp),
+ jaxbContext);
+
+ Source src = msg.getPayload();
+ msg.setPayload(src);
+
+ payload = msg.getPayload(jaxbContext);
+ if (payload instanceof JAXBElement) {
+ payload = ((JAXBElement)payload).getValue();
+ }
+
+ AddNumbersResponse resp2 = (AddNumbersResponse)payload;
+ if (resp2 == resp) {
+ throw new WebServiceException("Shouldn't be the same object");
+ }
// finally, return false, indicating that request
// processing stops here and our answer will be
Modified: incubator/cxf/branches/headerwork/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/pom.xml?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/pom.xml (original)
+++ incubator/cxf/branches/headerwork/pom.xml Tue May 15 07:49:20 2007
@@ -145,7 +145,6 @@
<id>everything</id>
<modules>
<module>distribution</module>
- <module>tools/eclipse-plugin</module>
<module>tools/eclipse3.1-plugin</module>
</modules>
</profile>
@@ -299,7 +298,6 @@
<id>deploy</id>
<modules>
<module>distribution</module>
- <module>tools/eclipse-plugin</module>
<module>tools/eclipse3.1-plugin</module>
</modules>
<build>
Modified: incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java (original)
+++ incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java Tue May 15 07:49:20 2007
@@ -77,8 +77,8 @@
extensions.put(extensionType, extension);
}
- public String getId() {
- return null == id ? DEFAULT_BUS_ID : id;
+ public String getId() {
+ return null == id ? DEFAULT_BUS_ID + Integer.toString(this.hashCode()) : id;
}
public void run() {
Modified: incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/bus/CXFBusImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/bus/CXFBusImplTest.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/bus/CXFBusImplTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/bus/CXFBusImplTest.java Tue May 15 07:49:20 2007
@@ -98,7 +98,7 @@
public void testBusID() {
CXFBusImpl bus = new CXFBusImpl();
String id = bus.getId();
- assertEquals("The bus id should be cxf", id, CXFBusImpl.DEFAULT_BUS_ID);
+ assertEquals("The bus id should be cxf", id, CXFBusImpl.DEFAULT_BUS_ID + bus.hashCode());
bus.setId("test");
assertEquals("The bus id should be changed", bus.getId(), "test");
}
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java Tue May 15 07:49:20 2007
@@ -28,6 +28,8 @@
import java.util.concurrent.FutureTask;
import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPFault;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
@@ -38,7 +40,12 @@
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.http.HTTPException;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.binding.soap.SoapFault;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.endpoint.Client;
@@ -126,8 +133,6 @@
} catch (WebServiceException wex) {
throw wex.fillInStackTrace();
} catch (Exception ex) {
- //TODO - map to SoapFaultException and HTTPException
-
for (Class<?> excls : method.getExceptionTypes()) {
if (excls.isInstance(ex)) {
throw ex.fillInStackTrace();
@@ -138,6 +143,25 @@
HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
exception.initCause(ex);
throw exception;
+ } else if (getBinding() instanceof SOAPBinding) {
+ SOAPFault soapFault = ((SOAPBinding)getBinding()).getSOAPFactory().createFault();
+
+ if (ex instanceof SoapFault) {
+ soapFault.setFaultString(((SoapFault)ex).getReason());
+ soapFault.setFaultCode(((SoapFault)ex).getFaultCode());
+
+ Node nd = soapFault.getOwnerDocument().importNode(((SoapFault)ex).getOrCreateDetail(),
+ true);
+ soapFault.addDetail().appendChild(nd);
+
+ } else {
+ soapFault.setFaultCode(new QName("http://cxf.apache.org/faultcode", "HandlerFault"));
+ soapFault.setFaultString(ex.getMessage());
+ }
+
+ SOAPFaultException exception = new SOAPFaultException(soapFault);
+ exception.initCause(ex);
+ throw exception;
} else {
throw new WebServiceException(ex);
}
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractJAXWSHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractJAXWSHandlerInterceptor.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractJAXWSHandlerInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractJAXWSHandlerInterceptor.java Tue May 15 07:49:20 2007
@@ -53,6 +53,7 @@
} else {
invoker.setInbound();
}
+ invoker.setRequestor(isRequestor(message));
if (message.getExchange().isOneWay()
|| ((isRequestor(message) && !isOutbound(message))
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java Tue May 15 07:49:20 2007
@@ -69,6 +69,7 @@
private final List<Handler> closeHandlers = new ArrayList<Handler>();
private boolean outbound;
+ private boolean isRequestor;
private boolean responseExpected = true;
private boolean faultExpected;
private boolean handlerProcessingAborted;
@@ -124,9 +125,14 @@
// objectCtx.setRequestorRole(requestor);
context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, isOutbound());
return invokeHandlerChain(logicalHandlers, context);
-
}
-
+
+ public boolean invokeLogicalHandlersHandleFault(boolean requestor, LogicalMessageContext context) {
+ // objectCtx.setRequestorRole(requestor);
+ context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, isOutbound());
+ return invokeHandlerChainHandleFault(logicalHandlers, context);
+ }
+
public boolean invokeProtocolHandlers(boolean requestor, MessageContext context) {
// WrappedMessageContext context = new WrappedMessageContext(message);
// bindingContext.put(ObjectMessageContext.REQUESTOR_ROLE_PROPERTY, requestor);
@@ -134,7 +140,14 @@
return invokeHandlerChain(protocolHandlers, context);
}
+ public boolean invokeProtocolHandlersHandleFault(boolean requestor, MessageContext context) {
+ // WrappedMessageContext context = new WrappedMessageContext(message);
+ // bindingContext.put(ObjectMessageContext.REQUESTOR_ROLE_PROPERTY, requestor);
+ context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, isOutbound());
+ return invokeHandlerChainHandleFault(protocolHandlers, context);
+ }
+
public void setResponseExpected(boolean expected) {
responseExpected = expected;
}
@@ -150,7 +163,18 @@
public boolean isInbound() {
return !outbound;
}
-
+
+ //We need HandlerChainInvoker behaves differently on client and server side. For
+ //client side, as we do not have a faultChain, we need to call handleFault and close
+ //on handlers directly.
+ protected boolean isRequestor() {
+ return isRequestor;
+ }
+
+ protected void setRequestor(boolean requestor) {
+ isRequestor = requestor;
+ }
+
public void setInbound() {
outbound = false;
}
@@ -218,11 +242,46 @@
handlers = reverseHandlerChain(handlers);
for (Handler h : handlers) {
if (closeHandlers.contains(h)) {
+ //System.out.println("===========invokeClose " + h.toString());
h.close(context);
}
}
}
+
+ private boolean invokeHandlerChainHandleFault(List<? extends Handler> handlerChain,
+ MessageContext ctx) {
+ if (handlerChain.isEmpty()) {
+ LOG.log(Level.FINEST, "no handlers registered");
+ return true;
+ }
+
+ if (isClosed()) {
+ return false;
+ }
+
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.log(Level.FINE, "invoking handlers, direction: " + (outbound ? "outbound" : "inbound"));
+ }
+ setMessageOutboundProperty(ctx);
+
+ if (!outbound) {
+ handlerChain = reverseHandlerChain(handlerChain);
+ }
+
+ boolean continueProcessing = true;
+
+ WebServiceContextImpl.setMessageContext(ctx);
+
+
+ continueProcessing = invokeHandleFault(handlerChain, ctx);
+
+ if (!continueProcessing) {
+ handlerProcessingAborted = true;
+ }
+ return continueProcessing;
+ }
+
private boolean invokeHandlerChain(List<? extends Handler> handlerChain,
MessageContext ctx) {
if (handlerChain.isEmpty()) {
@@ -269,6 +328,7 @@
if (invokeThisHandler(h)) {
closeHandlers.add(h);
markHandlerInvoked(h);
+ //System.out.println("===========handleFault " + h.toString());
continueProcessing = h.handleFault(ctx);
}
if (!continueProcessing) {
@@ -294,6 +354,7 @@
if (invokeThisHandler(h)) {
closeHandlers.add(h);
markHandlerInvoked(h);
+ //System.out.println("===========handlerMessage " + h.toString());
continueProcessing = h.handleMessage(ctx);
}
if (!continueProcessing) {
@@ -307,12 +368,16 @@
}
} catch (ProtocolException e) {
LOG.log(Level.FINE, "handleMessage raised exception", e);
- changeMessageDirection(ctx);
- if (responseExpected) {
- setFaultMessage(ctx, e);
- invokeReversedHandleFault(ctx);
- } else {
- invokeReversedClose();
+
+ //this is the client outbound
+ if (isRequestor()) {
+ changeMessageDirection(ctx);
+ if (responseExpected) {
+ setFaultMessage(ctx, e);
+ invokeReversedHandleFault(ctx);
+ } else {
+ invokeReversedClose();
+ }
}
continueProcessing = false;
@@ -320,15 +385,19 @@
throw e;
} catch (RuntimeException e) {
LOG.log(Level.WARNING, "HANDLER_RAISED_RUNTIME_EXCEPTION", e);
- changeMessageDirection(ctx);
+
+ if (isRequestor()) {
+ changeMessageDirection(ctx);
+ invokeReversedClose();
+ }
+
continueProcessing = false;
- invokeReversedClose();
-
+ setFault(e);
throw e;
}
return continueProcessing;
}
-
+
//When the message direction is reversed, if the message is not already a fault message then it is
//replaced with a fault message
private void setFaultMessage(MessageContext mc, Exception exception) {
@@ -387,6 +456,7 @@
int index = invokedHandlers.size() - 2;
while (index >= 0 && continueProcessing) {
Handler h = invokedHandlers.get(index);
+ //System.out.println("===========invokeReversedHandleFault " + h.toString());
if (h instanceof LogicalHandler) {
continueProcessing = h.handleFault(logicalMessageContext);
} else {
@@ -451,7 +521,7 @@
// when handler processing has been aborted, only invoked on
// previously invoked handlers
//
- if (handlerProcessingAborted) {
+ if (handlerProcessingAborted || faultRaised()) {
ret = invokedHandlers.contains(h);
}
if (ret && LOG.isLoggable(Level.FINE)) {
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java Tue May 15 07:49:20 2007
@@ -157,18 +157,17 @@
}
} else {
// client side inbound - Normal handler message processing
- // stops,, but still continue the outbound interceptor chain, dispatch the message
+ // stops,, but the inbound interceptor chain still continues, dispatch the message
System.out.println("SOAP Handler handleMessage returns false on client inbound, aborting");
}
} else {
if (!getInvoker(message).isOutbound()) {
- // server side outbound
+ // server side inbound
message.getInterceptorChain().abort();
Endpoint e = message.getExchange().get(Endpoint.class);
Message responseMsg = e.getBinding().createMessage();
if (!message.getExchange().isOneWay()) {
- // server side inbound
message.getExchange().setOutMessage(responseMsg);
SOAPMessage soapMessage = ((SOAPMessageContext)context).getMessage();
@@ -186,9 +185,9 @@
}
} else {
- // server side inbound - Normal handler message processing
- // stops, but still continue the inbound interceptor chain, dispatch the message
- System.out.println("SOAP Handler handleMessage returns false on server inbound, aborting");
+ // server side outbound - Normal handler message processing
+ // stops, but still continue the outbound interceptor chain, dispatch the message
+ System.out.println("SOAP Handler handleMessage returns false on server outbound, aborting");
}
}
}
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java Tue May 15 07:49:20 2007
@@ -34,8 +34,10 @@
import org.apache.cxf.jaxws.binding.http.HTTPBindingImpl;
import org.apache.cxf.jaxws.binding.soap.SOAPBindingImpl;
//import org.apache.cxf.jaxws.handler.StreamHandlerInterceptor;
+import org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultOutInterceptor;
import org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor;
import org.apache.cxf.jaxws.handler.logical.LogicalHandlerOutInterceptor;
+import org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultOutInterceptor;
import org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor;
import org.apache.cxf.jaxws.interceptors.HolderInInterceptor;
import org.apache.cxf.jaxws.interceptors.HolderOutInterceptor;
@@ -67,11 +69,16 @@
} else {
// TODO: what for non soap bindings?
}
-
- List<Interceptor> fault = super.getOutFaultInterceptors();
- fault.add(new LogicalHandlerOutInterceptor(binding));
- if (soap != null) {
- fault.add(soap);
+
+ List<Interceptor> fault = super.getOutFaultInterceptors();
+
+ LogicalHandlerFaultOutInterceptor lh = new LogicalHandlerFaultOutInterceptor(binding);
+ fault.add(lh);
+ //fault.add(new LogicalHandlerOutInterceptor(binding));
+ if (getBinding() instanceof SoapBinding) {
+ //fault.add(soap);
+ SOAPHandlerFaultOutInterceptor sh = new SOAPHandlerFaultOutInterceptor(binding);
+ fault.add(sh);
}
List<Interceptor> in = super.getInInterceptors();
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java Tue May 15 07:49:20 2007
@@ -236,6 +236,7 @@
ProtocolException pe = new ProtocolException("banzai");
protocolHandlers[2].setException(pe);
+ invoker.setRequestor(true);
assertTrue(invoker.isOutbound());
boolean continueProcessing = true;
@@ -321,6 +322,7 @@
protocolHandlers[2].setException(pe);
protocolHandlers[0].setHandleFaultRet(false);
+ invoker.setRequestor(true);
assertTrue(invoker.isOutbound());
boolean continueProcessing = true;
@@ -521,6 +523,8 @@
ProtocolException pe = new ProtocolException("banzai");
logicalHandlers[2].setException(pe);
+
+ invoker.setRequestor(true);
//boolean continueProcessing = true;
try {
@@ -583,6 +587,7 @@
ProtocolException pe = new ProtocolException("banzai");
logicalHandlers[2].setException(pe);
invoker.setResponseExpected(false);
+ invoker.setRequestor(true);
//boolean continueProcessing = true;
try {
@@ -626,6 +631,7 @@
RuntimeException re = new RuntimeException("banzai");
logicalHandlers[1].setException(re);
+ invoker.setRequestor(true);
//boolean continueProcessing = true;
try {
@@ -690,7 +696,8 @@
// throw exception during handleFault processing
logicalHandlers[2].setException(pe);
logicalHandlers[1].setFaultException(pe2);
-
+ invoker.setRequestor(true);
+
boolean continueProcessing = false;
try {
continueProcessing = invoker.invokeLogicalHandlers(false, lmc);
@@ -734,6 +741,7 @@
// throw exception during handleFault processing
logicalHandlers[2].setException(pe);
logicalHandlers[1].setFaultException(re);
+ invoker.setRequestor(true);
boolean continueProcessing = false;
@@ -773,7 +781,8 @@
public void testHandleFaultReturnsTrue() {
ProtocolException pe = new ProtocolException("banzai");
logicalHandlers[2].setException(pe);
-
+ invoker.setRequestor(true);
+
logicalHandlers[0].setHandleFaultRet(true);
logicalHandlers[1].setHandleFaultRet(true);
logicalHandlers[2].setHandleFaultRet(true);
@@ -815,7 +824,8 @@
public void testHandleFaultReturnsFalse() {
ProtocolException pe = new ProtocolException("banzai");
logicalHandlers[3].setException(pe);
-
+ invoker.setRequestor(true);
+
logicalHandlers[0].setHandleFaultRet(true);
logicalHandlers[1].setHandleFaultRet(true);
logicalHandlers[2].setHandleFaultRet(false);
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java Tue May 15 07:49:20 2007
@@ -24,8 +24,13 @@
import java.util.Iterator;
import java.util.List;
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
import javax.xml.namespace.QName;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.AbstractJaxWsTest;
import org.apache.cxf.mtom_xop.TestMtomImpl;
@@ -38,7 +43,9 @@
import org.apache.cxf.service.model.OperationInfo;
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
import org.apache.hello_world_soap_http.GreeterImpl;
+import org.junit.Ignore;
import org.junit.Test;
public class JaxWsServiceFactoryBeanTest extends AbstractJaxWsTest {
@@ -89,7 +96,7 @@
assertNotNull(mpi.getTypeClass());
}
- @Test
+ @Ignore
public void testHolder() throws Exception {
ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
@@ -188,5 +195,47 @@
Collection<SchemaInfo> schemas = si.getSchemas();
assertEquals(1, schemas.size());
}
+
+ @Test
+ public void testBareBug() throws Exception {
+ ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
+ Bus bus = getBus();
+ bean.setBus(bus);
+ bean.setServiceClass(org.apache.cxf.test.TestInterfacePort.class);
+ Service service = bean.create();
+ ServiceInfo si = service.getServiceInfos().get(0);
+ ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, si);
+ Definition def = builder.build();
+
+ Document wsdl = WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
+ NodeList nodeList = assertValid("/wsdl:definitions/wsdl:types/xsd:schema"
+ + "[@targetNamespace='http://cxf.apache.org/"
+ + "org.apache.cxf.test.TestInterface/xsd']"
+ + "/xsd:element[@name='getMessage']", wsdl);
+ assertEquals(1, nodeList.getLength());
+
+
+ assertValid("/wsdl:definitions/wsdl:message[@name='setMessage']"
+ + "/wsdl:part[@name = 'parameters'][@element='ns2:setMessage']" , wsdl);
+
+ assertValid("/wsdl:definitions/wsdl:message[@name='echoCharResponse']"
+ + "/wsdl:part[@name = 'y'][@element='ns2:charEl_y']" , wsdl);
+
+ assertValid("/wsdl:definitions/wsdl:message[@name='echoCharResponse']"
+ + "/wsdl:part[@name = 'return'][@element='ns2:charEl_return']" , wsdl);
+
+ assertValid("/wsdl:definitions/wsdl:message[@name='echoCharResponse']"
+ + "/wsdl:part[@name = 'z'][@element='ns2:charEl_z']" , wsdl);
+
+ assertValid("/wsdl:definitions/wsdl:message[@name='echoChar']"
+ + "/wsdl:part[@name = 'x'][@element='ns2:charEl_x']" , wsdl);
+
+ assertValid("/wsdl:definitions/wsdl:message[@name='echoChar']"
+ + "/wsdl:part[@name = 'y'][@element='ns2:charEl_y']" , wsdl);
+
+
+ }
+
+
}
Modified: incubator/cxf/branches/headerwork/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Tue May 15 07:49:20 2007
@@ -81,12 +81,11 @@
import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException;
import org.apache.ws.commons.schema.utils.NamespaceMap;
-
/**
- * Introspects a class and builds a {@link Service} from it. If a WSDL URL is specified,
- * a Service model will be directly from the WSDL and then metadata will be filled in
- * from the service class. If no WSDL URL is specified, the Service will be constructed
- * directly from the class structure.
+ * Introspects a class and builds a {@link Service} from it. If a WSDL URL is
+ * specified, a Service model will be directly from the WSDL and then metadata
+ * will be filled in from the service class. If no WSDL URL is specified, the
+ * Service will be constructed directly from the class structure.
*/
public class ReflectionServiceFactoryBean extends AbstractServiceFactoryBean {
@@ -97,14 +96,14 @@
public static final String HEADER = "messagepart.isheader";
public static final String ELEMENT_NAME = "messagepart.elementName";
public static final String METHOD = "operation.method";
-
+
private static final Logger LOG = Logger.getLogger(ReflectionServiceFactoryBean.class.getName());
private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ReflectionServiceFactoryBean.class);
-
+
protected String wsdlURL;
protected Class<?> serviceClass;
-
+
private List<AbstractServiceConfiguration> serviceConfigurations =
new ArrayList<AbstractServiceConfiguration>();
private QName serviceName;
@@ -116,11 +115,11 @@
private Map<String, Object> properties;
private QName endpointName;
private boolean populateFromClass;
-
+
public ReflectionServiceFactoryBean() {
getServiceConfigurations().add(0, new DefaultServiceConfiguration());
setDataBinding(new JAXBDataBinding());
-
+
ignoredClasses.add("java.lang.Object");
ignoredClasses.add("java.lang.Throwable");
ignoredClasses.add("org.omg.CORBA_2_3.portable.ObjectImpl");
@@ -142,21 +141,21 @@
} else {
getService().setInvoker(createInvoker());
}
-
+
if (getExecutor() != null) {
getService().setExecutor(getExecutor());
- }
+ }
if (getDataBinding() != null) {
getService().setDataBinding(getDataBinding());
- }
-
+ }
+
getService().put(MethodDispatcher.class.getName(), getMethodDispatcher());
createEndpoints();
-
+
return getService();
}
-
+
protected void createEndpoints() {
Service service = getService();
@@ -164,7 +163,7 @@
for (EndpointInfo ei : inf.getEndpoints()) {
try {
Endpoint ep = createEndpoint(ei);
-
+
service.getEndpoints().put(ei.getName(), ep);
} catch (EndpointException e) {
throw new ServiceConstructionException(e);
@@ -182,7 +181,7 @@
c.setServiceFactory(this);
}
}
-
+
protected void buildServiceFromWSDL(String url) {
LOG.info("Creating Service " + getServiceQName() + " from WSDL: " + url);
WSDLServiceFactory factory = new WSDLServiceFactory(getBus(), url, getServiceQName());
@@ -191,34 +190,34 @@
if (properties != null) {
getService().putAll(properties);
}
-
+
initializeWSDLOperations();
if (getDataBinding() != null) {
getDataBinding().initialize(getService());
- }
+ }
}
-
+
protected void buildServiceFromClass() {
LOG.info("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName());
ServiceInfo serviceInfo = new ServiceInfo();
ServiceImpl service = new ServiceImpl(serviceInfo);
- setService(service);
-
+ setService(service);
+
if (properties != null) {
service.putAll(properties);
}
-
+
service.put(MethodDispatcher.class.getName(), getMethodDispatcher());
-
+
serviceInfo.setName(getServiceQName());
serviceInfo.setTargetNamespace(serviceInfo.getName().getNamespaceURI());
-
+
createInterface(serviceInfo);
-
+
getDataBinding().initialize(service);
-
+
boolean isWrapped = isWrapped();
if (isWrapped) {
initializeWrappedSchema(serviceInfo);
@@ -226,19 +225,19 @@
for (OperationInfo opInfo : serviceInfo.getInterface().getOperations()) {
Method m = (Method)opInfo.getProperty(METHOD);
-
+
if (!isWrapped(m) && !isRPC(m) && opInfo.getInput() != null) {
- createBareMessage(serviceInfo, opInfo.getInput(), "");
+ createBareMessage(serviceInfo, opInfo, false);
+
}
if (!isWrapped(m) && !isRPC(m) && opInfo.getOutput() != null) {
- createBareMessage(serviceInfo, opInfo.getOutput(), "Response");
+ createBareMessage(serviceInfo, opInfo, true);
}
}
}
-
-
+
protected void initializeServiceModel() {
String wsdlurl = getWsdlURL();
@@ -248,7 +247,7 @@
buildServiceFromClass();
}
}
-
+
public boolean isPopulateFromClass() {
return populateFromClass;
}
@@ -256,7 +255,7 @@
public void setPopulateFromClass(boolean fomClass) {
this.populateFromClass = fomClass;
}
-
+
protected InterfaceInfo getInterfaceInfo() {
if (getEndpointInfo() != null) {
return getEndpointInfo().getInterface();
@@ -269,11 +268,11 @@
}
throw new ServiceConstructionException(new Message("COULD_NOT_FIND_PORTTYPE", BUNDLE, qn));
}
-
+
protected void initializeWSDLOperations() {
Method[] methods = serviceClass.getMethods();
Arrays.sort(methods, new MethodComparator());
-
+
InterfaceInfo intf = getInterfaceInfo();
Map<QName, Method> validMethods = new HashMap<QName, Method>();
@@ -283,7 +282,7 @@
validMethods.put(opName, m);
}
}
-
+
for (OperationInfo o : intf.getOperations()) {
Method selected = null;
for (Map.Entry<QName, Method> m : validMethods.entrySet()) {
@@ -310,10 +309,9 @@
}
protected Invoker createInvoker() {
- return new FactoryInvoker(new LocalFactory(getServiceClass()),
- new ApplicationScopePolicy());
+ return new FactoryInvoker(new LocalFactory(getServiceClass()), new ApplicationScopePolicy());
}
-
+
protected ServiceInfo createServiceInfo(InterfaceInfo intf) {
ServiceInfo svcInfo = new ServiceInfo();
svcInfo.setInterface(intf);
@@ -340,7 +338,7 @@
createOperation(serviceInfo, intf, m);
}
}
-
+
return intf;
}
@@ -348,32 +346,32 @@
OperationInfo op = intf.addOperation(getOperationName(intf, m));
op.setProperty(m.getClass().getName(), m);
op.setProperty("action", getAction(op, m));
-
+
if (isWrapped(m)) {
UnwrappedOperationInfo uOp = new UnwrappedOperationInfo(op);
op.setUnwrappedOperation(uOp);
-
+
createMessageParts(intf, uOp, m);
-
+
if (uOp.hasInput()) {
MessageInfo msg = new MessageInfo(op, uOp.getInput().getName());
op.setInput(uOp.getInputName(), msg);
-
+
createInputWrappedMessageParts(uOp, m, msg);
-
- for (MessagePartInfo p : uOp.getInput().getMessageParts()) {
+
+ for (MessagePartInfo p : uOp.getInput().getMessageParts()) {
p.setConcreteName(p.getName());
}
- }
-
+ }
+
if (uOp.hasOutput()) {
-
+
QName name = uOp.getOutput().getName();
MessageInfo msg = new MessageInfo(op, name);
op.setOutput(uOp.getOutputName(), msg);
-
+
createOutputWrappedMessageParts(uOp, m, msg);
-
+
for (MessagePartInfo p : uOp.getOutput().getMessageParts()) {
p.setConcreteName(p.getName());
}
@@ -384,7 +382,6 @@
getMethodDispatcher().bind(op, m);
-
return op;
}
@@ -424,10 +421,8 @@
}
- protected void createWrappedSchema(ServiceInfo serviceInfo,
- AbstractMessageContainer wrappedMessage,
- AbstractMessageContainer unwrappedMessage,
- QName wraperBeanName) {
+ protected void createWrappedSchema(ServiceInfo serviceInfo, AbstractMessageContainer wrappedMessage,
+ AbstractMessageContainer unwrappedMessage, QName wraperBeanName) {
SchemaInfo schemaInfo = null;
for (SchemaInfo s : serviceInfo.getSchemas()) {
if (s.getNamespaceURI().equals(wraperBeanName.getNamespaceURI())) {
@@ -471,142 +466,159 @@
}
Element e = docs[0].getDocumentElement();
// XXX A problem can occur with the ibm jdk when the XmlSchema
- // object is serialized. The xmlns declaration gets incorrectly
+ // object is serialized. The xmlns declaration gets incorrectly
// set to the same value as the targetNamespace attribute.
// The aegis databinding tests demonstrate this particularly.
- if (e.getPrefix() == null && !WSDLConstants.NU_SCHEMA_XSD.equals(
- e.getAttributeNS(WSDLConstants.NU_XMLNS, WSDLConstants.NP_XMLNS))) {
- e.setAttributeNS(WSDLConstants.NU_XMLNS,
- WSDLConstants.NP_XMLNS, WSDLConstants.NU_SCHEMA_XSD);
+ if (e.getPrefix() == null
+ && !WSDLConstants.NU_SCHEMA_XSD.equals(e.getAttributeNS(WSDLConstants.NU_XMLNS,
+ WSDLConstants.NP_XMLNS))) {
+ e.setAttributeNS(WSDLConstants.NU_XMLNS, WSDLConstants.NP_XMLNS, WSDLConstants.NU_SCHEMA_XSD);
}
schemaInfo.setElement(e);
}
}
-
- protected void createBareMessage(ServiceInfo serviceInfo, MessageInfo message, String suffix) {
-
+
+ protected void createBareMessage(ServiceInfo serviceInfo,
+ OperationInfo opInfo, boolean isOut) {
+
SchemaInfo schemaInfo = null;
XmlSchema schema = null;
+ MessageInfo message = isOut ? opInfo.getOutput() : opInfo.getInput();
if (message.getMessageParts().size() == 0) {
return;
}
-
- MessagePartInfo mpi = message.getMessageParts().get(0);
-
- QName qname = message.getOperation().getName();
- qname = new QName(qname.getNamespaceURI(), qname.getLocalPart() + suffix);
- if (mpi.getProperty(ELEMENT_NAME) != null
- && !mpi.getProperty(ELEMENT_NAME, QName.class).getLocalPart().startsWith("return")
- && !mpi.getProperty(ELEMENT_NAME, QName.class).getLocalPart().startsWith("arg")) {
- qname = (QName)mpi.getProperty(ELEMENT_NAME);
- }
-
- for (SchemaInfo s : serviceInfo.getSchemas()) {
- if (s.getNamespaceURI().equals(qname.getNamespaceURI())) {
- schemaInfo = s;
- break;
+
+ Method method = (Method)opInfo.getProperty(METHOD);
+ int paraNumber = 0;
+ for (MessagePartInfo mpi : message.getMessageParts()) {
+ QName qname = (QName)mpi.getProperty(ELEMENT_NAME);
+ if (message.getMessageParts().size() == 1) {
+ qname = qname == null && !isOut ? getInParameterName(opInfo, method, -1) : qname;
+ qname = qname == null && isOut ? getOutParameterName(opInfo, method, -1) : qname;
+ if (qname.getLocalPart().startsWith("arg") || qname.getLocalPart().startsWith("return")) {
+ qname = isOut
+ ? new QName(qname.getNamespaceURI(), method.getName() + "Response") : new QName(qname
+ .getNamespaceURI(), method.getName());
+ }
+
+ }
+
+ if (isOut && message.getMessageParts().size() > 1 && qname == null) {
+ while (!isOutParam(method, paraNumber)) {
+ paraNumber++;
+ }
+ qname = getOutParameterName(opInfo, method, paraNumber);
+ } else if (qname == null) {
+ qname = getInParameterName(opInfo, method, paraNumber);
+ }
+
+ for (SchemaInfo s : serviceInfo.getSchemas()) {
+ if (s.getNamespaceURI().equals(qname.getNamespaceURI())) {
+ schemaInfo = s;
+ break;
+ }
}
- }
-
- if (schemaInfo == null) {
- schemaInfo = new SchemaInfo(serviceInfo, qname.getNamespaceURI());
- XmlSchemaCollection col = new XmlSchemaCollection();
- schema = new XmlSchema(qname.getNamespaceURI(), col);
- schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
- serviceInfo.setXmlSchemaCollection(col);
- NamespaceMap nsMap = new NamespaceMap();
- nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NU_SCHEMA_XSD);
- schema.setNamespaceContext(nsMap);
- serviceInfo.addSchema(schemaInfo);
- } else {
- schema = schemaInfo.getSchema();
- }
-
- XmlSchemaElement el = new XmlSchemaElement();
-
- el.setQName(qname);
- el.setName(qname.getLocalPart());
- schema.getItems().add(el);
-
- el.setMinOccurs(1);
- el.setMaxOccurs(0);
- el.setNillable(true);
-
- if (mpi.isElement()) {
- el.setRefName(mpi.getElementQName());
- String ns = message.getMessageParts().get(0).getElementQName().getNamespaceURI();
- if (!ns.equals(schema.getTargetNamespace()) && !ns.equals(WSDLConstants.NU_SCHEMA_XSD)) {
- XmlSchemaImport is = new XmlSchemaImport();
- is.setNamespace(ns);
- schema.getItems().add(is);
+ if (schemaInfo == null) {
+ schemaInfo = new SchemaInfo(serviceInfo, qname.getNamespaceURI());
+ XmlSchemaCollection col = new XmlSchemaCollection();
+ schema = new XmlSchema(qname.getNamespaceURI(), col);
+ schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+ serviceInfo.setXmlSchemaCollection(col);
+
+ NamespaceMap nsMap = new NamespaceMap();
+ nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NU_SCHEMA_XSD);
+ schema.setNamespaceContext(nsMap);
+ serviceInfo.addSchema(schemaInfo);
+ } else {
+ schema = schemaInfo.getSchema();
+ if (schema.getElementByName(qname) != null) {
+ mpi.setElement(true);
+ mpi.setElementQName(qname);
+ paraNumber++;
+ continue;
+ }
}
- } else {
- el.setSchemaTypeName(mpi.getTypeQName());
- String ns = message.getMessageParts().get(0).getTypeQName().getNamespaceURI();
- if (!ns.equals(schema.getTargetNamespace()) && !ns.equals(WSDLConstants.NU_SCHEMA_XSD)) {
- XmlSchemaImport is = new XmlSchemaImport();
- is.setNamespace(ns);
- schema.getItems().add(is);
+
+ XmlSchemaElement el = new XmlSchemaElement();
+ el.setQName(qname);
+ el.setName(qname.getLocalPart());
+ schema.getItems().add(el);
+
+ el.setMinOccurs(1);
+ el.setMaxOccurs(0);
+ el.setNillable(true);
+
+ if (mpi.isElement()) {
+ el.setRefName(mpi.getElementQName());
+ String ns = message.getMessageParts().get(0).getElementQName().getNamespaceURI();
+ if (!ns.equals(schema.getTargetNamespace()) && !ns.equals(WSDLConstants.NU_SCHEMA_XSD)) {
+ XmlSchemaImport is = new XmlSchemaImport();
+ is.setNamespace(ns);
+ schema.getItems().add(is);
+ }
+ } else {
+ el.setSchemaTypeName(mpi.getTypeQName());
+ String ns = message.getMessageParts().get(0).getTypeQName().getNamespaceURI();
+ if (!ns.equals(schema.getTargetNamespace()) && !ns.equals(WSDLConstants.NU_SCHEMA_XSD)) {
+ XmlSchemaImport is = new XmlSchemaImport();
+ is.setNamespace(ns);
+ schema.getItems().add(is);
+ }
}
+
+ Document[] docs;
+ try {
+ docs = XmlSchemaSerializer.serializeSchema(schema, false);
+ } catch (XmlSchemaSerializerException e1) {
+ throw new ServiceConstructionException(e1);
+ }
+ schemaInfo.setElement(docs[0].getDocumentElement());
+ schemaInfo.setSchema(schema);
+
+ mpi.setElement(true);
+ mpi.setElementQName(qname);
+ paraNumber++;
}
-
- Document[] docs;
- try {
- docs = XmlSchemaSerializer.serializeSchema(schema, false);
- } catch (XmlSchemaSerializerException e1) {
- throw new ServiceConstructionException(e1);
- }
- Element e = docs[0].getDocumentElement();
- schemaInfo.setElement(e);
- schemaInfo.setSchema(schema);
-
- message.getMessageParts().get(0).setElement(true);
- message.getMessageParts().get(0).setElementQName(qname);
-
-
}
private void createWrappedMessageSchema(AbstractMessageContainer wrappedMessage,
- AbstractMessageContainer unwrappedMessage,
- XmlSchema schema,
+ AbstractMessageContainer unwrappedMessage, XmlSchema schema,
QName wrapperName) {
XmlSchemaElement el = new XmlSchemaElement();
el.setQName(wrapperName);
el.setName(wrapperName.getLocalPart());
schema.getItems().add(el);
-
+
wrappedMessage.getMessageParts().get(0).setXmlSchema(el);
-
+
XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
ct.setName(wrapperName.getLocalPart());
el.setSchemaTypeName(wrapperName);
schema.addType(ct);
schema.getItems().add(ct);
-
+
XmlSchemaSequence seq = new XmlSchemaSequence();
ct.setParticle(seq);
-
+
for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) {
if (!Boolean.TRUE.equals(mpi.getProperty(HEADER))) {
el = new XmlSchemaElement();
el.setName(mpi.getName().getLocalPart());
el.setQName(mpi.getName());
-
- if (mpi.getTypeClass() != null
- && mpi.getTypeClass().isArray()
+
+ if (mpi.getTypeClass() != null && mpi.getTypeClass().isArray()
&& !Byte.TYPE.equals(mpi.getTypeClass().getComponentType())) {
el.setMinOccurs(0);
el.setMaxOccurs(Long.MAX_VALUE);
} else {
el.setMaxOccurs(1);
- if (mpi.getTypeClass() != null
- && !mpi.getTypeClass().isPrimitive()) {
+ if (mpi.getTypeClass() != null && !mpi.getTypeClass().isPrimitive()) {
el.setMinOccurs(0);
}
}
-
+
if (mpi.isElement()) {
el.setRefName(mpi.getElementQName());
} else {
@@ -617,12 +629,11 @@
}
}
-
protected void createMessageParts(InterfaceInfo intf, OperationInfo op, Method method) {
final Class[] paramClasses = method.getParameterTypes();
// Setup the input message
op.setProperty(METHOD, method);
- MessageInfo inMsg = op.createMessage(this.getInputMessageName(op, method));
+ MessageInfo inMsg = op.createMessage(this.getInputMessageName(op, method));
op.setInput(inMsg.getName().getLocalPart(), inMsg);
for (int j = 0; j < paramClasses.length; j++) {
if (isInParam(method, j)) {
@@ -630,12 +641,11 @@
final QName q2 = getInPartName(op, method, j);
MessagePartInfo part = inMsg.addMessagePart(q2);
initializeParameter(part, paramClasses[j], method.getGenericParameterTypes()[j]);
-
+
if (!isWrapped(method) && !isRPC(method)) {
part.setProperty(ELEMENT_NAME, q);
}
-
-
+
if (isHeader(method, j)) {
part.setElementQName(q);
part.setProperty(HEADER, Boolean.TRUE);
@@ -643,13 +653,13 @@
part.setIndex(j);
}
}
-
+
if (hasOutMessage(method)) {
// Setup the output message
MessageInfo outMsg = op.createMessage(createOutputMessageName(op, method));
op.setOutput(outMsg.getName().getLocalPart(), outMsg);
final Class<?> returnType = method.getReturnType();
- if (!returnType.isAssignableFrom(void.class)) {
+ if (!returnType.isAssignableFrom(void.class)) {
final QName q = getOutPartName(op, method, -1);
final QName q2 = getOutParameterName(op, method, -1);
MessagePartInfo part = outMsg.addMessagePart(q);
@@ -663,11 +673,11 @@
for (int j = 0; j < paramClasses.length; j++) {
if (isOutParam(method, j)) {
if (outMsg == null) {
- outMsg = op.createMessage(createOutputMessageName(op, method));
+ outMsg = op.createMessage(createOutputMessageName(op, method));
}
QName q = getOutPartName(op, method, j);
QName q2 = getOutParameterName(op, method, j);
-
+
if (isInParam(method, j)) {
q = op.getInput().getMessagePartByIndex(j).getName();
q2 = (QName)op.getInput().getMessagePartByIndex(j).getProperty(ELEMENT_NAME);
@@ -675,15 +685,15 @@
q2 = op.getInput().getMessagePartByIndex(j).getElementQName();
}
}
-
+
MessagePartInfo part = outMsg.addMessagePart(q);
initializeParameter(part, paramClasses[j], method.getGenericParameterTypes()[j]);
part.setIndex(j);
-
+
if (isRPC(method) && !isWrapped(method)) {
part.setProperty(ELEMENT_NAME, q2);
}
-
+
if (isInParam(method, j)) {
part.setProperty(MODE_INOUT, Boolean.TRUE);
}
@@ -693,7 +703,7 @@
}
}
}
-
+
}
initializeFaults(intf, op, method);
@@ -706,7 +716,7 @@
part.setElementQName(fault.getFaultName());
}
}
-
+
protected void createInputWrappedMessageParts(OperationInfo op, Method method, MessageInfo inMsg) {
MessagePartInfo part = inMsg.addMessagePart("parameters");
part.setElement(true);
@@ -725,7 +735,7 @@
if (getRequestWrapper(method) != null) {
part.setTypeClass(this.getRequestWrapper(method));
}
-
+
for (MessagePartInfo mpart : op.getInput().getMessageParts()) {
if (Boolean.TRUE.equals(mpart.getProperty(HEADER))) {
int idx = mpart.getIndex();
@@ -733,8 +743,8 @@
mpart.setIndex(idx);
}
}
- }
-
+ }
+
protected void createOutputWrappedMessageParts(OperationInfo op, Method method, MessageInfo inMsg) {
MessagePartInfo part = inMsg.addMessagePart("parameters");
part.setElement(true);
@@ -743,24 +753,26 @@
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
QName q = c.getResponseWrapperName(op, method);
if (q != null) {
- part.setElementQName(q);
+ part.setElementQName(q);
}
}
-
+
if (part.getElementQName() == null) {
part.setElementQName(inMsg.getName());
} else if (!part.getElementQName().equals(op.getOutput().getName())) {
op.getOutput().setName(part.getElementQName());
}
-
+
if (this.getResponseWrapper(method) != null) {
part.setTypeClass(this.getResponseWrapper(method));
}
- }
-
+ }
+
// TODO: Remove reference to JAX-WS holder if possible
- // We do need holder support in the simple frontend though as Aegis has its own
- // holder class. I'll tackle refactoring this into a more generic way of handling
+ // We do need holder support in the simple frontend though as Aegis has its
+ // own
+ // holder class. I'll tackle refactoring this into a more generic way of
+ // handling
// holders in phase 2.
protected void initializeParameter(MessagePartInfo part, Class rawClass, Type type) {
if (rawClass.equals(Holder.class) && type instanceof ParameterizedType) {
@@ -776,30 +788,30 @@
Object rawType = paramType.getActualTypeArguments()[0];
Class rawClass;
if (rawType instanceof GenericArrayType) {
- rawClass = (Class) ((GenericArrayType) rawType).getGenericComponentType();
+ rawClass = (Class)((GenericArrayType)rawType).getGenericComponentType();
rawClass = Array.newInstance(rawClass, 0).getClass();
} else {
if (rawType instanceof ParameterizedType) {
- rawType = (Class) ((ParameterizedType) rawType).getRawType();
+ rawType = (Class)((ParameterizedType)rawType).getRawType();
}
- rawClass = (Class) rawType;
+ rawClass = (Class)rawType;
}
return rawClass;
}
-
- public QName getServiceQName() {
+
+ public QName getServiceQName() {
if (serviceName == null) {
serviceName = new QName(getServiceNamespace(), getServiceName());
}
return serviceName;
}
-
+
public QName getEndpointName() {
if (endpointName != null) {
return endpointName;
}
-
+
for (AbstractServiceConfiguration c : serviceConfigurations) {
QName name = c.getEndpointName();
if (name != null) {
@@ -813,11 +825,11 @@
public EndpointInfo getEndpointInfo() {
return getService().getEndpointInfo(getEndpointName());
}
-
+
public void setEndpointName(QName en) {
this.endpointName = en;
}
-
+
protected String getServiceName() {
for (AbstractServiceConfiguration c : serviceConfigurations) {
String name = c.getServiceName();
@@ -832,7 +844,7 @@
if (serviceName != null) {
return serviceName.getNamespaceURI();
}
-
+
for (AbstractServiceConfiguration c : serviceConfigurations) {
String name = c.getServiceNamespace();
if (name != null) {
@@ -861,7 +873,7 @@
}
return true;
}
-
+
protected boolean isWrapped(final Method method) {
for (AbstractServiceConfiguration c : serviceConfigurations) {
Boolean b = c.isWrapped(method);
@@ -873,18 +885,19 @@
}
protected boolean isMatchOperation(String methodNameInClass, String methodNameInWsdl) {
- // TODO: This seems wrong and not sure who put it here. Will revisit - DBD
+ // TODO: This seems wrong and not sure who put it here. Will revisit -
+ // DBD
boolean ret = false;
String initOfMethodInClass = methodNameInClass.substring(0, 1);
String initOfMethodInWsdl = methodNameInWsdl.substring(0, 1);
if (initOfMethodInClass.equalsIgnoreCase(initOfMethodInWsdl)
- && methodNameInClass.substring(1, methodNameInClass.length()).equals(
- methodNameInWsdl.substring(1, methodNameInWsdl.length()))) {
+ && methodNameInClass.substring(1, methodNameInClass.length())
+ .equals(methodNameInWsdl.substring(1, methodNameInWsdl.length()))) {
ret = true;
}
return ret;
}
-
+
protected boolean isOutParam(Method method, int j) {
for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
@@ -911,7 +924,7 @@
for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
QName q = c.getInputMessageName(op, method);
- if (q != null) {
+ if (q != null) {
return q;
}
}
@@ -922,7 +935,7 @@
for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
QName q = c.getOutputMessageName(op, method);
- if (q != null) {
+ if (q != null) {
return q;
}
}
@@ -941,18 +954,15 @@
}
protected void initializeFaults(final InterfaceInfo service,
- final OperationInfo op,
- final Method method) {
+ final OperationInfo op, final Method method) {
// Set up the fault messages
final Class[] exceptionClasses = method.getExceptionTypes();
for (int i = 0; i < exceptionClasses.length; i++) {
Class exClazz = exceptionClasses[i];
// Ignore XFireFaults because they don't need to be declared
- if (exClazz.equals(Exception.class)
- || Fault.class.isAssignableFrom(exClazz)
- || exClazz.equals(RuntimeException.class)
- || exClazz.equals(Throwable.class)) {
+ if (exClazz.equals(Exception.class) || Fault.class.isAssignableFrom(exClazz)
+ || exClazz.equals(RuntimeException.class) || exClazz.equals(Throwable.class)) {
continue;
}
@@ -969,24 +979,23 @@
QName faultName = getFaultName(service, op, exClass, beanClass);
FaultInfo fi = op.addFault(faultName, faultName);
fi.setProperty(Class.class.getName(), exClass);
-
+
MessagePartInfo mpi = fi.addMessagePart(new QName(op.getName().getNamespaceURI(), "fault"));
mpi.setTypeClass(beanClass);
return fi;
}
protected void createFaultForException(Class<?> exClass, FaultInfo fi) {
- Field fields[] = exClass.getDeclaredFields();
+ Field fields[] = exClass.getDeclaredFields();
for (Field field : fields) {
- MessagePartInfo mpi = fi.addMessagePart(new QName(fi.getName().getNamespaceURI(),
- field.getName()));
+ MessagePartInfo mpi = fi
+ .addMessagePart(new QName(fi.getName().getNamespaceURI(), field.getName()));
mpi.setProperty(Class.class.getName(), field.getType());
}
- MessagePartInfo mpi = fi.addMessagePart(new QName(fi.getName().getNamespaceURI(),
- "message"));
+ MessagePartInfo mpi = fi.addMessagePart(new QName(fi.getName().getNamespaceURI(), "message"));
mpi.setProperty(Class.class.getName(), String.class);
}
-
+
protected Class<?> getBeanClass(Class<?> exClass) {
if (java.rmi.RemoteException.class.isAssignableFrom(exClass)) {
return null;
@@ -1059,31 +1068,27 @@
return true;
}
- protected QName getInPartName(final OperationInfo op,
- final Method method,
- final int paramNumber) {
+ protected QName getInPartName(final OperationInfo op, final Method method, final int paramNumber) {
if (paramNumber == -1) {
return null;
}
-
+
if (isWrapped(method)) {
return getInParameterName(op, method, paramNumber);
}
-
+
for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
QName q = c.getInPartName(op, method, paramNumber);
if (q != null) {
return q;
}
-
+
}
throw new IllegalStateException("ServiceConfiguration must provide a value!");
}
-
- protected QName getInParameterName(final OperationInfo op,
- final Method method,
- final int paramNumber) {
+
+ protected QName getInParameterName(final OperationInfo op, final Method method, final int paramNumber) {
if (paramNumber == -1) {
return null;
}
@@ -1097,9 +1102,7 @@
throw new IllegalStateException("ServiceConfiguration must provide a value!");
}
- protected QName getOutParameterName(final OperationInfo op,
- final Method method,
- final int paramNumber) {
+ protected QName getOutParameterName(final OperationInfo op, final Method method, final int paramNumber) {
for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
QName q = c.getOutParameterName(op, method, paramNumber);
@@ -1110,13 +1113,11 @@
throw new IllegalStateException("ServiceConfiguration must provide a value!");
}
- protected QName getOutPartName(final OperationInfo op,
- final Method method,
- final int paramNumber) {
+ protected QName getOutPartName(final OperationInfo op, final Method method, final int paramNumber) {
if (isWrapped(method)) {
return getOutParameterName(op, method, paramNumber);
}
-
+
for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
QName q = c.getOutPartName(op, method, paramNumber);
@@ -1126,7 +1127,7 @@
}
throw new IllegalStateException("ServiceConfiguration must provide a value!");
}
-
+
protected Class getResponseWrapper(Method selected) {
for (AbstractServiceConfiguration c : serviceConfigurations) {
Class cls = c.getResponseWrapper(selected);
@@ -1136,6 +1137,7 @@
}
return null;
}
+
protected Class getRequestWrapper(Method selected) {
for (AbstractServiceConfiguration c : serviceConfigurations) {
Class cls = c.getRequestWrapper(selected);
@@ -1181,6 +1183,7 @@
public void setWsdlURL(String wsdlURL) {
this.wsdlURL = wsdlURL;
}
+
public void setWsdlURL(URL wsdlURL) {
this.wsdlURL = wsdlURL.toString();
}
@@ -1233,8 +1236,7 @@
}
return true;
}
-
-
+
public String getStyle() {
for (AbstractServiceConfiguration c : serviceConfigurations) {
String style = c.getStyle();
@@ -1244,7 +1246,7 @@
}
return "document";
}
-
+
public boolean isRPC(Method method) {
for (AbstractServiceConfiguration c : serviceConfigurations) {
Boolean b = c.isRPC(method);
@@ -1266,5 +1268,5 @@
public void setProperties(Map<String, Object> properties) {
this.properties = properties;
}
-
+
}
Modified: incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/Counter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/Counter.java?view=diff&rev=538192&r1=538191&r2=538192
==============================================================================
--- incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/Counter.java (original)
+++ incubator/cxf/branches/headerwork/rt/management/src/main/java/org/apache/cxf/management/counters/Counter.java Tue May 15 07:49:20 2007
@@ -19,58 +19,12 @@
package org.apache.cxf.management.counters;
-/** class for the performance couter */
-public class Counter {
-
- private String discription;
- private int value;
- private float rate;
- private Boolean runFlag;
-
- Counter(String disc) {
- discription = disc;
- runFlag = false;
- }
-
- public void reset() {
- value = 0;
- runFlag = true;
- }
-
- public int add(int i) {
- value = value + i;
- return value;
- }
-
- public final void increase() {
- if (runFlag) {
- value++;
- }
- }
-
- public String getDiscription() {
- return discription;
- }
-
- float getRate() {
- return rate;
- }
-
- public int getValue() {
- return value;
- }
-
- public void stop() {
- value = 0;
- runFlag = false;
- }
-
- void setRate(float r) {
- if (rate < 1 && rate > 0) {
- rate = r;
- }
- // else do nothing
- }
-
-
+import org.apache.cxf.management.ManagedComponent;
+
+public interface Counter extends ManagedComponent {
+ String DEFAULT_DOMAIN_NAME = "com.iona.tandoori";
+
+ void increase(MessageHandlingTimeRecorder mhtr);
+
+ Number getNumInvocations();
}