Author: heiko.braun(a)jboss.com
Date: 2007-01-08 08:32:01 -0500 (Mon, 08 Jan 2007)
New Revision: 1862
Added:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/ServiceDecorator.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/StubExt.java
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ClientProxy.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceObjectFactory.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/SOAPMessageContextJAXWS.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/Configurable.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/ConfigurationProvider.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/samples/retail/OrderStatus.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java
Log:
Register configurables as config change listener. It allows config overrides through
jboss-dd
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -32,7 +32,10 @@
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
import org.jboss.ws.metadata.config.Configurable;
import org.jboss.ws.metadata.config.ConfigurationProvider;
+import org.jboss.logging.Logger;
+import java.util.Observable;
+
/**
* Provides access to the protocol binding.
*
@@ -41,6 +44,8 @@
*/
public class CommonBindingProvider implements Configurable
{
+ private static Logger log = Logger.getLogger(CommonBindingProvider.class);
+
protected EndpointMetaData epMetaData;
protected CommonBinding binding;
@@ -48,13 +53,25 @@
{
this.epMetaData = epMetaData;
initBinding(epMetaData.getBindingId(), epMetaData.getType());
+ configure();
}
public CommonBindingProvider(String bindingId, Type type)
{
initBinding(bindingId, type);
+ configure();
}
+ private void configure()
+ {
+ // process MTOM config elements
+ if(epMetaData!=null)
+ {
+ ConfigurationProvider configProvider = (ConfigurationProvider)epMetaData;
+ configProvider.configure(this);
+ }
+ }
+
protected void initBinding(String bindingId, Type type)
{
if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId)
@@ -71,17 +88,16 @@
{
throw new WSException("Unsupported binding: " + bindingId);
}
-
- // process MTOM config elements
- if(epMetaData!=null)
- {
- ConfigurationProvider configProvider = (ConfigurationProvider)epMetaData;
- configProvider.configure(this);
- }
+
}
public CommonBinding getCommonBinding()
{
return binding;
}
+
+ public void update(Observable observable, Object object) {
+ log.debug("Update config: " + object);
+ configure();
+ }
}
Added: trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/ServiceDecorator.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/ServiceDecorator.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/ServiceDecorator.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws;
+
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import java.util.HashMap;
+import java.util.Map;
+import java.net.URL;
+
+/**
+ * Acts as a wrapper between clients and the JAX-WS API.
+ * Allows additional, propriatary API to be injected and core API calls
+ * to be decorated.
+ *
+ * @author Heiko.Braun(a)jboss.org
+ * @version $Id$
+ * @since 21.12.2006
+ */
+public class ServiceDecorator extends Service {
+
+ public final static String CLIENT_CONF_NAME =
"org.jboss.ws.jaxws.client.configName";
+ public final static String CLIENT_CONF_FILE =
"org.jboss.ws.jaxws.client.configFile";
+
+ private Map<String, Object> props = new HashMap<String, Object>();
+
+ private Map getProps()
+ {
+ return props;
+ }
+
+ public void setProperty(String key, Object value)
+ {
+ props.put(key, value);
+ }
+
+ public Object getProperty(String key)
+ {
+ return props.get(key);
+ }
+
+ public static ServiceDecorator newInstance(URL wsdlDocumentLocation, QName
serviceName)
+ {
+ return new ServiceDecorator(wsdlDocumentLocation, serviceName);
+ }
+
+ // ----------------------------------------------------------------------------
+ // intercepted javax.xml.ws.Service invocations
+
+ protected ServiceDecorator(URL wsdlDocumentLocation, QName serviceName) {
+ super(wsdlDocumentLocation, serviceName);
+ }
+
+ public <T> T getPort(Class<T> serviceEndpointInterface) {
+ T port = super.getPort(serviceEndpointInterface);
+ adjustConfig((StubExt)port);
+ return port;
+ }
+
+ public <T> T getPort(QName portName, Class<T> serviceEndpointInterface) {
+ T port = super.getPort(portName, serviceEndpointInterface);
+ adjustConfig((StubExt)port);
+ return port;
+ }
+
+ public <T> T getPort(QName portName, Class<T> serviceEndpointInterface,
WebServiceFeature... features) {
+ return super.getPort(portName, serviceEndpointInterface, features);
+ }
+
+ public <T> T getPort(Class<T> serviceEndpointInterface,
WebServiceFeature... features) {
+ return super.getPort(serviceEndpointInterface, features);
+ }
+
+ public <T> T getPort(EndpointReference endpointReference, Class<T>
serviceEndpointInterface, WebServiceFeature... features) {
+ return super.getPort(endpointReference, serviceEndpointInterface, features);
+ }
+
+ private void adjustConfig(StubExt stub) {
+
+ EndpointMetaData epMetaData = stub.getEndpointMetaData();
+
+ if(props.containsKey(CLIENT_CONF_NAME))
+ epMetaData.setConfigName((String)props.get(CLIENT_CONF_NAME));
+ if(props.containsKey(CLIENT_CONF_FILE))
+ epMetaData.setConfigFile((String)props.get(CLIENT_CONF_FILE));
+
+ }
+}
Added: trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/StubExt.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/StubExt.java 2007-01-08
13:30:47 UTC (rev 1861)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/StubExt.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -0,0 +1,14 @@
+package org.jboss.ws.core.jaxws;
+
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+
+/**
+ * @author Heiko.Braun(a)jboss.org
+ * @version $Id$
+ * @since 21.12.2006
+ */
+public interface StubExt {
+
+ EndpointMetaData getEndpointMetaData();
+
+}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ClientProxy.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ClientProxy.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ClientProxy.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -46,6 +46,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.core.jaxws.StubExt;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -66,6 +67,9 @@
private List stubMethods;
// List<Method> of the Object methods
private List objectMethods;
+
+ private List stubExtMethods;
+
// The service configured executor
private ExecutorService executor;
@@ -87,6 +91,7 @@
this.executor = executor;
this.stubMethods = Arrays.asList(BindingProvider.class.getMethods());
this.objectMethods = Arrays.asList(Object.class.getMethods());
+ this.stubExtMethods = Arrays.asList(StubExt.class.getMethods());
}
/** Processes a method invocation on a proxy instance and returns the result.
@@ -108,6 +113,13 @@
return objMethod.invoke(client, args);
}
+ // An invocation on StubExt interface
+ else if (stubExtMethods.contains(method))
+ {
+ Method stubExtMethod = ClientImpl.class.getMethod(methodName,
method.getParameterTypes());
+ return stubExtMethod.invoke(client, args);
+ }
+
// An invocation on the service endpoint interface
else
{
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceObjectFactory.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceObjectFactory.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceObjectFactory.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -45,6 +45,7 @@
import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.ServiceDecorator;
/**
* This ServiceObjectFactory reconstructs a javax.xml.ws.Service
@@ -104,7 +105,7 @@
{
if (wsdlURL != null)
{
- target = Service.create(wsdlURL, null);
+ target = ServiceDecorator.create(wsdlURL, null);
}
else
{
@@ -144,6 +145,9 @@
throw new WebServiceException("Cannot find getter for port type:
" + portTypeName);
}
+ // process config-name and config-file
+ processConfig(target, serviceRef);
+
return target;
}
catch (Exception ex)
@@ -153,6 +157,19 @@
}
}
+ private void processConfig(Object target, UnifiedServiceRef serviceRef) {
+ if(target instanceof ServiceDecorator)
+ {
+ ServiceDecorator service = (ServiceDecorator)target;
+ service.setProperty(ServiceDecorator.CLIENT_CONF_NAME,
serviceRef.getConfigName());
+ service.setProperty(ServiceDecorator.CLIENT_CONF_FILE,
serviceRef.getConfigFile());
+ }
+ else
+ {
+ log.warn("Configuration ignored for " + target.getClass().getName());
+ }
+ }
+
private UnifiedServiceRef unmarshallServiceRef(Reference ref) throws
ClassNotFoundException, NamingException
{
UnifiedServiceRef sref;
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/SOAPMessageContextJAXWS.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/SOAPMessageContextJAXWS.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/SOAPMessageContextJAXWS.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -60,7 +60,7 @@
public SOAPMessageContextJAXWS(CommonMessageContext msgContext)
{
- super(msgContext);
+ super(msgContext);
}
/**
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -30,6 +30,7 @@
import org.jboss.ws.core.jaxws.client.ClientProxy;
import org.jboss.ws.core.jaxws.client.DispatchImpl;
import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
+import org.jboss.ws.core.jaxws.StubExt;
import org.jboss.ws.metadata.builder.jaxws.JAXWSClientEndpointMetaDataBuilder;
import org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder;
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
@@ -313,7 +314,7 @@
ExecutorService executor = (ExecutorService)getExecutor();
ClientProxy handler = new ClientProxy(executor, new ClientImpl(epMetaData,
handlerResolver));
ClassLoader cl = epMetaData.getClassLoader();
- T proxy = (T)Proxy.newProxyInstance(cl, new Class[] { seiClass,
BindingProvider.class }, handler);
+ T proxy = (T)Proxy.newProxyInstance(cl, new Class[] { seiClass,
BindingProvider.class, StubExt.class }, handler);
return proxy;
}
catch (WebServiceException ex)
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -113,8 +113,8 @@
/**
* Check if MTOM is enabled.<br>
*
- * With JAX-WS is depends on a endpoint property and defaults to FALSE,
- * opposed to JAX-RPC where it defaults to TRUE and is set through a message context
property.
+ * Even though the client API to enable/disable MTOM is different
+ * between JAX-WS and JAXRPC, both do will cases will propagate a message context
property.
* (<code>org.jboss.ws.mtom.enabled</code>)<br>
*/
public static boolean isMTOMEnabled()
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/Configurable.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/Configurable.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/Configurable.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -1,5 +1,7 @@
package org.jboss.ws.metadata.config;
+import java.util.Observer;
+
/**
* A marker interface that identifies configurable JBossWS components.
*
@@ -7,5 +9,5 @@
* @version $Id$
* @since 15.12.2006
*/
-public interface Configurable {
+public interface Configurable extends Observer {
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/ConfigurationProvider.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/ConfigurationProvider.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/ConfigurationProvider.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -21,28 +21,25 @@
*/
package org.jboss.ws.metadata.config;
-// $Id: $
-
-
/**
* Provides configuration for JBossWS components.<br>
* Currently this is implemented by <code>EndpointMetaData</code>.
*
* @author Heiko.Braun(a)jboss.org
+ * @version $Id$
* @since 15.12.2006
*
* @see org.jboss.ws.metadata.umdm.EndpointMetaData
*/
-public interface ConfigurationProvider
-{
+public interface ConfigurationProvider {
- static final String DEFAULT_JAXRPC_ENDPOINT_CONFIG_FILE =
"META-INF/standard-jaxrpc-endpoint-config.xml";
- static final String DEFAULT_JAXWS_ENDPOINT_CONFIG_FILE =
"META-INF/standard-jaxws-endpoint-config.xml";
- static final String DEFAULT_ENDPOINT_CONFIG_NAME = "Standard Endpoint";
+ static final String DEFAULT_JAXRPC_ENDPOINT_CONFIG_FILE =
"META-INF/standard-jaxrpc-endpoint-config.xml";
+ static final String DEFAULT_JAXWS_ENDPOINT_CONFIG_FILE =
"META-INF/standard-jaxws-endpoint-config.xml";
+ static final String DEFAULT_ENDPOINT_CONFIG_NAME = "Standard
Endpoint";
- static final String DEFAULT_JAXRPC_CLIENT_CONFIG =
"META-INF/standard-jaxrpc-client-config.xml";
- static final String DEFAULT_JAXWS_CLIENT_CONFIG =
"META-INF/standard-jaxws-client-config.xml";
- static final String DEFAULT_CLIENT_CONFIG_NAME = "Standard Client";
+ static final String DEFAULT_JAXRPC_CLIENT_CONFIG_FILE =
"META-INF/standard-jaxrpc-client-config.xml";
+ static final String DEFAULT_JAXWS_CLIENT_CONFIG_FILE =
"META-INF/standard-jaxws-client-config.xml";
+ static final String DEFAULT_CLIENT_CONFIG_NAME = "Standard
Client";
/**
* Callback for components that require configuration through jbossws-dd
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -115,6 +115,9 @@
}
}
+ /**
+ * @return config - cannot be null
+ */
public CommonConfig getConfig(String configName, String configFile)
{
CommonConfig config;
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -57,11 +57,11 @@
{
if (getType() == Type.JAXRPC)
{
- configFile = ConfigurationProvider.DEFAULT_JAXRPC_CLIENT_CONFIG;
+ configFile = ConfigurationProvider.DEFAULT_JAXRPC_CLIENT_CONFIG_FILE;
}
else
{
- configFile = ConfigurationProvider.DEFAULT_JAXWS_CLIENT_CONFIG;
+ configFile = ConfigurationProvider.DEFAULT_JAXWS_CLIENT_CONFIG_FILE;
}
setConfigFile(configFile);
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -24,12 +24,7 @@
// $Id$
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.xml.namespace.QName;
@@ -64,7 +59,8 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2005
*/
-public abstract class EndpointMetaData extends ExtensibleMetaData implements
ConfigurationProvider, Configurable
+public abstract class EndpointMetaData extends ExtensibleMetaData
+ implements ConfigurationProvider, Configurable
{
// provide logging
private static Logger log = Logger.getLogger(EndpointMetaData.class);
@@ -78,7 +74,7 @@
private ServiceMetaData serviceMetaData;
// The REQUIRED endpoint config
- private CommonConfig endpointConfig;
+ private CommonConfig config;
// The REQUIRED name
private QName portName;
@@ -119,6 +115,8 @@
// Maps the java method to the operation meta data
private Map<Method, OperationMetaData> opMetaDataCache = new HashMap<Method,
OperationMetaData>();
+ private ConfigObservable configObservable = new ConfigObservable();
+
public EndpointMetaData(ServiceMetaData service, QName qname, QName interfaceQName,
Type type)
{
this.serviceMetaData = service;
@@ -162,8 +160,10 @@
public void setBindingId(String bindingId)
{
- if (!Constants.SOAP11HTTP_BINDING.equals(bindingId) &&
!Constants.SOAP12HTTP_BINDING.equals(bindingId) &&
!Constants.SOAP11HTTP_MTOM_BINDING.equals(bindingId)
- && !Constants.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
+ if (!Constants.SOAP11HTTP_BINDING.equals(bindingId)
+ && !Constants.SOAP12HTTP_BINDING.equals(bindingId)
+ && !Constants.SOAP11HTTP_MTOM_BINDING.equals(bindingId)
+ && !Constants.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
{
throw new WSException("Unsupported binding: " + bindingId);
}
@@ -390,10 +390,10 @@
boolean doesMatch = aux.getJavaMethod().equals(method);
// fallback for async methods
- if (!doesMatch &&
method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
+ if(!doesMatch &&
method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
{
String name = method.getName();
- name = name.substring(0, name.length() - 5);
+ name = name.substring(0, name.length()-5);
doesMatch = aux.getJavaName().equals(name);
}
@@ -519,8 +519,7 @@
List<Class> registeredTypes = typeMapping.getJavaTypes(xmlType);
boolean registered = false;
- for (Class current : registeredTypes)
- {
+ for (Class current : registeredTypes) {
if (current.getName().equals(javaTypeName))
{
registered = true;
@@ -571,37 +570,46 @@
*
* @param configurable
*/
- public void configure(Configurable configurable)
- {
+ public void configure(Configurable configurable) {
- if (endpointConfig == null)
+ // emit notificatins when the config changes
+ this.configObservable.addObserver(configurable);
+
+ if(null == config)
{
+ log.trace("Create new config: " +
getConfigFile()+":"+getConfigName());
JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance();
- endpointConfig = factory.getConfig(getConfigName(), getConfigFile());
+ config = factory.getConfig(getConfigName(), getConfigFile());
}
+ else
+ {
+ log.trace("Reusing cached config. Current should be: " +
getConfigFile()+":"+getConfigName());
+ }
// SOAPBinding configuration
- if (configurable instanceof CommonBindingProvider)
+ if(configurable instanceof CommonBindingProvider)
{
log.debug("Configure SOAPBinding");
- if (endpointConfig.hasFeature(EndpointFeature.MTOM))
+ if(config.hasFeature(EndpointFeature.MTOM))
{
- ((CommonSOAPBinding)configurable).setMTOMEnabled(true);
+ CommonBindingProvider provider = (CommonBindingProvider)configurable;
+ ((CommonSOAPBinding)provider.getCommonBinding()).setMTOMEnabled(true);
log.debug("Enable MTOM on endpoint " + this.getQName());
}
}
// Configure EndpointMetaData
- else if (configurable instanceof EndpointMetaData)
+ else if(configurable instanceof EndpointMetaData)
{
+
log.debug("Configure EndpointMetaData");
List<HandlerMetaData> sepHandlers =
getHandlerMetaData(HandlerType.ENDPOINT);
clearHandlers();
- List<HandlerMetaData> preHandlers = endpointConfig.getHandlers(this,
HandlerType.PRE);
- List<HandlerMetaData> postHandlers = endpointConfig.getHandlers(this,
HandlerType.POST);
+ List<HandlerMetaData> preHandlers = config.getHandlers(this,
HandlerType.PRE);
+ List<HandlerMetaData> postHandlers = config.getHandlers(this,
HandlerType.POST);
addHandlers(preHandlers);
addHandlers(sepHandlers);
@@ -610,6 +618,7 @@
log.debug("Added " + preHandlers.size() + " PRE handlers");
log.debug("Added " + postHandlers.size() + " POST
handlers");
}
+
}
public String getConfigFile()
@@ -620,7 +629,7 @@
public void setConfigFile(String configFile)
{
this.configFile = configFile;
- this.endpointConfig = null;
+ this.config = null;
}
public String getConfigName()
@@ -631,6 +640,22 @@
public void setConfigName(String configName)
{
this.configName = configName;
- this.endpointConfig = null;
+ this.config = null;
+
+ // notify obervers
+ log.debug("Reconfiguration forced");
+ this.configObservable.touch();
+ this.configObservable.notifyObservers(configName);
}
+
+ public void update(Observable observable, Object object) {
+ log.trace("Ingore configuration change notification");
}
+
+ class ConfigObservable extends Observable {
+ public void touch()
+ {
+ setChanged();
+ };
+ }
+}
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/samples/retail/OrderStatus.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/samples/retail/OrderStatus.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/samples/retail/OrderStatus.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -21,6 +21,9 @@
*/
package org.jboss.test.ws.jaxws.samples.retail;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlAccessType;
import java.io.Serializable;
/**
@@ -28,6 +31,11 @@
* @version $Id$
* @since Nov 8, 2006
*/
+
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "orderStatus", propOrder = {
+ "status", "orderNum", "discount"
+ })
public class OrderStatus implements Serializable {
private String status;
private long orderNum;
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java 2007-01-08
13:30:47 UTC (rev 1861)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java 2007-01-08
13:32:01 UTC (rev 1862)
@@ -82,6 +82,7 @@
}
OrderStatus result = orderMgmtWS.prepareOrder(ORDER);
+ assertNotNull("Result was null", result);
assertEquals("Prepared", result.getStatus());
}
}