Author: heiko.braun(a)jboss.com
Date: 2006-12-18 07:26:19 -0500 (Mon, 18 Dec 2006)
New Revision: 1665
Added:
trunk/src/main/java/org/jboss/ws/metadata/config/Configurable.java
trunk/src/main/java/org/jboss/ws/metadata/config/ConfigurationProvider.java
trunk/src/main/java/org/jboss/ws/metadata/config/EndpointFeature.java
Modified:
trunk/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPDocument.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/config/CommonConfig.java
trunk/src/main/java/org/jboss/ws/metadata/config/EndpointProperty.java
trunk/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/ConfigRootJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/ConfigRootJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
trunk/src/main/resources/jbossws.sar/META-INF/standard-jaxws-client-config.xml
trunk/src/main/resources/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml
trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java
trunk/src/test/resources/common/config/jaxws-endpoint-config.xml
Log:
Refactor ConfigFactory and ConfigProvider
Modified: trunk/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2006-12-18 10:52:44
UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2006-12-18 12:26:19
UTC (rev 1665)
@@ -30,6 +30,8 @@
import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.config.Configurable;
+import org.jboss.ws.metadata.config.ConfigurationProvider;
/**
* Provides access to the protocol binding.
@@ -37,17 +39,17 @@
* @author Thomas.Diesler(a)jboss.com
* @since 04-Jul-2006
*/
-public class CommonBindingProvider
+public class CommonBindingProvider implements Configurable
{
protected EndpointMetaData epMetaData;
protected CommonBinding binding;
-
+
public CommonBindingProvider(EndpointMetaData epMetaData)
{
this.epMetaData = epMetaData;
initBinding(epMetaData.getBindingId(), epMetaData.getType());
}
-
+
public CommonBindingProvider(String bindingId, Type type)
{
initBinding(bindingId, type);
@@ -69,6 +71,13 @@
{
throw new WSException("Unsupported binding: " + bindingId);
}
+
+ // process MTOM config elements
+ if(epMetaData!=null)
+ {
+ ConfigurationProvider configProvider = (ConfigurationProvider)epMetaData;
+ configProvider.configure(this);
+ }
}
public CommonBinding getCommonBinding()
Modified: trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-18 10:52:44 UTC
(rev 1664)
+++ trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-18 12:26:19 UTC
(rev 1665)
@@ -23,26 +23,6 @@
// $Id$
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
-
import org.apache.xerces.xs.XSElementDeclaration;
import org.apache.xerces.xs.XSTypeDefinition;
import org.jboss.logging.Logger;
@@ -52,18 +32,7 @@
import org.jboss.ws.core.jaxrpc.StubExt;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.NameImpl;
-import org.jboss.ws.core.soap.SOAPBodyElementDoc;
-import org.jboss.ws.core.soap.SOAPBodyElementRpc;
-import org.jboss.ws.core.soap.SOAPContentElement;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPFactoryImpl;
-import org.jboss.ws.core.soap.SOAPFaultImpl;
-import org.jboss.ws.core.soap.SOAPHeaderElementImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.soap.UnboundHeader;
+import org.jboss.ws.core.soap.*;
import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
import org.jboss.ws.core.soap.attachment.CIDGenerator;
import org.jboss.ws.core.utils.DOMUtils;
@@ -76,6 +45,15 @@
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Element;
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.soap.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
/**
* The SOAPBinding interface is an abstraction for the SOAP binding.
*
@@ -142,7 +120,7 @@
if (opMetaData.isRPCEncoded())
XOPContext.setMTOMEnabled(false);
else
- XOPContext.setMTOMEnabled( isMTOMEnabled() );
+ XOPContext.setMTOMEnabled( isMTOMEnabled() );
// Associate current message with message context
SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
Modified: trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-18 10:52:44 UTC
(rev 1664)
+++ trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-18 12:26:19 UTC
(rev 1665)
@@ -569,6 +569,7 @@
}
catch (Exception ex)
{
+ ex.printStackTrace();
throw new RemoteException("Call invocation failed", ex);
}
finally
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPDocument.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPDocument.java 2006-12-18 10:52:44 UTC
(rev 1664)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPDocument.java 2006-12-18 12:26:19 UTC
(rev 1665)
@@ -422,7 +422,7 @@
public Object getFeature(String arg0, String arg1)
{
- // FIXME getFeature
+ // FIXME hasFeature
return null;
}
Modified:
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -28,6 +28,7 @@
import org.jboss.ws.core.server.AbstractServiceEndpointServlet;
import org.jboss.ws.core.server.ServiceEndpoint;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.config.ConfigurationProvider;
import javax.servlet.ServletContext;
@@ -60,10 +61,14 @@
{
log.debug("Updating service endpoint config\n config-name: " +
configName + "\n config-file: " + configFile);
ServerEndpointMetaData sepMetaData =
wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
- sepMetaData.setConfigName(configName);
- sepMetaData.setConfigFile(configFile);
- sepMetaData.processEndpointConfig();
+ ConfigurationProvider configProvider = (ConfigurationProvider)sepMetaData;
+ configProvider.setConfigName(configName);
+ configProvider.setConfigFile(configFile);
+
+ // configure handler chain
+ configProvider.configure(sepMetaData);
+
log.debug("Updated server meta data" + sepMetaData);
}
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -175,7 +175,7 @@
sepMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
}
- public static ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi,
ServerEndpointMetaData sepMetaData)
+ public static ObjectName createServiceEndpointID(UnifiedDeploymentInfo udi,
ServerEndpointMetaData sepMetaData)
{
String linkName = sepMetaData.getLinkName();
String context = sepMetaData.getContextRoot();
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -33,6 +33,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.metadata.config.jaxrpc.ClientConfigJAXRPC;
+import org.jboss.ws.metadata.config.JBossWSConfigFactory;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
@@ -219,7 +220,8 @@
private void setupHandlers(UnifiedServiceRefMetaData serviceRefMetaData, QName
portName, EndpointMetaData epMetaData)
{
// Add pre handlers
- ClientConfigJAXRPC jaxrpcConfig =
(ClientConfigJAXRPC)epMetaData.getEndpointConfig();
+ JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance();
+ ClientConfigJAXRPC jaxrpcConfig =
(ClientConfigJAXRPC)factory.getConfig(epMetaData.getConfigName(),
epMetaData.getConfigFile());
epMetaData.addHandlers(jaxrpcConfig.getHandlers(epMetaData, HandlerType.PRE));
// Setup the endpoint handlers
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -25,6 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.metadata.config.jaxrpc.EndpointConfigJAXRPC;
+import org.jboss.ws.metadata.config.JBossWSConfigFactory;
import org.jboss.ws.metadata.j2ee.*;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
@@ -145,7 +146,7 @@
serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
// Copy <port-component> meta data
- UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)apMetaData.getBeanByEjbName(linkName);
+ UnifiedBeanMetaData beanMetaData =
apMetaData.getBeanByEjbName(linkName);
if (beanMetaData == null)
throw new WSException("Cannot obtain UnifiedBeanMetaData for:
" + linkName);
@@ -199,7 +200,7 @@
}
// init service endpoint id
- ObjectName sepID = getServiceEndpointID(udi, sepMetaData);
+ ObjectName sepID = createServiceEndpointID(udi, sepMetaData);
sepMetaData.setServiceEndpointID(sepID);
replaceAddressLocation(sepMetaData);
@@ -218,7 +219,8 @@
setupOperationsFromWSDL(sepMetaData, wsdlEndpoint, seiMapping);
// Add pre handlers
- EndpointConfigJAXRPC jaxrpcConfig =
(EndpointConfigJAXRPC)sepMetaData.getEndpointConfig();
+ JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance();
+ EndpointConfigJAXRPC jaxrpcConfig =
(EndpointConfigJAXRPC)factory.getConfig(sepMetaData.getConfigName(),
sepMetaData.getConfigFile());
sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData,
HandlerType.PRE));
// Setup the endpoint handlers
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -61,7 +61,7 @@
processSOAPBinding(epMetaData, wsClass);
// process config, this will as well setup the handler
- epMetaData.processEndpointConfig();
+ epMetaData.configure(epMetaData);
// Process an optional @HandlerChain annotation
if (wsClass.isAnnotationPresent(HandlerChain.class))
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -48,6 +48,9 @@
protected void processBindingType(EndpointMetaData epMetaData, Class<?>
wsClass)
{
+ if (! wsClass.isAnnotationPresent(BindingType.class))
+ return;
+
BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
String uri = anBindingType.value();
if (uri.length() > 0)
@@ -58,86 +61,87 @@
protected void processPortComponent(UnifiedDeploymentInfo udi, Class<?> wsClass,
String linkName, ServerEndpointMetaData sepMetaData)
{
- PortComponent anPortComponent =
(PortComponent)wsClass.getAnnotation(PortComponent.class);
- if (anPortComponent != null)
+ PortComponent anPortComponent = wsClass.getAnnotation(PortComponent.class);
+ if (anPortComponent == null)
+ return;
+
+ // setup config name
+ if (anPortComponent.configName().length() > 0)
{
- // setup config name
- if (anPortComponent.configName().length() > 0)
- {
- String configName = anPortComponent.configName();
- sepMetaData.setConfigName(configName);
- }
+ String configName = anPortComponent.configName();
+ sepMetaData.setConfigName(configName);
+ }
- // setup config file
- if (anPortComponent.configFile().length() > 0)
- {
- String configFile = anPortComponent.configFile();
- sepMetaData.setConfigFile(configFile);
- }
+ // setup config file
+ if (anPortComponent.configFile().length() > 0)
+ {
+ String configFile = anPortComponent.configFile();
+ sepMetaData.setConfigFile(configFile);
+ }
- boolean isJSEEndpoint = udi.type == DeploymentType.JAXWS_JSE;
+ boolean isJSEEndpoint = udi.type == DeploymentType.JAXWS_JSE;
- // context-root
- if (anPortComponent.contextRoot().length() > 0)
+ // context-root
+ if (anPortComponent.contextRoot().length() > 0)
+ {
+ if (isJSEEndpoint)
+ log.warn("(a)PortComponent.contextRoot is only valid on EJB
endpoints");
+
+ if (isJSEEndpoint == false)
{
- if (isJSEEndpoint)
- log.warn("(a)PortComponent.contextRoot is only valid on EJB
endpoints");
+ String contextRoot = anPortComponent.contextRoot();
+ if (contextRoot.startsWith("/") == false)
+ contextRoot = "/" + contextRoot;
- if (isJSEEndpoint == false)
- {
- String contextRoot = anPortComponent.contextRoot();
- if (contextRoot.startsWith("/") == false)
- contextRoot = "/" + contextRoot;
-
- sepMetaData.setContextRoot(contextRoot);
- }
+ sepMetaData.setContextRoot(contextRoot);
}
+ }
- // url-pattern
- if (anPortComponent.urlPattern().length() > 0)
+ // url-pattern
+ if (anPortComponent.urlPattern().length() > 0)
+ {
+ if (isJSEEndpoint)
+ log.warn("(a)PortComponent.urlPattern is only valid on EJB
endpoints");
+
+ if (isJSEEndpoint == false)
{
- if (isJSEEndpoint)
- log.warn("(a)PortComponent.urlPattern is only valid on EJB
endpoints");
-
- if (isJSEEndpoint == false)
- {
- String urlPattern = anPortComponent.urlPattern();
- sepMetaData.setURLPattern(urlPattern);
- }
+ String urlPattern = anPortComponent.urlPattern();
+ sepMetaData.setURLPattern(urlPattern);
}
+ }
- // auth-method
- if (anPortComponent.authMethod().length() > 0)
+ // auth-method
+ if (anPortComponent.authMethod().length() > 0)
+ {
+ if (isJSEEndpoint)
+ log.warn("(a)PortComponent.authMethod is only valid on EJB
endpoints");
+
+ if (isJSEEndpoint == false)
{
- if (isJSEEndpoint)
- log.warn("(a)PortComponent.authMethod is only valid on EJB
endpoints");
-
- if (isJSEEndpoint == false)
- {
- String authMethod = anPortComponent.authMethod();
- sepMetaData.setAuthMethod(authMethod);
- }
+ String authMethod = anPortComponent.authMethod();
+ sepMetaData.setAuthMethod(authMethod);
}
+ }
- // transport-guarantee
- if (anPortComponent.transportGuarantee().length() > 0)
+ // transport-guarantee
+ if (anPortComponent.transportGuarantee().length() > 0)
+ {
+ if (isJSEEndpoint)
+ log.warn("(a)PortComponent.transportGuarantee is only valid on EJB
endpoints");
+
+ if (isJSEEndpoint == false)
{
- if (isJSEEndpoint)
- log.warn("(a)PortComponent.transportGuarantee is only valid on EJB
endpoints");
-
- if (isJSEEndpoint == false)
- {
- String transportGuarantee = anPortComponent.transportGuarantee();
- sepMetaData.setTransportGuarantee(transportGuarantee);
- }
+ String transportGuarantee = anPortComponent.transportGuarantee();
+ sepMetaData.setTransportGuarantee(transportGuarantee);
}
-
- // virtual hosts
- String[] virtualHosts = anPortComponent.virtualHosts();
- if (virtualHosts != null & virtualHosts.length > 0)
- {
- sepMetaData.setVirtualHosts(virtualHosts);
- }
}
+
+ // virtual hosts
+ String[] virtualHosts = anPortComponent.virtualHosts();
+ if (virtualHosts != null & virtualHosts.length > 0)
+ {
+ sepMetaData.setVirtualHosts(virtualHosts);
+ }
+
}
}
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -145,7 +145,7 @@
MetaDataBuilder.replaceAddressLocation(sepMetaData);
// init service endpoint id
- ObjectName sepID = MetaDataBuilder.getServiceEndpointID(udi, sepMetaData);
+ ObjectName sepID = MetaDataBuilder.createServiceEndpointID(udi, sepMetaData);
sepMetaData.setServiceEndpointID(sepID);
return sepMetaData;
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -68,7 +68,6 @@
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
-import javax.xml.ws.BindingType;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.WebFault;
@@ -89,10 +88,13 @@
import java.util.List;
import java.util.Map;
-/** An abstract annotation meta data builder.
+/**
+ * An abstract annotation meta data builder.
*
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @author Heiko.Braun(a)jboss.org
+ *
* @since 15-Oct-2005
*/
@SuppressWarnings("deprecation")
@@ -304,7 +306,7 @@
return null;
}
- private QName getWebParamName(OperationMetaData opMetaData, int index, Class javaType,
WebParam webParam)
+ private QName getWebParamName(OperationMetaData opMetaData, int index, WebParam
webParam)
{
String namespace = null;
String name = null;
@@ -339,7 +341,7 @@
return (namespace != null) ? new QName(namespace, name) : new QName(name);
}
- private QName getWebResultName(OperationMetaData opMetaData, Class javaType, WebResult
anWebResult)
+ private QName getWebResultName(OperationMetaData opMetaData, WebResult anWebResult)
{
String name = null;
String namespace = null;
@@ -427,7 +429,7 @@
*/
private void processMetaExtensions(EndpointMetaData epMetaData, OperationMetaData
opMetaData)
{
- // Until there is a addressing annotion we fallback to implicit action asosciation
+ // Until there is a addressing annotion we fallback to implicit action association
// TODO: figure out a way to assign message name instead of IN and OUT
String tns = epMetaData.getQName().getNamespaceURI();
String portTypeName = epMetaData.getQName().getLocalPart();
@@ -530,7 +532,7 @@
if (isWrapped)
{
- QName wrappedElementName = getWebParamName(opMetaData, i, javaType,
anWebParam);
+ QName wrappedElementName = getWebParamName(opMetaData, i, anWebParam);
String variable = convertToVariable(wrappedElementName.getLocalPart());
WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName,
javaTypeName, variable, i);
@@ -546,7 +548,7 @@
}
else
{
- QName xmlName = getWebParamName(opMetaData, i, javaType, anWebParam);
+ QName xmlName = getWebParamName(opMetaData, i, anWebParam);
ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName,
javaTypeName);
paramMetaData.setInHeader(isHeader);
@@ -566,7 +568,7 @@
Class returnType = method.getReturnType();
Type genericReturnType = method.getGenericReturnType();
String returnTypeName = returnType.getName();
- if ((returnType == void.class) == false)
+ if (!(returnType == void.class))
{
if (opMetaData.isOneWay())
throw new IllegalArgumentException("[JSR-181 2.5.1] The method
'" + method.getName() + "' can not have a return value if it is marked
OneWay");
@@ -574,7 +576,7 @@
WebResult anWebResult = method.getAnnotation(WebResult.class);
boolean isHeader = anWebResult != null && anWebResult.header();
boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
- QName xmlName = getWebResultName(opMetaData, returnType, anWebResult);
+ QName xmlName = getWebResultName(opMetaData, anWebResult);
if (isWrapped)
{
@@ -632,7 +634,7 @@
throw new WSException("Cannot obtain @WebService annotation from: " +
sepClass.getName());
Class<?> seiClass = null;
- String seiName = null;
+ String seiName;
WSDLUtils wsdlUtils = WSDLUtils.getInstance();
String name = anWebService.name();
@@ -750,7 +752,7 @@
if (wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
throw new WSException("Cannot combine @HandlerChain with
@SOAPMessageHandlers");
- HandlerChain anHandlerChain =
(HandlerChain)wsClass.getAnnotation(HandlerChain.class);
+ HandlerChain anHandlerChain = wsClass.getAnnotation(HandlerChain.class);
URL fileURL = null;
String filename = anHandlerChain.file();
@@ -884,8 +886,12 @@
protected void processSOAPBinding(EndpointMetaData epMetaData, Class<?>
wsClass)
{
- SOAPBinding anSoapBinding = (SOAPBinding)wsClass.getAnnotation(SOAPBinding.class);
+ if (! wsClass.isAnnotationPresent(SOAPBinding.class))
+ return;
+
+ SOAPBinding anSoapBinding = wsClass.getAnnotation(SOAPBinding.class);
+
SOAPBinding.Style attrStyle = anSoapBinding.style();
Style style = (attrStyle == SOAPBinding.Style.RPC ? Style.RPC : Style.DOCUMENT);
epMetaData.setStyle(style);
@@ -959,49 +965,61 @@
// Clear the java types, etc.
resetMetaDataBuilder(udi.classLoader);
- ServerEndpointMetaData sepMetaData = result.semd;
- ServiceMetaData serviceMetaData = result.smd;
- Class<?> wsClass = result.klass;
+ ServerEndpointMetaData sepMetaData = result.semd;
+ ServiceMetaData serviceMetaData = result.smd;
+ Class<?> seiClass = result.klass;
+
sepMetaData.setLinkName(linkName);
+ sepMetaData.setServiceEndpointImplName(sepClass.getName());
+ sepMetaData.setServiceEndpointInterfaceName(seiClass.getName());
// Assign the WS-Security configuration,
WSSecurityConfigFactory wsseConfFactory =
WSSecurityConfigFactory.newInstance();
WSSecurityConfiguration securityConfiguration =
wsseConfFactory.createConfiguration(udi);
serviceMetaData.setSecurityConfiguration(securityConfiguration);
- sepMetaData.setServiceEndpointImplName(sepClass.getName());
- sepMetaData.setServiceEndpointInterfaceName(wsClass.getName());
// Process an optional @SOAPBinding annotation
- if (wsClass.isAnnotationPresent(SOAPBinding.class))
- processSOAPBinding(sepMetaData, wsClass);
+ processSOAPBinding(sepMetaData, seiClass);
// Process an optional @BindingType annotation
- if (wsClass.isAnnotationPresent(BindingType.class))
- processBindingType(sepMetaData, wsClass);
+ processBindingType(sepMetaData, seiClass);
+ // Process web methods
+ processWebMethods(sepMetaData, seiClass);
+
// Init the transport guarantee
initTransportGuaranteeJSE(udi, sepMetaData, linkName);
- // Process web methods
- processWebMethods(sepMetaData, wsClass);
-
// Initialize types
createJAXBContext(sepMetaData);
populateXmlTypes(sepMetaData);
// Process or generate WSDL
- processOrGenerateWSDL(wsClass, serviceMetaData, result.wsdlLocation,
sepMetaData);
+ processOrGenerateWSDL(seiClass, serviceMetaData, result.wsdlLocation,
sepMetaData);
- // Read the generated WSDL and initialize the schema model
- // FIXME - This should be removed
+ // process config name and config file amongst others
+ processPortComponent(udi, seiClass, linkName, sepMetaData);
+
+ // setup handler chain from config
+ sepMetaData.configure(sepMetaData);
+
+ // Process an optional @HandlerChain annotation
+ if (sepClass.isAnnotationPresent(HandlerChain.class))
+ {
+ processHandlerChain(sepMetaData, sepClass);
+ }
+ else if (seiClass.isAnnotationPresent(HandlerChain.class))
+ {
+ processHandlerChain(sepMetaData, seiClass);
+ }
+
+
+ // Sanity check: read the generated WSDL and initialize the schema model
WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
JBossXSModel schemaModel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
- // Set the endpoint address
- processPortComponent(udi, wsClass, linkName, sepMetaData);
-
// Init the endpoint address
MetaDataBuilder.initEndpointAddress(udi, sepMetaData, linkName);
@@ -1009,24 +1027,11 @@
MetaDataBuilder.replaceAddressLocation(sepMetaData);
// Process an optional @SOAPMessageHandlers annotation
- if (sepClass.isAnnotationPresent(SOAPMessageHandlers.class) ||
wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
+ if (sepClass.isAnnotationPresent(SOAPMessageHandlers.class) ||
seiClass.isAnnotationPresent(SOAPMessageHandlers.class))
log.warn("@SOAPMessageHandlers is deprecated as of JAX-WS 2.0 with no
replacement.");
- // setup handler chain from config
- sepMetaData.processEndpointConfig();
-
- // Process an optional @HandlerChain annotation
- if (sepClass.isAnnotationPresent(HandlerChain.class))
- {
- processHandlerChain(sepMetaData, sepClass);
- }
- else if (wsClass.isAnnotationPresent(HandlerChain.class))
- {
- processHandlerChain(sepMetaData, wsClass);
- }
-
// init service endpoint id
- ObjectName sepID = MetaDataBuilder.getServiceEndpointID(udi, sepMetaData);
+ ObjectName sepID = MetaDataBuilder.createServiceEndpointID(udi, sepMetaData);
sepMetaData.setServiceEndpointID(sepID);
return sepMetaData;
Modified: trunk/src/main/java/org/jboss/ws/metadata/config/CommonConfig.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/CommonConfig.java 2006-12-18 10:52:44
UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/CommonConfig.java 2006-12-18 12:26:19
UTC (rev 1665)
@@ -56,13 +56,13 @@
public abstract List<HandlerMetaData> getHandlers(EndpointMetaData epMetaData,
HandlerType type);
- public boolean getFeature(URI type) {
+ public boolean hasFeature(URI type) {
return features.contains(type);
}
- public boolean getFeature(String uri)
+ public boolean hasFeature(String uri)
{
- return getFeature(nameToURI(uri));
+ return hasFeature(nameToURI(uri));
}
public void setFeature(String type, boolean enabled) {
Added: trunk/src/main/java/org/jboss/ws/metadata/config/Configurable.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/Configurable.java 2006-12-18 10:52:44
UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/Configurable.java 2006-12-18 12:26:19
UTC (rev 1665)
@@ -0,0 +1,11 @@
+package org.jboss.ws.metadata.config;
+
+/**
+ * A marker interface that identifies configurable JBossWS components.
+ *
+ * @author Heiko.Braun(a)jboss.org
+ * @version $Id$
+ * @since 15.12.2006
+ */
+public interface Configurable {
+}
Added: trunk/src/main/java/org/jboss/ws/metadata/config/ConfigurationProvider.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/ConfigurationProvider.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/ConfigurationProvider.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -0,0 +1,37 @@
+package org.jboss.ws.metadata.config;
+
+/**
+ * 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 {
+
+ 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";
+
+ /**
+ * Callback for components that require configuration through jbossws-dd
+ *
+ * @param configurable
+ */
+ void configure(Configurable configurable);
+
+ String getConfigFile();
+
+ void setConfigFile(String configFile);
+
+ String getConfigName();
+
+ void setConfigName(String configName);
+}
Added: trunk/src/main/java/org/jboss/ws/metadata/config/EndpointFeature.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/EndpointFeature.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/EndpointFeature.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -0,0 +1,31 @@
+/*
+ * 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.metadata.config;
+
+/**
+ * @author Heiko.Braun(a)jboss.org
+ * @version $Id$
+ * @since 14.12.2006
+ */
+public class EndpointFeature {
+ public final static String MTOM = "http://org.jboss.ws/mtom";
+}
Modified: trunk/src/main/java/org/jboss/ws/metadata/config/EndpointProperty.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/EndpointProperty.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/EndpointProperty.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -1,3 +1,24 @@
+/*
+ * 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.metadata.config;
import java.net.URI;
@@ -2,2 +23,7 @@
+/**
+ * @author Heiko.Braun(a)jboss.org
+ * @version $Id$
+ * @since 14.12.2006
+ */
public class EndpointProperty
Modified: trunk/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -28,12 +28,15 @@
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.metadata.config.binding.OMFactoryJAXRPC;
import org.jboss.ws.metadata.config.binding.OMFactoryJAXWS;
+import org.jboss.ws.metadata.config.jaxrpc.ConfigRootJAXRPC;
+import org.jboss.ws.metadata.config.jaxws.ConfigRootJAXWS;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.w3c.dom.Element;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
/**
@@ -47,8 +50,8 @@
// provide logging
private final Logger log = Logger.getLogger(JBossWSConfigFactory.class);
- private static String URN_JAXRPC_CONFIG = "urn:jboss:jaxrpc-config:2.0";
- private static String URN_JAXWS_CONFIG = "urn:jboss:jaxws-config:2.0";
+ private static String URN_JAXRPC_CONFIG = "urn:jboss:jaxrpc-config:2.0";
+ private static String URN_JAXWS_CONFIG = "urn:jboss:jaxws-config:2.0";
// Hide constructor
private JBossWSConfigFactory()
@@ -69,7 +72,6 @@
Object wsConfig;
try
{
-
Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
unmarshaller.setValidation(true);
unmarshaller.setSchemaValidation(true);
@@ -112,4 +114,55 @@
throw new WSException(ex);
}
}
+
+ public CommonConfig getConfig(String configName, String configFile)
+ {
+ CommonConfig config;
+
+ log.debug("getConfig: [name=" + configName + ",url=" +
configFile + "]");
+
+ // Get the config root
+ URL configURL = filenameToURL(configFile);
+ Object configRoot = parse(configURL);
+
+ // Get the endpoint config
+ if (configRoot instanceof ConfigRootJAXRPC)
+ {
+ config = ((ConfigRootJAXRPC)configRoot).getConfigByName(configName);
+ }
+ else
+ {
+ config = ((ConfigRootJAXWS)configRoot).getConfigByName(configName);
+ }
+
+ if (config == null)
+ throw new WSException("Cannot obtain config: " + configName);
+
+
+ return config;
+ }
+
+ private static URL filenameToURL(String configFile) {
+ URL configURL = null;
+ try
+ {
+ configURL = new URL(configFile);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+
+ // Try to get the URL as resource
+ if (configURL == null)
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ configURL = cl.getResource(configFile);
+ if (configURL == null)
+ throw new WSException("Cannot get resource: " + configFile);
+ }
+
+ return configURL;
+ }
+
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/ConfigRootJAXRPC.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/ConfigRootJAXRPC.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/ConfigRootJAXRPC.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -91,4 +91,12 @@
return config;
}
+
+ public CommonConfigJAXRPC getConfigByName(String name)
+ {
+ CommonConfigJAXRPC config = getClientConfigByName(name);
+ if(null == config)
+ config = getEndpointConfigByName(name);
+ return config;
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/ConfigRootJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/ConfigRootJAXWS.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/ConfigRootJAXWS.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -91,4 +91,12 @@
return config;
}
+
+ public CommonConfigJAXWS getConfigByName(String name)
+ {
+ CommonConfigJAXWS config = getClientConfigByName(name);
+ if(null == config)
+ config = getEndpointConfigByName(name);
+ return config;
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -23,19 +23,11 @@
// $Id$
-import java.net.MalformedURLException;
-import java.net.URL;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.config.ConfigurationProvider;
import javax.xml.namespace.QName;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.config.JBossWSConfigFactory;
-import org.jboss.ws.metadata.config.jaxrpc.ConfigRootJAXRPC;
-import org.jboss.ws.metadata.config.jaxws.ConfigRootJAXWS;
-import org.jboss.ws.metadata.config.jaxws.ClientConfigJAXWS;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
/**
* Client side endpoint meta data.
*
@@ -44,74 +36,16 @@
*/
public class ClientEndpointMetaData extends EndpointMetaData
{
- // provide logging
- private static Logger log = Logger.getLogger(ClientEndpointMetaData.class);
-
public ClientEndpointMetaData(ServiceMetaData service, QName qname, QName
interfaceQName, Type type)
{
super(service, qname, interfaceQName, type);
}
- public void setConfigName(String configName)
- {
- super.setConfigName(configName);
- endpointConfig = null;
- }
-
- public void setConfigFile(String configFile)
- {
- super.setConfigFile(configFile);
- endpointConfig = null;
- }
-
- @Override
- public Object getEndpointConfig()
- {
- if (endpointConfig == null)
- {
- String configName = getConfigName();
- String configFile = getConfigFile();
-
- log.debug("getClientConfig: [name=" + configName + ",url=" +
configFile + "]");
-
- // Get the config root
- URL configURL = filenameToURL(configFile);
- JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance();
- Object wsConfig = factory.parse(configURL);
-
- // Get the client config
- if (wsConfig instanceof ConfigRootJAXRPC)
- {
- endpointConfig =
((ConfigRootJAXRPC)wsConfig).getClientConfigByName(configName);
- }
- else
- {
- endpointConfig =
((ConfigRootJAXWS)wsConfig).getClientConfigByName(configName);
- }
-
- if (endpointConfig == null)
- throw new WSException("Cannot obtain client config: " +
configName);
- }
-
- return endpointConfig;
- }
-
- public void processEndpointConfig() {
-
- log.debug("Process endpoint config");
-
- // rebuild handler from config
- clearHandlers();
- ClientConfigJAXWS jaxwsConfig = (ClientConfigJAXWS)getEndpointConfig();
- addHandlers(jaxwsConfig.getHandlers(this, HandlerType.PRE));
- addHandlers(jaxwsConfig.getHandlers(this, HandlerType.POST));
- }
-
public String getConfigName() {
String configName = super.getConfigName();
if (configName == null)
{
- configName = "Standard Client";
+ configName = ConfigurationProvider.DEFAULT_CLIENT_CONFIG_NAME;
setConfigName(configName);
}
return configName;
@@ -123,59 +57,37 @@
{
if (getType() == Type.JAXRPC)
{
- configFile = "META-INF/standard-jaxrpc-client-config.xml";
+ configFile = ConfigurationProvider.DEFAULT_JAXRPC_CLIENT_CONFIG;
}
else
{
- configFile = "META-INF/standard-jaxws-client-config.xml";
+ configFile = ConfigurationProvider.DEFAULT_JAXWS_CLIENT_CONFIG;
}
setConfigFile(configFile);
}
return configFile;
}
- private URL filenameToURL(String configFile) {
- URL configURL = null;
- try
- {
- configURL = new URL(configFile);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- // Try to get the URL as resource
- if (configURL == null)
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- configURL = cl.getResource(configFile);
- if (configURL == null)
- throw new WSException("Cannot get resource: " + configFile);
- }
- return configURL;
- }
-
public String toString()
{
StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:");
- buffer.append("\n type=" + getType());
- buffer.append("\n qname=" + getQName());
- buffer.append("\n address=" + getEndpointAddress());
- buffer.append("\n binding=" + getBindingId());
- buffer.append("\n seiName=" + getServiceEndpointInterfaceName());
- buffer.append("\n configFile=" + getConfigFile());
- buffer.append("\n configName=" + getConfigName());
- buffer.append("\n authMethod=" + getAuthMethod());
- buffer.append("\n properties=" + getProperties());
+ buffer.append("\n type=").append(getType());
+ buffer.append("\n qname=").append(getQName());
+ buffer.append("\n address=" ).append(getEndpointAddress());
+ buffer.append("\n binding=" ).append( getBindingId());
+ buffer.append("\n seiName=" ).append(
getServiceEndpointInterfaceName());
+ buffer.append("\n configFile=" ).append( getConfigFile());
+ buffer.append("\n configName=" ).append( getConfigName());
+ buffer.append("\n authMethod=" ).append( getAuthMethod());
+ buffer.append("\n properties=" ).append( getProperties());
for (OperationMetaData opMetaData : getOperations())
{
- buffer.append("\n" + opMetaData);
+ buffer.append("\n" ).append( opMetaData);
}
for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
{
- buffer.append("\n" + hdlMetaData);
+ buffer.append("\n" ).append( hdlMetaData);
}
return buffer.toString();
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -26,6 +26,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.Use;
@@ -36,7 +38,7 @@
import org.jboss.ws.core.jaxws.JAXBDeserializerFactory;
import org.jboss.ws.core.jaxws.JAXBSerializerFactory;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.config.CommonConfig;
+import org.jboss.ws.metadata.config.*;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
import javax.jws.soap.SOAPBinding.ParameterStyle;
@@ -53,6 +55,7 @@
* @since 12-May-2005
*/
public abstract class EndpointMetaData extends ExtensibleMetaData
+ implements ConfigurationProvider, Configurable
{
// provide logging
private static Logger log = Logger.getLogger(EndpointMetaData.class);
@@ -66,7 +69,7 @@
private ServiceMetaData serviceMetaData;
// The REQUIRED endpoint config
- protected CommonConfig endpointConfig;
+ private CommonConfig endpointConfig;
// The REQUIRED name
private QName portName;
@@ -133,37 +136,6 @@
return interfaceQName;
}
- public String getConfigFile()
- {
- return configFile;
- }
-
- public void setConfigFile(String configFile)
- {
- this.configFile = configFile;
- this.endpointConfig = null;
- }
-
- public String getConfigName()
- {
- return configName;
- }
-
- public void setConfigName(String configName)
- {
- this.configName = configName;
- this.endpointConfig = null;
- }
-
- public abstract Object getEndpointConfig();
-
- /**
- * Processing the endpoint configuration will
- * reset parts of the meta data model and update it according to
- * the configuration given.
- */
- public abstract void processEndpointConfig();
-
public String getEndpointAddress()
{
return endpointAddress;
@@ -216,8 +188,7 @@
/** Get the class loader associated with the endpoint meta data */
public ClassLoader getClassLoader()
{
- ClassLoader classLoader =
getServiceMetaData().getUnifiedMetaData().getClassLoader();
- return classLoader;
+ return getServiceMetaData().getUnifiedMetaData().getClassLoader();
}
/**
@@ -372,7 +343,7 @@
for (ParameterMetaData auxParam : auxOperation.getParameters())
{
ParameterMode mode = auxParam.getMode();
- if (auxParam.isInHeader() == false && mode != ParameterMode.OUT)
+ if (!auxParam.isInHeader() && mode != ParameterMode.OUT)
{
paramMetaData = auxParam;
break;
@@ -583,4 +554,77 @@
}
}
}
+
+ // ---------------------------------------------------------------
+ // Configuration provider impl
+
+ /**
+ * Callback for components that require configuration through jbossws-dd
+ *
+ * @param configurable
+ */
+ public void configure(Configurable configurable) {
+
+ if(null == endpointConfig)
+ {
+ JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance();
+ endpointConfig = factory.getConfig(getConfigName(), getConfigFile());
+ }
+
+ // SOAPBinding configuration
+ if(configurable instanceof CommonBindingProvider)
+ {
+ log.debug("Configure SOAPBinding");
+
+ if(endpointConfig.hasFeature(EndpointFeature.MTOM))
+ {
+ ((CommonSOAPBinding)configurable).setMTOMEnabled(true);
+ log.debug("Enable MTOM on endpoint " + this.getQName());
+ }
+ }
+
+ // Configure 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);
+
+ addHandlers(preHandlers);
+ addHandlers(sepHandlers);
+ addHandlers(postHandlers);
+
+ log.debug("Added " + preHandlers.size() + " PRE handlers");
+ log.debug("Added " + postHandlers.size() + " POST
handlers");
+ }
+
+ }
+
+ public String getConfigFile()
+ {
+ return configFile;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ this.configFile = configFile;
+ this.endpointConfig = null;
+ }
+
+ public String getConfigName()
+ {
+ return configName;
+ }
+
+ public void setConfigName(String configName)
+ {
+ this.configName = configName;
+ this.endpointConfig = null;
+ }
+
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -23,19 +23,11 @@
// $Id$
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.config.CommonConfig;
-import org.jboss.ws.metadata.config.JBossWSConfigFactory;
-import org.jboss.ws.metadata.config.jaxrpc.ConfigRootJAXRPC;
-import org.jboss.ws.metadata.config.jaxws.ConfigRootJAXWS;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.config.ConfigurationProvider;
import javax.management.ObjectName;
import javax.xml.namespace.QName;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
/**
* Client side endpoint meta data.
@@ -46,9 +38,6 @@
*/
public class ServerEndpointMetaData extends EndpointMetaData
{
- // provide logging
- private static Logger log = Logger.getLogger(ServerEndpointMetaData.class);
-
public static final String SEPID_DOMAIN = "jboss.ws";
public static final String SEPID_PROPERTY_CONTEXT = "context";
public static final String SEPID_PROPERTY_ENDPOINT = "endpoint";
@@ -72,27 +61,11 @@
// The bean that registers with the ServiceEndpointManager
private String managedEndpointBean =
"org.jboss.ws.core.server.ServiceEndpoint";
- private static final String DEFAULT_JAXRPC_CONFIG_FILE =
"META-INF/standard-jaxrpc-endpoint-config.xml";
- private static final String DEFAULT_JAXWS_CONFIG_FILE =
"META-INF/standard-jaxws-endpoint-config.xml";
- private static final String DEFAULT_CONFIG_NAME = "Standard
Endpoint";
-
public ServerEndpointMetaData(ServiceMetaData service, QName qname, QName
interfaceQName, Type type)
{
super(service, qname, interfaceQName, type);
}
- public void setConfigName(String configName)
- {
- super.setConfigName(configName);
- endpointConfig = null;
- }
-
- public void setConfigFile(String configFile)
- {
- super.setConfigFile(configFile);
- endpointConfig = null;
- }
-
public String getLinkName()
{
return linkName;
@@ -189,43 +162,11 @@
this.managedEndpointBean = managedEndpointBean;
}
- @Override
- public CommonConfig getEndpointConfig()
- {
- if (endpointConfig == null)
- {
- String configName = getConfigName();
- String configFile = getConfigFile();
-
- log.debug("getEndpointConfig: [name=" + configName + ",url="
+ configFile + "]");
-
- // Get the config root
- URL configURL = filenameToURL(configFile);
- JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance();
- Object wsConfig = factory.parse(configURL);
-
- // Get the endpoint config
- if (wsConfig instanceof ConfigRootJAXRPC)
- {
- endpointConfig =
((ConfigRootJAXRPC)wsConfig).getEndpointConfigByName(configName);
- }
- else
- {
- endpointConfig =
((ConfigRootJAXWS)wsConfig).getEndpointConfigByName(configName);
- }
-
- if (endpointConfig == null)
- throw new WSException("Cannot obtain endpoint config: " +
configName);
- }
-
- return endpointConfig;
- }
-
public String getConfigName() {
String configName = super.getConfigName();
if (configName == null)
{
- configName = DEFAULT_CONFIG_NAME;
+ configName = ConfigurationProvider.DEFAULT_ENDPOINT_CONFIG_NAME;
setConfigName(configName);
}
return configName;
@@ -238,57 +179,17 @@
{
if (getType() == Type.JAXRPC)
{
- configFile = DEFAULT_JAXRPC_CONFIG_FILE;
+ configFile = ConfigurationProvider.DEFAULT_JAXRPC_ENDPOINT_CONFIG_FILE;
}
else
{
- configFile = DEFAULT_JAXWS_CONFIG_FILE;
+ configFile = ConfigurationProvider.DEFAULT_JAXWS_ENDPOINT_CONFIG_FILE;
}
setConfigFile(configFile);
}
return configFile;
}
- /**
- * Processes an associated configuration and
- * rebuilds the related meta data model.
- */
- public void processEndpointConfig()
- {
- log.debug("Process endpoint config");
-
- // update handler configuration
- List<HandlerMetaData> sepHandlers =
getHandlerMetaData(HandlerType.ENDPOINT);
- clearHandlers();
-
- CommonConfig sepConfig = getEndpointConfig();
- addHandlers(sepConfig.getHandlers(this, HandlerType.PRE));
- addHandlers(sepHandlers);
- addHandlers(sepConfig.getHandlers(this, HandlerType.POST));
- }
-
- private URL filenameToURL(String configFile) {
- URL configURL = null;
- try
- {
- configURL = new URL(configFile);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- // Try to get the URL as resource
- if (configURL == null)
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- configURL = cl.getResource(configFile);
- if (configURL == null)
- throw new WSException("Cannot get resource: " + configFile);
- }
- return configURL;
- }
-
public String toString()
{
StringBuilder buffer = new StringBuilder("\nServerEndpointMetaData:");
Modified: trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2006-12-18
10:52:44 UTC (rev 1664)
+++ trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -23,12 +23,11 @@
// $Id$
-import javax.xml.namespace.QName;
-
-import org.jboss.util.NotImplementedException;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import javax.xml.namespace.QName;
+
/**
* Tools Endpoint Metadata
* @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
@@ -42,14 +41,4 @@
{
super(service, name, interfaceQName, Type.JAXRPC);
}
-
- @Override
- public Object getEndpointConfig()
- {
- throw new NotImplementedException();
- }
-
- public void processEndpointConfig() {
- throw new NotImplementedException();
- }
}
\ No newline at end of file
Modified: trunk/src/main/resources/jbossws.sar/META-INF/standard-jaxws-client-config.xml
===================================================================
---
trunk/src/main/resources/jbossws.sar/META-INF/standard-jaxws-client-config.xml 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/resources/jbossws.sar/META-INF/standard-jaxws-client-config.xml 2006-12-18
12:26:19 UTC (rev 1665)
@@ -3,36 +3,43 @@
<!-- $Id$ -->
<jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
- xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
-
- <client-config>
- <config-name>Standard Client</config-name>
- </client-config>
-
- <client-config>
- <config-name>Standard WSAddressing Client</config-name>
- <post-handler-chains>
- <javaee:handler-chain>
- <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
- <javaee:handler>
- <javaee:handler-name>WSAddressing Handler</javaee:handler-name>
-
<javaee:handler-class>org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler</javaee:handler-class>
- </javaee:handler>
- </javaee:handler-chain>
- </post-handler-chains>
- </client-config>
-
- <client-config>
- <config-name>Standard WSSecurity Client</config-name>
- <post-handler-chains>
- <javaee:handler-chain>
- <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
- <javaee:handler>
-
<javaee:handler-name>WSSecurityHandlerOutbound</javaee:handler-name>
-
<javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerOutbound</javaee:handler-class>
- </javaee:handler>
- </javaee:handler-chain>
- </post-handler-chains>
- </client-config>
-
+ xsi:schemaLocation="urn:jboss:jaxws-config:2.0
jaxws-config_2_0.xsd">
+
+ <client-config>
+ <config-name>Standard Client</config-name>
+ </client-config>
+
+ <client-config>
+ <config-name>Standard MTOM Client</config-name>
+
+ <feature>http://org.jboss.ws/mtom</feature>
+
+ </client-config>
+
+ <client-config>
+ <config-name>Standard WSAddressing Client</config-name>
+ <post-handler-chains>
+ <javaee:handler-chain>
+
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
+ <javaee:handler>
+ <javaee:handler-name>WSAddressing
Handler</javaee:handler-name>
+
<javaee:handler-class>org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </post-handler-chains>
+ </client-config>
+
+ <client-config>
+ <config-name>Standard WSSecurity Client</config-name>
+ <post-handler-chains>
+ <javaee:handler-chain>
+
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
+ <javaee:handler>
+
<javaee:handler-name>WSSecurityHandlerOutbound</javaee:handler-name>
+
<javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerOutbound</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </post-handler-chains>
+ </client-config>
+
</jaxws-config>
\ No newline at end of file
Modified:
trunk/src/main/resources/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml
===================================================================
---
trunk/src/main/resources/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/main/resources/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml 2006-12-18
12:26:19 UTC (rev 1665)
@@ -3,36 +3,44 @@
<!-- $Id$ -->
<jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
- xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
-
- <endpoint-config>
- <config-name>Standard Endpoint</config-name>
- </endpoint-config>
-
- <endpoint-config>
- <config-name>Standard WSAddressing Endpoint</config-name>
- <pre-handler-chains>
- <javaee:handler-chain>
- <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
- <javaee:handler>
- <javaee:handler-name>WSAddressing Handler</javaee:handler-name>
-
<javaee:handler-class>org.jboss.ws.extensions.addressing.jaxws.WSAddressingServerHandler</javaee:handler-class>
- </javaee:handler>
- </javaee:handler-chain>
- </pre-handler-chains>
- </endpoint-config>
-
- <endpoint-config>
- <config-name>Standard WSSecurity Endpoint</config-name>
- <pre-handler-chains>
- <javaee:handler-chain>
- <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
- <javaee:handler>
- <javaee:handler-name>WSSecurity Handler</javaee:handler-name>
-
<javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerInbound</javaee:handler-class>
- </javaee:handler>
- </javaee:handler-chain>
- </pre-handler-chains>
- </endpoint-config>
-
+ xsi:schemaLocation="urn:jboss:jaxws-config:2.0
jaxws-config_2_0.xsd">
+
+ <endpoint-config>
+ <config-name>Standard Endpoint</config-name>
+ </endpoint-config>
+
+ <endpoint-config>
+ <config-name>Standard Endpoint</config-name>
+
+ <feature>http://org.jboss.ws/mtom</feature>
+
+ </endpoint-config>
+
+
+ <endpoint-config>
+ <config-name>Standard WSAddressing Endpoint</config-name>
+ <pre-handler-chains>
+ <javaee:handler-chain>
+
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
+ <javaee:handler>
+ <javaee:handler-name>WSAddressing
Handler</javaee:handler-name>
+
<javaee:handler-class>org.jboss.ws.extensions.addressing.jaxws.WSAddressingServerHandler</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </pre-handler-chains>
+ </endpoint-config>
+
+ <endpoint-config>
+ <config-name>Standard WSSecurity Endpoint</config-name>
+ <pre-handler-chains>
+ <javaee:handler-chain>
+
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
+ <javaee:handler>
+ <javaee:handler-name>WSSecurity Handler</javaee:handler-name>
+
<javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerInbound</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </pre-handler-chains>
+ </endpoint-config>
+
</jaxws-config>
\ No newline at end of file
Modified: trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java 2006-12-18
10:52:44 UTC (rev 1664)
+++
trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java 2006-12-18
12:26:19 UTC (rev 1665)
@@ -77,12 +77,12 @@
ConfigRootJAXWS config = (ConfigRootJAXWS)factory.parse(confFile.toURL());
assertNotNull("Null config", config);
- EndpointConfigJAXWS epConfig = config.getEndpointConfig().get(1);
- assertTrue("Feature not set" ,
epConfig.getFeature("http://org.jboss.ws/mtom"));
+ EndpointConfigJAXWS epConfig =
(EndpointConfigJAXWS)config.getConfigByName("Standard MTOM Endpoint");
+ assertTrue("Feature not set" ,
epConfig.hasFeature("http://org.jboss.ws/mtom"));
// disable feature
epConfig.setFeature("http://org.jboss.ws/mtom", false);
- assertFalse("Feature still set",
epConfig.getFeature("http://org.jboss.ws/mtom"));
+ assertFalse("Feature still set",
epConfig.hasFeature("http://org.jboss.ws/mtom"));
}
@@ -95,7 +95,7 @@
ConfigRootJAXWS config = (ConfigRootJAXWS)factory.parse(confFile.toURL());
assertNotNull("Null config", config);
- EndpointConfigJAXWS epConfig = config.getEndpointConfig().get(1);
+ EndpointConfigJAXWS epConfig =
(EndpointConfigJAXWS)config.getConfigByName("Standard WSSecurity Endpoint");
String value = epConfig.getProperty(EndpointProperty.MTOM_THRESHOLD);
assertNotNull("Property does not exist", value);
assertEquals("Wrong property valule", value, "5000");
Modified: trunk/src/test/resources/common/config/jaxws-endpoint-config.xml
===================================================================
--- trunk/src/test/resources/common/config/jaxws-endpoint-config.xml 2006-12-18 10:52:44
UTC (rev 1664)
+++ trunk/src/test/resources/common/config/jaxws-endpoint-config.xml 2006-12-18 12:26:19
UTC (rev 1665)
@@ -12,7 +12,14 @@
</endpoint-config>
<endpoint-config>
+ <config-name>Standard MTOM Endpoint</config-name>
+ <feature>http://org.jboss.ws/mtom</feature>
+
+ </endpoint-config>
+
+ <endpoint-config>
+
<config-name>Standard WSSecurity Endpoint</config-name>
<pre-handler-chains>