JBossWS SVN: r10383 - in container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration: util and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-24 19:18:13 -0400 (Fri, 24 Jul 2009)
New Revision: 10383
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifier.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifierImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java
Log:
[JBWS-2332] refactoring
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifier.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifier.java 2009-07-24 15:17:53 UTC (rev 10382)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifier.java 2009-07-24 23:18:13 UTC (rev 10383)
@@ -23,6 +23,7 @@
import org.jboss.wsf.spi.deployment.Deployment;
+// TODO: remove this
/**
* Modifies the web app according to the stack requirements.
*
@@ -31,6 +32,7 @@
*/
public interface WebMetaDataModifier
{
+ // TODO: move these properties to jbossws-common and reuse them in AS integration and in stacks
static String PROPERTY_WEBAPP_CONTEXT_PARAMETERS = "org.jboss.ws.webapp.ContextParameterMap";
static String PROPERTY_WEBAPP_SERVLET_CLASS = "org.jboss.ws.webapp.ServletClass";
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifierImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifierImpl.java 2009-07-24 15:17:53 UTC (rev 10382)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifierImpl.java 2009-07-24 23:18:13 UTC (rev 10383)
@@ -25,7 +25,7 @@
import org.jboss.metadata.javaee.spec.ParamValueMetaData;
import org.jboss.metadata.web.jboss.JBossServletMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.ListenerMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -37,141 +37,98 @@
import java.util.Map;
/**
- * The rewriter for web.xml
+ * The rewriter of web.xml metadata.
*
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class WebMetaDataModifierImpl implements WebMetaDataModifier
{
- // logging support
- private static Logger log = Logger.getLogger(WebMetaDataModifierImpl.class);
- public void modifyMetaData(Deployment dep)
+ public void modifyMetaData( final Deployment dep )
{
- JBossWebMetaData jbwmd = Helper.getRequiredAttachment( dep, JBossWebMetaData.class );
+ final JBossWebMetaData jbossWebMD = Helper.getRequiredAttachment( dep, JBossWebMetaData.class );
- try
- {
- modifyMetaData(dep, jbwmd);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WebServiceException(e);
- }
+ propagateContextProperties( dep, jbossWebMD );
+ configureWebserviceEndpoints( dep, jbossWebMD );
}
- private void modifyMetaData(Deployment dep, JBossWebMetaData jbwmd) throws ClassNotFoundException
+ private void propagateContextProperties( final Deployment dep, final JBossWebMetaData jbossWebMD )
{
- String servletClass = (String)dep.getProperty(PROPERTY_WEBAPP_SERVLET_CLASS);
- if (servletClass == null)
- throw new IllegalStateException("Cannot obtain context property: " + PROPERTY_WEBAPP_SERVLET_CLASS);
-
- Map<String, String> depCtxParams = (Map<String, String>)dep.getProperty(PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
- if (depCtxParams != null)
+ Map< String, String > depCtxParams = ( Map< String, String > ) dep.getProperty( PROPERTY_WEBAPP_CONTEXT_PARAMETERS );
+ if ( depCtxParams != null )
{
- List<ParamValueMetaData> contextParams = jbwmd.getContextParams();
- if (contextParams == null)
- {
- contextParams = new ArrayList<ParamValueMetaData>();
- jbwmd.setContextParams(contextParams);
- }
+ List< ParamValueMetaData > contextParams = getContextParameters( jbossWebMD );
- for (Map.Entry<String, String> entry : depCtxParams.entrySet())
+ for ( Map.Entry< String, String > entry : depCtxParams.entrySet() )
{
- ParamValueMetaData param = new ParamValueMetaData();
- param.setParamName(entry.getKey());
- param.setParamValue(entry.getValue());
- contextParams.add(param);
+ ParamValueMetaData param = newParameter( entry.getKey(), entry.getValue() );
+ contextParams.add( param );
}
}
-
- for (Iterator it = jbwmd.getServlets().iterator(); it.hasNext();)
+ }
+
+ private void configureWebserviceEndpoints( final Deployment dep, final JBossWebMetaData jbossWebMD )
+ {
+ for (Iterator it = jbossWebMD.getServlets().iterator(); it.hasNext();)
{
- JBossServletMetaData servlet = (JBossServletMetaData)it.next();
- List<ParamValueMetaData> initParams = servlet.getInitParam();
- if (initParams == null)
- {
- initParams = new ArrayList<ParamValueMetaData>();
- servlet.setInitParam(initParams);
- }
-
- String linkName = servlet.getServletName();
+ ServletMetaData servletMD = (ServletMetaData)it.next();
+ String endpointClassName = servletMD.getServletClass();
+ ClassLoader loader = dep.getInitialClassLoader();
+ Class< ? > endpointClass = Helper.getEndpointClass( servletMD, loader );
+ String stackEndpointServletName = getStackEndpointServletName(dep);
- // find the servlet-class
- String orgServletClassName = servlet.getServletClass();
-
- // JSP
- if (orgServletClassName == null)
- continue;
-
- // Get the servlet class
- Class orgServletClass = null;
- try
+ if ( endpointClass != null )
{
- ClassLoader loader = dep.getInitialClassLoader();
- orgServletClass = loader.loadClass(orgServletClassName);
+ servletMD.setServletClass(stackEndpointServletName);
+ List<ParamValueMetaData> initParams = getServletInitParameters( servletMD );
+ ParamValueMetaData endpointClassParameter = newParameter(Endpoint.SEPID_DOMAIN_ENDPOINT, endpointClassName );
+ initParams.add( endpointClassParameter );
}
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + orgServletClassName);
- }
-
- String targetBeanName = null;
-
- // Nothing to do if we have an <init-param>
- if (isAlreadyModified(servlet))
- {
- for (ParamValueMetaData initParam : initParams)
- {
- String paramName = initParam.getParamName();
- String paramValue = initParam.getParamValue();
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(paramName))
- {
- targetBeanName = paramValue;
- }
- }
- }
- else
- {
- // Check if it is a real servlet that we can ignore
- if (orgServletClass != null && javax.servlet.Servlet.class.isAssignableFrom(orgServletClass))
- {
- log.info("Ignore servlet: " + orgServletClassName);
- continue;
- }
-
- servlet.setServletClass(servletClass);
-
- // add additional init params
- if (orgServletClassName.equals(servletClass) == false)
- {
- targetBeanName = orgServletClassName;
- ParamValueMetaData initParam = new ParamValueMetaData();
- initParam.setParamName(Endpoint.SEPID_DOMAIN_ENDPOINT);
- initParam.setParamValue(targetBeanName);
- initParams.add(initParam);
- }
- }
-
- if (targetBeanName == null)
- throw new IllegalStateException("Cannot obtain service endpoint bean for: " + linkName);
}
}
-
- // Return true if the web.xml is already modified
- private boolean isAlreadyModified(JBossServletMetaData servlet)
+
+ private String getStackEndpointServletName( final Deployment dep )
{
- for (ParamValueMetaData initParam : servlet.getInitParam())
+ final String stackSpecificEndpointServlet = ( String ) dep.getProperty( PROPERTY_WEBAPP_SERVLET_CLASS );
+ if ( stackSpecificEndpointServlet == null )
{
- String paramName = initParam.getParamName();
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(paramName))
- return true;
+ throw new IllegalStateException( "Cannot obtain context property: " + PROPERTY_WEBAPP_SERVLET_CLASS );
}
- return false;
+
+ return stackSpecificEndpointServlet;
}
+
+ private ParamValueMetaData newParameter( final String key, final String value )
+ {
+ ParamValueMetaData paramMD = new ParamValueMetaData();
+ paramMD.setParamName( key );
+ paramMD.setParamValue( value );
+ return paramMD;
+ }
+
+ private List< ParamValueMetaData > getServletInitParameters( final ServletMetaData servletMD )
+ {
+ List< ParamValueMetaData > initParams = servletMD.getInitParam();
+ if (initParams == null)
+ {
+ initParams = new ArrayList< ParamValueMetaData >();
+ servletMD.setInitParam(initParams);
+ }
+
+ return initParams;
+ }
+
+ private List< ParamValueMetaData > getContextParameters( final JBossWebMetaData jbossWebMD )
+ {
+ List< ParamValueMetaData > contextParams = jbossWebMD.getContextParams();
+ if (contextParams == null)
+ {
+ contextParams = new ArrayList< ParamValueMetaData >();
+ jbossWebMD.setContextParams( contextParams );
+ }
+
+ return contextParams;
+ }
+
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java 2009-07-24 15:17:53 UTC (rev 10382)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java 2009-07-24 23:18:13 UTC (rev 10383)
@@ -287,7 +287,7 @@
try
{
final Class< ? > endpointClass = loader.loadClass( endpointClassName );
- final boolean notServlet = !endpointClass.isAssignableFrom( Servlet.class );
+ final boolean notServlet = !Servlet.class.isAssignableFrom( endpointClass );
if ( notServlet )
{
15 years, 5 months
JBossWS SVN: r10382 - in container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration: injection and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-24 11:17:53 -0400 (Fri, 24 Jul 2009)
New Revision: 10382
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSEJBAdapterDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSTypeDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/injection/InjectionMetaDataDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB21MetaDataBuilder.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB3MetaDataBuilder.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEMetaDataBuilder.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/SecurityHandlerEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/SecurityHandlerEJB3.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/WebAppGeneratorDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebAppDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifierImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java
Log:
[JBWS-2332] refactoring
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -101,7 +101,7 @@
if ( Helper.isWebServiceDeployment( unit ) )
{
log.debug( this.aspect.getClass() + " deploy: " + unit.getName() );
- final Deployment dep = unit.getAttachment( Deployment.class );
+ final Deployment dep = Helper.getRequiredAttachment( unit, Deployment.class );
this.aspect.start( dep );
}
}
@@ -118,7 +118,7 @@
if ( Helper.isWebServiceDeployment( unit ) )
{
log.debug( this.aspect.getClass() + " undeploy: " + unit.getName() );
- final Deployment dep = unit.getAttachment( Deployment.class );
+ final Deployment dep = Helper.getRequiredAttachment( unit, Deployment.class );
this.aspect.stop( dep );
}
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -123,9 +123,9 @@
private void newJaxrpcEjbDeployment( final DeploymentUnit unit )
{
final ArchiveDeployment dep = this.newDeployment( unit );
- final JBossMetaData jbmd = this.getAttachment( JBossMetaData.class, unit, dep );
- final WebservicesMetaData wsMetaData = this.getAttachment( WebservicesMetaData.class, unit, dep );
- this.getAttachment( WebServiceDeployment.class, unit, dep );
+ final JBossMetaData jbmd = this.getAndPropagateAttachment( JBossMetaData.class, unit, dep );
+ final WebservicesMetaData wsMetaData = this.getAndPropagateAttachment( WebservicesMetaData.class, unit, dep );
+ this.getAndPropagateAttachment( WebServiceDeployment.class, unit, dep );
for ( WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions() )
{
@@ -151,21 +151,17 @@
private void newJaxwsEjbDeployment( final DeploymentUnit unit )
{
final ArchiveDeployment dep = this.newDeployment( unit );
- final WebServiceDeployment webServiceDeployment = this.getAttachment( WebServiceDeployment.class, unit, dep );
+ this.getAndPropagateAttachment( WebServiceDeployment.class, unit, dep );
- final Iterator< WebServiceDeclaration > it = webServiceDeployment.getServiceEndpoints().iterator();
- while ( it.hasNext() )
+ final Iterator< WebServiceDeclaration > ejbIterator = Helper.getJaxwsEjbs( unit ).iterator();
+ while ( ejbIterator.hasNext() )
{
- final WebServiceDeclaration container = it.next();
+ final WebServiceDeclaration container = ejbIterator.next();
+ final String ejbName = container.getComponentName();
+ final String ejbClass = container.getComponentClassName();
- if ( Helper.isWebServiceBean( container ) )
- {
- final String ejbName = container.getComponentName();
- final String ejbClass = container.getComponentClassName();
-
- final Endpoint ep = this.createEndpoint( ejbClass, ejbName, dep );
- ep.setProperty( InvocationHandlerEJB3.CONTAINER_NAME, container.getContainerName() );
- }
+ final Endpoint ep = this.createEndpoint( ejbClass, ejbName, dep );
+ ep.setProperty( InvocationHandlerEJB3.CONTAINER_NAME, container.getContainerName() );
}
dep.addAttachment( DeploymentUnit.class, unit );
@@ -180,8 +176,8 @@
private void newJaxrpcJseDeployment( final DeploymentUnit unit )
{
final ArchiveDeployment dep = this.newDeployment( unit );
- final JBossWebMetaData webMetaData = this.getAttachment( JBossWebMetaData.class, unit, dep );
- final WebservicesMetaData wsMetaData = this.getAttachment( WebservicesMetaData.class, unit, dep );
+ final JBossWebMetaData webMetaData = this.getAndPropagateAttachment( JBossWebMetaData.class, unit, dep );
+ final WebservicesMetaData wsMetaData = this.getAndPropagateAttachment( WebservicesMetaData.class, unit, dep );
for ( WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions() )
{
@@ -207,7 +203,7 @@
private void newJaxwsJseDeployment( final DeploymentUnit unit )
{
final ArchiveDeployment dep = this.newDeployment( unit );
- this.getAttachment( JBossWebMetaData.class, unit, dep );
+ this.getAndPropagateAttachment( JBossWebMetaData.class, unit, dep );
final List< ServletMetaData > servlets = Helper.getJaxwsServlets( unit );
for ( ServletMetaData servlet : servlets )
@@ -263,7 +259,8 @@
dep.setRootFile( new VirtualFileAdaptor( ( ( VFSDeploymentUnit ) unit ).getRoot() ) );
dep.setRuntimeClassLoader( unit.getClassLoader() );
- dep.setType( unit.getAttachment( DeploymentType.class ) );
+ final DeploymentType deploymentType = Helper.getRequiredAttachment( unit, DeploymentType.class );
+ dep.setType( deploymentType );
return dep;
}
@@ -306,9 +303,12 @@
* @param dep deployment
* @return attachment value if found in unit
*/
- private <A> A getAttachment( final Class< A > attachment, final DeploymentUnit unit, final Deployment dep )
+ private <A> A getAndPropagateAttachment
+ (
+ final Class< A > attachment, final DeploymentUnit unit, final Deployment dep
+ )
{
- final A attachmentValue = unit.getAttachment( attachment );
+ final A attachmentValue = Helper.getOptionalAttachment( unit, attachment );
if ( attachmentValue != null )
{
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSEJBAdapterDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSEJBAdapterDeployer.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSEJBAdapterDeployer.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -39,6 +39,7 @@
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
@@ -80,7 +81,7 @@
final JBossMetaData mergedMD = ( JBossMetaData ) unit.getAttachment(
MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME
);
- final Ejb3Deployment ejb3Deployment = unit.getAttachment( Ejb3Deployment.class );
+ final Ejb3Deployment ejb3Deployment = Helper.getOptionalAttachment( unit, Ejb3Deployment.class );
if ( mergedMD != null )
{
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSTypeDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSTypeDeployer.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSTypeDeployer.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -91,10 +91,10 @@
*/
private boolean isJaxrpcEjbDeployment( final DeploymentUnit unit )
{
- final boolean isJaxrpc = unit.getAttachment( WebservicesMetaData.class ) != null;
+ final boolean hasWebservicesMD = Helper.hasAttachment( unit, WebservicesMetaData.class );
final boolean hasJBossMD = unit.getAllMetaData( JBossMetaData.class ).size() > 0;
- return isJaxrpc && hasJBossMD;
+ return hasWebservicesMD && hasJBossMD;
}
/**
@@ -105,10 +105,10 @@
*/
private boolean isJaxrpcJseDeployment( final DeploymentUnit unit )
{
- final boolean isJaxrpc = unit.getAttachment( WebservicesMetaData.class ) != null;
- final boolean hasJBossWebMD = unit.getAttachment( JBossWebMetaData.class ) != null;
+ final boolean hasWebservicesMD = Helper.hasAttachment( unit, WebservicesMetaData.class );
+ final boolean hasJBossWebMD = Helper.hasAttachment( unit, JBossWebMetaData.class );
- if ( isJaxrpc && hasJBossWebMD )
+ if ( hasWebservicesMD && hasJBossWebMD )
{
return Helper.getJaxrpcServlets( unit ).size() > 0;
}
@@ -124,11 +124,11 @@
*/
private boolean isJaxwsEjbDeployment( final DeploymentUnit unit )
{
- final boolean hasWSDeployment = unit.getAttachment( WebServiceDeployment.class ) != null;
+ final boolean hasWSDeployment = Helper.hasAttachment( unit, WebServiceDeployment.class );
if ( hasWSDeployment )
{
- return Helper.isEjb3Deployment( unit );
+ return Helper.getJaxwsEjbs( unit ).size() > 0;
}
return false;
@@ -142,7 +142,7 @@
*/
private boolean isJaxwsJseDeployment( final DeploymentUnit unit )
{
- final boolean hasJBossWebMD = unit.getAttachment( JBossWebMetaData.class ) != null;
+ final boolean hasJBossWebMD = Helper.hasAttachment( unit, JBossWebMetaData.class );
if ( hasJBossWebMD )
{
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/injection/InjectionMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/injection/InjectionMetaDataDeploymentAspect.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/injection/InjectionMetaDataDeploymentAspect.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -73,14 +73,9 @@
{
super.start(dep);
- DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
- if (unit == null)
- throw new IllegalStateException("DeploymentUnit not found");
+ DeploymentUnit unit = Helper.getRequiredAttachment( dep, DeploymentUnit.class );
+ JBossWebMetaData webMD = Helper.getRequiredAttachment( dep, JBossWebMetaData.class );
- JBossWebMetaData webMD = dep.getAttachment(JBossWebMetaData.class);
- if (webMD == null)
- throw new IllegalStateException("JBossWebMetaData not found");
-
List<InjectionMetaData> injectionMD = new LinkedList<InjectionMetaData>();
Map<Class<? extends Annotation>, ReferenceResolver> resolvers = createResolvers(unit);
@@ -98,11 +93,10 @@
}
else if ( Helper.isJaxwsEjbDeployment( unit ) )
{
- JBossMetaData jbossMD = unit.getAttachment(JBossMetaData.class);
+ WebServiceDeployment webServiceDeployment = Helper.getRequiredAttachment( unit, WebServiceDeployment.class );
+ JBossMetaData jbossMD = Helper.getRequiredAttachment( unit, JBossMetaData.class );
JBossEnterpriseBeansMetaData jebMDs = jbossMD.getEnterpriseBeans();
- WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
-
Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
while (it.hasNext())
{
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -41,6 +41,7 @@
import org.jboss.security.SecurityContext;
import org.jboss.security.SecurityContextAssociation;
import org.jboss.webservices.integration.invocation.ServiceEndpointInterceptor;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.common.ObjectNameFactory;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
@@ -82,7 +83,7 @@
{
String ejbName = ep.getShortName();
Deployment dep = ep.getService().getDeployment();
- EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class);
+ EJBArchiveMetaData apMetaData = Helper.getRequiredAttachment( dep, EJBArchiveMetaData.class );
EJBMetaData beanMetaData = (EJBMetaData)apMetaData.getBeanByEjbName(ejbName);
if (beanMetaData == null)
throw new WebServiceException("Cannot obtain ejb meta data for: " + ejbName);
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -60,7 +60,7 @@
@Override
public void start( final Deployment dep )
{
- final DeploymentUnit unit = dep.getAttachment( DeploymentUnit.class );
+ final DeploymentUnit unit = Helper.getRequiredAttachment( dep, DeploymentUnit.class );
if ( Helper.isJseDeployment( unit ) )
{
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB21MetaDataBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB21MetaDataBuilder.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB21MetaDataBuilder.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -36,6 +36,7 @@
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
import org.jboss.metadata.javaee.spec.PortComponent;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
@@ -56,7 +57,7 @@
EJBArchiveMetaData create(Deployment dep, DeploymentUnit unit)
{
- JBossMetaData jbossMetaData = unit.getAttachment(JBossMetaData.class);
+ JBossMetaData jbossMetaData = Helper.getRequiredAttachment( unit, JBossMetaData.class );
dep.addAttachment(JBossMetaData.class, jbossMetaData);
EJBArchiveMetaData ejbMetaData = new EJBArchiveMetaData();
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB3MetaDataBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB3MetaDataBuilder.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB3MetaDataBuilder.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -27,6 +27,7 @@
import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
import org.jboss.metadata.ejb.jboss.JBossMetaData;
import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
@@ -53,12 +54,11 @@
{
EJBArchiveMetaData umd = new EJBArchiveMetaData();
- WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class);
+ WebServiceDeployment webServiceDeployment = Helper.getRequiredAttachment( dep, WebServiceDeployment.class );
buildEnterpriseBeansMetaData(umd, webServiceDeployment);
- JBossMetaData jbMetaData = unit.getAttachment(JBossMetaData.class);
- if (jbMetaData != null)
- buildWebservicesMetaData(umd, jbMetaData);
+ JBossMetaData jbMetaData = Helper.getRequiredAttachment( unit, JBossMetaData.class );
+ buildWebservicesMetaData(umd, jbMetaData);
return umd;
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEMetaDataBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEMetaDataBuilder.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEMetaDataBuilder.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -41,6 +41,7 @@
import org.jboss.metadata.web.spec.ServletMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData;
@@ -61,12 +62,11 @@
{
String contextRoot = null;
- JBossWebMetaData jbossWebMetaData = unit.getAttachment(JBossWebMetaData.class);
- dep.addAttachment(JBossWebMetaData.class, jbossWebMetaData);
+ JBossWebMetaData jbossWebMetaData = Helper.getRequiredAttachment( unit, JBossWebMetaData.class );
if (unit.getParent() != null)
{
- JBossAppMetaData appmd = unit.getParent().getAttachment(JBossAppMetaData.class);
+ JBossAppMetaData appmd = Helper.getOptionalAttachment( unit.getParent(), JBossAppMetaData.class );
if (appmd != null)
{
ModuleMetaData module = appmd.getModule(dep.getSimpleName());
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/SecurityHandlerEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/SecurityHandlerEJB21.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/SecurityHandlerEJB21.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -25,6 +25,7 @@
import org.jboss.metadata.ejb.jboss.JBossMetaData;
import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
@@ -32,15 +33,13 @@
* Handle web app security meta data for EJB21
*
* @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
public class SecurityHandlerEJB21 implements SecurityHandler
{
public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep)
{
- EJBArchiveMetaData ejbMetaData = dep.getAttachment(EJBArchiveMetaData.class);
- if (ejbMetaData == null)
- throw new IllegalStateException("Cannot obtain application meta data");
+ EJBArchiveMetaData ejbMetaData = Helper.getRequiredAttachment( dep, EJBArchiveMetaData.class );
String securityDomain = ejbMetaData.getSecurityDomain();
if (securityDomain != null)
@@ -54,7 +53,7 @@
public void addSecurityRoles(JBossWebMetaData webApp, Deployment dep)
{
- JBossMetaData jbmd = dep.getAttachment(JBossMetaData.class);
+ JBossMetaData jbmd = Helper.getRequiredAttachment( dep, JBossMetaData.class );
IAssemblyDescriptorMetaData assemblyDescriptor = jbmd.getAssemblyDescriptor();
if (assemblyDescriptor != null)
{
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/SecurityHandlerEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/SecurityHandlerEJB3.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/SecurityHandlerEJB3.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -25,6 +25,7 @@
import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
@@ -36,29 +37,26 @@
* Handle web app security meta data for EJB3
*
* @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
public class SecurityHandlerEJB3 implements SecurityHandler
{
public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep)
{
+ WebServiceDeployment webServiceDeployment = Helper.getRequiredAttachment( dep, WebServiceDeployment.class );
String securityDomain = null;
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
- WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class);
- if (webServiceDeployment != null)
+ while (it.hasNext())
{
- Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
- while (it.hasNext())
+ WebServiceDeclaration container = it.next();
+ SecurityDomain anSecurityDomain = container.getAnnotation(SecurityDomain.class);
+ if (anSecurityDomain != null)
{
- WebServiceDeclaration container = it.next();
- SecurityDomain anSecurityDomain = container.getAnnotation(SecurityDomain.class);
- if (anSecurityDomain != null)
- {
- if (securityDomain != null && !securityDomain.equals(anSecurityDomain.value()))
- throw new IllegalStateException("Multiple security domains not supported");
+ if (securityDomain != null && !securityDomain.equals(anSecurityDomain.value()))
+ throw new IllegalStateException("Multiple security domains not supported");
- securityDomain = anSecurityDomain.value();
- }
+ securityDomain = anSecurityDomain.value();
}
}
@@ -73,25 +71,24 @@
public void addSecurityRoles(JBossWebMetaData webApp, Deployment dep)
{
- WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class);
- if (webServiceDeployment != null)
+ WebServiceDeployment webServiceDeployment = Helper.getRequiredAttachment( dep, WebServiceDeployment.class );
+
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
{
- Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
- while (it.hasNext())
+ WebServiceDeclaration container = it.next();
+ RolesAllowed anRolesAllowed = container.getAnnotation(RolesAllowed.class);
+ if (anRolesAllowed != null)
{
- WebServiceDeclaration container = it.next();
- RolesAllowed anRolesAllowed = container.getAnnotation(RolesAllowed.class);
- if (anRolesAllowed != null)
+ SecurityRolesMetaData securityRoles = webApp.getSecurityRoles();
+ for (String roleName : anRolesAllowed.value())
{
- SecurityRolesMetaData securityRoles = webApp.getSecurityRoles();
- for (String roleName : anRolesAllowed.value())
- {
- SecurityRoleMetaData role = new SecurityRoleMetaData();
- role.setRoleName(roleName);
- securityRoles.add(role);
- }
+ SecurityRoleMetaData role = new SecurityRoleMetaData();
+ role.setRoleName(roleName);
+ securityRoles.add(role);
}
}
}
}
+
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/WebAppGeneratorDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/WebAppGeneratorDeploymentAspect.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/ejb/WebAppGeneratorDeploymentAspect.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -36,6 +36,7 @@
import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.annotation.WebContext;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
@@ -152,7 +153,7 @@
secureWSDLAccess = anWebContext.secureWSDLAccess();
}
- EJBArchiveMetaData appMetaData = dep.getAttachment(EJBArchiveMetaData.class);
+ EJBArchiveMetaData appMetaData = Helper.getOptionalAttachment( dep, EJBArchiveMetaData.class );
if (appMetaData != null && appMetaData.getBeanByEjbName(ejbName) != null)
{
EJBMetaData bmd = appMetaData.getBeanByEjbName(ejbName);
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebAppDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebAppDeploymentAspect.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebAppDeploymentAspect.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -24,6 +24,7 @@
import javax.security.jacc.PolicyConfiguration;
import javax.security.jacc.PolicyConfigurationFactory;
import org.jboss.web.WebPermissionMapping;
+import org.jboss.webservices.integration.util.Helper;
import javax.xml.ws.WebServiceException;
import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -50,37 +51,28 @@
public void start(Deployment dep)
{
- JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
- if (jbwmd == null)
- throw new WebServiceException("Cannot find web meta data");
+ final JBossWebMetaData jbwmd = Helper.getRequiredAttachment( dep, JBossWebMetaData.class );
+ final DeploymentUnit unit = Helper.getRequiredAttachment( dep, DeploymentUnit.class );
- DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
- if (unit != null)
+ try
{
+ webMetaDataModifier.modifyMetaData(dep);
+
try
{
- webMetaDataModifier.modifyMetaData(dep);
-
- try
- {
- generateJACCPermissions(dep.getSimpleName(), jbwmd); // TODO: make it another deployment aspect
- }
- catch (Exception e)
- {
- throw new RuntimeException("Exception generating JACC perms:",e);
- }
-
- // Attaching it to the DeploymentUnit will cause a new webapp deployment
- unit.addAttachment(JBossWebMetaData.class, jbwmd);
+ generateJACCPermissions(dep.getSimpleName(), jbwmd); // TODO: make it another deployment aspect
}
- catch (Exception ex)
+ catch (Exception e)
{
- WSFDeploymentException.rethrow(ex);
+ throw new RuntimeException("Exception generating JACC perms:",e);
}
+
+ // Attaching it to the DeploymentUnit will cause a new webapp deployment
+ unit.addAttachment(JBossWebMetaData.class, jbwmd);
}
- else
+ catch (Exception ex)
{
- throw new IllegalStateException("Cannot obtain deployment unit");
+ WSFDeploymentException.rethrow(ex);
}
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifierImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifierImpl.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/jse/WebMetaDataModifierImpl.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -26,6 +26,7 @@
import org.jboss.metadata.web.jboss.JBossServletMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ListenerMetaData;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -48,9 +49,7 @@
public void modifyMetaData(Deployment dep)
{
- JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
- if (jbwmd == null)
- throw new WebServiceException("Cannot find web meta data");
+ JBossWebMetaData jbwmd = Helper.getRequiredAttachment( dep, JBossWebMetaData.class );
try
{
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java 2009-07-24 09:47:32 UTC (rev 10381)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java 2009-07-24 15:17:53 UTC (rev 10382)
@@ -31,12 +31,11 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.logging.Logger;
-import org.jboss.metadata.javaee.spec.ParamValueMetaData;
import org.jboss.metadata.web.jboss.JBossServletMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
@@ -48,16 +47,6 @@
public final class Helper
{
- /*
- * TODO: implement methods
- * * getRequiredAttachment( DeploymentUnit unit, Class<?> attachmentType )
- * * getRequiredAttachment( Deployment dep, Class<?> attachmentType )
- * both methods should throw exception if attachment not found
- * * getOptionalAttachment( DeploymentUnit unit, Class<?> attachmentType )
- * * getOptionalAttachment( Deployment dep, Class<?> attachmentType )
- * both methods will return null if attachment will not be found.
- */
-
/** Logger. */
private static final Logger LOG = Logger.getLogger( Helper.class );
@@ -77,7 +66,7 @@
*/
public static boolean isWebServiceDeployment( final DeploymentUnit unit )
{
- return unit.getAttachment( DeploymentType.class ) != null;
+ return Helper.getOptionalAttachment( unit, DeploymentType.class ) != null;
}
/**
@@ -88,7 +77,7 @@
*/
public static boolean isJaxrpcEjbDeployment( final DeploymentUnit unit )
{
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ final DeploymentType deploymentType = Helper.getOptionalAttachment( unit, DeploymentType.class );
return DeploymentType.JAXRPC_EJB21.equals( deploymentType );
}
@@ -101,7 +90,7 @@
*/
public static boolean isJaxrpcJseDeployment( final DeploymentUnit unit )
{
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ final DeploymentType deploymentType = Helper.getOptionalAttachment( unit, DeploymentType.class );
return DeploymentType.JAXRPC_JSE.equals( deploymentType );
}
@@ -114,7 +103,7 @@
*/
public static boolean isJaxwsEjbDeployment( final DeploymentUnit unit )
{
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ final DeploymentType deploymentType = Helper.getOptionalAttachment( unit, DeploymentType.class );
return DeploymentType.JAXWS_EJB3.equals( deploymentType );
}
@@ -127,7 +116,7 @@
*/
public static boolean isJaxwsJseDeployment( final DeploymentUnit unit )
{
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ final DeploymentType deploymentType = Helper.getOptionalAttachment( unit, DeploymentType.class );
return DeploymentType.JAXWS_JSE.equals( deploymentType );
}
@@ -210,33 +199,45 @@
return Helper.getWebServiceServlets( unit, false );
}
- public static boolean isWebServiceBean( final WebServiceDeclaration ejbContainerAdapter )
+ /**
+ * Gets list of JAXWS EJBs meta data.
+ *
+ * @param unit deployment unit
+ * @return list of JAXWS EJBs meta data
+ */
+ public static List< WebServiceDeclaration > getJaxwsEjbs( final DeploymentUnit unit )
{
- final boolean isWebService = ejbContainerAdapter.getAnnotation( WebService.class ) != null;
- final boolean isWebServiceProvider = ejbContainerAdapter.getAnnotation( WebServiceProvider.class ) != null;
+ final WebServiceDeployment wsDeployment = Helper.getRequiredAttachment( unit, WebServiceDeployment.class );
+ final List< WebServiceDeclaration > endpoints = new ArrayList< WebServiceDeclaration >();
- return isWebService || isWebServiceProvider;
- }
-
- // TODO: review why we don't detect WS deployments in WebServiceDeployment creation process
- public static boolean isEjb3Deployment( final DeploymentUnit unit )
- {
- final WebServiceDeployment wsDeployment = unit.getAttachment( WebServiceDeployment.class );
-
- final Iterator<WebServiceDeclaration> it = wsDeployment.getServiceEndpoints().iterator();
- while ( it.hasNext() )
+ final Iterator< WebServiceDeclaration > ejbIterator = wsDeployment.getServiceEndpoints().iterator();
+ while ( ejbIterator.hasNext() )
{
- final WebServiceDeclaration container = it.next();
- if ( Helper.isWebServiceBean( container ) )
+ final WebServiceDeclaration ejbContainer = ejbIterator.next();
+ if ( Helper.isWebServiceBean( ejbContainer ) )
{
- return true;
+ endpoints.add( ejbContainer );
}
}
- return false;
+ return endpoints;
}
/**
+ * Returns true if EJB container is webservice endpoint.
+ *
+ * @param ejbContainerAdapter EJB container adapter
+ * @return true if EJB container is webservice endpoint, false otherwise
+ */
+ public static boolean isWebServiceBean( final WebServiceDeclaration ejbContainerAdapter )
+ {
+ final boolean isWebService = ejbContainerAdapter.getAnnotation( WebService.class ) != null;
+ final boolean isWebServiceProvider = ejbContainerAdapter.getAnnotation( WebServiceProvider.class ) != null;
+
+ return isWebService || isWebServiceProvider;
+ }
+
+ /**
* Returns endpoint class name.
*
* @param servletMD servlet meta data
@@ -249,6 +250,13 @@
return endpointClass != null ? endpointClass.trim() : null;
}
+ /**
+ * Returns servlet meta data for requested servlet name.
+ *
+ * @param jbossWebMD jboss web meta data
+ * @param servletName servlet name
+ * @return servlet meta data
+ */
public static ServletMetaData getServletForName( final JBossWebMetaData jbossWebMD, final String servletName )
{
for ( JBossServletMetaData servlet : jbossWebMD.getServlets() )
@@ -263,6 +271,131 @@
}
/**
+ * Returns webservice endpoint class or null if passed servlet meta data belong to either JSP or servlet instance.
+ *
+ * @param servletMD servlet meta data
+ * @param loader class loader
+ * @return webservice endpoint class or null
+ */
+ public static Class< ? > getEndpointClass( final ServletMetaData servletMD, final ClassLoader loader )
+ {
+ final String endpointClassName = Helper.getEndpointName( servletMD );
+ final boolean notJSP = endpointClassName != null && endpointClassName.length() > 0;
+
+ if ( notJSP )
+ {
+ try
+ {
+ final Class< ? > endpointClass = loader.loadClass( endpointClassName );
+ final boolean notServlet = !endpointClass.isAssignableFrom( Servlet.class );
+
+ if ( notServlet )
+ {
+ return endpointClass;
+ }
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ Helper.LOG.warn( "Cannot load servlet class: " + endpointClassName, cnfe );
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns required attachment value from deployment unit.
+ *
+ * @param <A> expected value
+ * @param unit deployment unit
+ * @param key attachment key
+ * @return required attachment
+ * @throws IllegalStateException if attachment value is null
+ */
+ public static <A> A getRequiredAttachment( final DeploymentUnit unit, final Class< A > key )
+ {
+ final A value = unit.getAttachment( key );
+ if ( value == null )
+ {
+ Helper.LOG.error( "Cannot find attachment in deployment unit: " + key );
+ throw new IllegalStateException();
+ }
+
+ return value;
+ }
+
+ /**
+ * Returns optional attachment value from deployment unit or null if not bound.
+ *
+ * @param <A> expected value
+ * @param unit deployment unit
+ * @param key attachment key
+ * @return optional attachment value or null
+ */
+ public static <A> A getOptionalAttachment( final DeploymentUnit unit, final Class< A > key )
+ {
+ return unit.getAttachment( key );
+ }
+
+ /**
+ * Returns true if deployment unit have attachment value associated with the <b>key</b>.
+ *
+ * @param unit deployment unit
+ * @param key attachment key
+ * @return true if contains attachment, false otherwise
+ */
+ public static boolean hasAttachment( final DeploymentUnit unit, final Class< ? > key )
+ {
+ return Helper.getOptionalAttachment( unit, key ) != null;
+ }
+
+ /**
+ * Returns required attachment value from webservice deployment.
+ *
+ * @param <A> expected value
+ * @param dep webservice deployment
+ * @param key attachment key
+ * @return required attachment
+ * @throws IllegalStateException if attachment value is null
+ */
+ public static <A> A getRequiredAttachment( final Deployment dep, final Class< A > key )
+ {
+ final A value = dep.getAttachment( key );
+ if ( value == null )
+ {
+ Helper.LOG.error( "Cannot find attachment in webservice deployment: " + 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
+ * @return optional attachment value or null
+ */
+ public static <A> A getOptionalAttachment( final Deployment dep, final Class< A > key )
+ {
+ return dep.getAttachment( key );
+ }
+
+ /**
+ * 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
+ */
+ public static boolean hasAttachment( final Deployment dep, final Class< ? > key )
+ {
+ return Helper.getOptionalAttachment( dep, key ) != null;
+ }
+
+ /**
* Gets list of JAXRPC or JAXWS servlets meta data.
*
* @param unit deployment unit
@@ -271,7 +404,7 @@
*/
private static List< ServletMetaData > getWebServiceServlets( final DeploymentUnit unit, final boolean jaxws )
{
- final JBossWebMetaData jbossWebMD = unit.getAttachment( JBossWebMetaData.class );
+ final JBossWebMetaData jbossWebMD = Helper.getRequiredAttachment( unit, JBossWebMetaData.class );
final ClassLoader loader = unit.getClassLoader();
final List< ServletMetaData > endpoints = new ArrayList< ServletMetaData >();
@@ -298,37 +431,4 @@
return endpoints;
}
- /**
- * Returns webservice endpoint class or null if passed servlet meta data belong to either JSP or servlet instance.
- *
- * @param servletMD servlet meta data
- * @param loader class loader
- * @return webservice endpoint class or null
- */
- private static Class< ? > getEndpointClass( final ServletMetaData servletMD, final ClassLoader loader )
- {
- final String endpointClassName = Helper.getEndpointName( servletMD );
- final boolean notJSP = endpointClassName != null && endpointClassName.length() > 0;
-
- if ( notJSP )
- {
- try
- {
- final Class< ? > endpointClass = loader.loadClass( endpointClassName );
- final boolean notServlet = !endpointClass.isAssignableFrom( Servlet.class );
-
- if ( notServlet )
- {
- return endpointClass;
- }
- }
- catch ( ClassNotFoundException cnfe )
- {
- Helper.LOG.warn( "Cannot load servlet class: " + endpointClassName, cnfe );
- }
- }
-
- return null;
- }
-
}
15 years, 5 months
JBossWS SVN: r10381 - stack/cxf/branches/ropalka/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-24 05:47:32 -0400 (Fri, 24 Jul 2009)
New Revision: 10381
Modified:
stack/cxf/branches/ropalka/modules/testsuite/pom.xml
Log:
[JBWS-2332] removing AS 4x support - we're modifying WebMD in runtime, not the web.xml file
Modified: stack/cxf/branches/ropalka/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/branches/ropalka/modules/testsuite/pom.xml 2009-07-24 09:45:44 UTC (rev 10380)
+++ stack/cxf/branches/ropalka/modules/testsuite/pom.xml 2009-07-24 09:47:32 UTC (rev 10381)
@@ -25,7 +25,6 @@
<wsdl.publish.location>${project.build.directory}/wsdl-publish</wsdl.publish.location>
<hibernate.version>3.2.4.sp1</hibernate.version>
<asm.version>2.2.3</asm.version>
- <endpoint.servlet>org.jboss.wsf.stack.cxf.CXFServletExt</endpoint.servlet>
<jboss.javaee.version>5.0.0.GA</jboss.javaee.version>
</properties>
15 years, 5 months
JBossWS SVN: r10380 - stack/metro/branches/ropalka/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-24 05:45:44 -0400 (Fri, 24 Jul 2009)
New Revision: 10380
Modified:
stack/metro/branches/ropalka/modules/testsuite/pom.xml
Log:
[JBWS-2332] removing AS 4x support - we're modifying WebMD in runtime, not the web.xml file
Modified: stack/metro/branches/ropalka/modules/testsuite/pom.xml
===================================================================
--- stack/metro/branches/ropalka/modules/testsuite/pom.xml 2009-07-24 09:41:00 UTC (rev 10379)
+++ stack/metro/branches/ropalka/modules/testsuite/pom.xml 2009-07-24 09:45:44 UTC (rev 10380)
@@ -24,7 +24,6 @@
<test.resources.directory>${project.build.directory}/test-resources</test.resources.directory>
<wsdl.publish.location>${project.build.directory}/wsdl-publish</wsdl.publish.location>
<hibernate.version>3.2.4.sp1</hibernate.version>
- <endpoint.servlet>org.jboss.wsf.stack.metro.EndpointServlet</endpoint.servlet>
<jboss.javaee.version>5.0.0.GA</jboss.javaee.version>
</properties>
15 years, 5 months
JBossWS SVN: r10379 - in container/jboss50/branches/ropalka-jboss510/src/main: java/org/jboss/webservices/integration/metadata and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-24 05:41:00 -0400 (Fri, 24 Jul 2009)
New Revision: 10379
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataBuilder.java
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/stack-agnostic-jboss-beans.xml
Log:
[JBWS-2332] refactoring + fixing javadocs
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java 2009-07-24 09:37:05 UTC (rev 10378)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java 2009-07-24 09:41:00 UTC (rev 10379)
@@ -189,7 +189,7 @@
{
final String servletName = pcmd.getServletLink();
final ServletMetaData servletMD = Helper.getServletForName( webMetaData, servletName );
- final String servletClass = Helper.getTargetBean( servletMD );
+ final String servletClass = Helper.getEndpointName( servletMD );
this.createEndpoint( servletClass, servletName, dep );
}
@@ -213,7 +213,7 @@
for ( ServletMetaData servlet : servlets )
{
final String servletName = servlet.getName();
- final String servletClass = Helper.getTargetBean( servlet );
+ final String servletClass = Helper.getEndpointName( servlet );
this.createEndpoint( servletClass, servletName, dep );
}
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataBuilder.java 2009-07-24 09:37:05 UTC (rev 10378)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataBuilder.java 2009-07-24 09:41:00 UTC (rev 10379)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.webservices.integration.metadata;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.webservices.integration.util.Helper;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
-
-/**
- * Builds container independent deployment meta data.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
- */
-public final class ContainerMetaDataBuilder
-{
-
- /** JSE meta data builder. */
- private JSEMetaDataBuilder jseMetaDataBuilder = new JSEMetaDataBuilder();
- /** EJB3 meta data builder. */
- private EJB3MetaDataBuilder ejb3MetaDataBuilder = new EJB3MetaDataBuilder();
- /** EJB21 meta data builder. */
- private EJB21MetaDataBuilder ejb21MetaDataBuilder = new EJB21MetaDataBuilder();
-
- /**
- * Constructor.
- */
- public ContainerMetaDataBuilder()
- {
- super();
- }
-
- /**
- * Creates container independent meta data and deploys it to <b>dep</b>.
- *
- * @param dep webservice deployment
- * @param unit deployment unit
- */
- public void create( final Deployment dep, final DeploymentUnit unit )
- {
- if ( Helper.isJseDeployment( unit ) )
- {
- final JSEArchiveMetaData jseMetaData = this.jseMetaDataBuilder.create( dep, unit );
- dep.addAttachment( JSEArchiveMetaData.class, jseMetaData );
- }
- else if ( Helper.isJaxwsEjbDeployment( unit ) )
- {
- final EJBArchiveMetaData ejbMetaData = this.ejb3MetaDataBuilder.create( dep, unit );
- dep.addAttachment( EJBArchiveMetaData.class, ejbMetaData );
- }
- else if ( Helper.isJaxrpcEjbDeployment( unit ) )
- {
- final EJBArchiveMetaData ejbMetaData = this.ejb21MetaDataBuilder.create( dep, unit );
- dep.addAttachment( EJBArchiveMetaData.class, ejbMetaData );
- }
- }
-
-}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java 2009-07-24 09:37:05 UTC (rev 10378)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java 2009-07-24 09:41:00 UTC (rev 10379)
@@ -22,8 +22,11 @@
package org.jboss.webservices.integration.metadata;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.webservices.integration.util.Helper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
/**
* An aspect that builds container independent meta data.
@@ -34,8 +37,12 @@
public final class ContainerMetaDataDeploymentAspect extends DeploymentAspect
{
- /** Container independent meta data builder. */
- private ContainerMetaDataBuilder metaDataBuilder;
+ /** JSE meta data builder. */
+ private JSEMetaDataBuilder jseMetaDataBuilder = new JSEMetaDataBuilder();
+ /** EJB3 meta data builder. */
+ private EJB3MetaDataBuilder ejb3MetaDataBuilder = new EJB3MetaDataBuilder();
+ /** EJB21 meta data builder. */
+ private EJB21MetaDataBuilder ejb21MetaDataBuilder = new EJB21MetaDataBuilder();
/**
* Constructor.
@@ -46,16 +53,6 @@
}
/**
- * Sets container independent meta data builder via MC injection.
- *
- * @param builder meta data builder
- */
- public void setMetaDataBuilder( final ContainerMetaDataBuilder builder )
- {
- this.metaDataBuilder = builder;
- }
-
- /**
* Build container independent meta data.
*
* @param dep webservice deployment
@@ -65,7 +62,21 @@
{
final DeploymentUnit unit = dep.getAttachment( DeploymentUnit.class );
- this.metaDataBuilder.create( dep, unit );
+ if ( Helper.isJseDeployment( unit ) )
+ {
+ final JSEArchiveMetaData jseMetaData = this.jseMetaDataBuilder.create( dep, unit );
+ dep.addAttachment( JSEArchiveMetaData.class, jseMetaData );
+ }
+ else if ( Helper.isJaxwsEjbDeployment( unit ) )
+ {
+ final EJBArchiveMetaData ejbMetaData = this.ejb3MetaDataBuilder.create( dep, unit );
+ dep.addAttachment( EJBArchiveMetaData.class, ejbMetaData );
+ }
+ else if ( Helper.isJaxrpcEjbDeployment( unit ) )
+ {
+ final EJBArchiveMetaData ejbMetaData = this.ejb21MetaDataBuilder.create( dep, unit );
+ dep.addAttachment( EJBArchiveMetaData.class, ejbMetaData );
+ }
}
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java 2009-07-24 09:37:05 UTC (rev 10378)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/Helper.java 2009-07-24 09:41:00 UTC (rev 10379)
@@ -22,7 +22,6 @@
package org.jboss.webservices.integration.util;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -36,8 +35,8 @@
import org.jboss.metadata.web.jboss.JBossServletMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
@@ -48,7 +47,7 @@
*/
public final class Helper
{
-
+
/*
* TODO: implement methods
* * getRequiredAttachment( DeploymentUnit unit, Class<?> attachmentType )
@@ -58,9 +57,9 @@
* * getOptionalAttachment( Deployment dep, Class<?> attachmentType )
* both methods will return null if attachment will not be found.
*/
-
+
/** Logger. */
- private static final Logger log = Logger.getLogger( Helper.class );
+ private static final Logger LOG = Logger.getLogger( Helper.class );
/**
* Forbidden constructor.
@@ -69,222 +68,267 @@
{
super();
}
-
+
+ /**
+ * Returns true if unit contains JAXWS JSE, JAXRPC JSE, JAXWS EJB or JAXRPC EJB deployment.
+ *
+ * @param unit deployment unit
+ * @return true if JAXWS JSE, JAXRPC JSE, JAXWS EJB or JAXRPC EJB deployment, false otherwise.
+ */
public static boolean isWebServiceDeployment( final DeploymentUnit unit )
{
return unit.getAttachment( DeploymentType.class ) != null;
}
-
- public static boolean isJseDeployment( final DeploymentUnit unit )
+
+ /**
+ * Returns true if unit contains JAXRPC EJB deployment.
+ *
+ * @param unit deployment unit
+ * @return true if JAXRPC EJB deployment, false otherwise
+ */
+ public static boolean isJaxrpcEjbDeployment( final DeploymentUnit unit )
{
- if ( Helper.isWebServiceDeployment( unit ) )
- {
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
- final boolean isJaxrpcJse = DeploymentType.JAXRPC_JSE.equals( deploymentType );
- final boolean isJaxwsJse = DeploymentType.JAXWS_JSE.equals( deploymentType );
-
- return isJaxwsJse || isJaxrpcJse;
- }
-
- return false;
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+
+ return DeploymentType.JAXRPC_EJB21.equals( deploymentType );
}
-
- public static boolean isEjbDeployment( final DeploymentUnit unit )
+
+ /**
+ * Returns true if unit contains JAXRPC JSE deployment.
+ *
+ * @param unit deployment unit
+ * @return true if JAXRPC JSE deployment, false otherwise
+ */
+ public static boolean isJaxrpcJseDeployment( final DeploymentUnit unit )
{
- if ( Helper.isWebServiceDeployment( unit ) )
- {
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
- final boolean isJaxwsEjb3 = DeploymentType.JAXWS_EJB3.equals( deploymentType );
- final boolean isJaxrpcEjb21 = DeploymentType.JAXRPC_EJB21.equals( deploymentType );
-
- return isJaxwsEjb3 || isJaxrpcEjb21;
- }
-
- return false;
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+
+ return DeploymentType.JAXRPC_JSE.equals( deploymentType );
}
-
- public static boolean isJaxwsDeployment( final DeploymentUnit unit )
+
+ /**
+ * Returns true if unit contains JAXWS EJB deployment.
+ *
+ * @param unit deployment unit
+ * @return true if JAXWS EJB deployment, false otherwise
+ */
+ public static boolean isJaxwsEjbDeployment( final DeploymentUnit unit )
{
- if ( Helper.isWebServiceDeployment( unit ) )
- {
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
- final boolean isJaxwsEjb3 = DeploymentType.JAXWS_EJB3.equals( deploymentType );
- final boolean isJaxwsJse = DeploymentType.JAXWS_JSE.equals( deploymentType );
-
- return isJaxwsEjb3 || isJaxwsJse;
- }
-
- return false;
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+
+ return DeploymentType.JAXWS_EJB3.equals( deploymentType );
}
-
- public static boolean isJaxrpcDeployment( final DeploymentUnit unit )
+
+ /**
+ * Returns true if unit contains JAXWS JSE deployment.
+ *
+ * @param unit deployment unit
+ * @return true if JAXWS JSE deployment, false otherwise
+ */
+ public static boolean isJaxwsJseDeployment( final DeploymentUnit unit )
{
- if ( Helper.isWebServiceDeployment( unit ) )
- {
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
- final boolean isJaxrpcEjb21 = DeploymentType.JAXRPC_EJB21.equals( deploymentType );
- final boolean isJaxrpcJse = DeploymentType.JAXRPC_JSE.equals( deploymentType );
-
- return isJaxrpcEjb21 || isJaxrpcJse;
- }
-
- return false;
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+
+ return DeploymentType.JAXWS_JSE.equals( deploymentType );
}
-
- public static boolean isJaxrpcJseDeployment( final DeploymentUnit unit )
+
+ /**
+ * Returns true if unit contains either JAXWS JSE or JAXRPC JSE deployment.
+ *
+ * @param unit deployment unit
+ * @return true if either JAXWS JSE or JAXRPC JSE deployment, false otherwise.
+ */
+ public static boolean isJseDeployment( final DeploymentUnit unit )
{
- final boolean isJaxrpc = Helper.isJaxrpcDeployment( unit );
- final boolean isJse = Helper.isJseDeployment( unit );
-
- return isJse && isJaxrpc;
+ final boolean isJaxwsJse = Helper.isJaxwsJseDeployment( unit );
+ final boolean isJaxrpcJse = Helper.isJaxrpcJseDeployment( unit );
+
+ return isJaxwsJse || isJaxrpcJse;
}
- public static boolean isJaxwsJseDeployment( final DeploymentUnit unit )
+ /**
+ * Returns true if unit contains either JAXWS EJB or JAXRPC EJB deployment.
+ *
+ * @param unit deployment unit
+ * @return true if either JAXWS EJB or JAXRPC EJB deployment, false otherwise
+ */
+ public static boolean isEjbDeployment( final DeploymentUnit unit )
{
- final boolean isJaxws = Helper.isJaxwsDeployment( unit );
- final boolean isJse = Helper.isJseDeployment( unit );
-
- return isJse && isJaxws;
+ final boolean isJaxwsEjb = Helper.isJaxwsEjbDeployment( unit );
+ final boolean isJaxrpcEjb = Helper.isJaxrpcEjbDeployment( unit );
+
+ return isJaxwsEjb || isJaxrpcEjb;
}
- public static boolean isJaxrpcEjbDeployment( final DeploymentUnit unit )
+ /**
+ * Returns true if unit contains either JAXWS EJB or JAXWS JSE deployment.
+ *
+ * @param unit deployment unit
+ * @return true if either JAXWS EJB or JAXWS JSE deployment, false otherwise
+ */
+ public static boolean isJaxwsDeployment( final DeploymentUnit unit )
{
- final boolean isJaxrpc = Helper.isJaxrpcDeployment( unit );
- final boolean isEjb = Helper.isEjbDeployment( unit );
-
- return isEjb && isJaxrpc;
+ final boolean isJaxwsEjb = Helper.isJaxwsEjbDeployment( unit );
+ final boolean isJaxwsJse = Helper.isJaxwsJseDeployment( unit );
+
+ return isJaxwsEjb || isJaxwsJse;
}
- public static boolean isJaxwsEjbDeployment( final DeploymentUnit unit )
+ /**
+ * Returns true if unit contains either JAXRPC EJB or JAXRPC JSE deployment.
+ *
+ * @param unit deployment unit
+ * @return true if either JAXRPC EJB or JAXRPC JSE deployment, false otherwise
+ */
+ public static boolean isJaxrpcDeployment( final DeploymentUnit unit )
{
- final boolean isJaxws = Helper.isJaxwsDeployment( unit );
- final boolean isEjb = Helper.isEjbDeployment( unit );
-
- return isEjb && isJaxws;
+ final boolean isJaxrpcEjb = Helper.isJaxrpcEjbDeployment( unit );
+ final boolean isJaxrpcJse = Helper.isJaxrpcJseDeployment( unit );
+
+ return isJaxrpcEjb || isJaxrpcJse;
}
- public static final boolean isWebServiceBean( final WebServiceDeclaration ejbContainerAdapter )
+ /**
+ * Gets list of JAXWS servlets meta data.
+ *
+ * @param unit deployment unit
+ * @return list of JAXWS servlets meta data
+ */
+ public static List< ServletMetaData > getJaxwsServlets( final DeploymentUnit unit )
{
- boolean isWebServiceBean = false;
- boolean isWebService = ejbContainerAdapter.getAnnotation(WebService.class) != null;
- boolean isWebServiceProvider = ejbContainerAdapter.getAnnotation(WebServiceProvider.class) != null;
- isWebServiceBean = isWebService || isWebServiceProvider;
+ return Helper.getWebServiceServlets( unit, true );
+ }
- return isWebServiceBean;
+ /**
+ * Gets list of JAXRPC servlets meta data.
+ *
+ * @param unit deployment unit
+ * @return list of JAXRPC servlets meta data
+ */
+ public static List< ServletMetaData > getJaxrpcServlets( final DeploymentUnit unit )
+ {
+ return Helper.getWebServiceServlets( unit, false );
}
-
- public static final boolean isEjb3Deployment( final DeploymentUnit unit )
+
+ public static boolean isWebServiceBean( final WebServiceDeclaration ejbContainerAdapter )
{
+ final boolean isWebService = ejbContainerAdapter.getAnnotation( WebService.class ) != null;
+ final boolean isWebServiceProvider = ejbContainerAdapter.getAnnotation( WebServiceProvider.class ) != null;
+
+ return isWebService || isWebServiceProvider;
+ }
+
+ // TODO: review why we don't detect WS deployments in WebServiceDeployment creation process
+ public static boolean isEjb3Deployment( final DeploymentUnit unit )
+ {
final WebServiceDeployment wsDeployment = unit.getAttachment( WebServiceDeployment.class );
-
- Iterator<WebServiceDeclaration> it = wsDeployment.getServiceEndpoints().iterator();
- while (it.hasNext())
+
+ final Iterator<WebServiceDeclaration> it = wsDeployment.getServiceEndpoints().iterator();
+ while ( it.hasNext() )
{
- WebServiceDeclaration container = it.next();
- if (Helper.isWebServiceBean(container))
+ final WebServiceDeclaration container = it.next();
+ if ( Helper.isWebServiceBean( container ) )
{
return true;
}
}
-
+
return false;
}
- public static final List<ServletMetaData> getJaxwsServlets( final DeploymentUnit unit )
+ /**
+ * Returns endpoint class name.
+ *
+ * @param servletMD servlet meta data
+ * @return endpoint class name
+ */
+ public static String getEndpointName( final ServletMetaData servletMD )
{
- return Helper.getRelevantServlets( unit, true );
+ final String endpointClass = servletMD.getServletClass();
+
+ return endpointClass != null ? endpointClass.trim() : null;
}
- public static List<ServletMetaData> getJaxrpcServlets( final DeploymentUnit unit )
+ public static ServletMetaData getServletForName( final JBossWebMetaData jbossWebMD, final String servletName )
{
- return Helper.getRelevantServlets( unit, false );
+ for ( JBossServletMetaData servlet : jbossWebMD.getServlets() )
+ {
+ if ( servlet.getName().equals( servletName ) )
+ {
+ return servlet;
+ }
+ }
+
+ throw new IllegalStateException( "Cannot find servlet for link: " + servletName );
}
- private static final List< ServletMetaData > getRelevantServlets( final DeploymentUnit unit, final boolean jaxws )
+ /**
+ * Gets list of JAXRPC or JAXWS servlets meta data.
+ *
+ * @param unit deployment unit
+ * @param jaxws if passed value is <b>true</b> JAXWS servlets list will be returned, otherwise JAXRPC servlets list
+ * @return either JAXRPC or JAXWS servlets list
+ */
+ private static List< ServletMetaData > getWebServiceServlets( final DeploymentUnit unit, final boolean jaxws )
{
- try
- {
- final JBossWebMetaData jbossWebMD = unit.getAttachment(JBossWebMetaData.class);
+ final JBossWebMetaData jbossWebMD = unit.getAttachment( JBossWebMetaData.class );
final ClassLoader loader = unit.getClassLoader();
-
- List<ServletMetaData> endpoints = new ArrayList<ServletMetaData>();
- for (ServletMetaData servlet : jbossWebMD.getServlets())
+ final List< ServletMetaData > endpoints = new ArrayList< ServletMetaData >();
+
+ for ( ServletMetaData servletMD : jbossWebMD.getServlets() )
{
- String servletClassName = getTargetBean(servlet);
+ final Class< ? > endpointClass = Helper.getEndpointClass( servletMD, loader );
- // Skip JSPs
- if (servletClassName == null || servletClassName.length() == 0)
- continue;
+ if ( endpointClass != null )
+ {
+ // check webservice annotations
+ final boolean isWebService = endpointClass.isAnnotationPresent( WebService.class );
+ final boolean isWebServiceProvider = endpointClass.isAnnotationPresent( WebServiceProvider.class );
+ // detect webservice type
+ final boolean isJaxwsEndpoint = jaxws && ( isWebService || isWebServiceProvider );
+ final boolean isJaxrpcEndpoint = !jaxws && ( !isWebService && !isWebServiceProvider );
- try
- {
- Class<?> servletClass = loader.loadClass(servletClassName.trim());
- boolean isServlet = servletClass.isAssignableFrom(Servlet.class);
- if (false == isServlet)
+ if ( isJaxwsEndpoint || isJaxrpcEndpoint )
{
- boolean isWebService = servletClass.isAnnotationPresent(WebService.class);
- boolean isWebServiceProvider = servletClass.isAnnotationPresent(WebServiceProvider.class);
- if ( jaxws )
- {
- if (isWebService || isWebServiceProvider)
- {
- endpoints.add(servlet); // jaxws endpoint
- }
- }
- else
- {
- if (!isWebService && !isWebServiceProvider)
- {
- endpoints.add(servlet); // jaxrpc endpoint
- }
- }
+ endpoints.add( servletMD );
}
}
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClassName);
- continue;
- }
}
-
+
return endpoints;
- }
- catch (Exception ex)
- {
- log.error("Cannot process web deployment", ex);
- return Collections.emptyList();
- }
}
- public static String getTargetBean(ServletMetaData servlet)
+ /**
+ * Returns webservice endpoint class or null if passed servlet meta data belong to either JSP or servlet instance.
+ *
+ * @param servletMD servlet meta data
+ * @param loader class loader
+ * @return webservice endpoint class or null
+ */
+ private static Class< ? > getEndpointClass( final ServletMetaData servletMD, final ClassLoader loader )
{
- String endpointClass = servlet.getServletClass();
- List<ParamValueMetaData> initParams = servlet.getInitParam();
- if (initParams != null)
+ final String endpointClassName = Helper.getEndpointName( servletMD );
+ final boolean notJSP = endpointClassName != null && endpointClassName.length() > 0;
+
+ if ( notJSP )
{
- for (ParamValueMetaData param : initParams)
+ try
{
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(param.getParamName()))
+ final Class< ? > endpointClass = loader.loadClass( endpointClassName );
+ final boolean notServlet = !endpointClass.isAssignableFrom( Servlet.class );
+
+ if ( notServlet )
{
- endpointClass = param.getParamValue();
- break;
+ return endpointClass;
}
}
- }
- return endpointClass;
- }
-
- public static ServletMetaData getServletForName( final JBossWebMetaData jbossWebMD, final String servletName )
- {
- for ( JBossServletMetaData servlet : jbossWebMD.getServlets() )
- {
- if ( servlet.getName().equals( servletName ) )
+ catch ( ClassNotFoundException cnfe )
{
- return servlet;
+ Helper.LOG.warn( "Cannot load servlet class: " + endpointClassName, cnfe );
}
}
-
- throw new IllegalStateException( "Cannot find servlet for link: " + servletName );
+
+ return null;
}
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/stack-agnostic-jboss-beans.xml
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-07-24 09:37:05 UTC (rev 10378)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-07-24 09:41:00 UTC (rev 10379)
@@ -67,12 +67,10 @@
<bean name="WSSecurityHandlerEJB21" class="org.jboss.webservices.integration.tomcat.ejb.SecurityHandlerEJB21"/>
<bean name="WSSecurityHandlerEJB3" class="org.jboss.webservices.integration.tomcat.ejb.SecurityHandlerEJB3"/>
<bean name="WSWebMetaDataModifier" class="org.jboss.webservices.integration.tomcat.jse.WebMetaDataModifierImpl"/>
- <bean name="WSContainerMetaDataBuilder" class="org.jboss.webservices.integration.metadata.ContainerMetaDataBuilder"/>
<!-- The AS specific deployment aspects -->
<bean name="WSContainerMetaDataDeploymentAspect" class="org.jboss.webservices.integration.metadata.ContainerMetaDataDeploymentAspect">
<property name="provides">ContainerMetaData, VFSRoot</property>
- <property name="metaDataBuilder"><inject bean="WSContainerMetaDataBuilder"/></property>
<property name="relativeOrder">12</property> <!-- [JBDEPLOY-201] workaround -->
</bean>
15 years, 5 months
JBossWS SVN: r10378 - in framework/branches/ropalka/testsuite/test: resources/jaxws/jbws1762/WEB-INF and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-24 05:37:05 -0400 (Fri, 24 Jul 2009)
New Revision: 10378
Modified:
framework/branches/ropalka/testsuite/test/ant-import/build-testsuite.xml
framework/branches/ropalka/testsuite/test/resources/jaxws/jbws1762/WEB-INF/web.xml
Log:
[JBWS-2332] removing AS 4x support - we're modifying WebMD in runtime, not the web.xml file
Modified: framework/branches/ropalka/testsuite/test/ant-import/build-testsuite.xml
===================================================================
--- framework/branches/ropalka/testsuite/test/ant-import/build-testsuite.xml 2009-07-24 09:36:29 UTC (rev 10377)
+++ framework/branches/ropalka/testsuite/test/ant-import/build-testsuite.xml 2009-07-24 09:37:05 UTC (rev 10378)
@@ -489,7 +489,6 @@
<exclude name="jaxrpc/samples-override/**"/>
</fileset>
<filterset>
- <filter token="endpoint.servlet" value="${endpoint.servlet}"/>
<filter token="java.home" value="${java.home}"/>
<filter token="jboss.bind.address" value="${node0}"/>
<filter token="tests.output.dir" value="${tests.output.dir}"/>
Modified: framework/branches/ropalka/testsuite/test/resources/jaxws/jbws1762/WEB-INF/web.xml
===================================================================
--- framework/branches/ropalka/testsuite/test/resources/jaxws/jbws1762/WEB-INF/web.xml 2009-07-24 09:36:29 UTC (rev 10377)
+++ framework/branches/ropalka/testsuite/test/resources/jaxws/jbws1762/WEB-INF/web.xml 2009-07-24 09:37:05 UTC (rev 10378)
@@ -4,11 +4,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>POJOBean</servlet-name>
- <servlet-class>@endpoint.servlet@</servlet-class>
- <init-param>
- <param-name>jboss.ws.endpoint</param-name>
- <param-value>org.jboss.test.ws.jaxws.jbws1762.services.POJOBean</param-value>
- </init-param>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws1762.services.POJOBean</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>POJOBean</servlet-name>
15 years, 5 months
JBossWS SVN: r10377 - in stack/native/branches/ropalka/modules/testsuite: native-tests/src/test/resources/jaxrpc/jbws124/WEB-INF and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-24 05:36:29 -0400 (Fri, 24 Jul 2009)
New Revision: 10377
Modified:
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxrpc/jbws124/WEB-INF/web.xml
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxrpc/jbws1762/WEB-INF/web.xml
stack/native/branches/ropalka/modules/testsuite/pom.xml
Log:
[JBWS-2332] removing AS 4x support - we're modifying WebMD in runtime, not the web.xml file
Modified: stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxrpc/jbws124/WEB-INF/web.xml
===================================================================
--- stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxrpc/jbws124/WEB-INF/web.xml 2009-07-23 16:21:31 UTC (rev 10376)
+++ stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxrpc/jbws124/WEB-INF/web.xml 2009-07-24 09:36:29 UTC (rev 10377)
@@ -8,11 +8,7 @@
<!-- Test that we can deploy an already modified web.xml -->
<servlet>
<servlet-name>Hello</servlet-name>
- <servlet-class>@endpoint.servlet@</servlet-class>
- <init-param>
- <param-name>jboss.ws.endpoint</param-name>
- <param-value>org.jboss.test.ws.jaxrpc.jbws124.HelloJavaBean</param-value>
- </init-param>
+ <servlet-class>org.jboss.test.ws.jaxrpc.jbws124.HelloJavaBean</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hello</servlet-name>
Modified: stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxrpc/jbws1762/WEB-INF/web.xml
===================================================================
--- stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxrpc/jbws1762/WEB-INF/web.xml 2009-07-23 16:21:31 UTC (rev 10376)
+++ stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxrpc/jbws1762/WEB-INF/web.xml 2009-07-24 09:36:29 UTC (rev 10377)
@@ -4,11 +4,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>POJOBean</servlet-name>
- <servlet-class>@endpoint.servlet@</servlet-class>
- <init-param>
- <param-name>jboss.ws.endpoint</param-name>
- <param-value>org.jboss.test.ws.jaxrpc.jbws1762.services.POJOBean</param-value>
- </init-param>
+ <servlet-class>org.jboss.test.ws.jaxrpc.jbws1762.services.POJOBean</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>POJOBean</servlet-name>
Modified: stack/native/branches/ropalka/modules/testsuite/pom.xml
===================================================================
--- stack/native/branches/ropalka/modules/testsuite/pom.xml 2009-07-23 16:21:31 UTC (rev 10376)
+++ stack/native/branches/ropalka/modules/testsuite/pom.xml 2009-07-24 09:36:29 UTC (rev 10377)
@@ -23,7 +23,6 @@
<test.resources.directory>${project.build.directory}/test-resources</test.resources.directory>
<wsdl.publish.location>${project.build.directory}/wsdl-publish</wsdl.publish.location>
<hibernate.version>3.2.4.sp1</hibernate.version>
- <endpoint.servlet>org.jboss.wsf.stack.jbws.EndpointServlet</endpoint.servlet>
<jboss.javaee.version>5.0.0.GA</jboss.javaee.version>
</properties>
15 years, 5 months