JBossWS SVN: r19509 - in stack/cxf/trunk/modules: server/src/main/java/org/jboss/wsf/stack/cxf and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-03-03 06:21:37 -0500 (Tue, 03 Mar 2015)
New Revision: 19509
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInstanceProvider.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2634/JBWS2634TestCase.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
Log:
[JBWS-3846] Get endpoint configuration from container when available; update CXFInstanceProvider to build component instances for configuration endpoints too; cleanup ServerBeancustomizer
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -35,7 +35,6 @@
import org.jboss.logging.MessageBundle;
import org.jboss.wsf.spi.WSFException;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.WSFDeploymentException;
/**
* JBossWS-CXF exception messages
@@ -207,9 +206,6 @@
@Message(id = 24088, value = "Cannot load additional config from null location")
IllegalArgumentException unableToLoadAdditionalConfigFromNull();
- @Message(id = 24090, value = "Could not read from config file: %s")
- RuntimeException couldNotReadConfigFile(String file);
-
@Message(id = 24093, value = "Error parsing policy attachment: %s")
RuntimeException errorParsingPolicyAttachment(String uri, @Cause Throwable cause);
@@ -219,9 +215,6 @@
@Message(id = 24096, value = "Multiple incompatible JAXWS client Bus features provided")
IllegalArgumentException incompatibleJAXWSClientBusFeatureProvided();
- @Message(id = 24101, value = "Could not find endpoint config name: %s")
- WSFDeploymentException couldNotFindEndpointConfigName(String name);
-
@Message(id = 24104, value = "Service class %s is missing required JAX-WS 2.2 additional constructors")
WSFException missingJAXWS22ServiceConstructor(String className, @Cause Throwable cause);
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInstanceProvider.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInstanceProvider.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInstanceProvider.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
+ * Copyright 2015, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -30,6 +30,7 @@
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+import org.jboss.ws.common.configuration.ConfigDelegateHandler;
import org.jboss.ws.common.deployment.ReferenceFactory;
import org.jboss.wsf.spi.deployment.InstanceProvider;
import org.jboss.wsf.spi.deployment.Reference;
@@ -38,6 +39,7 @@
* CXF instance provider.
*
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
*/
public final class CXFInstanceProvider implements InstanceProvider {
@@ -58,14 +60,21 @@
}
if (instance == null)
{
- List<Handler> chain = ((JaxWsEndpointImpl) factory.getServer().getEndpoint()).getJaxwsBinding().getHandlerChain();
- if (chain != null) {
- for (Handler handler : chain) {
- if (className.equals(handler.getClass().getName())) {
- cache.put(className, instance = ReferenceFactory.newUninitializedReference(handler));
- }
- }
- }
+ List<Handler> chain = ((JaxWsEndpointImpl) factory.getServer().getEndpoint()).getJaxwsBinding().getHandlerChain();
+ if (chain != null)
+ {
+ for (Handler handler : chain)
+ {
+ if (handler instanceof ConfigDelegateHandler)
+ {
+ handler = ((ConfigDelegateHandler)handler).getDelegate();
+ }
+ if (className.equals(handler.getClass().getName()))
+ {
+ cache.put(className, instance = ReferenceFactory.newUninitializedReference(handler));
+ }
+ }
+ }
}
}
if (instance == null)
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -78,5 +78,4 @@
});
}
}
-
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -23,7 +23,6 @@
import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -59,16 +58,14 @@
import org.jboss.wsf.spi.WSFException;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.deployment.AnnotationsInfo;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata;
import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
import org.jboss.wsf.spi.security.JASPIAuthenticationProvider;
import org.jboss.wsf.stack.cxf.Loggers;
import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
import org.jboss.wsf.stack.cxf.client.Constants;
-import org.jboss.wsf.stack.cxf.client.configuration.CXFClientConfigurer;
import org.jboss.wsf.stack.cxf.client.configuration.InterceptorUtils;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
import org.jboss.wsf.stack.cxf.extensions.policy.PolicySetsAnnotationListener;
@@ -195,13 +192,11 @@
*
* @param customization The binding customization to set in the configurer, if any
* @param wsdlPublisher The wsdl file publisher to set in the configurer, if any
- * @param depEndpoints The list of deployment endpoints
- * @param epConfigName The endpoint configuration name, if any
- * @param epConfigFile The endpoint configuration file, if any
+ * @param dep The deployment
* @return The new jbossws cxf configurer
*/
public abstract Configurer createServerConfigurer(BindingCustomization customization,
- WSDLFilePublisher wsdlPublisher, List<Endpoint> depEndpoints, UnifiedVirtualFile root, String epConfigName, String epConfigFile);
+ WSDLFilePublisher wsdlPublisher, ArchiveDeployment dep);
protected void setInterceptors(Bus bus, Deployment dep, Map<String, String> props)
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -37,9 +37,8 @@
import org.apache.cxf.ws.addressing.WSAddressingFeature;
import org.apache.cxf.ws.rm.RMManager;
import org.jboss.ws.api.binding.BindingCustomization;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata;
import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
import org.jboss.wsf.stack.cxf.Messages;
@@ -179,16 +178,12 @@
}
@Override
- public Configurer createServerConfigurer(BindingCustomization customization, WSDLFilePublisher wsdlPublisher,
- List<Endpoint> depEndpoints, UnifiedVirtualFile root, String epConfigName, String epConfigFile)
+ public Configurer createServerConfigurer(BindingCustomization customization, WSDLFilePublisher wsdlPublisher, ArchiveDeployment dep)
{
ServerBeanCustomizer customizer = new ServerBeanCustomizer();
customizer.setBindingCustomization(customization);
customizer.setWsdlPublisher(wsdlPublisher);
- customizer.setDeploymentEndpoints(depEndpoints);
- customizer.setDeploymentRoot(root);
- customizer.setEpConfigFile(epConfigFile);
- customizer.setEpConfigName(epConfigName);
+ customizer.setDeployment(dep);
return new JBossWSNonSpringConfigurer(customizer);
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2014, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,28 +21,20 @@
*/
package org.jboss.wsf.stack.cxf.configuration;
-import java.io.IOException;
-import java.net.URL;
-import java.security.AccessController;
import java.util.List;
import java.util.Locale;
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.transport.http.DestinationRegistry;
import org.apache.cxf.transport.http.HTTPTransportFactory;
-import org.jboss.ws.api.annotation.EndpointConfig;
import org.jboss.ws.api.util.ServiceLoader;
-import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.ws.common.configuration.BasicConfigResolver;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.metadata.config.ConfigMetaDataParser;
-import org.jboss.wsf.spi.metadata.config.ConfigRoot;
import org.jboss.wsf.spi.security.JASPIAuthenticationProvider;
import org.jboss.wsf.stack.cxf.JBossWSInvoker;
import org.jboss.wsf.stack.cxf.Loggers;
-import org.jboss.wsf.stack.cxf.Messages;
import org.jboss.wsf.stack.cxf.client.configuration.BeanCustomizer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
@@ -58,14 +50,8 @@
{
private WSDLFilePublisher wsdlPublisher;
- private List<Endpoint> depEndpoints;
+ private ArchiveDeployment dep;
- private UnifiedVirtualFile deploymentRoot;
-
- private String epConfigName;
-
- private String epConfigFile;
-
@Override
public void customize(Object beanInstance)
{
@@ -81,6 +67,7 @@
{
((JBossWSInvoker) factory.getInvoker()).setTargetBean(factory.getServiceBean());
}
+ List<Endpoint> depEndpoints = dep.getService().getEndpoints();
if (depEndpoints != null)
{
final String targetBeanName = factory.getServiceBean().getClass().getName();
@@ -113,7 +100,7 @@
//Configure according to the specified jaxws endpoint configuration
if (!endpoint.isPublished()) //before publishing, we set the jaxws conf
{
- Object implementor = endpoint.getImplementor();
+ final Object implementor = endpoint.getImplementor();
// setup our invoker for http endpoints if invoker is not configured in jbossws-cxf.xml DD
boolean isHttpEndpoint = endpoint.getAddress() != null && endpoint.getAddress().substring(0, 5).toLowerCase(Locale.ENGLISH).startsWith("http");
@@ -121,97 +108,27 @@
{
endpoint.setInvoker(new JBossWSInvoker());
}
-
+
// ** Endpoint configuration setup **
- // 1) default values
- //String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;
- String configName = implementor.getClass().getName();
- String configFile = org.jboss.wsf.spi.metadata.config.EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE;
- boolean specifiedConfig = false;
- // 2) annotation contribution
- EndpointConfig epConfigAnn = implementor.getClass().getAnnotation(EndpointConfig.class);
- if (epConfigAnn != null)
- {
- if (!epConfigAnn.configName().isEmpty())
- {
- configName = epConfigAnn.configName();
- }
- if (!epConfigAnn.configFile().isEmpty())
- {
- configFile = epConfigAnn.configFile();
- }
- specifiedConfig = true;
- }
- // 3) descriptor overrides (jboss-webservices.xml or web.xml)
- if (epConfigName != null && !epConfigName.isEmpty())
- {
- configName = epConfigName;
- specifiedConfig = true;
- }
- if (epConfigFile != null && !epConfigFile.isEmpty())
- {
- configFile = epConfigFile;
- }
- // 4) setup of configuration
- if (configFile != org.jboss.wsf.spi.metadata.config.EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE) {
- //look for provided endpoint config file
- try
- {
- UnifiedVirtualFile vf = deploymentRoot.findChild(configFile);
- ConfigRoot configRoot = ConfigMetaDataParser.parse(vf.toURL());
- org.jboss.wsf.spi.metadata.config.EndpointConfig config = configRoot.getEndpointConfigByName(configName);
- if (config == null && !specifiedConfig) {
- config = configRoot.getEndpointConfigByName(org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG);
+ final String endpointClassName = implementor.getClass().getName();
+ final List<Endpoint> depEndpoints = dep.getService().getEndpoints();
+ for (Endpoint depEndpoint : depEndpoints) {
+ if (endpointClassName.equals(depEndpoint.getTargetBeanName())) {
+ org.jboss.wsf.spi.metadata.config.EndpointConfig config = depEndpoint.getEndpointConfig();
+ if (config == null) {
+ //the ASIL did not set the endpoint configuration, perhaps because we're processing an
+ //Endpoint.publish() API started endpoint or because we're on WildFly 8.0.0.Final or
+ //previous version. We compute the config here then (clearly no container injection
+ //will be performed on optional handlers attached to the config)
+ BasicConfigResolver bcr = new BasicConfigResolver(dep, implementor.getClass());
+ config = bcr.resolveEndpointConfig();
+ depEndpoint.setEndpointConfig(config);
}
if (config != null) {
endpoint.setEndpointConfig(config);
}
}
- catch (IOException e)
- {
- throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
- }
}
- else
- {
- org.jboss.wsf.spi.metadata.config.EndpointConfig config = null;
- URL url = implementor.getClass().getResource("/" + configFile);
- if (url == null) {
- UnifiedVirtualFile vf = deploymentRoot.findChildFailSafe(configFile);
- if (vf != null) {
- url = vf.toURL();
- }
- }
- if (url != null) {
- //the default file exists
- try
- {
- ConfigRoot configRoot = ConfigMetaDataParser.parse(url);
- config = configRoot.getEndpointConfigByName(configName);
- if (config == null && !specifiedConfig) {
- config = configRoot.getEndpointConfigByName(org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG);
- }
- }
- catch (IOException e)
- {
- throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
- }
- }
- if (config == null) {
- //use endpoint configs from AS domain
- ServerConfig sc = getServerConfig();
- config = sc.getEndpointConfig(configName);
- if (config == null && !specifiedConfig) {
- config = sc.getEndpointConfig(org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG);
- }
- if (config == null && specifiedConfig) {
- throw Messages.MESSAGES.couldNotFindEndpointConfigName(configName);
- }
- }
- if (config != null) {
- endpoint.setEndpointConfig(config);
- }
- }
//JASPI
final JASPIAuthenticationProvider jaspiProvider = (JASPIAuthenticationProvider) ServiceLoader.loadService(
@@ -230,38 +147,13 @@
}
}
- private static ServerConfig getServerConfig() {
- if(System.getSecurityManager() == null) {
- return AbstractServerConfig.getServerIntegrationServerConfig();
- }
- return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
- }
-
- public void setDeploymentRoot(UnifiedVirtualFile deploymentRoot)
- {
- this.deploymentRoot = deploymentRoot;
- }
-
public void setWsdlPublisher(WSDLFilePublisher wsdlPublisher)
{
this.wsdlPublisher = wsdlPublisher;
}
- public void setDeploymentEndpoints(List<Endpoint> endpoints)
+ public void setDeployment(ArchiveDeployment dep)
{
- this.depEndpoints = endpoints;
+ this.dep = dep;
}
-
- public void setEpConfigName(String epConfigName)
- {
- this.epConfigName = epConfigName;
- }
-
- public void setEpConfigFile(String epConfigFile)
- {
- this.epConfigFile = epConfigFile;
- }
-
-
-
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -39,9 +39,9 @@
import org.apache.cxf.transport.http.HttpDestinationFactory;
import org.apache.cxf.transport.servlet.ServletDestinationFactory;
import org.jboss.ws.api.binding.BindingCustomization;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSSpringBusFactory;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSSpringConfigurer;
@@ -166,21 +166,22 @@
}
}
bus.setProperty(Deployment.class.getName(), null);
+
+ for (Endpoint endpoint : dep.getService().getEndpoints())
+ {
+ endpoint.setProperty("SpringBus", true);
+ }
configured = true;
}
@Override
- public Configurer createServerConfigurer(BindingCustomization customization, WSDLFilePublisher wsdlPublisher,
- List<Endpoint> depEndpoints, UnifiedVirtualFile root, String epConfigName, String epConfigFile)
+ public Configurer createServerConfigurer(BindingCustomization customization, WSDLFilePublisher wsdlPublisher, ArchiveDeployment dep)
{
ApplicationContext ctx = bus.getExtension(BusApplicationContext.class);
ServerBeanCustomizer customizer = new ServerBeanCustomizer();
customizer.setBindingCustomization(customization);
customizer.setWsdlPublisher(wsdlPublisher);
- customizer.setDeploymentEndpoints(depEndpoints);
- customizer.setDeploymentRoot(root);
- customizer.setEpConfigFile(epConfigFile);
- customizer.setEpConfigName(epConfigName);
+ customizer.setDeployment(dep);
Configurer orig = bus.getExtension(Configurer.class);
JBossWSSpringConfigurer serverConfigurer = (orig instanceof JBossWSSpringConfigurer) ? (JBossWSSpringConfigurer)orig : new JBossWSSpringConfigurer(orig);
serverConfigurer.setApplicationContext(ctx);
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -35,9 +35,7 @@
import org.jboss.ws.common.utils.DelegateClassLoader;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.ResourceResolver;
-import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
import org.jboss.wsf.stack.cxf.configuration.BusHolder;
@@ -118,30 +116,9 @@
holder = new NonSpringBusHolder(metadata);
}
- String epConfigName = null;
- String epConfigFile = null;
- JSEArchiveMetaData jsemd = dep.getAttachment(JSEArchiveMetaData.class);
- JBossWebservicesMetaData wsmd = dep.getAttachment(JBossWebservicesMetaData.class);
- //first check JSEArchiveMetaData as that has the actual merged value for POJO deployments
- if (jsemd != null) {
- epConfigName = jsemd.getConfigName();
- epConfigFile = jsemd.getConfigFile();
- } else if (wsmd != null) {
- epConfigName = wsmd.getConfigName();
- epConfigFile = wsmd.getConfigFile();
- }
-
- Configurer configurer = holder.createServerConfigurer(dep.getAttachment(BindingCustomization.class),
- new WSDLFilePublisher(aDep), dep.getService().getEndpoints(), aDep.getRootFile(), epConfigName, epConfigFile);
- holder.configure(resolver, configurer, wsmd, dep);
+ Configurer configurer = holder.createServerConfigurer(dep.getAttachment(BindingCustomization.class), new WSDLFilePublisher(aDep), aDep);
+ holder.configure(resolver, configurer, dep.getAttachment(JBossWebservicesMetaData.class), dep);
dep.addAttachment(BusHolder.class, holder);
- if (holder instanceof SpringBusHolder)
- {
- for (Endpoint endpoint : dep.getService().getEndpoints())
- {
- endpoint.setProperty("SpringBus", true);
- }
- }
}
finally
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -37,6 +37,7 @@
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
import org.jboss.ws.common.ObjectNameFactory;
+import org.jboss.ws.common.configuration.ConfigDelegateHandler;
import org.jboss.ws.common.injection.InjectionHelper;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
@@ -100,6 +101,10 @@
{
for (Handler<?> handler : chain)
{
+ if (handler instanceof ConfigDelegateHandler)
+ {
+ handler = ((ConfigDelegateHandler<?>) handler).getDelegate();
+ }
final Reference handlerReference = endpoint.getInstanceProvider().getInstance(handler.getClass().getName());
if (!handlerReference.isInitialized()) {
final Object handlerInstance = handlerReference.getValue();
Modified: stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2634/JBWS2634TestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2634/JBWS2634TestCase.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2634/JBWS2634TestCase.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -115,9 +115,12 @@
@Test
@RunAsClient
- @Ignore(value = "[JBWS-3846] Refactor creation process of jaxws handlers from predefined configurations")
public void testPojoEndpoint2Injection() throws Exception
{
+ if (JBossWSTestHelper.isTargetWildFly80()) {
+ System.out.println("FIXME: [JBWS-3846] Refactor creation process of jaxws handlers from predefined configurations");
+ return;
+ }
QName serviceName = new QName("http://jbossws.org/JBWS2634", "POJOService2");
URL wsdlURL = new URL(baseURL + "/POJOService2?wsdl");
@@ -128,9 +131,12 @@
@Test
@RunAsClient
- @Ignore(value = "[JBWS-3846] Refactor creation process of jaxws handlers from predefined configurations")
public void testPojoEndpoint3Injection() throws Exception
{
+ if (JBossWSTestHelper.isTargetWildFly80()) {
+ System.out.println("FIXME: [JBWS-3846] Refactor creation process of jaxws handlers from predefined configurations");
+ return;
+ }
QName serviceName = new QName("http://jbossws.org/JBWS2634", "POJOService3");
URL wsdlURL = new URL(baseURL + "/POJOService3?wsdl");
@@ -153,9 +159,12 @@
@Test
@RunAsClient
- @Ignore(value = "[JBWS-3846] Refactor creation process of jaxws handlers from predefined configurations")
public void testEjb3Endpoint2Injection() throws Exception
{
+ if (JBossWSTestHelper.isTargetWildFly80()) {
+ System.out.println("FIXME: [JBWS-3846] Refactor creation process of jaxws handlers from predefined configurations");
+ return;
+ }
QName serviceName = new QName("http://jbossws.org/JBWS2634", "EJB3Service2");
URL wsdlURL = new URL("http://" + baseURL.getHost() + ":" + baseURL.getPort() + "/jaxws-jbws2634-ejb3/EJB3Service2?wsdl");
@@ -164,11 +173,15 @@
assertEquals("Hello World!:Inbound:TestHandler:EJB3Bean2:Outbound:TestHandler", proxy.echo("Hello World!"));
}
+
@Test
@RunAsClient
- @Ignore(value = "[JBWS-3846] Refactor creation process of jaxws handlers from predefined configurations")
public void testEjb3Endpoint3Injection() throws Exception
{
+ if (JBossWSTestHelper.isTargetWildFly80()) {
+ System.out.println("FIXME: [JBWS-3846] Refactor creation process of jaxws handlers from predefined configurations");
+ return;
+ }
QName serviceName = new QName("http://jbossws.org/JBWS2634", "EJB3Service3");
URL wsdlURL = new URL("http://" + baseURL.getHost() + ":" + baseURL.getPort() + "/jaxws-jbws2634-ejb3/EJB3Service3?wsdl");
Modified: stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2015-03-03 11:16:12 UTC (rev 19508)
+++ stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2015-03-03 11:21:37 UTC (rev 19509)
@@ -69,7 +69,7 @@
public static JavaArchive createDeployment() {
JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "management-recording-as7.jar");
archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.logging\n"))
+ + "Dependencies: org.jboss.logging,org.jboss.ws.common\n")) //TODO!! temp fix
.addClass(org.jboss.test.ws.management.recording.Endpoint.class)
.addClass(org.jboss.test.ws.management.recording.EndpointWithConfigImpl.class);
return archive;
9 years, 11 months
JBossWS SVN: r19508 - in container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices: deployers/deployment and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-03-03 06:16:12 -0500 (Tue, 03 Mar 2015)
New Revision: 19508
Added:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java
Modified:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/AbstractIntegrationProcessorJAXWS.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_HANDLER.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WebServiceAnnotationProcessor.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_POJO.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/util/ASHelper.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java
Log:
[JBWS-3846] Resolve endpoint configurations in PARSE phase and create proper components for handlers specified in endpoint configurations
Modified: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/AbstractIntegrationProcessorJAXWS.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/AbstractIntegrationProcessorJAXWS.java 2015-03-03 11:15:20 UTC (rev 19507)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/AbstractIntegrationProcessorJAXWS.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -111,9 +111,7 @@
}
static boolean isEjb3(final ClassInfo clazz) {
- final boolean isStateless = clazz.annotations().containsKey(STATELESS_ANNOTATION);
- final boolean isSingleton = clazz.annotations().containsKey(SINGLETON_ANNOTATION);
- return isStateless || isSingleton;
+ return clazz.annotations().containsKey(STATELESS_ANNOTATION) || clazz.annotations().containsKey(SINGLETON_ANNOTATION);
}
}
Added: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java (rev 0)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.as.webservices.deployers;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.AnnotationValue;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.ws.api.annotation.EndpointConfig;
+import org.jboss.ws.common.configuration.AbstractCommonConfigResolver;
+import org.jboss.ws.common.integration.WSConstants;
+import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
+
+public class ConfigResolver extends AbstractCommonConfigResolver {
+
+ private final ClassInfo epClassInfo;
+ private final String className;
+ private final String annotationConfigName;
+ private final String annotationConfigFile;
+ private final String descriptorConfigName;
+ private final String descriptorConfigFile;
+ private final VirtualFile root;
+ private final boolean isWar;
+
+ public ConfigResolver(ClassInfo epClassInfo, JBossWebservicesMetaData jwmd, JBossWebMetaData jbwebmd, VirtualFile root, boolean isWar) {
+ this.epClassInfo = epClassInfo;
+ this.className = epClassInfo.name().toString();
+ List<AnnotationInstance> annotations = epClassInfo.annotations().get(
+ DotName.createSimple(EndpointConfig.class.getName()));
+ if (annotations != null && !annotations.isEmpty()) {
+ AnnotationInstance ann = annotations.get(0);
+ AnnotationValue av = ann.value("configName");
+ this.annotationConfigName = av != null ? av.asString() : null;
+ av = ann.value("configFile");
+ this.annotationConfigFile = av != null ? av.asString() : null;
+ } else {
+ this.annotationConfigName = null;
+ this.annotationConfigFile = null;
+ }
+ String f = null;
+ String n = null;
+ if (jbwebmd != null && jbwebmd.getContextParams() != null) {
+ for (ParamValueMetaData pvmd : jbwebmd.getContextParams()) {
+ if (WSConstants.JBOSSWS_CONFIG_NAME.equals(pvmd.getParamName())) {
+ n = pvmd.getParamValue();
+ }
+ if (WSConstants.JBOSSWS_CONFIG_FILE.equals(pvmd.getParamName())) {
+ f = pvmd.getParamValue();
+ }
+ }
+ }
+ this.descriptorConfigFile = f != null ? f : (jwmd != null ? jwmd.getConfigFile() : null);
+ this.descriptorConfigName = n != null ? n : (jwmd != null ? jwmd.getConfigName() : null);
+ this.root = root;
+ this.isWar = isWar;
+ }
+
+ @Override
+ protected String getEndpointClassName() {
+ return className;
+ }
+
+ @Override
+ protected <T extends Annotation> boolean isEndpointClassAnnotated(Class<T> annotation) {
+ return epClassInfo.annotations().containsKey(DotName.createSimple(annotation.getName()));
+ }
+
+ @Override
+ protected String getEndpointConfigNameFromAnnotation() {
+ return annotationConfigName;
+ }
+
+ @Override
+ protected String getEndpointConfigFileFromAnnotation() {
+ return annotationConfigFile;
+ }
+
+ @Override
+ protected String getEndpointConfigNameOverride() {
+ return descriptorConfigName;
+ }
+
+ @Override
+ protected String getEndpointConfigFileOverride() {
+ return descriptorConfigFile;
+ }
+
+ @Override
+ protected URL getConfigFile(String configFileName) throws IOException {
+ return root.getChild(configFileName).asFileURL();
+ }
+
+ @Override
+ protected URL getDefaultConfigFile(String defaultConfigFileName) {
+ URL url = null;
+ if (isWar) {
+ url = asFileURL(root.getChild("/WEB-INF/classes/" + defaultConfigFileName));
+ }
+ if (url == null) {
+ url = asFileURL(root.getChild("/" + defaultConfigFileName));
+ }
+ return url;
+ }
+
+ private URL asFileURL(VirtualFile vf) {
+ URL url = null;
+ if (vf != null && vf.exists()) {
+ try {
+ url = vf.asFileURL();
+ } catch (MalformedURLException e) {
+ // ignore
+ }
+ }
+ return url;
+ }
+}
Property changes on: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java (rev 0)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.as.webservices.deployers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
+
+/**
+ * Defines mapping of endpoints and their config.
+ *
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
+ */
+public final class WSEndpointConfigMapping {
+
+ private final Map<String, EndpointConfig> endpointConfigMap = new HashMap<String, EndpointConfig>();
+
+ /**
+ * Registers endpoint and its config.
+ *
+ * @param endpointClass WS endpoint
+ * @param config Config with endpoint
+ */
+ public void registerEndpointConfig(final String endpointClass, final EndpointConfig config) {
+ if ((endpointClass == null) || (config == null)) {
+ throw new IllegalArgumentException();
+ }
+ endpointConfigMap.put(endpointClass, config);
+ }
+
+ /**
+ * Returns config associated with WS endpoint.
+ *
+ * @param endpointClass to get associated config
+ * @return associated config
+ */
+ public EndpointConfig getConfig(final String endpointClass) {
+ return endpointConfigMap.get(endpointClass);
+ }
+
+ public boolean isEmpty() {
+ return endpointConfigMap.size() == 0;
+ }
+
+}
Property changes on: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_HANDLER.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_HANDLER.java 2015-03-03 11:15:20 UTC (rev 19507)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_HANDLER.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
+ * Copyright 2015, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -22,11 +22,15 @@
package org.jboss.as.webservices.deployers;
+import static org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT;
import static org.jboss.as.webservices.util.ASHelper.getJaxwsEjbs;
import static org.jboss.as.webservices.util.ASHelper.getJaxwsPojos;
import static org.jboss.as.webservices.util.ASHelper.getOptionalAttachment;
+import static org.jboss.as.webservices.util.ASHelper.isJaxwsEndpoint;
import static org.jboss.as.webservices.util.WSAttachmentKeys.WS_ENDPOINT_HANDLERS_MAPPING_KEY;
+import java.util.Set;
+
import javax.jws.WebService;
import javax.xml.ws.WebServiceProvider;
@@ -35,18 +39,29 @@
import org.jboss.as.ee.component.EEModuleClassDescription;
import org.jboss.as.ee.component.EEModuleDescription;
import org.jboss.as.ee.metadata.ClassAnnotationInformation;
+import org.jboss.as.ee.structure.DeploymentType;
+import org.jboss.as.ee.structure.DeploymentTypeMarker;
+import org.jboss.as.server.deployment.Attachments;
import org.jboss.as.server.deployment.DeploymentUnit;
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.annotation.CompositeIndex;
import org.jboss.as.webservices.injection.WSEndpointHandlersMapping;
import org.jboss.as.webservices.metadata.model.EJBEndpoint;
import org.jboss.as.webservices.metadata.model.POJOEndpoint;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
import org.jboss.jandex.ClassInfo;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
+import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
/**
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
*/
public final class WSIntegrationProcessorJAXWS_HANDLER extends AbstractIntegrationProcessorJAXWS {
@@ -56,8 +71,11 @@
@Override
protected void processAnnotation(final DeploymentUnit unit, final EEModuleDescription moduleDescription) throws DeploymentUnitProcessingException {
final WSEndpointHandlersMapping mapping = getOptionalAttachment(unit, WS_ENDPOINT_HANDLERS_MAPPING_KEY);
- if (mapping == null)
- return;
+ final VirtualFile root = unit.getAttachment(DEPLOYMENT_ROOT).getRoot();
+ final JBossWebservicesMetaData jbossWebservicesMD = unit.getAttachment(WSAttachmentKeys.JBOSS_WEBSERVICES_METADATA_KEY);
+ final CompositeIndex index = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
+ final boolean war = DeploymentTypeMarker.isType(DeploymentType.WAR, unit);
+ final JBossWebMetaData jwmd = ASHelper.getJBossWebMetaData(unit);
for (EEModuleClassDescription classDescription : moduleDescription.getClassDescriptions()) {
ClassInfo classInfo = null;
ClassAnnotationInformation<WebService, WebServiceAnnotationInfo> annotationInfo = classDescription
@@ -70,27 +88,34 @@
if (providreInfo != null) {
classInfo = (ClassInfo) providreInfo.getClassLevelAnnotations().get(0).getTarget();
}
- if (classInfo != null && mapping.getHandlers(classInfo.name().toString()) != null) {
+
+ if (classInfo != null && isJaxwsEndpoint(classInfo, index, false)) {
final String endpointClassName = classInfo.name().toString();
- if (isEjb3(classInfo)) {
- for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
- if (endpointClassName.equals(ejbEndpoint.getClassName())) {
- for (final String handlerClassName : mapping.getHandlers(endpointClassName)) {
- final String ejbEndpointName = ejbEndpoint.getName();
- final String handlerName = ejbEndpointName + "-" + handlerClassName;
- final ComponentDescription jaxwsHandlerDescription = createComponentDescription(unit,
- handlerName, handlerClassName, ejbEndpointName);
- propagateNamingContext(jaxwsHandlerDescription, ejbEndpoint);
+ final ConfigResolver configResolver = new ConfigResolver(classInfo, jbossWebservicesMD, jwmd, root, war);
+ final EndpointConfig config = configResolver.resolveEndpointConfig();
+ registerConfigMapping(endpointClassName, config, unit);
+ final Set<String> handlers = getHandlers(endpointClassName, config, configResolver, mapping);
+ if (!handlers.isEmpty()) {
+ if (isEjb3(classInfo)) {
+ for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
+ if (endpointClassName.equals(ejbEndpoint.getClassName())) {
+ for (final String handlerClassName : handlers) {
+ final String ejbEndpointName = ejbEndpoint.getName();
+ final String handlerName = ejbEndpointName + "-" + handlerClassName;
+ final ComponentDescription jaxwsHandlerDescription = createComponentDescription(unit,
+ handlerName, handlerClassName, ejbEndpointName);
+ propagateNamingContext(jaxwsHandlerDescription, ejbEndpoint);
+ }
}
}
- }
- } else {
- for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
- if (endpointClassName.equals(pojoEndpoint.getClassName())) {
- for (final String handlerClassName : mapping.getHandlers(endpointClassName)) {
- final String pojoEndpointName = pojoEndpoint.getName();
- final String handlerName = pojoEndpointName + "-" + handlerClassName;
- createComponentDescription(unit, handlerName, handlerClassName, pojoEndpointName);
+ } else {
+ for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
+ if (endpointClassName.equals(pojoEndpoint.getClassName())) {
+ for (final String handlerClassName : handlers) {
+ final String pojoEndpointName = pojoEndpoint.getName();
+ final String handlerName = pojoEndpointName + "-" + handlerClassName;
+ createComponentDescription(unit, handlerName, handlerClassName, pojoEndpointName);
+ }
}
}
}
@@ -99,6 +124,27 @@
}
}
+ //TODO this could be moved to a separate DeploymentUnitProcessor operating on endpoints (together with the rest of the config resolution mechanism)
+ private void registerConfigMapping(String endpointClassName, EndpointConfig config, DeploymentUnit unit) {
+ WSEndpointConfigMapping mapping = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
+ if (mapping == null) {
+ mapping = new WSEndpointConfigMapping();
+ unit.putAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY, mapping);
+ }
+ mapping.registerEndpointConfig(endpointClassName, config);
+ }
+
+ private Set<String> getHandlers(String endpointClassName, EndpointConfig config, ConfigResolver resolver, WSEndpointHandlersMapping mapping) {
+ Set<String> handlers = resolver.getAllHandlers(config); //handlers from the resolved endpoint configuration
+ if (mapping != null) {
+ Set<String> hch = mapping.getHandlers(endpointClassName); // handlers from @HandlerChain
+ if (hch != null) {
+ handlers.addAll(hch);
+ }
+ }
+ return handlers;
+ }
+
private static void propagateNamingContext(final ComponentDescription jaxwsHandlerDescription, final EJBEndpoint ejbEndpoint) {
final ServiceName ejbContextServiceName = ejbEndpoint.getContextServiceName();
final DeploymentDescriptorEnvironment ejbEnv = ejbEndpoint.getDeploymentDescriptorEnvironment();
Modified: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WebServiceAnnotationProcessor.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WebServiceAnnotationProcessor.java 2015-03-03 11:15:20 UTC (rev 19507)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WebServiceAnnotationProcessor.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -54,6 +54,7 @@
this.factories = Collections.unmodifiableList(factories);
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public final void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
Modified: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB.java 2015-03-03 11:15:20 UTC (rev 19507)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -27,7 +27,9 @@
import static org.jboss.wsf.spi.deployment.EndpointType.JAXWS_EJB3;
import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.deployers.WSEndpointConfigMapping;
import org.jboss.as.webservices.metadata.model.EJBEndpoint;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
import org.jboss.msc.service.ServiceName;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -46,6 +48,7 @@
@Override
protected void build(final Deployment dep, final DeploymentUnit unit) {
ROOT_LOGGER.creatingEndpointsMetaDataModel("JAXWS", "EJB");
+ WSEndpointConfigMapping ecm = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
final String ejbEndpointName = ejbEndpoint.getName();
ROOT_LOGGER.ejbName(ejbEndpointName);
@@ -56,6 +59,7 @@
if (componentViewName != null) {
ep.setProperty(COMPONENT_VIEW_NAME, componentViewName);
}
+ ep.setEndpointConfig(ecm.getConfig(ejbEndpointClassName));
}
}
Modified: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_POJO.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_POJO.java 2015-03-03 11:15:20 UTC (rev 19507)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_POJO.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -27,7 +27,9 @@
import static org.jboss.wsf.spi.deployment.EndpointType.JAXWS_JSE;
import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.deployers.WSEndpointConfigMapping;
import org.jboss.as.webservices.metadata.model.POJOEndpoint;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
import org.jboss.msc.service.ServiceName;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -46,6 +48,7 @@
@Override
protected void build(final Deployment dep, final DeploymentUnit unit) {
ROOT_LOGGER.creatingEndpointsMetaDataModel("JAXWS", "POJO");
+ WSEndpointConfigMapping ecm = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
final String pojoEndpointName = pojoEndpoint.getName();
ROOT_LOGGER.pojoName(pojoEndpointName);
@@ -56,6 +59,9 @@
if (componentViewName != null) {
ep.setProperty(COMPONENT_VIEW_NAME, componentViewName);
}
+ if (ecm != null) {
+ ep.setEndpointConfig(ecm.getConfig(pojoEndpointClassName));
+ }
}
}
Modified: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/util/ASHelper.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/util/ASHelper.java 2015-03-03 11:15:20 UTC (rev 19507)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/util/ASHelper.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -208,6 +208,10 @@
}
public static boolean isJaxwsEndpoint(final ClassInfo clazz, final CompositeIndex index) {
+ return isJaxwsEndpoint(clazz, index, true);
+ }
+
+ public static boolean isJaxwsEndpoint(final ClassInfo clazz, final CompositeIndex index, boolean log) {
// assert JAXWS endpoint class flags
final short flags = clazz.flags();
if (Modifier.isInterface(flags)) return false;
@@ -220,11 +224,15 @@
return false;
}
if (hasWebServiceAnnotation && hasWebServiceProviderAnnotation) {
- ROOT_LOGGER.mutuallyExclusiveAnnotations(clazz.name().toString());
+ if (log) {
+ ROOT_LOGGER.mutuallyExclusiveAnnotations(clazz.name().toString());
+ }
return false;
}
if (Modifier.isFinal(flags)) {
- ROOT_LOGGER.finalEndpointClassDetected(clazz.name().toString());
+ if (log) {
+ ROOT_LOGGER.finalEndpointClassDetected(clazz.name().toString());
+ }
return false;
}
return true;
Modified: container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java 2015-03-03 11:15:20 UTC (rev 19507)
+++ container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java 2015-03-03 11:16:12 UTC (rev 19508)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
+ * Copyright 2015, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -22,6 +22,7 @@
package org.jboss.as.webservices.util;
import org.jboss.as.server.deployment.AttachmentKey;
+import org.jboss.as.webservices.deployers.WSEndpointConfigMapping;
import org.jboss.as.webservices.injection.WSEndpointHandlersMapping;
import org.jboss.as.webservices.metadata.model.JAXWSDeployment;
import org.jboss.as.webservices.webserviceref.WSRefRegistry;
@@ -51,6 +52,7 @@
public static final AttachmentKey<ClassLoader> CLASSLOADER_KEY = AttachmentKey.create(ClassLoader.class);
public static final AttachmentKey<WSRefRegistry> WS_REFREGISTRY = AttachmentKey.create(WSRefRegistry.class);
public static final AttachmentKey<WSEndpointHandlersMapping> WS_ENDPOINT_HANDLERS_MAPPING_KEY = AttachmentKey.create(WSEndpointHandlersMapping.class);
+ public static final AttachmentKey<WSEndpointConfigMapping> WS_ENDPOINT_CONFIG_MAPPING_KEY = AttachmentKey.create(WSEndpointConfigMapping.class);
public static final AttachmentKey<ServerConfig> SERVER_CONFIG_KEY = AttachmentKey.create(ServerConfig.class);
private WSAttachmentKeys() {
9 years, 11 months
JBossWS SVN: r19507 - in container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices: deployers/deployment and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-03-03 06:15:20 -0500 (Tue, 03 Mar 2015)
New Revision: 19507
Added:
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java
Modified:
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/AbstractIntegrationProcessorJAXWS.java
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_HANDLER.java
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WebServiceAnnotationProcessor.java
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB.java
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_POJO.java
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/util/ASHelper.java
container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java
Log:
[JBWS-3846] Resolve endpoint configurations in PARSE phase and create proper components for handlers specified in endpoint configurations
Modified: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/AbstractIntegrationProcessorJAXWS.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/AbstractIntegrationProcessorJAXWS.java 2015-03-03 11:12:58 UTC (rev 19506)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/AbstractIntegrationProcessorJAXWS.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -111,9 +111,7 @@
}
static boolean isEjb3(final ClassInfo clazz) {
- final boolean isStateless = clazz.annotations().containsKey(STATELESS_ANNOTATION);
- final boolean isSingleton = clazz.annotations().containsKey(SINGLETON_ANNOTATION);
- return isStateless || isSingleton;
+ return clazz.annotations().containsKey(STATELESS_ANNOTATION) || clazz.annotations().containsKey(SINGLETON_ANNOTATION);
}
}
Added: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java (rev 0)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.as.webservices.deployers;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.jandex.AnnotationInstance;
+import org.jboss.jandex.AnnotationValue;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.ws.api.annotation.EndpointConfig;
+import org.jboss.ws.common.configuration.AbstractCommonConfigResolver;
+import org.jboss.ws.common.integration.WSConstants;
+import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
+
+public class ConfigResolver extends AbstractCommonConfigResolver {
+
+ private final ClassInfo epClassInfo;
+ private final String className;
+ private final String annotationConfigName;
+ private final String annotationConfigFile;
+ private final String descriptorConfigName;
+ private final String descriptorConfigFile;
+ private final VirtualFile root;
+ private final boolean isWar;
+
+ public ConfigResolver(ClassInfo epClassInfo, JBossWebservicesMetaData jwmd, JBossWebMetaData jbwebmd, VirtualFile root, boolean isWar) {
+ this.epClassInfo = epClassInfo;
+ this.className = epClassInfo.name().toString();
+ List<AnnotationInstance> annotations = epClassInfo.annotations().get(
+ DotName.createSimple(EndpointConfig.class.getName()));
+ if (annotations != null && !annotations.isEmpty()) {
+ AnnotationInstance ann = annotations.get(0);
+ AnnotationValue av = ann.value("configName");
+ this.annotationConfigName = av != null ? av.asString() : null;
+ av = ann.value("configFile");
+ this.annotationConfigFile = av != null ? av.asString() : null;
+ } else {
+ this.annotationConfigName = null;
+ this.annotationConfigFile = null;
+ }
+ String f = null;
+ String n = null;
+ if (jbwebmd != null && jbwebmd.getContextParams() != null) {
+ for (ParamValueMetaData pvmd : jbwebmd.getContextParams()) {
+ if (WSConstants.JBOSSWS_CONFIG_NAME.equals(pvmd.getParamName())) {
+ n = pvmd.getParamValue();
+ }
+ if (WSConstants.JBOSSWS_CONFIG_FILE.equals(pvmd.getParamName())) {
+ f = pvmd.getParamValue();
+ }
+ }
+ }
+ this.descriptorConfigFile = f != null ? f : (jwmd != null ? jwmd.getConfigFile() : null);
+ this.descriptorConfigName = n != null ? n : (jwmd != null ? jwmd.getConfigName() : null);
+ this.root = root;
+ this.isWar = isWar;
+ }
+
+ @Override
+ protected String getEndpointClassName() {
+ return className;
+ }
+
+ @Override
+ protected <T extends Annotation> boolean isEndpointClassAnnotated(Class<T> annotation) {
+ return epClassInfo.annotations().containsKey(DotName.createSimple(annotation.getName()));
+ }
+
+ @Override
+ protected String getEndpointConfigNameFromAnnotation() {
+ return annotationConfigName;
+ }
+
+ @Override
+ protected String getEndpointConfigFileFromAnnotation() {
+ return annotationConfigFile;
+ }
+
+ @Override
+ protected String getEndpointConfigNameOverride() {
+ return descriptorConfigName;
+ }
+
+ @Override
+ protected String getEndpointConfigFileOverride() {
+ return descriptorConfigFile;
+ }
+
+ @Override
+ protected URL getConfigFile(String configFileName) throws IOException {
+ return root.getChild(configFileName).asFileURL();
+ }
+
+ @Override
+ protected URL getDefaultConfigFile(String defaultConfigFileName) {
+ URL url = null;
+ if (isWar) {
+ url = asFileURL(root.getChild("/WEB-INF/classes/" + defaultConfigFileName));
+ }
+ if (url == null) {
+ url = asFileURL(root.getChild("/" + defaultConfigFileName));
+ }
+ return url;
+ }
+
+ private URL asFileURL(VirtualFile vf) {
+ URL url = null;
+ if (vf != null && vf.exists()) {
+ try {
+ url = vf.asFileURL();
+ } catch (MalformedURLException e) {
+ // ignore
+ }
+ }
+ return url;
+ }
+}
Property changes on: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/ConfigResolver.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java (rev 0)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.as.webservices.deployers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
+
+/**
+ * Defines mapping of endpoints and their config.
+ *
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
+ */
+public final class WSEndpointConfigMapping {
+
+ private final Map<String, EndpointConfig> endpointConfigMap = new HashMap<String, EndpointConfig>();
+
+ /**
+ * Registers endpoint and its config.
+ *
+ * @param endpointClass WS endpoint
+ * @param config Config with endpoint
+ */
+ public void registerEndpointConfig(final String endpointClass, final EndpointConfig config) {
+ if ((endpointClass == null) || (config == null)) {
+ throw new IllegalArgumentException();
+ }
+ endpointConfigMap.put(endpointClass, config);
+ }
+
+ /**
+ * Returns config associated with WS endpoint.
+ *
+ * @param endpointClass to get associated config
+ * @return associated config
+ */
+ public EndpointConfig getConfig(final String endpointClass) {
+ return endpointConfigMap.get(endpointClass);
+ }
+
+ public boolean isEmpty() {
+ return endpointConfigMap.size() == 0;
+ }
+
+}
Property changes on: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSEndpointConfigMapping.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_HANDLER.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_HANDLER.java 2015-03-03 11:12:58 UTC (rev 19506)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_HANDLER.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
+ * Copyright 2015, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -22,11 +22,15 @@
package org.jboss.as.webservices.deployers;
+import static org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT;
import static org.jboss.as.webservices.util.ASHelper.getJaxwsEjbs;
import static org.jboss.as.webservices.util.ASHelper.getJaxwsPojos;
import static org.jboss.as.webservices.util.ASHelper.getOptionalAttachment;
+import static org.jboss.as.webservices.util.ASHelper.isJaxwsEndpoint;
import static org.jboss.as.webservices.util.WSAttachmentKeys.WS_ENDPOINT_HANDLERS_MAPPING_KEY;
+import java.util.Set;
+
import javax.jws.WebService;
import javax.xml.ws.WebServiceProvider;
@@ -35,18 +39,29 @@
import org.jboss.as.ee.component.EEModuleClassDescription;
import org.jboss.as.ee.component.EEModuleDescription;
import org.jboss.as.ee.metadata.ClassAnnotationInformation;
+import org.jboss.as.ee.structure.DeploymentType;
+import org.jboss.as.ee.structure.DeploymentTypeMarker;
+import org.jboss.as.server.deployment.Attachments;
import org.jboss.as.server.deployment.DeploymentUnit;
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.annotation.CompositeIndex;
import org.jboss.as.webservices.injection.WSEndpointHandlersMapping;
import org.jboss.as.webservices.metadata.model.EJBEndpoint;
import org.jboss.as.webservices.metadata.model.POJOEndpoint;
+import org.jboss.as.webservices.util.ASHelper;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
import org.jboss.jandex.ClassInfo;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
+import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
/**
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
*/
public final class WSIntegrationProcessorJAXWS_HANDLER extends AbstractIntegrationProcessorJAXWS {
@@ -56,8 +71,11 @@
@Override
protected void processAnnotation(final DeploymentUnit unit, final EEModuleDescription moduleDescription) throws DeploymentUnitProcessingException {
final WSEndpointHandlersMapping mapping = getOptionalAttachment(unit, WS_ENDPOINT_HANDLERS_MAPPING_KEY);
- if (mapping == null)
- return;
+ final VirtualFile root = unit.getAttachment(DEPLOYMENT_ROOT).getRoot();
+ final JBossWebservicesMetaData jbossWebservicesMD = unit.getAttachment(WSAttachmentKeys.JBOSS_WEBSERVICES_METADATA_KEY);
+ final CompositeIndex index = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
+ final boolean war = DeploymentTypeMarker.isType(DeploymentType.WAR, unit);
+ final JBossWebMetaData jwmd = ASHelper.getJBossWebMetaData(unit);
for (EEModuleClassDescription classDescription : moduleDescription.getClassDescriptions()) {
ClassInfo classInfo = null;
ClassAnnotationInformation<WebService, WebServiceAnnotationInfo> annotationInfo = classDescription
@@ -70,27 +88,34 @@
if (providreInfo != null) {
classInfo = (ClassInfo) providreInfo.getClassLevelAnnotations().get(0).getTarget();
}
- if (classInfo != null && mapping.getHandlers(classInfo.name().toString()) != null) {
+
+ if (classInfo != null && isJaxwsEndpoint(classInfo, index, false)) {
final String endpointClassName = classInfo.name().toString();
- if (isEjb3(classInfo)) {
- for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
- if (endpointClassName.equals(ejbEndpoint.getClassName())) {
- for (final String handlerClassName : mapping.getHandlers(endpointClassName)) {
- final String ejbEndpointName = ejbEndpoint.getName();
- final String handlerName = ejbEndpointName + "-" + handlerClassName;
- final ComponentDescription jaxwsHandlerDescription = createComponentDescription(unit,
- handlerName, handlerClassName, ejbEndpointName);
- propagateNamingContext(jaxwsHandlerDescription, ejbEndpoint);
+ final ConfigResolver configResolver = new ConfigResolver(classInfo, jbossWebservicesMD, jwmd, root, war);
+ final EndpointConfig config = configResolver.resolveEndpointConfig();
+ registerConfigMapping(endpointClassName, config, unit);
+ final Set<String> handlers = getHandlers(endpointClassName, config, configResolver, mapping);
+ if (!handlers.isEmpty()) {
+ if (isEjb3(classInfo)) {
+ for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
+ if (endpointClassName.equals(ejbEndpoint.getClassName())) {
+ for (final String handlerClassName : handlers) {
+ final String ejbEndpointName = ejbEndpoint.getName();
+ final String handlerName = ejbEndpointName + "-" + handlerClassName;
+ final ComponentDescription jaxwsHandlerDescription = createComponentDescription(unit,
+ handlerName, handlerClassName, ejbEndpointName);
+ propagateNamingContext(jaxwsHandlerDescription, ejbEndpoint);
+ }
}
}
- }
- } else {
- for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
- if (endpointClassName.equals(pojoEndpoint.getClassName())) {
- for (final String handlerClassName : mapping.getHandlers(endpointClassName)) {
- final String pojoEndpointName = pojoEndpoint.getName();
- final String handlerName = pojoEndpointName + "-" + handlerClassName;
- createComponentDescription(unit, handlerName, handlerClassName, pojoEndpointName);
+ } else {
+ for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
+ if (endpointClassName.equals(pojoEndpoint.getClassName())) {
+ for (final String handlerClassName : handlers) {
+ final String pojoEndpointName = pojoEndpoint.getName();
+ final String handlerName = pojoEndpointName + "-" + handlerClassName;
+ createComponentDescription(unit, handlerName, handlerClassName, pojoEndpointName);
+ }
}
}
}
@@ -99,6 +124,27 @@
}
}
+ //TODO this could be moved to a separate DeploymentUnitProcessor operating on endpoints (together with the rest of the config resolution mechanism)
+ private void registerConfigMapping(String endpointClassName, EndpointConfig config, DeploymentUnit unit) {
+ WSEndpointConfigMapping mapping = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
+ if (mapping == null) {
+ mapping = new WSEndpointConfigMapping();
+ unit.putAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY, mapping);
+ }
+ mapping.registerEndpointConfig(endpointClassName, config);
+ }
+
+ private Set<String> getHandlers(String endpointClassName, EndpointConfig config, ConfigResolver resolver, WSEndpointHandlersMapping mapping) {
+ Set<String> handlers = resolver.getAllHandlers(config); //handlers from the resolved endpoint configuration
+ if (mapping != null) {
+ Set<String> hch = mapping.getHandlers(endpointClassName); // handlers from @HandlerChain
+ if (hch != null) {
+ handlers.addAll(hch);
+ }
+ }
+ return handlers;
+ }
+
private static void propagateNamingContext(final ComponentDescription jaxwsHandlerDescription, final EJBEndpoint ejbEndpoint) {
final ServiceName ejbContextServiceName = ejbEndpoint.getContextServiceName();
final DeploymentDescriptorEnvironment ejbEnv = ejbEndpoint.getDeploymentDescriptorEnvironment();
Modified: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WebServiceAnnotationProcessor.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WebServiceAnnotationProcessor.java 2015-03-03 11:12:58 UTC (rev 19506)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/WebServiceAnnotationProcessor.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -54,6 +54,7 @@
this.factories = Collections.unmodifiableList(factories);
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public final void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
Modified: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB.java 2015-03-03 11:12:58 UTC (rev 19506)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_EJB.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -27,7 +27,9 @@
import static org.jboss.wsf.spi.deployment.EndpointType.JAXWS_EJB3;
import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.deployers.WSEndpointConfigMapping;
import org.jboss.as.webservices.metadata.model.EJBEndpoint;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
import org.jboss.msc.service.ServiceName;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -46,6 +48,7 @@
@Override
protected void build(final Deployment dep, final DeploymentUnit unit) {
ROOT_LOGGER.creatingEndpointsMetaDataModel("JAXWS", "EJB");
+ WSEndpointConfigMapping ecm = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
final String ejbEndpointName = ejbEndpoint.getName();
ROOT_LOGGER.ejbName(ejbEndpointName);
@@ -56,6 +59,7 @@
if (componentViewName != null) {
ep.setProperty(COMPONENT_VIEW_NAME, componentViewName);
}
+ ep.setEndpointConfig(ecm.getConfig(ejbEndpointClassName));
}
}
Modified: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_POJO.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_POJO.java 2015-03-03 11:12:58 UTC (rev 19506)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/deployers/deployment/DeploymentModelBuilderJAXWS_POJO.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -27,7 +27,9 @@
import static org.jboss.wsf.spi.deployment.EndpointType.JAXWS_JSE;
import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.webservices.deployers.WSEndpointConfigMapping;
import org.jboss.as.webservices.metadata.model.POJOEndpoint;
+import org.jboss.as.webservices.util.WSAttachmentKeys;
import org.jboss.msc.service.ServiceName;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -46,6 +48,7 @@
@Override
protected void build(final Deployment dep, final DeploymentUnit unit) {
ROOT_LOGGER.creatingEndpointsMetaDataModel("JAXWS", "POJO");
+ WSEndpointConfigMapping ecm = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
final String pojoEndpointName = pojoEndpoint.getName();
ROOT_LOGGER.pojoName(pojoEndpointName);
@@ -56,6 +59,9 @@
if (componentViewName != null) {
ep.setProperty(COMPONENT_VIEW_NAME, componentViewName);
}
+ if (ecm != null) {
+ ep.setEndpointConfig(ecm.getConfig(pojoEndpointClassName));
+ }
}
}
Modified: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/util/ASHelper.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/util/ASHelper.java 2015-03-03 11:12:58 UTC (rev 19506)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/util/ASHelper.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -208,6 +208,10 @@
}
public static boolean isJaxwsEndpoint(final ClassInfo clazz, final CompositeIndex index) {
+ return isJaxwsEndpoint(clazz, index, true);
+ }
+
+ public static boolean isJaxwsEndpoint(final ClassInfo clazz, final CompositeIndex index, boolean log) {
// assert JAXWS endpoint class flags
final short flags = clazz.flags();
if (Modifier.isInterface(flags)) return false;
@@ -220,11 +224,15 @@
return false;
}
if (hasWebServiceAnnotation && hasWebServiceProviderAnnotation) {
- ROOT_LOGGER.mutuallyExclusiveAnnotations(clazz.name().toString());
+ if (log) {
+ ROOT_LOGGER.mutuallyExclusiveAnnotations(clazz.name().toString());
+ }
return false;
}
if (Modifier.isFinal(flags)) {
- ROOT_LOGGER.finalEndpointClassDetected(clazz.name().toString());
+ if (log) {
+ ROOT_LOGGER.finalEndpointClassDetected(clazz.name().toString());
+ }
return false;
}
return true;
Modified: container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java
===================================================================
--- container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java 2015-03-03 11:12:58 UTC (rev 19506)
+++ container/wildfly82/branches/jbossws-wildfly820/server-integration/src/main/java/org/jboss/as/webservices/util/WSAttachmentKeys.java 2015-03-03 11:15:20 UTC (rev 19507)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
+ * Copyright 2015, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -22,6 +22,7 @@
package org.jboss.as.webservices.util;
import org.jboss.as.server.deployment.AttachmentKey;
+import org.jboss.as.webservices.deployers.WSEndpointConfigMapping;
import org.jboss.as.webservices.injection.WSEndpointHandlersMapping;
import org.jboss.as.webservices.metadata.model.JAXWSDeployment;
import org.jboss.as.webservices.webserviceref.WSRefRegistry;
@@ -51,6 +52,7 @@
public static final AttachmentKey<ClassLoader> CLASSLOADER_KEY = AttachmentKey.create(ClassLoader.class);
public static final AttachmentKey<WSRefRegistry> WS_REFREGISTRY = AttachmentKey.create(WSRefRegistry.class);
public static final AttachmentKey<WSEndpointHandlersMapping> WS_ENDPOINT_HANDLERS_MAPPING_KEY = AttachmentKey.create(WSEndpointHandlersMapping.class);
+ public static final AttachmentKey<WSEndpointConfigMapping> WS_ENDPOINT_CONFIG_MAPPING_KEY = AttachmentKey.create(WSEndpointConfigMapping.class);
public static final AttachmentKey<ServerConfig> SERVER_CONFIG_KEY = AttachmentKey.create(ServerConfig.class);
private WSAttachmentKeys() {
9 years, 11 months
JBossWS SVN: r19506 - in common/trunk/src: main/java/org/jboss/ws/common/configuration and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-03-03 06:12:58 -0500 (Tue, 03 Mar 2015)
New Revision: 19506
Added:
common/trunk/src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java
common/trunk/src/main/java/org/jboss/ws/common/configuration/BasicConfigResolver.java
Modified:
common/trunk/src/main/java/org/jboss/ws/common/Messages.java
common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigDelegateHandler.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
common/trunk/src/test/java/org/jboss/test/ws/common/management/DefaultEndpointRegistryTestCase.java
Log:
[JBWS-3846] Providing facilities for resolving configuration for a given endpoint
Modified: common/trunk/src/main/java/org/jboss/ws/common/Messages.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/Messages.java 2015-03-03 11:11:21 UTC (rev 19505)
+++ common/trunk/src/main/java/org/jboss/ws/common/Messages.java 2015-03-03 11:12:58 UTC (rev 19506)
@@ -37,6 +37,7 @@
import org.jboss.ws.common.injection.InjectionException;
import org.jboss.wsf.spi.WSFException;
import org.jboss.wsf.spi.deployment.EndpointState;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
/**
@@ -264,4 +265,10 @@
@Message(id = 22117, value = "Invalid address provided: %s")
IllegalArgumentException invalidAddressProvided(String address);
+
+ @Message(id = 22120, value = "Could not read from config file: %s")
+ RuntimeException couldNotReadConfigFile(String file);
+
+ @Message(id = 22121, value = "Could not find endpoint config name: %s")
+ WSFDeploymentException couldNotFindEndpointConfigName(String name);
}
Added: common/trunk/src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java 2015-03-03 11:12:58 UTC (rev 19506)
@@ -0,0 +1,238 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.configuration;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.net.URL;
+import java.security.AccessController;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.ws.common.Messages;
+import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.metadata.config.ConfigMetaDataParser;
+import org.jboss.wsf.spi.metadata.config.ConfigRoot;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+
+
+/**
+ * Base class for resolving common configs
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 26-Feb-2015
+ */
+public abstract class AbstractCommonConfigResolver {
+
+ /**
+ * Returns the EndpointConfig resolved for the current endpoint
+ *
+ * @return the EndpointConfig resolved for the current endpoint
+ */
+ public EndpointConfig resolveEndpointConfig() {
+ final String endpointClassName = getEndpointClassName();
+ // 1) default values
+ //String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;
+ String configName = endpointClassName;
+ String configFile = EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE;
+ boolean specifiedConfig = false;
+ // 2) annotation contribution
+ if (isEndpointClassAnnotated(org.jboss.ws.api.annotation.EndpointConfig.class))
+ {
+ final String cfgName = getEndpointConfigNameFromAnnotation();
+ if (cfgName != null && !cfgName.isEmpty())
+ {
+ configName = cfgName;
+ }
+ final String cfgFile = getEndpointConfigFileFromAnnotation();
+ if (cfgFile != null && !cfgFile.isEmpty())
+ {
+ configFile = cfgFile;
+ }
+ specifiedConfig = true;
+ }
+ // 3) descriptor overrides (jboss-webservices.xml or web.xml)
+ final String epCfgNameOverride = getEndpointConfigNameOverride();
+ if (epCfgNameOverride != null && !epCfgNameOverride.isEmpty())
+ {
+ configName = epCfgNameOverride;
+ specifiedConfig = true;
+ }
+ final String epCfgFileOverride = getEndpointConfigFileOverride();
+ if (epCfgFileOverride != null && !epCfgFileOverride.isEmpty())
+ {
+ configFile = epCfgFileOverride;
+ }
+ // 4) setup of configuration
+ if (configFile != EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE) {
+ //look for provided endpoint config file
+ try
+ {
+ ConfigRoot configRoot = ConfigMetaDataParser.parse(getConfigFile(configFile));
+ EndpointConfig config = configRoot.getEndpointConfigByName(configName);
+ if (config == null && !specifiedConfig) {
+ config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
+ }
+ if (config != null) {
+ return config;
+ }
+ }
+ catch (IOException e)
+ {
+ throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
+ }
+ }
+ else
+ {
+ EndpointConfig config = null;
+ URL url = getDefaultConfigFile(configFile);
+ if (url != null) {
+ //the default file exists
+ try
+ {
+ ConfigRoot configRoot = ConfigMetaDataParser.parse(url);
+ config = configRoot.getEndpointConfigByName(configName);
+ if (config == null && !specifiedConfig) {
+ config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
+ }
+ }
+ catch (IOException e)
+ {
+ throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
+ }
+ }
+ if (config == null) {
+ //use endpoint configs from AS domain
+ ServerConfig sc = getServerConfig();
+ config = sc.getEndpointConfig(configName);
+ if (config == null && !specifiedConfig) {
+ config = sc.getEndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
+ }
+ if (config == null && specifiedConfig) {
+ throw Messages.MESSAGES.couldNotFindEndpointConfigName(configName);
+ }
+ }
+ if (config != null) {
+ return config;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns a set of full qualified class names of the handlers from the specified endpoint config
+ *
+ * @param The config to get the handler class names of
+ * @return A set of full qualified class names of the handlers from the specified endpoint config
+ */
+ public Set<String> getAllHandlers(EndpointConfig config) {
+ Set<String> set = new HashSet<String>();
+ if (config != null) {
+ for (UnifiedHandlerChainMetaData uhcmd : config.getPreHandlerChains()) {
+ for (UnifiedHandlerMetaData uhmd : uhcmd.getHandlers()) {
+ set.add(uhmd.getHandlerClass());
+ }
+ }
+ for (UnifiedHandlerChainMetaData uhcmd : config.getPostHandlerChains()) {
+ for (UnifiedHandlerMetaData uhmd : uhcmd.getHandlers()) {
+ set.add(uhmd.getHandlerClass());
+ }
+ }
+ }
+ return set;
+ }
+
+ /**
+ * Gets the FQN of the endpoint class whose config is to be resolved by this class
+ *
+ * @return the FQN of the endpoint class
+ */
+ protected abstract String getEndpointClassName();
+
+ /**
+ * Returns true or false depending on the current endpoint class being annotated or
+ * not with the specified annotation.
+ *
+ * @param annotation The annotation to look for
+ * @return True if the endpoint is annotated with the specified annotation,
+ * false otherwise.
+ */
+ protected abstract <T extends Annotation> boolean isEndpointClassAnnotated(Class<T> annotation);
+
+ /**
+ * Returns the config name specified on the @EndpointConfig annotation (if any) on
+ * the current endpoint
+ *
+ * @return The config name in the @EndpointConfig annotation on the endpoint
+ */
+ protected abstract String getEndpointConfigNameFromAnnotation();
+
+ /**
+ * Returns the config file specified on the @EndpointConfig annotation (if any) on
+ * the current endpoint
+ *
+ * @return The config file in the @EndpointConfig annotation on the endpoint
+ */
+ protected abstract String getEndpointConfigFileFromAnnotation();
+
+ /**
+ * Returns the config name value coming from deployment descriptor
+ *
+ * @return The config name value from deployment descriptor
+ */
+ protected abstract String getEndpointConfigNameOverride();
+
+ /**
+ * Returns the config file value coming from deployment descriptor
+ *
+ * @return The config file value from deployment descriptor
+ */
+ protected abstract String getEndpointConfigFileOverride();
+
+ /**
+ * Returns the URL of the config file for the given name; this can either be in the root of the deployment
+ * or at the same level of the endpoint class file (a sibling of it)
+ *
+ * @param configFileName The name of the config file to look for
+ * @return the URL of the config file or null if it's not found
+ */
+ protected abstract URL getConfigFile(String configFileName) throws IOException;
+
+ /**
+ * Returns the URL of the specified default config file; this can either be in the root of the deployment
+ * or at the same level of the endpoint class file (a sibling of it)
+ *
+ * @param defaultConfigFileName The name of the config file to look for
+ * @return the URL of the config file or null if it's not found
+ */
+ protected abstract URL getDefaultConfigFile(String defaultConfigFileName);
+
+ protected ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+}
Property changes on: common/trunk/src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: common/trunk/src/main/java/org/jboss/ws/common/configuration/BasicConfigResolver.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/BasicConfigResolver.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/BasicConfigResolver.java 2015-03-03 11:12:58 UTC (rev 19506)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.configuration;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.net.URL;
+
+import org.jboss.ws.api.annotation.EndpointConfig;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
+
+/**
+ * A config resolver that operates on a JBossWS deployment
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 03-Mar-2015
+ */
+public class BasicConfigResolver extends AbstractCommonConfigResolver
+{
+ private final UnifiedVirtualFile deploymentRoot;
+ private final Class<?> implementorClass;
+ private final String configNameOverride;
+ private final String configFileOverride;
+ private final EndpointConfig ann;
+
+ public BasicConfigResolver(ArchiveDeployment dep, Class<?> implementorClass) {
+ String epConfigName = null;
+ String epConfigFile = null;
+ JSEArchiveMetaData jsemd = dep.getAttachment(JSEArchiveMetaData.class);
+ JBossWebservicesMetaData wsmd = dep.getAttachment(JBossWebservicesMetaData.class);
+ //first check JSEArchiveMetaData as that has the actual merged value for POJO deployments
+ if (jsemd != null) {
+ epConfigName = jsemd.getConfigName();
+ epConfigFile = jsemd.getConfigFile();
+ } else if (wsmd != null) {
+ epConfigName = wsmd.getConfigName();
+ epConfigFile = wsmd.getConfigFile();
+ }
+ this.configNameOverride = epConfigName;
+ this.configFileOverride = epConfigFile;
+ this.implementorClass = implementorClass;
+ this.deploymentRoot = dep.getRootFile();
+ this.ann = implementorClass.getAnnotation(EndpointConfig.class);
+ }
+
+ @Override
+ protected URL getDefaultConfigFile(String defaultConfigFileName)
+ {
+ URL url = implementorClass.getResource("/" + defaultConfigFileName);
+ if (url == null)
+ {
+ UnifiedVirtualFile vf = deploymentRoot.findChildFailSafe(defaultConfigFileName);
+ if (vf != null)
+ {
+ url = vf.toURL();
+ }
+ }
+ return url;
+ }
+
+ @Override
+ protected URL getConfigFile(String configFileName) throws IOException
+ {
+ UnifiedVirtualFile vf = deploymentRoot.findChild(configFileName);
+ return vf.toURL();
+ }
+
+ @Override
+ protected String getEndpointClassName()
+ {
+ return implementorClass.getName();
+ }
+
+ @Override
+ protected <T extends Annotation> boolean isEndpointClassAnnotated(Class<T> annotation)
+ {
+ return ann != null;
+ }
+
+ @Override
+ protected String getEndpointConfigNameFromAnnotation()
+ {
+ return ann.configName();
+ }
+
+ @Override
+ protected String getEndpointConfigFileFromAnnotation()
+ {
+ return ann.configFile();
+ }
+
+ @Override
+ protected String getEndpointConfigNameOverride()
+ {
+ return configNameOverride;
+ }
+
+ @Override
+ protected String getEndpointConfigFileOverride()
+ {
+ return configFileOverride;
+ }
+}
Property changes on: common/trunk/src/main/java/org/jboss/ws/common/configuration/BasicConfigResolver.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigDelegateHandler.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigDelegateHandler.java 2015-03-03 11:11:21 UTC (rev 19505)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigDelegateHandler.java 2015-03-03 11:12:58 UTC (rev 19506)
@@ -64,4 +64,9 @@
{
return isPre;
}
+
+ public Handler<T> getDelegate()
+ {
+ return delegate;
+ }
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2015-03-03 11:11:21 UTC (rev 19505)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2015-03-03 11:12:58 UTC (rev 19506)
@@ -44,6 +44,7 @@
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
import org.jboss.wsf.spi.security.SecurityDomainContext;
/**
@@ -70,6 +71,7 @@
protected volatile List<RecordProcessor> recordProcessors = new CopyOnWriteArrayList<RecordProcessor>();
protected volatile SecurityDomainContext securityDomainContext;
protected volatile InstanceProvider instanceProvider;
+ protected volatile EndpointConfig endpointConfig;
AbstractDefaultEndpoint(String targetBean)
{
@@ -318,4 +320,14 @@
this.instanceProvider = instanceProvider;
}
+ public void setEndpointConfig(final EndpointConfig endpointConfig)
+ {
+ assertEndpointSetterAccess();
+ this.endpointConfig = endpointConfig;
+ }
+
+ public EndpointConfig getEndpointConfig()
+ {
+ return endpointConfig;
+ }
}
Modified: common/trunk/src/test/java/org/jboss/test/ws/common/management/DefaultEndpointRegistryTestCase.java
===================================================================
--- common/trunk/src/test/java/org/jboss/test/ws/common/management/DefaultEndpointRegistryTestCase.java 2015-03-03 11:11:21 UTC (rev 19505)
+++ common/trunk/src/test/java/org/jboss/test/ws/common/management/DefaultEndpointRegistryTestCase.java 2015-03-03 11:12:58 UTC (rev 19506)
@@ -48,6 +48,7 @@
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
import org.jboss.wsf.spi.security.SecurityDomainContext;
import junit.framework.TestCase;
@@ -403,6 +404,19 @@
{
return null;
}
+
+ @Override
+ public EndpointConfig getEndpointConfig()
+ {
+ return null;
+ }
+
+ @Override
+ public void setEndpointConfig(EndpointConfig config)
+ {
+ // TODO Auto-generated method stub
+
+ }
};
}
}
9 years, 11 months
JBossWS SVN: r19505 - spi/trunk/src/main/java/org/jboss/wsf/spi/deployment.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-03-03 06:11:21 -0500 (Tue, 03 Mar 2015)
New Revision: 19505
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
Log:
[JBWS-3846] Adding EndpointConfig into Endpoint
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2015-02-27 23:48:04 UTC (rev 19504)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2015-03-03 11:11:21 UTC (rev 19505)
@@ -30,6 +30,7 @@
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
import org.jboss.wsf.spi.security.SecurityDomainContext;
/**
@@ -137,4 +138,9 @@
/** Set instance provider */
void setInstanceProvider(InstanceProvider provider);
+ /** Get endpoint config */
+ EndpointConfig getEndpointConfig();
+
+ /** Set endpoint config */
+ void setEndpointConfig(EndpointConfig config);
}
9 years, 11 months