Author: richard.opalka(a)jboss.com
Date: 2011-09-10 08:45:18 -0400 (Sat, 10 Sep 2011)
New Revision: 14968
Added:
common/trunk/src/main/java/org/jboss/ws/common/integration/EndpointTypeFilterImpl.java
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandler.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultService.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointNameDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/JAXBIntroDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/URLPatternDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/VirtualHostDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/integration/WSHelper.java
common/trunk/src/main/java/org/jboss/ws/common/servlet/AbstractEndpointServlet.java
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
Log:
[JBWS-3349] code review
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 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -36,8 +36,8 @@
import org.jboss.ws.common.injection.PreDestroyHolder;
import org.jboss.wsf.spi.deployment.AbstractExtensible;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Endpoint.EndpointState;
-import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
+import org.jboss.wsf.spi.deployment.EndpointState;
+import org.jboss.wsf.spi.deployment.EndpointType;
import org.jboss.wsf.spi.deployment.LifecycleHandler;
import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
@@ -62,6 +62,7 @@
protected String targetBean;
protected Class<?> targetBeanClass;
protected EndpointState state;
+ protected EndpointType type;
protected RequestHandler requestHandler;
protected InvocationHandler invocationHandler;
protected LifecycleHandler lifecycleHandler;
@@ -69,7 +70,6 @@
protected String address;
protected List<RecordProcessor> recordProcessors = new
Vector<RecordProcessor>();
protected SecurityDomainContext securityDomainContext;
- protected EndpointType type;
AbstractDefaultEndpoint(String targetBean)
{
@@ -169,6 +169,16 @@
this.state = state;
}
+ public EndpointType getType()
+ {
+ return type;
+ }
+
+ public void setType(EndpointType type)
+ {
+ this.type = type;
+ }
+
public RequestHandler getRequestHandler()
{
return requestHandler;
@@ -297,13 +307,5 @@
{
this.securityDomainContext = securityDomainContext;
}
- public void setType(EndpointType type)
- {
- this.type = type;
- }
-
- public EndpointType getType()
- {
- return this.type;
- }
+
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -45,7 +45,7 @@
private static final ResourceBundle bundle =
BundleUtils.getBundle(ContextRootDeploymentAspect.class);
@Override
public void start(Deployment dep)
- {
+ {
String contextRoot = dep.getService().getContextRoot();
if (contextRoot == null)
{
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -23,6 +23,8 @@
import org.jboss.wsf.spi.deployment.AbstractExtensible;
import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentState;
+import org.jboss.wsf.spi.deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.Service;
/**
@@ -39,6 +41,8 @@
private String simpleName;
// A deployment has one service
private Service service;
+ // The type of this deployment
+ private DeploymentType type;
// The state for this deployment
private DeploymentState state;
// The deployment class loader
@@ -105,4 +109,13 @@
this.state = deploymentState;
}
+ public DeploymentType getType()
+ {
+ return type;
+ }
+
+ public void setType(DeploymentType deploymentType)
+ {
+ this.type = deploymentType;
+ }
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -25,6 +25,7 @@
import javax.naming.Context;
+import org.jboss.wsf.spi.deployment.EndpointType;
import org.jboss.wsf.spi.deployment.JMSEndpoint;
import org.jboss.wsf.spi.management.EndpointMetrics;
@@ -106,4 +107,5 @@
{
}
+
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandler.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandler.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultLifecycleHandler.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -26,7 +26,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Endpoint.EndpointState;
+import org.jboss.wsf.spi.deployment.EndpointState;
import org.jboss.wsf.spi.deployment.LifecycleHandler;
import org.jboss.wsf.spi.invocation.InvocationHandler;
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultService.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultService.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultService.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -22,12 +22,12 @@
package org.jboss.ws.common.deployment;
import org.jboss.wsf.spi.deployment.AbstractExtensible;
-import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
+import org.jboss.wsf.spi.deployment.EndpointTypeFilter;
import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.EndpointTypeFilter;
+import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -71,9 +71,9 @@
{
return endpoints;
}
-
-
- public List<Endpoint> getEndpoints(EndpointTypeFilter filter)
+
+ @Override
+ public List<Endpoint> getEndpoints(final EndpointTypeFilter filter)
{
List<Endpoint> result = new LinkedList<Endpoint>();
for (Endpoint endpoint : endpoints)
@@ -84,8 +84,7 @@
}
}
return result;
- }
-
+ }
public Endpoint getEndpointByName(String shortName)
{
@@ -129,6 +128,6 @@
public void setVirtualHosts(List<String> virtualHosts)
{
this.virtualHosts = virtualHosts;
- }
+ }
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -29,7 +29,7 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentState;
+import org.jboss.wsf.spi.deployment.DeploymentState;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.DeploymentAspectManager;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -21,6 +21,10 @@
*/
package org.jboss.ws.common.deployment;
+import static org.jboss.ws.common.integration.WSHelper.isJaxrpcDeployment;
+import static org.jboss.ws.common.integration.WSHelper.isJaxwsJseEndpoint;
+import static org.jboss.ws.common.integration.WSHelper.isJaxwsEjbEndpoint;
+
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -34,7 +38,6 @@
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
import org.jboss.wsf.spi.deployment.HttpEndpoint;
import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.management.ServerConfigFactory;
@@ -118,10 +121,12 @@
}
}
- protected boolean isConfidentialTransportGuarantee(Deployment dep, Endpoint ep)
+ protected boolean isConfidentialTransportGuarantee(final Deployment dep, final
Endpoint ep)
{
+ if (isJaxrpcDeployment(dep)) return false;
+
String transportGuarantee = null;
- if (EndpointType.JAXWS_JSE == ep.getType())
+ if (isJaxwsJseEndpoint(ep))
{
JSEArchiveMetaData webMetaData = dep.getAttachment(JSEArchiveMetaData.class);
if (webMetaData != null)
@@ -152,10 +157,10 @@
}
}
}
- else if (EndpointType.JAXWS_EJB3 == ep.getType())
+ else if (isJaxwsEjbEndpoint(ep))
{
//TODO Unify annotation scans
- Class implClass = ep.getTargetBeanClass();
+ Class<?> implClass = ep.getTargetBeanClass();
WebContext anWebContext =
(WebContext)implClass.getAnnotation(WebContext.class);
if (anWebContext != null)
{
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -26,7 +26,6 @@
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
import org.jboss.wsf.spi.deployment.LifecycleHandler;
import org.jboss.wsf.spi.deployment.LifecycleHandlerFactory;
import org.jboss.wsf.spi.invocation.InvocationHandler;
@@ -34,15 +33,12 @@
import org.jboss.wsf.spi.invocation.InvocationType;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.invocation.RequestHandlerFactory;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.MDBMetaData;
/**
- * A deployer that assigns the handlers to the Endpoint
+ * An aspect that assigns the handlers to the Endpoint.
*
* @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class EndpointHandlerDeploymentAspect extends AbstractDeploymentAspect
{
@@ -50,62 +46,34 @@
public EndpointHandlerDeploymentAspect()
{
- super();
spiProvider = SPIProviderResolver.getInstance().getProvider();
}
@Override
- public void start(Deployment dep)
+ public void start(final Deployment dep)
{
- for (Endpoint ep : dep.getService().getEndpoints())
+ for (final Endpoint ep : dep.getService().getEndpoints())
{
- // Associate a request handler
ep.setRequestHandler(getRequestHandler(dep));
-
- // Associate a lifecycle handler
ep.setLifecycleHandler(getLifecycleHandler(dep));
-
- // Associate an invocation handler
- // Invocation handlers are assigned per container or per stack
- InvocationHandler invocationHandler = getInvocationHandler(ep);
- if (invocationHandler != null)
- ep.setInvocationHandler(invocationHandler);
-
+ ep.setInvocationHandler(getInvocationHandler(ep));
}
}
- private RequestHandler getRequestHandler(Deployment dep)
+ private RequestHandler getRequestHandler(final Deployment dep)
{
return spiProvider.getSPI(RequestHandlerFactory.class).newRequestHandler();
}
- private LifecycleHandler getLifecycleHandler(Deployment dep)
+ private LifecycleHandler getLifecycleHandler(final Deployment dep)
{
return spiProvider.getSPI(LifecycleHandlerFactory.class).newLifecycleHandler();
}
- private InvocationHandler getInvocationHandler(Endpoint ep)
+ private InvocationHandler getInvocationHandler(final Endpoint ep)
{
-
- String key = ep.getType().toString();
-
- // Use a special key for MDB endpoints
- EJBArchiveMetaData uapp =
ep.getService().getDeployment().getAttachment(EJBArchiveMetaData.class);
- if (uapp != null)
- {
- EJBMetaData bmd = uapp.getBeanByEjbName(ep.getShortName());
- if (ep.getType() == EndpointType.JAXRPC_EJB21 && bmd instanceof
MDBMetaData)
- {
- key = InvocationType.JAXRPC_MDB21.toString();
- }
- else if (ep.getType() == EndpointType.JAXWS_EJB3 && bmd instanceof
MDBMetaData)
- {
- key = InvocationType.JAXWS_MDB3.toString();
- }
- }
-
- InvocationType type = InvocationType.valueOf(key);
- InvocationHandler invocationHandler =
spiProvider.getSPI(InvocationHandlerFactory.class).newInvocationHandler(type);
- return invocationHandler;
+ final InvocationType invocationType =
InvocationType.valueOf(ep.getType().toString());
+ return
spiProvider.getSPI(InvocationHandlerFactory.class).newInvocationHandler(invocationType);
}
+
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointNameDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointNameDeploymentAspect.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointNameDeploymentAspect.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -28,45 +28,32 @@
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.MDBMetaData;
/**
* A deployer that assigns the complete name to the Endpoint
*
* @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
+ * @since <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class EndpointNameDeploymentAspect extends AbstractDeploymentAspect
{
+
private static final ResourceBundle bundle =
BundleUtils.getBundle(EndpointNameDeploymentAspect.class);
+
@Override
public void start(Deployment dep)
{
- String contextRoot = dep.getService().getContextRoot();
+ final String contextRoot = dep.getService().getContextRoot();
if (contextRoot == null || contextRoot.startsWith("/") == false)
throw new IllegalStateException(BundleUtils.getMessage(bundle,
"CONTEXT_ROOT_EXPECTED_TO_START_WITH_LEADING_SLASH", contextRoot));
for (Endpoint ep : dep.getService().getEndpoints())
{
- StringBuilder name = new StringBuilder(Endpoint.SEPID_DOMAIN + ":");
+ final StringBuilder name = new StringBuilder(Endpoint.SEPID_DOMAIN +
":");
name.append(Endpoint.SEPID_PROPERTY_CONTEXT + "=" +
contextRoot.substring(1) + ",");
name.append(Endpoint.SEPID_PROPERTY_ENDPOINT + "=" +
ep.getShortName());
-
- // Append the JMS destination, for an MDB endpoint
- EJBArchiveMetaData uapp = dep.getAttachment(EJBArchiveMetaData.class);
- if (uapp != null)
- {
- EJBMetaData bmd = uapp.getBeanByEjbName(ep.getShortName());
- if (bmd instanceof MDBMetaData)
- {
- String destName = ((MDBMetaData)bmd).getDestinationJndiName();
- name.append(",jms=" + destName);
- }
- }
-
ep.setName(ObjectNameFactory.create(name.toString()));
}
}
+
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/JAXBIntroDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/JAXBIntroDeploymentAspect.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/JAXBIntroDeploymentAspect.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -107,7 +107,7 @@
try {
introsConfigStream.close();
} catch (IOException e) {
- logger.error(BundleUtils.getMessage(bundle,
"ERROR_CLOSING_JAXB_INTRODUCTIONS", deployment.getService().getContextRoot()),
e);
+ logger.error(BundleUtils.getMessage(bundle,
"ERROR_CLOSING_JAXB_INTRODUCTIONS", deployment.getService().getContextRoot() ),
e);
}
}
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/URLPatternDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/URLPatternDeploymentAspect.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/URLPatternDeploymentAspect.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -21,6 +21,9 @@
*/
package org.jboss.ws.common.deployment;
+import static org.jboss.ws.common.integration.WSHelper.isEjbEndpoint;
+import static org.jboss.ws.common.integration.WSHelper.isJseEndpoint;
+
import java.util.ResourceBundle;
import java.util.StringTokenizer;
@@ -31,7 +34,6 @@
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
import org.jboss.wsf.spi.deployment.HttpEndpoint;
import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
@@ -78,7 +80,7 @@
// #1 For JSE lookup the url-pattern from the servlet mappings
JSEArchiveMetaData webMetaData = dep.getAttachment(JSEArchiveMetaData.class);
- if (webMetaData != null && (ep.getType() == EndpointType.JAXWS_JSE ||
ep.getType() == EndpointType.JAXRPC_JSE))
+ if (webMetaData != null && isJseEndpoint(ep))
{
String epName = ep.getShortName();
urlPattern = webMetaData.getServletMappings().get(epName);
@@ -88,7 +90,7 @@
// #2 Use the explicit urlPattern from port-component/port-component-uri
EJBArchiveMetaData appMetaData = dep.getAttachment(EJBArchiveMetaData.class);
- if (appMetaData != null && appMetaData.getBeanByEjbName(ep.getShortName())
!= null && (ep.getType() == EndpointType.JAXWS_EJB3 || ep.getType() ==
EndpointType.JAXRPC_EJB21))
+ if (appMetaData != null && appMetaData.getBeanByEjbName(ep.getShortName())
!= null && isEjbEndpoint(ep))
{
EJBMetaData bmd = appMetaData.getBeanByEjbName(ep.getShortName());
urlPattern = bmd.getPortComponentURI();
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/VirtualHostDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/VirtualHostDeploymentAspect.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/VirtualHostDeploymentAspect.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -22,6 +22,8 @@
package org.jboss.ws.common.deployment;
+import static org.jboss.ws.common.integration.WSHelper.isJaxwsEjbDeployment;
+
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
@@ -29,7 +31,6 @@
import org.jboss.ws.api.annotation.WebContext;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
-import org.jboss.ws.common.integration.WSHelper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -46,7 +47,7 @@
@Override
public void start(Deployment dep)
{
- if (WSHelper.isEjbDeployment(dep) && !WSHelper.isJaxwsJseDeployment(dep))
+ if (isJaxwsEjbDeployment(dep))
{
dep.getService().setVirtualHosts(getExplicitVirtualHosts(dep));
}
@@ -59,7 +60,7 @@
// Use the virtual hosts from @WebContext.virtualHosts
for (Endpoint ep : dep.getService().getEndpoints())
{
- Class implClass = ep.getTargetBeanClass();
+ Class<?> implClass = ep.getTargetBeanClass();
WebContext anWebContext =
(WebContext)implClass.getAnnotation(WebContext.class);
if (anWebContext != null && anWebContext.virtualHosts() != null
&& anWebContext.virtualHosts().length > 0)
{
Added:
common/trunk/src/main/java/org/jboss/ws/common/integration/EndpointTypeFilterImpl.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/integration/EndpointTypeFilterImpl.java
(rev 0)
+++
common/trunk/src/main/java/org/jboss/ws/common/integration/EndpointTypeFilterImpl.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.integration;
+
+import org.jboss.wsf.spi.deployment.EndpointType;
+import org.jboss.wsf.spi.deployment.EndpointTypeFilter;
+
+/**
+ * Endpoint type filter implementation.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class EndpointTypeFilterImpl implements EndpointTypeFilter
+{
+
+ private final EndpointType type;
+
+ EndpointTypeFilterImpl( final EndpointType type )
+ {
+ this.type = type;
+ }
+
+ @Override
+ public boolean accept( final EndpointType type ) {
+ return this.type == type;
+ }
+
+}
Modified: common/trunk/src/main/java/org/jboss/ws/common/integration/WSHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/integration/WSHelper.java 2011-09-10
12:43:38 UTC (rev 14967)
+++ common/trunk/src/main/java/org/jboss/ws/common/integration/WSHelper.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -23,10 +23,17 @@
import java.util.ResourceBundle;
+import static org.jboss.wsf.spi.deployment.EndpointType.JAXRPC_EJB21;
+import static org.jboss.wsf.spi.deployment.EndpointType.JAXRPC_JSE;
+import static org.jboss.wsf.spi.deployment.EndpointType.JAXWS_EJB3;
+import static org.jboss.wsf.spi.deployment.EndpointType.JAXWS_JSE;
+import static org.jboss.wsf.spi.deployment.DeploymentType.JAXWS;
+import static org.jboss.wsf.spi.deployment.DeploymentType.JAXRPC;
+
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
+import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.EndpointTypeFilter;
/**
@@ -36,26 +43,30 @@
*/
public final class WSHelper
{
+
private static final ResourceBundle bundle = BundleUtils.getBundle(WSHelper.class);
-
- /** Logger. */
private static final Logger LOG = Logger.getLogger( WSHelper.class );
+ private static final EndpointTypeFilter JAXRPC_EJB_ENDPOINT_FILTER = new
EndpointTypeFilterImpl( JAXRPC_EJB21 );
+ private static final EndpointTypeFilter JAXRPC_JSE_ENDPOINT_FILTER = new
EndpointTypeFilterImpl( JAXRPC_JSE );
+ private static final EndpointTypeFilter JAXWS_EJB_ENDPOINT_FILTER = new
EndpointTypeFilterImpl( JAXWS_EJB3 );
+ private static final EndpointTypeFilter JAXWS_JSE_ENDPOINT_FILTER = new
EndpointTypeFilterImpl( JAXWS_JSE );
+
/**
* Forbidden constructor.
*/
private WSHelper()
{
- super();
+ // forbidden inheritance
}
/**
* Returns required attachment value from webservice deployment.
- *
+ *
* @param <A> expected value
* @param dep webservice deployment
* @param key attachment key
- * @return required attachment
+ * @return required attachment
* @throws IllegalStateException if attachment value is null
*/
public static <A> A getRequiredAttachment( final Deployment dep, final Class<
A > key )
@@ -66,13 +77,12 @@
LOG.error(BundleUtils.getMessage(bundle, "CAN_NOT_FIND_ATTACHMENT",
key ));
throw new IllegalStateException();
}
-
return value;
}
-
+
/**
* Returns optional attachment value from webservice deployment or null if not bound.
- *
+ *
* @param <A> expected value
* @param dep webservice deployment
* @param key attachment key
@@ -85,7 +95,7 @@
/**
* Returns true if webservice deployment have attachment value associated with the
<b>key</b>.
- *
+ *
* @param dep webservice deployment
* @param key attachment key
* @return true if contains attachment, false otherwise
@@ -96,78 +106,49 @@
}
/**
- * Returns true if deployment represents JAXRPC EJB deployment.
+ * Returns true if deployment represents JAXWS JSE deployment.
*
* @param dep webservice deployment
- * @return true if JAXRPC EJB deployment, false otherwise
+ * @return true if JAXWS JSE deployment, false otherwise
*/
- public static boolean isJaxrpcEjbDeployment( final Deployment dep )
+ public static boolean isJaxwsJseDeployment( final Deployment dep )
{
- return dep.getService().getEndpoints(new EndpointTypeFilter() {
- public boolean accept(EndpointType type) {
- if (type == EndpointType.JAXRPC_EJB21) {
- return true;
- }
- return false;
- }
- }).size() > 0;
+ return isJaxwsDeployment( dep ) && dep.getService().getEndpoints(
JAXWS_JSE_ENDPOINT_FILTER ).size() > 0;
}
/**
- * Returns true if deployment represents JAXRPC JSE deployment.
+ * Returns true if deployment represents JAXWS EJB deployment.
*
* @param dep webservice deployment
- * @return true if JAXRPC JSE deployment, false otherwise
+ * @return true if JAXWS EJB deployment, false otherwise
*/
- public static boolean isJaxrpcJseDeployment( final Deployment dep )
+ public static boolean isJaxwsEjbDeployment( final Deployment dep )
{
- return dep.getService().getEndpoints(new EndpointTypeFilter() {
- public boolean accept(EndpointType type) {
- if (type == EndpointType.JAXRPC_JSE) {
- return true;
- }
- return false;
- }
- }).size() > 0;
+ return isJaxwsDeployment( dep ) && dep.getService().getEndpoints(
JAXWS_EJB_ENDPOINT_FILTER ).size() > 0;
}
/**
- * Returns true if deployment represents JAXWS EJB deployment.
+ * Returns true if deployment represents JAXRPC JSE deployment.
*
* @param dep webservice deployment
- * @return true if JAXWS EJB deployment, false otherwise
+ * @return true if JAXRPC JSE deployment, false otherwise
*/
- public static boolean isJaxwsEjbDeployment( final Deployment dep )
+ public static boolean isJaxrpcJseDeployment( final Deployment dep )
{
- return dep.getService().getEndpoints(new EndpointTypeFilter() {
- public boolean accept(EndpointType type) {
- if (type == EndpointType.JAXWS_EJB3) {
- return true;
- }
- return false;
- }
-
- }).size() > 0;
+ return isJaxrpcDeployment( dep ) && dep.getService().getEndpoints(
JAXRPC_JSE_ENDPOINT_FILTER ).size() > 0;
}
/**
- * Returns true if deployment represents JAXWS JSE deployment.
+ * Returns true if deployment represents JAXRPC EJB deployment.
*
* @param dep webservice deployment
- * @return true if JAXWS JSE deployment, false otherwise
+ * @return true if JAXRPC EJB deployment, false otherwise
*/
- public static boolean isJaxwsJseDeployment( final Deployment dep )
+ public static boolean isJaxrpcEjbDeployment( final Deployment dep )
{
- return dep.getService().getEndpoints(new EndpointTypeFilter() {
- public boolean accept(EndpointType type) {
- if (type == EndpointType.JAXWS_JSE || type == EndpointType.JAXWS_JMS) {
- return true;
- }
- return false;
- }
- }).size() > 0;
+ return isJaxrpcDeployment( dep ) && dep.getService().getEndpoints(
JAXRPC_EJB_ENDPOINT_FILTER ).size() > 0;
}
-
+
/**
* Returns true if deployment represents either JAXWS JSE or JAXRPC JSE deployment.
*
@@ -176,10 +157,7 @@
*/
public static boolean isJseDeployment( final Deployment dep )
{
- final boolean isJaxwsJse = WSHelper.isJaxwsJseDeployment( dep );
- final boolean isJaxrpcJse = WSHelper.isJaxrpcJseDeployment( dep );
-
- return isJaxwsJse || isJaxrpcJse;
+ return isJaxwsJseDeployment( dep ) || isJaxrpcJseDeployment( dep );
}
/**
@@ -190,10 +168,7 @@
*/
public static boolean isEjbDeployment( final Deployment dep )
{
- final boolean isJaxwsEjb = WSHelper.isJaxwsEjbDeployment( dep );
- final boolean isJaxrpcEjb = WSHelper.isJaxrpcEjbDeployment( dep );
-
- return isJaxwsEjb || isJaxrpcEjb;
+ return isJaxwsEjbDeployment( dep ) || isJaxrpcEjbDeployment( dep );
}
/**
@@ -204,10 +179,7 @@
*/
public static boolean isJaxwsDeployment( final Deployment dep )
{
- final boolean isJaxwsEjb = WSHelper.isJaxwsEjbDeployment( dep );
- final boolean isJaxwsJse = WSHelper.isJaxwsJseDeployment( dep );
-
- return isJaxwsEjb || isJaxwsJse;
+ return JAXWS == dep.getType();
}
/**
@@ -218,9 +190,95 @@
*/
public static boolean isJaxrpcDeployment( final Deployment dep )
{
- final boolean isJaxrpcEjb = WSHelper.isJaxrpcEjbDeployment( dep );
- final boolean isJaxrpcJse = WSHelper.isJaxrpcJseDeployment( dep );
+ return JAXRPC == dep.getType();
+ }
- return isJaxrpcEjb || isJaxrpcJse;
+ /**
+ * Returns true if endpoint represents JAXWS JSE endpoint.
+ *
+ * @param ep webservice endpoint
+ * @return true if either JAXWS JSE endpoint, false otherwise
+ */
+ public static boolean isJaxwsJseEndpoint( final Endpoint ep )
+ {
+ return JAXWS_JSE == ep.getType();
}
+
+ /**
+ * Returns true if endpoint represents JAXWS EJB3 endpoint.
+ *
+ * @param ep webservice endpoint
+ * @return true if JAXWS EJB3 endpoint, false otherwise
+ */
+ public static boolean isJaxwsEjbEndpoint( final Endpoint ep )
+ {
+ return JAXWS_EJB3 == ep.getType();
+ }
+
+ /**
+ * Returns true if endpoint represents JAXRPC JSE endpoint.
+ *
+ * @param ep webservice endpoint
+ * @return true if JAXRPC JSE endpoint, false otherwise
+ */
+ public static boolean isJaxrpcJseEndpoint( final Endpoint ep )
+ {
+ return JAXRPC_JSE == ep.getType();
+ }
+
+ /**
+ * Returns true if endpoint represents JAXRPC EJB21 endpoint.
+ *
+ * @param ep webservice endpoint
+ * @return true if JAXRPC EJB21 endpoint, false otherwise
+ */
+ public static boolean isJaxrpcEjbEndpoint( final Endpoint ep )
+ {
+ return JAXRPC_EJB21 == ep.getType();
+ }
+
+ /**
+ * Returns true if endpoint represents either JAXWS JSE or JAXRPC JSE endpoint.
+ *
+ * @param ep webservice endpoint
+ * @return true if either JAXWS JSE or JAXRPC JSE endpoint, false otherwise
+ */
+ public static boolean isJseEndpoint( final Endpoint ep )
+ {
+ return isJaxwsJseEndpoint( ep ) || isJaxrpcJseEndpoint( ep );
+ }
+
+ /**
+ * Returns true if endpoint represents either JAXWS EJB3 or JAXRPC EJB21 endpoint.
+ *
+ * @param ep webservice endpoint
+ * @return true if either JAXWS EJB3 or JAXRPC EJB21 endpoint, false otherwise
+ */
+ public static boolean isEjbEndpoint( final Endpoint ep )
+ {
+ return isJaxwsEjbEndpoint( ep ) || isJaxrpcEjbEndpoint( ep );
+ }
+
+ /**
+ * Returns true if endpoint represents either JAXWS JSE or JAXWS EJB3 endpoint.
+ *
+ * @param ep webservice endpoint
+ * @return true if either JAXWS JSE or JAXWS EJB3 endpoint, false otherwise
+ */
+ public static boolean isJaxwsEndpoint( final Endpoint ep )
+ {
+ return isJaxwsJseEndpoint( ep ) || isJaxwsEjbEndpoint( ep );
+ }
+
+ /**
+ * Returns true if endpoint represents either JAXRPC JSE or JAXRPC EJB21 endpoint.
+ *
+ * @param ep webservice endpoint
+ * @return true if either JAXRPC JSE or JAXRPC EJB21 endpoint, false otherwise
+ */
+ public static boolean isJaxrpcEndpoint( final Endpoint ep )
+ {
+ return isJaxrpcJseEndpoint( ep ) || isJaxrpcEjbEndpoint( ep );
+ }
+
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/servlet/AbstractEndpointServlet.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/servlet/AbstractEndpointServlet.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/servlet/AbstractEndpointServlet.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.common.servlet;
+import static org.jboss.ws.common.integration.WSHelper.isJseDeployment;
+
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -36,7 +38,6 @@
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.ObjectNameFactory;
-import org.jboss.ws.common.integration.WSHelper;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
@@ -167,10 +168,8 @@
private void setRuntimeLoader()
{
final Deployment dep = endpoint.getService().getDeployment();
- final boolean isJaxrpcJse = WSHelper.isJaxrpcJseDeployment(dep);
- final boolean isJaxwsJse = WSHelper.isJaxwsJseDeployment(dep);
- if (isJaxrpcJse || isJaxwsJse)
+ if (isJseDeployment(dep))
{
ClassLoader classLoader = getContextClassLoader();
dep.setRuntimeClassLoader(classLoader);
Modified:
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2011-09-10
12:43:38 UTC (rev 14967)
+++
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2011-09-10
12:45:18 UTC (rev 14968)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.common.utils;
+import static org.jboss.ws.common.integration.WSHelper.isJseDeployment;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
@@ -39,7 +41,6 @@
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.DOMUtils;
import org.jboss.ws.common.IOUtils;
-import org.jboss.ws.common.integration.WSHelper;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
@@ -77,7 +78,7 @@
serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
}
- if (WSHelper.isJseDeployment(dep))
+ if (isJseDeployment(dep))
{
expLocation = "WEB-INF/wsdl/";
}