JBossWS SVN: r10301 - stack/metro/branches/ropalka/modules/server/src/main/resources.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-02 15:20:17 -0400 (Thu, 02 Jul 2009)
New Revision: 10301
Modified:
stack/metro/branches/ropalka/modules/server/src/main/resources/jbossws-metro-config.xml
Log:
[JBWS-2332][JBWS-2382] refactoring
Modified: stack/metro/branches/ropalka/modules/server/src/main/resources/jbossws-metro-config.xml
===================================================================
--- stack/metro/branches/ropalka/modules/server/src/main/resources/jbossws-metro-config.xml 2009-07-02 19:19:42 UTC (rev 10300)
+++ stack/metro/branches/ropalka/modules/server/src/main/resources/jbossws-metro-config.xml 2009-07-02 19:20:17 UTC (rev 10301)
@@ -35,7 +35,7 @@
</property>
</bean>
- <bean name="WSMetroContextPropertiesDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSMetroContextPropertiesDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSMetroContextPropertiesDeploymentAspect"/>
@@ -49,7 +49,7 @@
<property name="provides">StackEndpointHandler</property>
</bean>
- <bean name="WSMetroEndpointHandlerDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSMetroEndpointHandlerDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSMetroEndpointHandlerDeploymentAspect"/>
@@ -70,7 +70,7 @@
</property>
</bean>
- <bean name="WSMetroEndpointRecordProcessorDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSMetroEndpointRecordProcessorDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSMetroEndpointRecordProcessorDeploymentAspect"/>
@@ -84,7 +84,7 @@
<property name="provides">StackDescriptor</property>
</bean>
- <bean name="WSMetroDescriptorDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSMetroDescriptorDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSMetroDescriptorDeploymentAspect"/>
@@ -98,7 +98,7 @@
<property name="provides">RuntimeModel</property>
</bean>
- <bean name="WSRuntimeModelDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSRuntimeModelDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSRuntimeModelDeploymentAspect"/>
15 years, 6 months
JBossWS SVN: r10300 - stack/cxf/branches/ropalka/modules/server/src/main/resources.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-02 15:19:42 -0400 (Thu, 02 Jul 2009)
New Revision: 10300
Modified:
stack/cxf/branches/ropalka/modules/server/src/main/resources/jbossws-cxf-config.xml
Log:
[JBWS-2332][JBWS-2382] refactoring
Modified: stack/cxf/branches/ropalka/modules/server/src/main/resources/jbossws-cxf-config.xml
===================================================================
--- stack/cxf/branches/ropalka/modules/server/src/main/resources/jbossws-cxf-config.xml 2009-07-02 19:17:30 UTC (rev 10299)
+++ stack/cxf/branches/ropalka/modules/server/src/main/resources/jbossws-cxf-config.xml 2009-07-02 19:19:42 UTC (rev 10300)
@@ -34,7 +34,7 @@
</property>
</bean>
- <bean name="WSCXFContextPropertiesDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSCXFContextPropertiesDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSCXFContextPropertiesDeploymentAspect"/>
@@ -50,7 +50,7 @@
<property name="invokerJSE">org.jboss.wsf.stack.cxf.InvokerJSE</property>
</bean>
- <bean name="WSCXFDescriptorDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSCXFDescriptorDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSCXFDescriptorDeploymentAspect"/>
@@ -64,7 +64,7 @@
<property name="provides">StackEndpointHandler</property>
</bean>
- <bean name="WSCXFEndpointHandlerDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSCXFEndpointHandlerDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSCXFEndpointHandlerDeploymentAspect"/>
@@ -85,7 +85,7 @@
</property>
</bean>
- <bean name="WSCXFEndpointRecordProcessorDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSCXFEndpointRecordProcessorDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSCXFEndpointRecordProcessorDeploymentAspect"/>
15 years, 6 months
JBossWS SVN: r10299 - in container/jboss50/branches/ropalka-jboss510/src/main: java/org/jboss/webservices and 8 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-02 15:17:30 -0400 (Thu, 02 Jul 2009)
New Revision: 10299
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/ASIntegrationHelper.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/ContainerMetaDataDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/InjectionMetaDataDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/WebAppDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/WebAppGeneratorDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/DeployerUtils.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/ServerConfigImpl.java
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/WSDescriptorDeployer.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/deployers/WSVirtualFileFilter.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandler.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/invocation/InvocationHandlerEJB3.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXWS.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJSE.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB3.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataAdapter.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBArchiveMetaDataAdapterEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBArchiveMetaDataAdapterEJB3.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBBeanReferenceResolver.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEArchiveMetaDataAdapter.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandler.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB3.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifierImpl.java
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/
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.jar/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
Log:
[JBWS-2332][JBWS-2382] refactoring
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/ASIntegrationHelper.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/ASIntegrationHelper.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/ASIntegrationHelper.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+
+/**
+ * JBoss AS integration helper class.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class ASIntegrationHelper
+{
+
+ /**
+ * Forbidden constructor.
+ */
+ private ASIntegrationHelper()
+ {
+ super();
+ }
+
+ public static boolean isWebServiceDeployment( final DeploymentUnit unit )
+ {
+ return unit.getAttachment( DeploymentType.class ) != null;
+ }
+
+ public static boolean isPojoDeployment( final DeploymentUnit unit )
+ {
+ if ( ASIntegrationHelper.isWebServiceDeployment( unit ) )
+ {
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ final boolean isJaxrpcPojo = DeploymentType.JAXRPC_JSE.equals( deploymentType );
+ final boolean isJaxwsPojo = DeploymentType.JAXWS_JSE.equals( deploymentType );
+
+ return isJaxwsPojo || isJaxrpcPojo;
+ }
+
+ return false;
+ }
+
+ public static boolean isEjbDeployment( final DeploymentUnit unit )
+ {
+ if ( ASIntegrationHelper.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;
+ }
+
+ public static boolean isJaxwsDeployment( final DeploymentUnit unit )
+ {
+ if ( ASIntegrationHelper.isWebServiceDeployment( unit ) )
+ {
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ final boolean isJaxwsEjb3 = DeploymentType.JAXWS_EJB3.equals( deploymentType );
+ final boolean isJaxwsPojo = DeploymentType.JAXWS_JSE.equals( deploymentType );
+
+ return isJaxwsEjb3 || isJaxwsPojo;
+ }
+
+ return false;
+ }
+
+ public static boolean isJaxrpcDeployment( final DeploymentUnit unit )
+ {
+ if ( ASIntegrationHelper.isWebServiceDeployment( unit ) )
+ {
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ final boolean isJaxrpcEjb21 = DeploymentType.JAXRPC_EJB21.equals( deploymentType );
+ final boolean isJaxrpcPojo = DeploymentType.JAXRPC_JSE.equals( deploymentType );
+
+ return isJaxrpcEjb21 || isJaxrpcPojo;
+ }
+
+ return false;
+ }
+
+ public static boolean isJaxrpcPojoDeployment( final DeploymentUnit unit )
+ {
+ final boolean isJaxrpc = ASIntegrationHelper.isJaxrpcDeployment( unit );
+ final boolean isPojo = ASIntegrationHelper.isPojoDeployment( unit );
+
+ return isPojo && isJaxrpc;
+ }
+
+ public static boolean isJaxwsPojoDeployment( final DeploymentUnit unit )
+ {
+ final boolean isJaxws = ASIntegrationHelper.isJaxwsDeployment( unit );
+ final boolean isPojo = ASIntegrationHelper.isPojoDeployment( unit );
+
+ return isPojo && isJaxws;
+ }
+
+ public static boolean isJaxrpcEjbDeployment( final DeploymentUnit unit )
+ {
+ final boolean isJaxrpc = ASIntegrationHelper.isJaxrpcDeployment( unit );
+ final boolean isEjb = ASIntegrationHelper.isEjbDeployment( unit );
+
+ return isEjb && isJaxrpc;
+ }
+
+ public static boolean isJaxwsEjbDeployment( final DeploymentUnit unit )
+ {
+ final boolean isJaxws = ASIntegrationHelper.isJaxwsDeployment( unit );
+ final boolean isEjb = ASIntegrationHelper.isEjbDeployment( unit );
+
+ return isEjb && isJaxws;
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/ContainerMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/ContainerMetaDataDeploymentAspect.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/ContainerMetaDataDeploymentAspect.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,53 @@
+/*
+ * 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.aspects;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.webservices.integration.metadata.ContainerMetaDataAdapter;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+
+/**
+ * A deployer that builds the UnifiedDeploymentInfo
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ContainerMetaDataDeploymentAspect extends DeploymentAspect
+{
+ private ContainerMetaDataAdapter metaDataAdapter = new ContainerMetaDataAdapter();
+
+ public void setMetaDataAdapter(ContainerMetaDataAdapter adapter)
+ {
+ this.metaDataAdapter = adapter;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+ if (unit == null)
+ throw new IllegalStateException("Cannot obtain deployment unit");
+
+ metaDataAdapter.buildContainerMetaData(dep, unit);
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/InjectionMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/InjectionMetaDataDeploymentAspect.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/InjectionMetaDataDeploymentAspect.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,236 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.aspects;
+
+import java.lang.annotation.Annotation;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.jws.WebService;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.webservices.integration.ASIntegrationHelper;
+import org.jboss.webservices.integration.metadata.EJBBeanReferenceResolver;
+import org.jboss.wsf.common.injection.resolvers.ResourceReferenceResolver;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
+import org.jboss.wsf.spi.metadata.injection.ReferenceResolver;
+
+/**
+ * Deployment aspect that builds injection meta data.
+ *
+ * @author <a href="mailto:richard.opalka@jboss.org">Richard Opalka</a>
+ */
+public final class InjectionMetaDataDeploymentAspect extends DeploymentAspect
+{
+
+ private static final ReferenceResolver RESOURCE_REFERENCE_RESOLVER = new ResourceReferenceResolver();
+ private static final String EJB3_JNDI_PREFIX = "java:env/";
+ private EjbReferenceResolver ejbReferenceResolver;
+
+ @Override
+ public void create(Deployment dep)
+ {
+ super.create(dep);
+
+ DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+ if (unit == null)
+ throw new IllegalStateException("DeploymentUnit not found");
+
+ 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);
+
+ try
+ {
+
+ if ( ASIntegrationHelper.isJaxwsPojoDeployment( unit ) )
+ {
+ injectionMD.addAll(buildInjectionMetaData(webMD.getEnvironmentEntries()));
+ for (Endpoint endpoint : dep.getService().getEndpoints())
+ {
+ InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, resolvers, null);
+ endpoint.addAttachment(InjectionsMetaData.class, injectionsMD);
+ }
+ }
+ else if ( ASIntegrationHelper.isJaxwsEjbDeployment( unit ) )
+ {
+ JBossMetaData jbossMD = unit.getAttachment(JBossMetaData.class);
+ JBossEnterpriseBeansMetaData jebMDs = jbossMD.getEnterpriseBeans();
+
+ WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+ if (isWebServiceBean(container))
+ {
+ final Context ctx = (Context)container.getContext().lookup(EJB3_JNDI_PREFIX);
+ String ejbName = container.getComponentName();
+ EnvironmentEntriesMetaData ejbEnvEntries = jebMDs.get(ejbName).getEnvironmentEntries();
+ injectionMD.addAll(buildInjectionMetaData(ejbEnvEntries));
+ Endpoint endpoint = dep.getService().getEndpointByName(ejbName);
+ InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, resolvers, ctx);
+ endpoint.addAttachment(InjectionsMetaData.class, injectionsMD);
+ }
+ }
+ }
+ }
+ catch (NamingException ne)
+ {
+ throw new RuntimeException(ne);
+ }
+ }
+
+ @Override
+ public void destroy(Deployment dep)
+ {
+ dep.getService().removeAttachment(InjectionMetaData.class);
+
+ super.destroy(dep);
+ }
+
+ /**
+ * Builds reference resolvers container.
+ *
+ * @param unit deployment unit
+ * @return reference resolvers
+ */
+ private Map<Class<? extends Annotation>, ReferenceResolver> createResolvers(DeploymentUnit unit)
+ {
+ final Map<Class<? extends Annotation>, ReferenceResolver> resolvers = new HashMap<Class<? extends Annotation>, ReferenceResolver>();
+ resolvers.put(Resource.class, RESOURCE_REFERENCE_RESOLVER);
+ resolvers.put(EJB.class, new EJBBeanReferenceResolver(unit, getEjbReferenceResolver()));
+ return resolvers;
+ }
+
+ /**
+ * Builds JBossWS specific injection metadata from JBoss metadata.
+ *
+ * @param envEntries environment entries
+ * @return JBossWS specific injection metadata
+ */
+ private List<InjectionMetaData> buildInjectionMetaData(EnvironmentEntriesMetaData envEntries)
+ {
+ if ((envEntries == null) || (envEntries.size() == 0))
+ {
+ return Collections.emptyList();
+ }
+
+ EnvironmentEntryMetaData eeMD = null;
+ LinkedList<InjectionMetaData> retVal = new LinkedList<InjectionMetaData>();
+ String envEntryName = null;
+ String envEntryValue = null;
+ String targetClass = null;
+ String targetName = null;
+ String valueClass = null;
+
+ for (Iterator<EnvironmentEntryMetaData> i = envEntries.iterator(); i.hasNext();)
+ {
+ eeMD = i.next();
+ envEntryName = eeMD.getEnvEntryName();
+ envEntryValue = eeMD.getValue();
+ valueClass = eeMD.getType();
+
+ Set<ResourceInjectionTargetMetaData> injectionTargets = eeMD.getInjectionTargets();
+ if ((injectionTargets != null) && (injectionTargets.size() > 0))
+ {
+ for (Iterator<ResourceInjectionTargetMetaData> j = injectionTargets.iterator(); j.hasNext(); )
+ {
+ ResourceInjectionTargetMetaData ritMD = j.next();
+ targetClass = ritMD.getInjectionTargetClass();
+ targetName = ritMD.getInjectionTargetName();
+ InjectionMetaData injectionMD = new InjectionMetaData(targetClass, targetName, valueClass, envEntryName, envEntryValue != null);
+ retVal.add(injectionMD);
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ /**
+ * Returns true if EJB represents webservice endpoint, false otherwise.
+ *
+ * @param container to analyze
+ * @return true if webservice endpoint, false otherwise
+ */
+ private boolean isWebServiceBean(WebServiceDeclaration container)
+ {
+ boolean isWebService = container.getAnnotation(WebService.class) != null;
+ boolean isWebServiceProvider = container.getAnnotation(WebServiceProvider.class) != null;
+
+ return isWebService || isWebServiceProvider;
+ }
+
+ /**
+ * Sets ejb reference resolver. This method is invoked by MC.
+ *
+ * @param resolver ejb reference resolver
+ */
+ public void setEjbReferenceResolver(final EjbReferenceResolver resolver)
+ {
+ this.ejbReferenceResolver = resolver;
+ }
+
+ /**
+ * Gets ejb reference resolver.
+ *
+ * @return ejb reference resolver
+ */
+ public EjbReferenceResolver getEjbReferenceResolver()
+ {
+ if (this.ejbReferenceResolver == null)
+ {
+ throw new IllegalStateException("No EjbReferenceResolver set by MC");
+ }
+
+ return this.ejbReferenceResolver;
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/WebAppDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/WebAppDeploymentAspect.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/WebAppDeploymentAspect.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,107 @@
+/*
+ * 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.aspects;
+
+import javax.security.jacc.PolicyConfiguration;
+import javax.security.jacc.PolicyConfigurationFactory;
+import org.jboss.web.WebPermissionMapping;
+import org.jboss.webservices.integration.tomcat.WebMetaDataModifier;
+
+import javax.xml.ws.WebServiceException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+
+/**
+ * Deploy the generated webapp to JBoss
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Anil.Saldhana(a)jboss.com
+ * @since 12-May-2006
+ */
+public class WebAppDeploymentAspect extends DeploymentAspect
+{
+ private WebMetaDataModifier webMetaDataModifier;
+
+ public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
+ {
+ this.webMetaDataModifier = webMetaDataModifier;
+ }
+
+ public void create(Deployment dep)
+ {
+ JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
+ if (jbwmd == null)
+ throw new WebServiceException("Cannot find web meta data");
+
+ DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+ if (unit != null)
+ {
+ 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);
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot obtain deployment unit");
+ }
+ }
+
+ /**
+ * JBAS-5935: The dynamic web application generated by the JBossWS
+ * does not go through the war security deployer. Hence the JACC
+ * permissions are not created. There is a need to explicitly create
+ * the war jacc permissions.
+ * @param depName
+ * @param jbwmd
+ * @throws Exception
+ */
+ protected void generateJACCPermissions(String depName, JBossWebMetaData jbwmd)
+ throws Exception
+ {
+ PolicyConfigurationFactory policyConfigurationFactory =
+ PolicyConfigurationFactory.getPolicyConfigurationFactory();
+ PolicyConfiguration policyConfiguration =
+ policyConfigurationFactory.getPolicyConfiguration(depName, false);
+ WebPermissionMapping.createPermissions(jbwmd, policyConfiguration);
+ policyConfiguration.commit();
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/WebAppGeneratorDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/WebAppGeneratorDeploymentAspect.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/aspects/WebAppGeneratorDeploymentAspect.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,274 @@
+/*
+ * 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.aspects;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AuthConstraintMetaData;
+import org.jboss.metadata.web.spec.LoginConfigMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.TransportGuaranteeType;
+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.tomcat.SecurityHandler;
+import org.jboss.wsf.spi.annotation.WebContext;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
+
+/**
+ * A deployment aspect that generates a webapp for an EJB endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 13-Oct-2007
+ */
+public class WebAppGeneratorDeploymentAspect extends DeploymentAspect
+{
+ private SecurityHandler securityHandlerEJB21;
+ private SecurityHandler securityHandlerEJB3;
+
+ public void setSecurityHandlerEJB21(SecurityHandler handler)
+ {
+ this.securityHandlerEJB21 = handler;
+ }
+
+ public void setSecurityHandlerEJB3(SecurityHandler handler)
+ {
+ this.securityHandlerEJB3 = handler;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ final DeploymentType deploymentType = dep.getType();
+
+ if (DeploymentType.JAXRPC_EJB21.equals(deploymentType))
+ {
+ JBossWebMetaData jbwmd = generatWebDeployment((ArchiveDeployment)dep, securityHandlerEJB21);
+ dep.addAttachment(JBossWebMetaData.class, jbwmd);
+ }
+ else if (DeploymentType.JAXWS_EJB3.equals(deploymentType))
+ {
+ JBossWebMetaData jbwmd = generatWebDeployment((ArchiveDeployment)dep, securityHandlerEJB3);
+ dep.addAttachment(JBossWebMetaData.class, jbwmd);
+ }
+ }
+
+ protected JBossWebMetaData generatWebDeployment(ArchiveDeployment dep, SecurityHandler securityHandler)
+ {
+ JBossWebMetaData jbwmd = new JBossWebMetaData();
+ createWebAppDescriptor(dep, jbwmd, securityHandler);
+ createJBossWebAppDescriptor(dep, jbwmd, securityHandler);
+ return jbwmd;
+ }
+
+ protected void createWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd, SecurityHandler securityHandler)
+ {
+ /*
+ <servlet>
+ <servlet-name>
+ <servlet-class>
+ </servlet>
+ */
+ JBossServletsMetaData servlets = jbwmd.getServlets();
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ JBossServletMetaData servlet = new JBossServletMetaData();
+ servlet.setServletName(ep.getShortName());
+ servlet.setServletClass(ep.getTargetBeanName());
+ servlets.add(servlet);
+ }
+
+ /*
+ <servlet-mapping>
+ <servlet-name>
+ <url-pattern>
+ </servlet-mapping>
+ */
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ List<ServletMappingMetaData> servletMappings = jbwmd.getServletMappings();
+ if (servletMappings == null)
+ {
+ servletMappings = new ArrayList<ServletMappingMetaData>();
+ jbwmd.setServletMappings(servletMappings);
+ }
+ ServletMappingMetaData servletMapping = new ServletMappingMetaData();
+ servletMapping.setServletName(ep.getShortName());
+ servletMapping.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern() }));
+ servletMappings.add(servletMapping);
+ }
+
+ String authMethod = null;
+
+ // Add web-app/security-constraint for each port component
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ String ejbName = ep.getShortName();
+
+ Boolean secureWSDLAccess = null;
+ String transportGuarantee = null;
+ String beanAuthMethod = null;
+
+ WebContext anWebContext = (WebContext)ep.getTargetBeanClass().getAnnotation(WebContext.class);
+ if (anWebContext != null)
+ {
+ if (anWebContext.authMethod().length() > 0)
+ beanAuthMethod = anWebContext.authMethod();
+ if (anWebContext.transportGuarantee().length() > 0)
+ transportGuarantee = anWebContext.transportGuarantee();
+ if (anWebContext.secureWSDLAccess())
+ secureWSDLAccess = anWebContext.secureWSDLAccess();
+ }
+
+ EJBArchiveMetaData appMetaData = dep.getAttachment(EJBArchiveMetaData.class);
+ if (appMetaData != null && appMetaData.getBeanByEjbName(ejbName) != null)
+ {
+ EJBMetaData bmd = appMetaData.getBeanByEjbName(ejbName);
+ EJBSecurityMetaData smd = bmd.getSecurityMetaData();
+ if (smd != null)
+ {
+ beanAuthMethod = smd.getAuthMethod();
+ transportGuarantee = smd.getTransportGuarantee();
+ secureWSDLAccess = smd.getSecureWSDLAccess();
+ }
+ }
+
+ if (beanAuthMethod != null || transportGuarantee != null)
+ {
+ /*
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>TestUnAuthPort</web-resource-name>
+ <url-pattern>/HSTestRoot/TestUnAuth/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>*</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ */
+ List<SecurityConstraintMetaData> securityContraints = jbwmd.getSecurityContraints();
+ if (securityContraints == null)
+ {
+ securityContraints = new ArrayList<SecurityConstraintMetaData>();
+ jbwmd.setSecurityContraints(securityContraints);
+ }
+ SecurityConstraintMetaData securityConstraint = new SecurityConstraintMetaData();
+ securityContraints.add(securityConstraint);
+
+ WebResourceCollectionsMetaData resourceCollections = securityConstraint.getResourceCollections();
+ if (resourceCollections == null)
+ {
+ resourceCollections = new WebResourceCollectionsMetaData();
+ securityConstraint.setResourceCollections(resourceCollections);
+ }
+ WebResourceCollectionMetaData resourceCollection = new WebResourceCollectionMetaData();
+ resourceCollections.add(resourceCollection);
+
+ resourceCollection.setWebResourceName(ejbName);
+ resourceCollection.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern() }));
+ ArrayList<String> httpMethods = new ArrayList<String>();
+ resourceCollection.setHttpMethods(httpMethods);
+ if (Boolean.TRUE.equals(secureWSDLAccess))
+ {
+ httpMethods.add("GET");
+ }
+ httpMethods.add("POST");
+
+ // Optional auth-constraint
+ if (beanAuthMethod != null)
+ {
+ // Only the first auth-method gives the war login-config/auth-method
+ if (authMethod == null)
+ authMethod = beanAuthMethod;
+
+ AuthConstraintMetaData authConstraint = new AuthConstraintMetaData();
+ authConstraint.setRoleNames(Arrays.asList(new String[] { "*" }));
+ securityConstraint.setAuthConstraint(authConstraint);
+ }
+ // Optional user-data-constraint
+ if (transportGuarantee != null)
+ {
+ UserDataConstraintMetaData userDataConstraint = new UserDataConstraintMetaData();
+ userDataConstraint.setTransportGuarantee(TransportGuaranteeType.valueOf(transportGuarantee));
+ securityConstraint.setUserDataConstraint(userDataConstraint);
+ }
+ }
+ }
+
+ // Optional login-config/auth-method
+ if (authMethod != null && securityHandler != null)
+ {
+ LoginConfigMetaData loginConfig = jbwmd.getLoginConfig();
+ if (loginConfig == null)
+ {
+ loginConfig = new LoginConfigMetaData();
+ jbwmd.setLoginConfig(loginConfig);
+ }
+ loginConfig.setAuthMethod(authMethod);
+ loginConfig.setRealmName("EJBServiceEndpointServlet Realm");
+
+ securityHandler.addSecurityRoles(jbwmd, dep);
+ }
+ }
+
+ protected void createJBossWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd, SecurityHandler securityHandler)
+ {
+ /* Create a jboss-web
+ <jboss-web>
+ <security-domain>java:/jaas/cts</security-domain>
+ <context-root>/ws/ejbN/</context-root>
+ <virtual-host>some.domain.com</virtual-host>
+ </jboss-web>
+ */
+ if (securityHandler != null)
+ securityHandler.addSecurityDomain(jbwmd, dep);
+
+ // Get the context root for this deployment
+ String contextRoot = dep.getService().getContextRoot();
+ if (contextRoot == null)
+ throw new WSFDeploymentException("Cannot obtain context root");
+
+ jbwmd.setContextRoot(contextRoot);
+ String[] virtualHosts = dep.getService().getVirtualHosts();
+ if (virtualHosts != null && virtualHosts.length > 0)
+ {
+ jbwmd.setVirtualHosts(Arrays.asList(virtualHosts));
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/DeployerUtils.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/DeployerUtils.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/DeployerUtils.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.deployers;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jws.WebService;
+import javax.servlet.Servlet;
+import javax.xml.ws.WebServiceProvider;
+
+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.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+
+/**
+ * TODO: javadoc
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+final class DeployerUtils
+{
+
+ /** Logger. */
+ private static final Logger log = Logger.getLogger( DeployerUtils.class );
+
+ /**
+ * Forbidden constructor.
+ */
+ private DeployerUtils()
+ {
+ super();
+ }
+
+ static final boolean isWebServiceBean( final WebServiceDeclaration ejbContainerAdapter )
+ {
+ boolean isWebServiceBean = false;
+ boolean isWebService = ejbContainerAdapter.getAnnotation(WebService.class) != null;
+ boolean isWebServiceProvider = ejbContainerAdapter.getAnnotation(WebServiceProvider.class) != null;
+ isWebServiceBean = isWebService || isWebServiceProvider;
+
+ return isWebServiceBean;
+ }
+
+ static final boolean isEjb3Deployment( final DeploymentUnit unit )
+ {
+ final WebServiceDeployment wsDeployment = unit.getAttachment( WebServiceDeployment.class );
+
+ Iterator<WebServiceDeclaration> it = wsDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+ if (DeployerUtils.isWebServiceBean(container))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static final List<ServletMetaData> getJaxwsServlets( final DeploymentUnit unit )
+ {
+ return DeployerUtils.getRelevantServlets( unit, true );
+ }
+
+ static List<ServletMetaData> getJaxrpcServlets( final DeploymentUnit unit )
+ {
+ return DeployerUtils.getRelevantServlets( unit, false );
+ }
+
+ private static final List< ServletMetaData > getRelevantServlets( final DeploymentUnit unit, final boolean jaxws )
+ {
+ try
+ {
+ final JBossWebMetaData jbossWebMD = unit.getAttachment(JBossWebMetaData.class);
+ final ClassLoader loader = unit.getClassLoader();
+
+ List<ServletMetaData> endpoints = new ArrayList<ServletMetaData>();
+ for (ServletMetaData servlet : jbossWebMD.getServlets())
+ {
+ String servletClassName = getTargetBean(servlet);
+
+ // Skip JSPs
+ if (servletClassName == null || servletClassName.length() == 0)
+ continue;
+
+ try
+ {
+ Class<?> servletClass = loader.loadClass(servletClassName.trim());
+ boolean isServlet = servletClass.isAssignableFrom(Servlet.class);
+ if (false == isServlet)
+ {
+ 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
+ }
+ }
+ }
+ }
+ 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();
+ }
+ }
+
+ static String getTargetBean(ServletMetaData servlet)
+ {
+ String endpointClass = servlet.getServletClass();
+ List<ParamValueMetaData> initParams = servlet.getInitParam();
+ if (initParams != null)
+ {
+ for (ParamValueMetaData param : initParams)
+ {
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(param.getParamName()))
+ {
+ endpointClass = param.getParamValue();
+ break;
+ }
+ }
+ }
+ return endpointClass;
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/ServerConfigImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/ServerConfigImpl.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/ServerConfigImpl.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,82 @@
+/*
+ * 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.deployers;
+
+import java.io.File;
+
+import javax.management.JMException;
+import javax.management.ObjectName;
+
+import org.jboss.wsf.common.management.AbstractServerConfig;
+import org.jboss.wsf.common.management.AbstractServerConfigMBean;
+
+/**
+ * A ServerConfig for AS <= 5.1.0
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author Thomas.Diesler(a)jboss.org
+ *
+ */
+public class ServerConfigImpl extends AbstractServerConfig implements AbstractServerConfigMBean
+{
+
+ public File getServerTempDir()
+ {
+ return this.getDirFromServerConfig("ServerTempDir");
+ }
+
+ public File getHomeDir()
+ {
+ return this.getDirFromServerConfig("HomeDir");
+ }
+
+ public File getServerDataDir()
+ {
+ return this.getDirFromServerConfig("ServerDataDir");
+ }
+
+ /**
+ * Obtains the specified attribute from the server configuration,
+ * represented as a {@link File}.
+ *
+ * @param attributeName
+ * @return
+ * @author ALR
+ */
+ protected File getDirFromServerConfig(final String attributeName)
+ {
+ // Define the ON to invoke upon
+ final ObjectName on = OBJECT_NAME_SERVER_CONFIG;
+
+ // Get the URL location
+ File location = null;
+ try
+ {
+ location = (File) getMbeanServer().getAttribute(on, attributeName);
+ }
+ catch (final JMException e)
+ {
+ throw new RuntimeException("Could not obtain attribute " + attributeName + " from " + on, e);
+ }
+ return location;
+ }
+}
Added: 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 (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,137 @@
+/*
+ * 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.deployers;
+
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.webservices.integration.ASIntegrationHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+
+/**
+ * A deployer that delegates to JBossWS deployment aspect.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSDeploymentAspectDeployer extends AbstractRealDeployer
+{
+
+ /** JBossWS specific inputs/outputs prefix. */
+ private static final String JBOSSWS_ATTACHMENT_PREFIX = "jbossws.";
+ /** JBossWS specific metadata. */
+ private static final String JBOSSWS_METADATA = WSDeploymentAspectDeployer.JBOSSWS_ATTACHMENT_PREFIX + "metadata";
+ /** Delegee. */
+ private final DeploymentAspect aspect;
+
+ /**
+ * Constructor.
+ *
+ * @param aspect deployment aspect
+ */
+ public WSDeploymentAspectDeployer( final DeploymentAspect aspect )
+ {
+ this( aspect, false );
+ }
+ /**
+ * Constructor.
+ *
+ * @param aspect deployment aspect
+ * @param lastAspect if this is the last JBossWS aspect in deployers chain
+ */
+ public WSDeploymentAspectDeployer( final DeploymentAspect aspect, final boolean lastAspect )
+ {
+ super();
+
+ // inputs
+ this.addInput( JBossWebMetaData.class );
+ this.addInput( Deployment.class );
+ if ( lastAspect )
+ {
+ this.addInput( WSDeploymentAspectDeployer.JBOSSWS_METADATA );
+ }
+
+ // propagate DA requirements and map them to deployer inputs
+ final Set< String > inputs = aspect.getRequiresAsSet();
+ for ( String input : inputs )
+ {
+ this.addInput( WSDeploymentAspectDeployer.JBOSSWS_ATTACHMENT_PREFIX + input );
+ }
+
+ // outputs
+ this.addOutput( JBossWebMetaData.class );
+ if ( !lastAspect )
+ {
+ this.addOutput( WSDeploymentAspectDeployer.JBOSSWS_METADATA );
+ }
+
+ // propagate DA provides and map them to deployer outputs
+ final Set< String > outputs = aspect.getProvidesAsSet();
+ for ( String output : outputs )
+ {
+ this.addOutput( WSDeploymentAspectDeployer.JBOSSWS_ATTACHMENT_PREFIX + output );
+ }
+
+ this.aspect = aspect;
+ }
+
+ /**
+ * If deployed unit is related to web services this method delegates
+ * to deployment aspect and calls its create() and start() methods.
+ *
+ * @param unit deployment unit
+ * @throws DeploymentException on deployment failure
+ */
+ @Override
+ public void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
+ {
+ if ( ASIntegrationHelper.isWebServiceDeployment( unit ) )
+ {
+ log.debug( this.aspect.getClass() + " deploy: " + unit.getName() );
+ final Deployment dep = unit.getAttachment( Deployment.class );
+ this.aspect.create( dep );
+ this.aspect.start( dep );
+ }
+ }
+
+ /**
+ * If undeployed unit is related to web services this method delegates
+ * to deployment aspect and calls its stop() and destroy() methods.
+ *
+ * @param unit deployment unit
+ */
+ @Override
+ public void internalUndeploy( final DeploymentUnit unit )
+ {
+ if ( ASIntegrationHelper.isWebServiceDeployment( unit ) )
+ {
+ log.debug( this.aspect.getClass() + " undeploy: " + unit.getName() );
+ final Deployment dep = unit.getAttachment( Deployment.class );
+ this.aspect.stop( dep );
+ this.aspect.destroy( dep );
+ }
+ }
+
+}
Added: 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 (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,316 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.deployers;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.serviceref.VirtualFileAdaptor;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.webservices.integration.ASIntegrationHelper;
+import org.jboss.webservices.integration.invocation.InvocationHandlerEJB3;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Service;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * This deployer initializes JBossWS deployment meta data.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSDeploymentDeployer extends AbstractRealDeployer
+{
+
+ private static final WSVirtualFileFilter WS_FILE_FILTER = new WSVirtualFileFilter();
+ private final DeploymentModelFactory deploymentModelFactory;
+
+ /**
+ * Constructor.
+ */
+ public WSDeploymentDeployer()
+ {
+ super();
+
+ // inputs
+ this.addInput( JBossWebMetaData.class );
+ this.addInput( DeploymentType.class );
+
+ // outputs
+ this.addOutput( JBossWebMetaData.class );
+ this.addOutput( Deployment.class );
+
+ // deployment factory
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
+ }
+
+ @Override
+ protected void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
+ {
+ if ( ASIntegrationHelper.isJaxrpcEjbDeployment( unit ) )
+ {
+ this.newJaxrpcEjbDeployment( unit );
+ }
+ else if ( ASIntegrationHelper.isJaxwsEjbDeployment( unit ) )
+ {
+ this.newJaxwsEjbDeployment( unit );
+ }
+ else if ( ASIntegrationHelper.isJaxrpcPojoDeployment( unit ) )
+ {
+ this.newJaxrpcPojoDeployment( unit );
+ }
+ else if ( ASIntegrationHelper.isJaxwsPojoDeployment( unit ) )
+ {
+ this.newJaxwsPojoDeployment( unit );
+ }
+ }
+
+ private void newJaxrpcEjbDeployment( final DeploymentUnit unit )
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+
+ Service service = dep.getService();
+
+ JBossMetaData jbmd = unit.getAttachment(JBossMetaData.class);
+ if (jbmd == null)
+ throw new IllegalStateException("Deployment unit does not contain application meta data");
+
+ WebservicesMetaData wsMetaData = unit.getAttachment(WebservicesMetaData.class);
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain webservices meta data");
+
+ WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+ if (webServiceDeployment == null)
+ throw new IllegalStateException("Deployment unit does not contain webServiceDeployment");
+
+ // Copy the attachments
+ dep.addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.addAttachment(JBossMetaData.class, jbmd);
+ dep.addAttachment(WebServiceDeployment.class, webServiceDeployment);
+
+ for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
+ {
+ for (PortComponentMetaData pcmd : wsd.getPortComponents())
+ {
+ String ejbLink = pcmd.getEjbLink();
+ if (ejbLink == null)
+ throw new IllegalStateException("ejb-link cannot be null");
+
+ JBossEnterpriseBeanMetaData beanMetaData = jbmd.getEnterpriseBean(ejbLink);
+ if (beanMetaData == null)
+ throw new IllegalStateException("Cannot obtain bean meta data for: " + ejbLink);
+
+ String ejbClass = beanMetaData.getEjbClass();
+
+ // Create the endpoint
+ Endpoint ep = this.deploymentModelFactory.newEndpoint(ejbClass);
+ ep.setShortName(ejbLink);
+ service.addEndpoint(ep);
+ }
+ }
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.addAttachment( Deployment.class, dep );
+ }
+
+ private void newJaxwsEjbDeployment( final DeploymentUnit unit )
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+
+ Service service = dep.getService();
+
+ WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+ if (webServiceDeployment == null)
+ throw new IllegalStateException("Deployment unit does not contain webServiceDeployment");
+
+ // Copy the attachments
+ dep.addAttachment(WebServiceDeployment.class, webServiceDeployment);
+
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+ if (DeployerUtils.isWebServiceBean(container))
+ {
+ String ejbName = container.getComponentName();
+ String epBean = container.getComponentClassName();
+
+ // Create the endpoint
+ Endpoint ep = this.deploymentModelFactory.newEndpoint(epBean);
+ ep.setShortName(ejbName);
+
+ String containName = container.getContainerName();
+ if(null==containName)
+ throw new IllegalArgumentException("Target container name not set");
+ ep.setProperty(InvocationHandlerEJB3.CONTAINER_NAME, containName);
+
+ service.addEndpoint(ep);
+ }
+ }
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.addAttachment( Deployment.class, dep );
+ }
+
+ private void newJaxrpcPojoDeployment( final DeploymentUnit unit )
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+
+ Service service = dep.getService();
+
+ JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta data");
+
+ WebservicesMetaData wsMetaData = unit.getAttachment(WebservicesMetaData.class);
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain webservices meta data");
+
+ // Copy the attachments
+ dep.addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.addAttachment(JBossWebMetaData.class, webMetaData);
+
+ for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
+ {
+ for (PortComponentMetaData pcmd : wsd.getPortComponents())
+ {
+ String servletLink = pcmd.getServletLink();
+ if (servletLink == null)
+ throw new IllegalStateException("servlet-link cannot be null");
+
+ ServletMetaData servlet = getServletForName(webMetaData, servletLink);
+ String targetBean = DeployerUtils.getTargetBean(servlet);
+
+ // Create the endpoint
+ Endpoint ep = this.deploymentModelFactory.newEndpoint(targetBean);
+ ep.setShortName(servletLink);
+ service.addEndpoint(ep);
+ }
+ }
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.addAttachment( Deployment.class, dep );
+ }
+
+ private void newJaxwsPojoDeployment( final DeploymentUnit unit )
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+
+ Service service = dep.getService();
+
+ JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta data");
+
+ // Copy the attachments
+ dep.addAttachment(JBossWebMetaData.class, webMetaData);
+
+ List<ServletMetaData> servlets = DeployerUtils.getJaxwsServlets(unit);
+ for (ServletMetaData servlet : servlets)
+ {
+ String servletName = servlet.getName();
+ String targetBean = DeployerUtils.getTargetBean(servlet);
+
+ // Create the endpoint
+ Endpoint ep = this.deploymentModelFactory.newEndpoint(targetBean);
+ ep.setShortName(servletName);
+ service.addEndpoint(ep);
+ }
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.addAttachment( Deployment.class, dep );
+ }
+
+ private ServletMetaData getServletForName(JBossWebMetaData wmd, String servletLink)
+ {
+ for (JBossServletMetaData servlet : wmd.getServlets())
+ {
+ if (servletLink.equals(servlet.getName()))
+ {
+ return servlet;
+ }
+ }
+ throw new IllegalStateException("Cannot find servlet for link: " + servletLink);
+ }
+
+ private ArchiveDeployment newDeployment(DeploymentUnit unit)
+ {
+ try
+ {
+ ArchiveDeployment dep = (ArchiveDeployment)this.deploymentModelFactory.newDeployment(unit.getSimpleName(), unit.getClassLoader());
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
+ List<VirtualFile> virtualFiles = vfsUnit.getMetaDataFiles(WS_FILE_FILTER); //get all wsdl and xsd files
+ Set<UnifiedVirtualFile> uVirtualFiles = new HashSet<UnifiedVirtualFile>();
+ for (VirtualFile vf : virtualFiles)
+ {
+ // Adding the roots of the virtual files.
+ uVirtualFiles.add(new VirtualFileAdaptor(vf.getVFS().getRoot()));
+ }
+ dep.setMetadataFiles(new LinkedList<UnifiedVirtualFile>(uVirtualFiles));
+ }
+
+ if (unit.getParent() != null)
+ {
+ DeploymentUnit parentUnit = unit.getParent();
+ ArchiveDeployment parentDep = (ArchiveDeployment)this.deploymentModelFactory.newDeployment(parentUnit.getSimpleName(), parentUnit.getClassLoader());
+ dep.setParent(parentDep);
+ }
+
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setRuntimeClassLoader(unit.getClassLoader());
+ dep.setType(unit.getAttachment( DeploymentType.class ));
+
+ return dep;
+ }
+ catch (Exception ex)
+ {
+ throw new WSFDeploymentException("Cannot load spi.deployment.Deployment class", ex);
+ }
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDescriptorDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDescriptorDeployer.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDescriptorDeployer.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.deployers;
+
+import org.jboss.deployers.vfs.spi.deployer.ObjectModelFactoryDeployer;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * webservices.xml deployer.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSDescriptorDeployer extends ObjectModelFactoryDeployer< WebservicesMetaData >
+{
+
+ /**
+ * Constructor.
+ */
+ public WSDescriptorDeployer()
+ {
+ super( WebservicesMetaData.class );
+ }
+
+ /**
+ * Model factory generator.
+ */
+ @Override
+ protected ObjectModelFactory getObjectModelFactory( final WebservicesMetaData root )
+ {
+ return new WebservicesFactory( null );
+ }
+
+}
Added: 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 (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSEJBAdapterDeployer.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,269 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.deployers;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb.deployers.EjbDeployment;
+import org.jboss.ejb.deployers.MergedJBossMetaDataDeployer;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * WebServiceDeployment deployer processes EJB containers and its metadata and creates WS adapters wrapping it.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSEJBAdapterDeployer extends AbstractRealDeployer
+{
+
+ /**
+ * Constructor.
+ */
+ public WSEJBAdapterDeployer()
+ {
+ super();
+
+ // inputs
+ this.addInput( MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME );
+ this.addInput( EjbDeployment.class );
+ this.addInput( Ejb3Deployment.class );
+ this.addInput( WebservicesMetaData.class );
+
+ // outputs
+ this.addOutput( WebServiceDeployment.class );
+ }
+
+ /**
+ * Deploys WebServiceDeployment meta data.
+ */
+ @Override
+ protected void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
+ {
+ final JBossMetaData mergedMD = ( JBossMetaData )unit.getAttachment(
+ MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME
+ );
+ final Ejb3Deployment ejb3Deployment = unit.getAttachment( Ejb3Deployment.class );
+
+ if( mergedMD != null )
+ {
+ final WebServiceDeploymentAdapter wsDeploymentAdapter = new WebServiceDeploymentAdapter();
+ final Iterator< JBossEnterpriseBeanMetaData > ejbIterator = mergedMD.getEnterpriseBeans().iterator();
+
+ while( ejbIterator.hasNext() )
+ {
+ final JBossEnterpriseBeanMetaData ejbMD = ejbIterator.next();
+ final EJBContainer ejbContainer = this.getContainer( ejb3Deployment, ejbMD );
+
+ if( ejbMD.getEjbClass() != null )
+ {
+ wsDeploymentAdapter.getServiceEndpoints().add(
+ new WebServiceDeclarationAdapter( ejbMD, ejbContainer, unit.getClassLoader() )
+ );
+ }
+ else
+ {
+ log.warn( "Ingoring ejb deployment with null classname: " + ejbMD );
+ }
+ }
+
+ unit.addAttachment( WebServiceDeployment.class, wsDeploymentAdapter );
+ }
+ }
+
+ /**
+ * Returns EJB container if EJB3 deployment is detected and EJB meta data does not represent entity bean.
+ *
+ * @param ejb3Deployment EJB3 deployment meta data
+ * @param ejbMD EJB meta data
+ * @return EJB container or null if not EJB3 stateless bean
+ * @throws DeploymentException if some error occurs
+ */
+ private EJBContainer getContainer( final Ejb3Deployment ejb3Deployment, final JBossEnterpriseBeanMetaData ejbMD )
+ throws DeploymentException
+ {
+ if ( ( ejb3Deployment != null ) && ( ejbMD.isEntity() == false ) )
+ {
+ try
+ {
+ final ObjectName objName = new ObjectName( ejbMD.determineContainerName() );
+ return ( EJBContainer ) ejb3Deployment.getContainer( objName );
+ }
+ catch ( MalformedObjectNameException e )
+ {
+ throw new DeploymentException( e );
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Adopts EJB3 bean meta data to a
+ * {@link org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration}.
+ */
+ private static class WebServiceDeclarationAdapter implements WebServiceDeclaration
+ {
+
+ private final JBossEnterpriseBeanMetaData ejbMetaData;
+ private final EJBContainer ejbContainer;
+ private final ClassLoader loader;
+
+ /**
+ * Constructor.
+ *
+ * @param ejbMetaData EJB metadata
+ * @param ejbContainer EJB container
+ * @param loader class loader
+ */
+ private WebServiceDeclarationAdapter
+ (
+ final JBossEnterpriseBeanMetaData ejbMetaData,
+ final EJBContainer ejbContainer,
+ final ClassLoader loader
+ )
+ {
+ super();
+
+ this.ejbMetaData = ejbMetaData;
+ this.ejbContainer = ejbContainer;
+ this.loader = loader;
+ }
+
+ /**
+ * Returns EJB container name.
+ *
+ * @return container name
+ */
+ public String getContainerName()
+ {
+ return this.ejbMetaData.determineContainerName();
+ }
+
+ /**
+ * Returns JNDI context associated with EJB container.
+ *
+ * @return JNDI context
+ */
+ public Context getContext()
+ {
+ return this.ejbContainer.getEnc();
+ }
+
+ /**
+ * Returns EJB name.
+ *
+ * @returns name
+ */
+ public String getComponentName()
+ {
+ return this.ejbMetaData.getName();
+ }
+
+ /**
+ * Returns EJB class name.
+ *
+ * @return class name
+ */
+ public String getComponentClassName()
+ {
+ return this.ejbMetaData.getEjbClass();
+ }
+
+ /**
+ * Returns requested annotation associated with EJB container or EJB bean.
+ *
+ * @return requested annotation or null if not found
+ */
+ public < T extends Annotation > T getAnnotation( final Class<T> annotationType )
+ {
+ final boolean haveEjbContainer = this.ejbContainer != null;
+
+ if ( haveEjbContainer )
+ {
+ return this.ejbContainer.getAnnotation( annotationType );
+ }
+ else
+ {
+ final Class< ? > bean = this.getComponentClass();
+ return ( T ) bean.getAnnotation( annotationType );
+ }
+ }
+
+ /**
+ * Loads ejb class from associated loader.
+ *
+ * @return ejb class instance
+ */
+ private Class< ? > getComponentClass()
+ {
+ try
+ {
+ return this.loader.loadClass( this.getComponentClassName() );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ throw new RuntimeException( "Failed to load component class: " +
+ this.getComponentClassName() + " from loader: " + this.loader );
+ }
+ }
+
+ }
+
+ /**
+ * Adopts an EJB deployment to a
+ * {@link org.jboss.wsf.spi.deployment.integration.WebServiceDeployment}
+ */
+ private static class WebServiceDeploymentAdapter implements WebServiceDeployment
+ {
+
+ /** List of endpoints. */
+ private final List< WebServiceDeclaration > endpoints = new ArrayList< WebServiceDeclaration >();
+
+ /**
+ * Returns endpoints list.
+ *
+ * @return endpoints list
+ */
+ public List< WebServiceDeclaration > getServiceEndpoints()
+ {
+ return endpoints;
+ }
+
+ }
+
+}
Added: 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 (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSTypeDeployer.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.deployers;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * Detects Web Service deployment type.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSTypeDeployer extends AbstractRealDeployer
+{
+
+ /**
+ * Constructor.
+ */
+ public WSTypeDeployer()
+ {
+ super();
+
+ // inputs
+ this.addInput( JBossWebMetaData.class );
+ this.addInput( WebservicesMetaData.class );
+ this.addInput( WebServiceDeployment.class );
+
+ // outputs
+ this.addOutput( DeploymentType.class );
+ this.addOutput( JBossWebMetaData.class );
+ }
+
+ /**
+ * Detects WS deployment type and puts it to the deployment unit attachments.
+ *
+ * @param unit deployment unit
+ * @throws DeploymentException on failure
+ */
+ @Override
+ protected void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
+ {
+ if ( this.isJaxrpcEjbDeployment( unit ) )
+ {
+ unit.addAttachment( DeploymentType.class, DeploymentType.JAXRPC_EJB21 );
+ }
+ else if ( this.isJaxwsEjbDeployment( unit ) )
+ {
+ unit.addAttachment( DeploymentType.class, DeploymentType.JAXWS_EJB3 );
+ }
+ else if ( this.isJaxrpcPojoDeployment( unit ) )
+ {
+ unit.addAttachment( DeploymentType.class, DeploymentType.JAXRPC_JSE );
+ }
+ else if ( this.isJaxwsPojoDeployment( unit ) )
+ {
+ unit.addAttachment( DeploymentType.class, DeploymentType.JAXWS_JSE );
+ }
+ }
+
+ /**
+ * Returns true if JAXRPC EJB deployment is detected.
+ *
+ * @param unit deployment unit
+ * @return true if JAXRPC EJB, false otherwise
+ */
+ private boolean isJaxrpcEjbDeployment( final DeploymentUnit unit )
+ {
+ final boolean isJaxrpc = unit.getAttachment( WebservicesMetaData.class ) != null;
+ final boolean hasJBossMD = unit.getAllMetaData( JBossMetaData.class ).size() > 0;
+
+ return isJaxrpc && hasJBossMD;
+ }
+
+ /**
+ * Returns true if JAXRPC POJO deployment is detected.
+ *
+ * @param unit deployment unit
+ * @return true if JAXRPC POJO, false otherwise
+ */
+ private boolean isJaxrpcPojoDeployment( final DeploymentUnit unit )
+ {
+ final boolean isJaxrpc = unit.getAttachment( WebservicesMetaData.class ) != null;
+ final boolean hasJBossWebMD = unit.getAttachment( JBossWebMetaData.class ) != null;
+
+ if ( isJaxrpc && hasJBossWebMD )
+ {
+ return DeployerUtils.getJaxrpcServlets( unit ).size() > 0;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Returns true if JAXWS EJB deployment is detected.
+ *
+ * @param unit deployment unit
+ * @return true if JAXWS EJB, false otherwise
+ */
+ private boolean isJaxwsEjbDeployment( final DeploymentUnit unit )
+ {
+ final boolean hasWSDeployment = unit.getAttachment( WebServiceDeployment.class ) != null;
+
+ if ( hasWSDeployment )
+ {
+ return DeployerUtils.isEjb3Deployment( unit );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Returns true if JAXWS POJO deployment is detected.
+ *
+ * @param unit deployment unit
+ * @return true if JAXWS POJO, false otherwise
+ */
+ private boolean isJaxwsPojoDeployment( final DeploymentUnit unit )
+ {
+ final boolean hasJBossWebMD = unit.getAttachment( JBossWebMetaData.class ) != null;
+
+ if ( hasJBossWebMD )
+ {
+ return DeployerUtils.getJaxwsServlets( unit ).size() > 0;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSVirtualFileFilter.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSVirtualFileFilter.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSVirtualFileFilter.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.deployers;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilterWithAttributes;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * VirtualFileFilter that can be used to search/filter files with the
+ * suffix ".wsdl" and ".xsd".
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius@jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class WSVirtualFileFilter implements VirtualFileFilterWithAttributes
+{
+ /** The attributes */
+ private VisitorAttributes attributes;
+
+ /**
+ * No-args constructor.
+ *
+ * Will create a recursive filter by setting {@link VisitorAttributes#RECURSE_LEAVES_ONLY}.
+ */
+ public WSVirtualFileFilter()
+ {
+ this(VisitorAttributes.RECURSE_LEAVES_ONLY);
+ }
+
+ /**
+ *
+ * @param attributes The {@link VisitorAttributes} value which determines the recursive behaviour of this filter.
+ */
+ public WSVirtualFileFilter(final VisitorAttributes attributes)
+ {
+ this.attributes = attributes;
+ }
+
+ /**
+ * Retrieves the VisitorAttribute for this instance.
+ */
+ public VisitorAttributes getAttributes()
+ {
+ return attributes;
+ }
+
+ /**
+ * Accepts files that end with .wsdl and .xsd.
+ *
+ * @return {@code true} If the file name ends with either .wsdl or .xsd. Otherwise returns false.
+ */
+ public boolean accepts(final VirtualFile file)
+ {
+ if (file == null)
+ return false;
+
+ final String fileName = file.getName();
+ return fileName.endsWith(".wsdl") || fileName.endsWith(".xsd") || fileName.endsWith(".xml");
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandler.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandler.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandler.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,53 @@
+/*
+ * 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.invocation;
+
+import java.lang.reflect.Method;
+
+import org.jboss.wsf.common.JavaUtils;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractInvocationHandler extends InvocationHandler
+{
+ protected Method getImplMethod(Class implClass, Method seiMethod) throws ClassNotFoundException, NoSuchMethodException
+ {
+ String methodName = seiMethod.getName();
+ Class[] paramTypes = seiMethod.getParameterTypes();
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ Class paramType = paramTypes[i];
+ if (JavaUtils.isPrimitive(paramType) == false)
+ {
+ String paramTypeName = paramType.getName();
+ paramType = JavaUtils.loadJavaType(paramTypeName);
+ paramTypes[i] = paramType;
+ }
+ }
+
+ Method implMethod = implClass.getMethod(methodName, paramTypes);
+ return implMethod;
+ }
+}
Added: 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 (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,197 @@
+/*
+ * 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.invocation;
+
+import java.lang.reflect.Method;
+import java.security.Principal;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.ejb.EjbModule;
+import org.jboss.ejb.Interceptor;
+import org.jboss.ejb.StatelessSessionContainer;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.invocation.InvocationType;
+import org.jboss.invocation.PayloadKey;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.webservices.integration.invocation.ServiceEndpointInterceptor;
+import org.jboss.wsf.common.ObjectNameFactory;
+import org.jboss.wsf.spi.SPIProvider;
+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.invocation.HandlerCallback;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+
+/**
+ * Handles invocations on EJB21 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB21 extends InvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerEJB21.class);
+
+ private String jndiName;
+ private MBeanServer server;
+ private ObjectName objectName;
+
+ InvocationHandlerEJB21()
+ {
+ }
+
+ public Invocation createInvocation()
+ {
+ return new Invocation();
+ }
+
+ public void init(Endpoint ep)
+ {
+ String ejbName = ep.getShortName();
+ Deployment dep = ep.getService().getDeployment();
+ EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class);
+ EJBMetaData beanMetaData = (EJBMetaData)apMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WebServiceException("Cannot obtain ejb meta data for: " + ejbName);
+
+ // get the MBeanServer
+ server = MBeanServerLocator.locateJBoss();
+
+ // get the bean's JNDI name
+ jndiName = beanMetaData.getContainerObjectNameJndiName();
+ if (jndiName == null)
+ throw new WebServiceException("Cannot obtain JNDI name for: " + ejbName);
+ }
+
+ public void invoke(Endpoint ep, Invocation inv) throws Exception
+ {
+ log.debug("Invoke: " + inv.getJavaMethod().getName());
+
+ if (objectName == null)
+ {
+ objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName + ",service=EJB");
+ if (server.isRegistered(objectName) == false)
+ throw new WebServiceException("Cannot find service endpoint target: " + objectName);
+
+ // Inject the Service endpoint interceptor
+ injectServiceEndpointInterceptor(objectName, ep.getShortName());
+ }
+
+ // invoke on the container
+ try
+ {
+ // setup the invocation
+ org.jboss.invocation.Invocation jbInv = getMBeanInvocation(inv);
+
+ String[] sig = { org.jboss.invocation.Invocation.class.getName() };
+ Object retObj = server.invoke(objectName, "invoke", new Object[] { jbInv }, sig);
+ inv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ private org.jboss.invocation.Invocation getMBeanInvocation(Invocation inv)
+ {
+ // EJB2.1 endpoints will only get an JAXRPC context
+ MessageContext msgContext = inv.getInvocationContext().getAttachment(MessageContext.class);
+ if (msgContext == null)
+ throw new IllegalStateException("Cannot obtain MessageContext");
+
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
+ SecurityContext sc = SecurityContextAssociation.getSecurityContext();
+ Principal principal = securityAdaptor.getPrincipal();
+ Object credential = securityAdaptor.getCredential();
+
+ if (principal == null && sc != null)
+ principal = sc.getUtil().getUserPrincipal();
+
+ if (credential == null && sc != null)
+ credential = sc.getUtil().getCredential();
+
+ Method method = inv.getJavaMethod();
+ Object[] args = inv.getArgs();
+ org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential);
+
+ HandlerCallback callback = inv.getInvocationContext().getAttachment(HandlerCallback.class);
+ if (callback == null)
+ throw new IllegalStateException("Cannot obtain HandlerCallback");
+
+ jbInv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ jbInv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage());
+ jbInv.setType(InvocationType.SERVICE_ENDPOINT);
+ jbInv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT);
+ jbInv.setValue(Invocation.class.getName(), inv, PayloadKey.TRANSIENT);
+
+ return jbInv;
+ }
+
+ private void injectServiceEndpointInterceptor(ObjectName objectName, String ejbName)
+ {
+ // Dynamically add the service endpoint interceptor
+ // http://jira.jboss.org/jira/browse/JBWS-758
+ try
+ {
+ EjbModule ejbModule = (EjbModule)server.getAttribute(objectName, "EjbModule");
+ StatelessSessionContainer container = (StatelessSessionContainer)ejbModule.getContainer(ejbName);
+
+ boolean injectionPointFound = false;
+ Interceptor prev = container.getInterceptor();
+ while (prev != null && prev.getNext() != null)
+ {
+ Interceptor next = prev.getNext();
+ if (next.getNext() == null)
+ {
+ log.debug("Inject service endpoint interceptor after: " + prev.getClass().getName());
+ ServiceEndpointInterceptor sepInterceptor = new ServiceEndpointInterceptor();
+ prev.setNext(sepInterceptor);
+ sepInterceptor.setNext(next);
+ injectionPointFound = true;
+ }
+ prev = next;
+ }
+ if (injectionPointFound == false)
+ log.warn("Cannot service endpoint interceptor injection point");
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot add service endpoint interceptor", ex);
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,120 @@
+/*
+ * 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.invocation;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
+import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
+import org.jboss.wsf.spi.util.KernelLocator;
+
+import javax.xml.ws.WebServiceException;
+import java.lang.reflect.Method;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Heiko.Braun(a)jboss.com
+ *
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB3 extends AbstractInvocationHandler
+{
+
+ public static final String CONTAINER_NAME = "org.jboss.wsf.spi.invocation.ContainerName";
+
+ private String containerName;
+ private KernelController houston;
+ private ServiceEndpointContainer serviceEndpointContainer;
+
+
+ InvocationHandlerEJB3()
+ {
+ houston = KernelLocator.getKernel().getController();
+ }
+
+ public Invocation createInvocation()
+ {
+ return new Invocation();
+ }
+
+ public void init(Endpoint ep)
+ {
+ containerName = (String)ep.getProperty(InvocationHandlerEJB3.CONTAINER_NAME);
+ assert containerName!=null : "Target container name not set";
+
+ }
+
+ private ServiceEndpointContainer lazyInitializeInvocationTarget()
+ {
+ if(null==this.serviceEndpointContainer)
+ {
+ ControllerContext context = houston.getInstalledContext(containerName);
+ if (context == null)
+ throw new WebServiceException("Cannot find service endpoint target: " + containerName);
+
+ assert (context.getTarget() instanceof ServiceEndpointContainer) : "Invocation target mismatch";
+ this.serviceEndpointContainer = (ServiceEndpointContainer) context.getTarget();
+ }
+
+ return this.serviceEndpointContainer;
+ }
+
+ public void invoke(Endpoint ep, Invocation wsInv) throws Exception
+ {
+ try
+ {
+ ServiceEndpointContainer invocationTarget = lazyInitializeInvocationTarget();
+
+ Class beanClass = invocationTarget.getServiceImplementationClass();
+ Method method = getImplMethod(beanClass, wsInv.getJavaMethod());
+ Object[] args = wsInv.getArgs();
+ InvocationContextCallback invProps = new EJB3InvocationContextCallback(wsInv);
+
+ Object retObj = invocationTarget.invokeEndpoint(method, args, invProps);
+
+ wsInv.setReturnValue(retObj);
+ }
+ catch (Throwable th)
+ {
+ handleInvocationException(th);
+ }
+ }
+
+ static class EJB3InvocationContextCallback implements InvocationContextCallback
+ {
+ private Invocation wsInv;
+
+ public EJB3InvocationContextCallback(Invocation wsInv)
+ {
+ this.wsInv = wsInv;
+ }
+
+ public <T> T get(Class<T> propertyType)
+ {
+ return wsInv.getInvocationContext().getAttachment(propertyType);
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,65 @@
+/*
+ * 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.invocation;
+
+import org.jboss.wsf.spi.invocation.*;
+
+/**
+ * The default invocation model factory fro AS 5.0.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * Created: Jul 19, 2007
+ */
+public class InvocationHandlerFactoryImpl extends InvocationHandlerFactory
+{
+ public InvocationHandler newInvocationHandler(InvocationType type)
+ {
+ InvocationHandler handler = null;
+
+ switch(type)
+ {
+ case JAXRPC_JSE:
+ handler = new InvocationHandlerJAXRPC();
+ break;
+ case JAXRPC_EJB21:
+ handler = new InvocationHandlerEJB21();
+ break;
+ case JAXRPC_MDB21:
+ handler = new InvocationHandlerMDB21();
+ break;
+ case JAXWS_JSE:
+ handler = new InvocationHandlerJAXWS();
+ break;
+ case JAXWS_EJB3:
+ handler = new InvocationHandlerEJB3();
+ break;
+ case JAXWS_MDB3:
+ handler = new InvocationHandlerMDB3();
+ break;
+ }
+
+ if(null == handler)
+ throw new IllegalArgumentException("Unable to resolve spi.invocation.InvocationHandler for type " +type);
+
+ return handler;
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,70 @@
+/*
+ * 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.invocation;
+
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJAXRPC extends InvocationHandlerJSE
+{
+ public void invoke(Endpoint ep, Invocation epInv) throws Exception
+ {
+ try
+ {
+ Object targetBean = getTargetBean(ep, epInv);
+
+ InvocationContext invContext = epInv.getInvocationContext();
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ServletEndpointContext sepContext = invContext.getAttachment(ServletEndpointContext.class);
+ if (sepContext != null)
+ ((ServiceLifecycle)targetBean).init(sepContext);
+ }
+
+ try
+ {
+ super.invoke(ep, epInv);
+ }
+ finally
+ {
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)targetBean).destroy();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXWS.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXWS.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXWS.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,32 @@
+/*
+ * 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.invocation;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJAXWS extends InvocationHandlerJSE
+{
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJSE.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJSE.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,135 @@
+/*
+ * 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.invocation;
+
+import java.lang.reflect.Method;
+
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.wsf.common.JavaUtils;
+import org.jboss.wsf.common.injection.InjectionHelper;
+import org.jboss.wsf.common.injection.PreDestroyHolder;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.ResourceInjector;
+import org.jboss.wsf.spi.invocation.ResourceInjectorFactory;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author richard.opalka(a)jboss.com
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJSE extends InvocationHandler
+{
+ private SPIProvider spiProvider;
+ private ResourceInjectorFactory resourceInjectorFactory;
+
+ public InvocationHandlerJSE()
+ {
+ spiProvider = SPIProviderResolver.getInstance().getProvider();
+ resourceInjectorFactory = spiProvider.getSPI(ResourceInjectorFactory.class);
+ }
+
+ public Invocation createInvocation()
+ {
+ return new Invocation();
+ }
+
+ public void init(Endpoint ep)
+ {
+ }
+
+ protected Object getTargetBean(Endpoint ep, Invocation epInv) throws Exception
+ {
+ InvocationContext invCtx = epInv.getInvocationContext();
+ Object targetBean = invCtx.getTargetBean();
+ if (targetBean == null)
+ {
+ try
+ {
+ Class<?> epImpl = ep.getTargetBeanClass();
+ targetBean = epImpl.newInstance();
+ invCtx.setTargetBean(targetBean);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot get target bean instance", ex);
+ }
+
+ InjectionHelper.injectResources(targetBean, ep.getAttachment(InjectionsMetaData.class));
+ InjectionHelper.callPostConstructMethod(targetBean);
+ ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
+ }
+
+ return targetBean;
+ }
+
+ public void invoke(Endpoint ep, Invocation epInv) throws Exception
+ {
+ try
+ {
+ Object targetBean = getTargetBean(ep, epInv);
+
+ InvocationContext invContext = epInv.getInvocationContext();
+ WebServiceContext wsContext = invContext.getAttachment(WebServiceContext.class);
+ if (wsContext != null)
+ {
+ ResourceInjector injector = resourceInjectorFactory.newResourceInjector();
+ injector.inject(targetBean, wsContext);
+ }
+
+ Method method = getImplMethod(targetBean.getClass(), epInv.getJavaMethod());
+ Object retObj = method.invoke(targetBean, epInv.getArgs());
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ protected Method getImplMethod(Class<?> implClass, Method seiMethod) throws ClassNotFoundException, NoSuchMethodException
+ {
+ String methodName = seiMethod.getName();
+ Class<?>[] paramTypes = seiMethod.getParameterTypes();
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ Class<?> paramType = paramTypes[i];
+ if (JavaUtils.isPrimitive(paramType) == false)
+ {
+ String paramTypeName = paramType.getName();
+ paramType = JavaUtils.loadJavaType(paramTypeName);
+ paramTypes[i] = paramType;
+ }
+ }
+
+ Method implMethod = implClass.getMethod(methodName, paramTypes);
+ return implMethod;
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB21.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB21.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,86 @@
+/*
+ * 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.invocation;
+
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+
+/**
+ * Handles invocations on MDB EJB21 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerMDB21 extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerMDB21.class);
+
+ public Invocation createInvocation()
+ {
+ return new Invocation();
+ }
+
+ public void init(Endpoint ep)
+ {
+
+ }
+
+ public void invoke(Endpoint ep, Invocation epInv) throws Exception
+ {
+ log.debug("Invoke: " + epInv.getJavaMethod().getName());
+
+ try
+ {
+ InvocationContext invCtx = epInv.getInvocationContext();
+ Object targetBean = invCtx.getTargetBean();
+ if (targetBean == null)
+ {
+ try
+ {
+ Class epImpl = ep.getTargetBeanClass();
+ targetBean = epImpl.newInstance();
+ invCtx.setTargetBean(targetBean);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Canot get target bean instance", ex);
+ }
+ }
+ Class implClass = targetBean.getClass();
+ Method seiMethod = epInv.getJavaMethod();
+ Method implMethod = getImplMethod(implClass, seiMethod);
+
+ Object[] args = epInv.getArgs();
+ Object retObj = implMethod.invoke(targetBean, args);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB3.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB3.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,86 @@
+/*
+ * 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.invocation;
+
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+
+/**
+ * Handles invocations on MDB EJB3 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerMDB3 extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerMDB3.class);
+
+ public Invocation createInvocation()
+ {
+ return new Invocation();
+ }
+
+ public void init(Endpoint ep)
+ {
+
+ }
+
+ public void invoke(Endpoint ep, Invocation epInv) throws Exception
+ {
+ log.debug("Invoke: " + epInv.getJavaMethod().getName());
+
+ try
+ {
+ InvocationContext invCtx = epInv.getInvocationContext();
+ Object targetBean = invCtx.getTargetBean();
+ if (targetBean == null)
+ {
+ try
+ {
+ Class epImpl = ep.getTargetBeanClass();
+ targetBean = epImpl.newInstance();
+ invCtx.setTargetBean(targetBean);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Canot get target bean instance", ex);
+ }
+ }
+ Class implClass = targetBean.getClass();
+ Method seiMethod = epInv.getJavaMethod();
+ Method implMethod = getImplMethod(implClass, seiMethod);
+
+ Object[] args = epInv.getArgs();
+ Object retObj = implMethod.invoke(targetBean, args);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,37 @@
+/*
+ * 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.invocation;
+
+import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * Created: Jul 24, 2007
+ */
+public class SecurityAdapterFactoryImpl extends SecurityAdaptorFactory
+{
+ public SecurityAdaptor newSecurityAdapter()
+ {
+ return new SecurityAdaptorImpl();
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,98 @@
+/*
+ * 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.invocation;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+
+import javax.security.auth.Subject;
+
+/**
+ * A JBoss specific SecurityAssociationAdaptor
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class SecurityAdaptorImpl implements SecurityAdaptor
+{
+ SecurityAdaptorImpl()
+ {
+ }
+
+ public Principal getPrincipal()
+ {
+ return SecurityAssociation.getPrincipal();
+ }
+
+ public void setPrincipal(Principal pricipal)
+ {
+ SecurityAssociation.setPrincipal(pricipal);
+ }
+
+ public Object getCredential()
+ {
+ return SecurityAssociation.getCredential();
+ }
+
+ public void setCredential(Object credential)
+ {
+ SecurityAssociation.setCredential(credential);
+ }
+
+ public void pushSubjectContext(Subject subject, Principal principal, Object credential)
+ {
+ SecurityAdaptorImpl.pushSubjectContext(principal, credential, subject);
+ }
+
+ private static SecurityContext getSecurityContext()
+ {
+ return (SecurityContext)AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run()
+ {
+ return SecurityContextAssociation.getSecurityContext();
+ }
+ });
+ }
+
+ private static void pushSubjectContext(final Principal p, final Object cred, final Subject s)
+ {
+ AccessController.doPrivileged(new PrivilegedAction() {
+
+ public Object run()
+ {
+ SecurityContext sc = getSecurityContext();
+ if (sc == null)
+ throw new IllegalStateException("Security Context is null");
+ sc.getUtil().createSubjectInfo(p, cred, s);
+ return null;
+ }
+ });
+ }
+
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,124 @@
+/*
+ * 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.invocation;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.invocation.HandlerCallback;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+
+/**
+ * This Interceptor does the ws4ee handler processing.
+ *
+ * According to the ws4ee spec the handler logic must be invoked after the container
+ * applied method level security to the invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Sep-2005
+ */
+public class ServiceEndpointInterceptor extends AbstractInterceptor
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ServiceEndpointInterceptor.class);
+
+ // Interceptor implementation --------------------------------------
+
+ /** Before and after we call the service endpoint bean, we process the handler chains.
+ */
+ public Object invoke(final org.jboss.invocation.Invocation jbInv) throws Exception
+ {
+ // If no msgContext, it's not for us
+ SOAPMessageContext msgContext = (SOAPMessageContext)jbInv.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ if (msgContext == null)
+ {
+ return getNext().invoke(jbInv);
+ }
+
+ // Get the endpoint invocation
+ Invocation wsInv = (Invocation)jbInv.getValue(Invocation.class.getName());
+
+ // Get the handler callback
+ HandlerCallback callback = (HandlerCallback)jbInv.getValue(HandlerCallback.class.getName());
+
+ // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
+ if (callback != null && wsInv != null)
+ {
+ try
+ {
+ // call the request handlers
+ boolean handlersPass = callback.callRequestHandlerChain(wsInv, HandlerType.ENDPOINT);
+ handlersPass = handlersPass && callback.callRequestHandlerChain(wsInv, HandlerType.POST);
+
+ // Call the next interceptor in the chain
+ if (handlersPass)
+ {
+ // The SOAPContentElements stored in the EndpointInvocation might have changed after
+ // handler processing. Get the updated request payload. This should be a noop if request
+ // handlers did not modify the incomming SOAP message.
+ Object[] reqParams = wsInv.getArgs();
+ jbInv.setArguments(reqParams);
+ Object resObj = getNext().invoke(jbInv);
+
+ // Setting the message to null should trigger binding of the response message
+ msgContext.setMessage(null);
+ wsInv.setReturnValue(resObj);
+ }
+
+ // call the response handlers
+ handlersPass = callback.callResponseHandlerChain(wsInv, HandlerType.POST);
+ handlersPass = handlersPass && callback.callResponseHandlerChain(wsInv, HandlerType.ENDPOINT);
+
+ // update the return value after response handler processing
+ Object resObj = wsInv.getReturnValue();
+
+ return resObj;
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ // call the fault handlers
+ boolean handlersPass = callback.callFaultHandlerChain(wsInv, HandlerType.POST, ex);
+ handlersPass = handlersPass && callback.callFaultHandlerChain(wsInv, HandlerType.ENDPOINT, ex);
+ }
+ catch (Exception subEx)
+ {
+ log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
+ }
+ throw ex;
+ }
+ finally
+ {
+ // do nothing
+ }
+ }
+ else
+ {
+ log.warn("Handler callback not available");
+ return getNext().invoke(jbInv);
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataAdapter.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataAdapter.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataAdapter.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,88 @@
+/*
+ * 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.ASIntegrationHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+
+/**
+ * Build container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public class ContainerMetaDataAdapter
+{
+
+ private EJBArchiveMetaDataAdapterEJB3 ejbMetaDataAdapterEJB3 = new EJBArchiveMetaDataAdapterEJB3();
+ private EJBArchiveMetaDataAdapterEJB21 ejbMetaDataAdapterEJB21 = new EJBArchiveMetaDataAdapterEJB21();
+ private JSEArchiveMetaDataAdapter webMetaDataAdapter = new JSEArchiveMetaDataAdapter();
+
+ public void setEjbMetaDataAdapterEJB21(EJBArchiveMetaDataAdapterEJB21 adapter)
+ {
+ this.ejbMetaDataAdapterEJB21 = adapter;
+ }
+
+ public void setEjbMetaDataAdapterEJB3(EJBArchiveMetaDataAdapterEJB3 adapter)
+ {
+ this.ejbMetaDataAdapterEJB3 = adapter;
+ }
+
+ public void setWebMetaDataAdapter(JSEArchiveMetaDataAdapter adapter)
+ {
+ this.webMetaDataAdapter = adapter;
+ }
+
+ public void buildContainerMetaData(Deployment dep, DeploymentUnit unit)
+ {
+ try
+ {
+ if ( ASIntegrationHelper.isPojoDeployment( unit ) )
+ {
+ JSEArchiveMetaData webMetaData = webMetaDataAdapter.buildMetaData(dep, unit);
+ dep.addAttachment(JSEArchiveMetaData.class, webMetaData);
+ }
+ else if ( ASIntegrationHelper.isJaxwsEjbDeployment(unit) )
+ {
+ EJBArchiveMetaData ejbMetaData = ejbMetaDataAdapterEJB3.buildMetaData(dep, unit);
+ dep.addAttachment(EJBArchiveMetaData.class, ejbMetaData);
+ }
+ else if ( ASIntegrationHelper.isJaxrpcEjbDeployment(unit) )
+ {
+ EJBArchiveMetaData ejbMetaData = ejbMetaDataAdapterEJB21.buildMetaData(dep, unit);
+ dep.addAttachment(EJBArchiveMetaData.class, ejbMetaData);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBArchiveMetaDataAdapterEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBArchiveMetaDataAdapterEJB21.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBArchiveMetaDataAdapterEJB21.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,174 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
+import org.jboss.metadata.javaee.spec.PortComponent;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.MDBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.SLSBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData.PublishLocationAdapter;
+
+/**
+ * Build container independent application meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class EJBArchiveMetaDataAdapterEJB21
+{
+ // logging support
+ private static Logger log = Logger.getLogger(EJBArchiveMetaDataAdapterEJB21.class);
+
+ public EJBArchiveMetaData buildMetaData(Deployment dep, DeploymentUnit unit)
+ {
+ JBossMetaData jbossMetaData = unit.getAttachment(JBossMetaData.class);
+ dep.addAttachment(JBossMetaData.class, jbossMetaData);
+
+ EJBArchiveMetaData ejbMetaData = new EJBArchiveMetaData();
+ buildEnterpriseBeansMetaData(ejbMetaData, jbossMetaData);
+ buildWebservicesMetaData(ejbMetaData, jbossMetaData);
+ ejbMetaData.setSecurityDomain(jbossMetaData.getSecurityDomain());
+
+ return ejbMetaData;
+ }
+
+ private void buildEnterpriseBeansMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbossMetaData)
+ {
+ List<EJBMetaData> targetBeans = new ArrayList<EJBMetaData>();
+ JBossEnterpriseBeansMetaData sourceBeans = jbossMetaData.getEnterpriseBeans();
+ Iterator<JBossEnterpriseBeanMetaData> it = sourceBeans.iterator();
+ while (it.hasNext())
+ {
+ JBossEnterpriseBeanMetaData bmd = it.next();
+ buildBeanMetaData(targetBeans, bmd);
+ }
+ ejbMetaData.setEnterpriseBeans(targetBeans);
+ }
+
+ private void buildWebservicesMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbossMetaData)
+ {
+ WebservicesMetaData webservices = jbossMetaData.getWebservices();
+ if (webservices != null)
+ {
+ String contextRoot = webservices.getContextRoot();
+ ejbMetaData.setWebServiceContextRoot(contextRoot);
+
+ ejbMetaData.setPublishLocationAdapter(getPublishLocationAdpater(webservices));
+
+ WebserviceDescriptionsMetaData wsDescriptions = webservices.getWebserviceDescriptions();
+ if (wsDescriptions != null)
+ {
+ if (wsDescriptions.size() > 1)
+ log.warn("Multiple <webservice-description> elements not supported");
+
+ if (wsDescriptions.size() > 0)
+ {
+ WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
+ ejbMetaData.setConfigName(wsd.getConfigName());
+ ejbMetaData.setConfigFile(wsd.getConfigFile());
+ }
+ }
+ }
+ }
+
+ private PublishLocationAdapter getPublishLocationAdpater(final WebservicesMetaData wsMetaData)
+ {
+ return new PublishLocationAdapter()
+ {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ String wsdlPublishLocation = null;
+ WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
+ if (wsDescriptions != null && wsDescriptions.get(name) != null)
+ {
+ WebserviceDescriptionMetaData wsdMetaData = wsDescriptions.get(name);
+ wsdlPublishLocation = wsdMetaData.getWsdlPublishLocation();
+ }
+ return wsdlPublishLocation;
+ }
+ };
+ }
+
+ private EJBMetaData buildBeanMetaData(List<EJBMetaData> ejbBeans, JBossEnterpriseBeanMetaData jbossBeansMetaData)
+ {
+ EJBMetaData targetBean = null;
+ if (jbossBeansMetaData.isSession())
+ {
+ targetBean = new SLSBMetaData();
+ JBossSessionBeanMetaData jbossSessionBean = (JBossSessionBeanMetaData)jbossBeansMetaData;
+
+ targetBean.setEjbName(jbossSessionBean.getEjbName());
+ targetBean.setEjbClass(jbossSessionBean.getEjbClass());
+ targetBean.setServiceEndpointInterface(jbossSessionBean.getServiceEndpoint());
+ targetBean.setHome(jbossSessionBean.getHome());
+ targetBean.setLocalHome(jbossSessionBean.getLocalHome());
+ targetBean.setJndiName(jbossSessionBean.determineJndiName());
+ targetBean.setLocalJndiName(jbossBeansMetaData.determineLocalJndiName());
+
+ PortComponent pcmd = jbossSessionBean.getPortComponent();
+ if (pcmd != null)
+ {
+ targetBean.setPortComponentName(pcmd.getPortComponentName());
+ targetBean.setPortComponentURI(pcmd.getPortComponentURI());
+ EJBSecurityMetaData smd = new EJBSecurityMetaData();
+ smd.setAuthMethod(pcmd.getAuthMethod());
+ smd.setTransportGuarantee(pcmd.getTransportGuarantee());
+ smd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
+ targetBean.setSecurityMetaData(smd);
+ }
+ }
+ else if (jbossBeansMetaData.isMessageDriven())
+ {
+ targetBean = new MDBMetaData();
+ JBossMessageDrivenBeanMetaData jbossMessageBean = (JBossMessageDrivenBeanMetaData)jbossBeansMetaData;
+
+ targetBean.setEjbName(jbossMessageBean.getEjbName());
+ targetBean.setEjbClass(jbossMessageBean.getEjbClass());
+ //targetBean.setServiceEndpointInterface(???);
+ //targetBean.setJndiName(???);
+ targetBean.setLocalJndiName(jbossBeansMetaData.getLocalJndiName());
+ ((MDBMetaData)targetBean).setDestinationJndiName(jbossMessageBean.getDestinationJndiName());
+ }
+
+ if (targetBean != null)
+ ejbBeans.add(targetBean);
+
+ return targetBean;
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBArchiveMetaDataAdapterEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBArchiveMetaDataAdapterEJB3.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBArchiveMetaDataAdapterEJB3.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,180 @@
+/*
+ * 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.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.j2ee.*;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData.PublishLocationAdapter;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Build container independent application meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Apr-2007
+ */
+public class EJBArchiveMetaDataAdapterEJB3
+{
+ // logging support
+ private static Logger log = Logger.getLogger(EJBArchiveMetaDataAdapterEJB3.class);
+
+ public EJBArchiveMetaData buildMetaData(Deployment dep, DeploymentUnit unit)
+ {
+ EJBArchiveMetaData umd = new EJBArchiveMetaData();
+
+ WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class);
+ buildEnterpriseBeansMetaData(umd, webServiceDeployment);
+
+ JBossMetaData jbMetaData = unit.getAttachment(JBossMetaData.class);
+ if (jbMetaData != null)
+ buildWebservicesMetaData(umd, jbMetaData);
+
+ return umd;
+ }
+
+ private void buildWebservicesMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbMetaData)
+ {
+ WebservicesMetaData wsMetaData = jbMetaData.getWebservices();
+ if (wsMetaData != null)
+ {
+ String contextRoot = wsMetaData.getContextRoot();
+ ejbMetaData.setWebServiceContextRoot(contextRoot);
+
+ ejbMetaData.setPublishLocationAdapter(getPublishLocationAdpater(wsMetaData));
+
+ WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
+ if (wsDescriptions != null)
+ {
+ if (wsDescriptions.size() > 1)
+ log.warn("Multiple <webservice-description> elements not supported");
+
+ if (wsDescriptions.size() > 0)
+ {
+ WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
+ ejbMetaData.setConfigName(wsd.getConfigName());
+ ejbMetaData.setConfigFile(wsd.getConfigFile());
+ }
+ }
+ }
+ }
+
+ private void buildEnterpriseBeansMetaData(EJBArchiveMetaData jarMetaData, WebServiceDeployment ejb3Deployment)
+ {
+ List<EJBMetaData> ejbMetaDataList = new ArrayList<EJBMetaData>();
+ Iterator<WebServiceDeclaration> it = ejb3Deployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+
+ PortComponentSpec pcMetaData = container.getAnnotation(PortComponentSpec.class);
+ MessageDriven mdbMetaData = container.getAnnotation(MessageDriven.class);
+
+ EJBMetaData ejbMetaData = null;
+
+ if(mdbMetaData!=null)
+ {
+ ejbMetaData = new MDBMetaData();
+
+ ActivationConfigProperty[] props = mdbMetaData.activationConfig();
+ if (props != null)
+ {
+ String destination = getActivationProperty("destination", props);
+ if (destination != null)
+ {
+ ((MDBMetaData)ejbMetaData).setDestinationJndiName(destination);
+ }
+ }
+ }
+ else
+ {
+ ejbMetaData = new SLSBMetaData();
+ }
+
+ if (ejbMetaData != null)
+ {
+ ejbMetaData.setEjbName(container.getComponentName());
+ ejbMetaData.setEjbClass(container.getComponentClassName());
+
+ if (pcMetaData != null)
+ {
+ ejbMetaData.setPortComponentName(pcMetaData.portComponentName());
+ ejbMetaData.setPortComponentURI(pcMetaData.portComponentURI());
+ EJBSecurityMetaData smd = new EJBSecurityMetaData();
+ smd.setAuthMethod(pcMetaData.authMethod());
+ smd.setTransportGuarantee(pcMetaData.transportGuarantee());
+ smd.setSecureWSDLAccess(pcMetaData.secureWSDLAccess());
+ ejbMetaData.setSecurityMetaData(smd);
+ }
+
+ ejbMetaDataList.add(ejbMetaData);
+ }
+ }
+
+ jarMetaData.setEnterpriseBeans(ejbMetaDataList);
+ }
+
+ private String getActivationProperty(String name, ActivationConfigProperty[] props)
+ {
+ String result = null;
+ for(ActivationConfigProperty p : props)
+ {
+ if(p.propertyName().equals(name))
+ {
+ result = p.propertyValue();
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ private PublishLocationAdapter getPublishLocationAdpater(final WebservicesMetaData wsMetaData)
+ {
+ return new PublishLocationAdapter() {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ String wsdlPublishLocation = null;
+ WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
+ if (wsDescriptions != null && wsDescriptions.get(name) != null)
+ {
+ WebserviceDescriptionMetaData wsdMetaData = wsDescriptions.get(name);
+ wsdlPublishLocation = wsdMetaData.getWsdlPublishLocation();
+ }
+ return wsdlPublishLocation;
+ }
+ };
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBBeanReferenceResolver.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBBeanReferenceResolver.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJBBeanReferenceResolver.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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 java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.ejb.EJB;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.resolvers.spi.EjbReference;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
+import org.jboss.wsf.common.injection.resolvers.AbstractReferenceResolver;
+
+/**
+ * EJB reference resolver.
+ *
+ * @author <a href="mailto:richard.opalka@jboss.org">Richard Opalka</a>
+ */
+public final class EJBBeanReferenceResolver extends AbstractReferenceResolver<EJB>
+{
+
+ /**
+ * Deployment unit used for resolving process.
+ */
+ private final DeploymentUnit unit;
+ /**
+ * Delegate used to resolve JNDI names.
+ */
+ private final EjbReferenceResolver delegate;
+
+ /**
+ * Constructor.
+ */
+ public EJBBeanReferenceResolver(final DeploymentUnit unit, final EjbReferenceResolver delegate)
+ {
+ super(EJB.class);
+
+ if (unit == null)
+ {
+ throw new IllegalArgumentException("Deployment unit cannot be null");
+ }
+ if (delegate == null)
+ {
+ throw new IllegalArgumentException("Ejb reference resolver cannot be null");
+ }
+
+ this.unit = unit;
+ this.delegate = delegate;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.wsf.common.injection.resolvers.AbstractReferenceResolver#resolveField(java.lang.reflect.Field)
+ */
+ @Override
+ protected String resolveField(final Field field)
+ {
+ final EJB ejbAnnotation = field.getAnnotation(EJB.class);
+ final Class<?> type = field.getType();
+ final EjbReference reference = getEjbReference(ejbAnnotation, type);
+
+ return this.delegate.resolveEjb(unit, reference);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.wsf.common.injection.resolvers.AbstractReferenceResolver#resolveMethod(java.lang.reflect.Method)
+ */
+ @Override
+ protected String resolveMethod(final Method method)
+ {
+ final EJB ejbAnnotation = method.getAnnotation(EJB.class);
+ final Class<?> type = method.getParameterTypes()[0];
+ final EjbReference reference = getEjbReference(ejbAnnotation, type);
+
+ return this.delegate.resolveEjb(unit, reference);
+ }
+
+ /**
+ * Constructs EjbReference.
+ *
+ * @param ejbAnnotation ejb annotation
+ * @param type fall back type
+ * @return ejb reference instance
+ */
+ private EjbReference getEjbReference(EJB ejbAnnotation, Class<?> type)
+ {
+ String beanInterface = ejbAnnotation.beanInterface().getName();
+ if (java.lang.Object.class.getName().equals(beanInterface))
+ {
+ beanInterface = type.getName();
+ }
+ return new EjbReference(ejbAnnotation.beanName(), beanInterface, ejbAnnotation.mappedName());
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEArchiveMetaDataAdapter.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEArchiveMetaDataAdapter.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEArchiveMetaDataAdapter.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,204 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ear.spec.ModuleMetaData;
+import org.jboss.metadata.ear.spec.WebModuleMetaData;
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData.PublishLocationAdapter;
+import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData.JSEResourceCollection;
+
+/**
+ * Build container independent web meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class JSEArchiveMetaDataAdapter
+{
+ // logging support
+ private static Logger log = Logger.getLogger(JSEArchiveMetaDataAdapter.class);
+
+ public JSEArchiveMetaData buildMetaData(Deployment dep, DeploymentUnit unit)
+ {
+ String contextRoot = null;
+
+ JBossWebMetaData jbossWebMetaData = unit.getAttachment(JBossWebMetaData.class);
+ dep.addAttachment(JBossWebMetaData.class, jbossWebMetaData);
+
+ if (unit.getParent() != null)
+ {
+ JBossAppMetaData appmd = unit.getParent().getAttachment(JBossAppMetaData.class);
+ if (appmd != null)
+ {
+ ModuleMetaData module = appmd.getModule(dep.getSimpleName());
+ if (module != null)
+ {
+ WebModuleMetaData web = (WebModuleMetaData) module.getValue();
+ contextRoot = web.getContextRoot();
+ }
+ }
+ }
+
+ if (contextRoot == null)
+ contextRoot = jbossWebMetaData.getContextRoot();
+
+ JSEArchiveMetaData umd = new JSEArchiveMetaData();
+ umd.setContextRoot(contextRoot);
+ umd.setServletMappings(getServletMappings(jbossWebMetaData));
+ umd.setServletClassNames(getServletClassMap(jbossWebMetaData));
+ umd.setSecurityDomain(jbossWebMetaData.getSecurityDomain());
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(jbossWebMetaData));
+ umd.setSecurityMetaData(getSecurityMetaData(jbossWebMetaData.getSecurityContraints()));
+
+ setConfigNameAndFile(umd, jbossWebMetaData);
+
+ return umd;
+ }
+
+ private void setConfigNameAndFile(JSEArchiveMetaData umd, JBossWebMetaData jbossWebMetaData)
+ {
+ String configName = null;
+ String configFile = null;
+
+ WebserviceDescriptionsMetaData wsDescriptions = jbossWebMetaData.getWebserviceDescriptions();
+ if (wsDescriptions != null && wsDescriptions.size() > 1)
+ log.warn("Multiple <webservice-description> elements not supported");
+
+ if (wsDescriptions != null && wsDescriptions.size() > 0)
+ {
+ WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
+ configName = wsd.getConfigName();
+ configFile = wsd.getConfigFile();
+ }
+
+ List<ParamValueMetaData> contextParams = jbossWebMetaData.getContextParams();
+ if (contextParams != null)
+ {
+ for (ParamValueMetaData ctxParam : contextParams)
+ {
+ if (ctxParam.getParamName().equals("jbossws-config-name"))
+ configName = ctxParam.getParamValue();
+ if (ctxParam.getParamName().equals("jbossws-config-file"))
+ configFile = ctxParam.getParamValue();
+ }
+ }
+
+ umd.setConfigName(configName);
+ umd.setConfigFile(configFile);
+ }
+
+ private PublishLocationAdapter getPublishLocationAdpater(final JBossWebMetaData wmd)
+ {
+ return new PublishLocationAdapter()
+ {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ WebserviceDescriptionsMetaData wsdmd = wmd.getWebserviceDescriptions();
+ WebserviceDescriptionMetaData wsmd = wsdmd.get(name);
+ String location = null;
+ if (wsmd != null)
+ location = wsmd.getWsdlPublishLocation();
+ return location;
+ }
+ };
+ }
+
+ protected List<JSESecurityMetaData> getSecurityMetaData(final List<SecurityConstraintMetaData> securityConstraints)
+ {
+ ArrayList<JSESecurityMetaData> unifiedsecurityMetaData = new ArrayList<JSESecurityMetaData>();
+ if (securityConstraints != null)
+ {
+ for (SecurityConstraintMetaData securityMetaData : securityConstraints)
+ {
+ JSESecurityMetaData current = new JSESecurityMetaData();
+ unifiedsecurityMetaData.add(current);
+
+ current.setTransportGuarantee(securityMetaData.getTransportGuarantee().name());
+
+ WebResourceCollectionsMetaData resources = securityMetaData.getResourceCollections();
+ for (WebResourceCollectionMetaData webResource : resources)
+ {
+ JSEResourceCollection currentResource = current.addWebResource(webResource.getName());
+ for (String currentPattern : webResource.getUrlPatterns())
+ {
+ currentResource.addPattern(currentPattern);
+ }
+ }
+ }
+ }
+ return unifiedsecurityMetaData;
+ }
+
+ private Map<String, String> getServletMappings(JBossWebMetaData wmd)
+ {
+ Map<String, String> mappings = new HashMap<String, String>();
+ List<ServletMappingMetaData> smappings = wmd.getServletMappings();
+ if (smappings != null)
+ {
+ for(ServletMappingMetaData mapping : smappings)
+ {
+ // FIXME - Add support for multiple mappings
+ mappings.put(mapping.getServletName(), mapping.getUrlPatterns().get(0));
+ }
+ }
+ return mappings;
+ }
+
+ private Map<String, String> getServletClassMap(JBossWebMetaData wmd)
+ {
+ Map<String, String> mappings = new HashMap<String, String>();
+ JBossServletsMetaData servlets = wmd.getServlets();
+ if (servlets != null)
+ {
+ for (ServletMetaData servlet : servlets)
+ {
+ // Skip JSPs
+ if (servlet.getServletClass() == null || servlet.getServletClass().length() == 0)
+ continue;
+
+ mappings.put(servlet.getName(), servlet.getServletClass());
+ }
+ }
+ return mappings;
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandler.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandler.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandler.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,40 @@
+/*
+ * 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.tomcat;
+
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+
+/**
+ * Handle web app security meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public interface SecurityHandler
+{
+ /** Add the security domain to jboss-web.xml */
+ void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep);
+
+ /** Add the security roles to web.xml */
+ void addSecurityRoles(JBossWebMetaData webApp, Deployment dep);
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB21.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB21.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,66 @@
+/*
+ * 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.tomcat;
+
+import org.jboss.metadata.common.ejb.IAssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+
+/**
+ * Handle web app security meta data for EJB21
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+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");
+
+ String securityDomain = ejbMetaData.getSecurityDomain();
+ if (securityDomain != null)
+ {
+ if (securityDomain.startsWith("java:/jaas/") == false)
+ securityDomain = "java:/jaas/" + securityDomain;
+
+ jbossWeb.setSecurityDomain(securityDomain);
+ }
+ }
+
+ public void addSecurityRoles(JBossWebMetaData webApp, Deployment dep)
+ {
+ JBossMetaData jbmd = dep.getAttachment(JBossMetaData.class);
+ IAssemblyDescriptorMetaData assemblyDescriptor = jbmd.getAssemblyDescriptor();
+ if (assemblyDescriptor != null)
+ {
+ SecurityRolesMetaData securityRoles = assemblyDescriptor.getSecurityRoles();
+ if (securityRoles != null)
+ webApp.setSecurityRoles(securityRoles);
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB3.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB3.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,97 @@
+/*
+ * 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.tomcat;
+
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+
+import javax.annotation.security.RolesAllowed;
+import java.util.Iterator;
+
+/**
+ * Handle web app security meta data for EJB3
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class SecurityHandlerEJB3 implements SecurityHandler
+{
+ public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep)
+ {
+ String securityDomain = null;
+
+ WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class);
+ if (webServiceDeployment != null)
+ {
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ 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");
+
+ securityDomain = anSecurityDomain.value();
+ }
+ }
+ }
+
+ if (securityDomain != null)
+ {
+ if (securityDomain.startsWith("java:/jaas/") == false)
+ securityDomain = "java:/jaas/" + securityDomain;
+
+ jbossWeb.setSecurityDomain(securityDomain);
+ }
+ }
+
+ public void addSecurityRoles(JBossWebMetaData webApp, Deployment dep)
+ {
+ WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class);
+ if (webServiceDeployment != null)
+ {
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+ RolesAllowed anRolesAllowed = container.getAnnotation(RolesAllowed.class);
+ if (anRolesAllowed != null)
+ {
+ SecurityRolesMetaData securityRoles = webApp.getSecurityRoles();
+ for (String roleName : anRolesAllowed.value())
+ {
+ SecurityRoleMetaData role = new SecurityRoleMetaData();
+ role.setRoleName(roleName);
+ securityRoles.add(role);
+ }
+ }
+ }
+ }
+ }
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,38 @@
+/*
+ * 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.tomcat;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+
+/**
+ * Modifies the web app according to the stack requirements.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public interface WebMetaDataModifier
+{
+ static String PROPERTY_WEBAPP_CONTEXT_PARAMETERS = "org.jboss.ws.webapp.ContextParameterMap";
+ static String PROPERTY_WEBAPP_SERVLET_CLASS = "org.jboss.ws.webapp.ServletClass";
+
+ void modifyMetaData( Deployment dep );
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifierImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifierImpl.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifierImpl.java 2009-07-02 19:17:30 UTC (rev 10299)
@@ -0,0 +1,178 @@
+/*
+ * 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.tomcat;
+
+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.ListenerMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+import javax.xml.ws.WebServiceException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The rewriter for web.xml
+ *
+ * @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)
+ {
+ JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
+ if (jbwmd == null)
+ throw new WebServiceException("Cannot find web meta data");
+
+ try
+ {
+ modifyMetaData(dep, jbwmd);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+
+ private void modifyMetaData(Deployment dep, JBossWebMetaData jbwmd) throws ClassNotFoundException
+ {
+ 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)
+ {
+ List<ParamValueMetaData> contextParams = jbwmd.getContextParams();
+ if (contextParams == null)
+ {
+ contextParams = new ArrayList<ParamValueMetaData>();
+ jbwmd.setContextParams(contextParams);
+ }
+
+ for (Map.Entry<String, String> entry : depCtxParams.entrySet())
+ {
+ ParamValueMetaData param = new ParamValueMetaData();
+ param.setParamName(entry.getKey());
+ param.setParamValue(entry.getValue());
+ contextParams.add(param);
+ }
+ }
+
+ for (Iterator it = jbwmd.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();
+
+ // find the servlet-class
+ String orgServletClassName = servlet.getServletClass();
+
+ // JSP
+ if (orgServletClassName == null)
+ continue;
+
+ // Get the servlet class
+ Class orgServletClass = null;
+ try
+ {
+ ClassLoader loader = dep.getInitialClassLoader();
+ orgServletClass = loader.loadClass(orgServletClassName);
+ }
+ 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)
+ {
+ for (ParamValueMetaData initParam : servlet.getInitParam())
+ {
+ String paramName = initParam.getParamName();
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(paramName))
+ return true;
+ }
+ return false;
+ }
+}
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-02 18:28:31 UTC (rev 10298)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-07-02 19:17:30 UTC (rev 10299)
@@ -13,7 +13,7 @@
</bean>
<!-- An abstraction of server configuration aspects. -->
- <bean name="WSServerConfig" class="org.jboss.wsf.container.jboss50.deployer.ServerConfigImpl">
+ <bean name="WSServerConfig" class="org.jboss.webservices.integration.deployers.ServerConfigImpl">
<property name="mbeanServer"><inject bean="WSMBeanServerLocator" property="mbeanServer"/></property>
<!--
@@ -38,27 +38,27 @@
</bean>
<!-- deployers -->
- <bean name="WSDescriptorDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDescriptorDeployer">
+ <bean name="WSDescriptorDeployer" class="org.jboss.webservices.integration.deployers.WSDescriptorDeployer">
<property name="name">webservices.xml</property>
<property name="useSchemaValidation">true</property>
</bean>
- <bean name="WSEJBAdapterDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSEJBAdapterDeployer"/>
+ <bean name="WSEJBAdapterDeployer" class="org.jboss.webservices.integration.deployers.WSEJBAdapterDeployer"/>
- <bean name="WSTypeDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSTypeDeployer">
+ <bean name="WSTypeDeployer" class="org.jboss.webservices.integration.deployers.WSTypeDeployer">
<property name="relativeOrder">1</property> <!-- [JBDEPLOY-201] workaround -->
</bean>
- <bean name="WSDeploymentDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentDeployer">
+ <bean name="WSDeploymentDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentDeployer">
<property name="relativeOrder">2</property> <!-- [JBDEPLOY-201] workaround -->
</bean>
<!-- The AS deployment aspects wrapped in deployers -->
- <bean name="WSContainerMetaDataDeploymentAspect" class="org.jboss.wsf.container.jboss50.deployment.metadata.ContainerMetaDataDeploymentAspect">
+ <bean name="WSContainerMetaDataDeploymentAspect" class="org.jboss.webservices.integration.aspects.ContainerMetaDataDeploymentAspect">
<property name="provides">ContainerMetaData, VFSRoot</property>
</bean>
- <bean name="WSContainerMetaDataDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSContainerMetaDataDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSContainerMetaDataDeploymentAspect"/>
@@ -67,13 +67,13 @@
<property name="relativeOrder">12</property> <!-- [JBDEPLOY-201] workaround -->
</bean>
- <bean name="WSInjectionMetaDataDeploymentAspect" class="org.jboss.wsf.container.jboss50.deployment.metadata.InjectionMetaDataDeploymentAspect">
+ <bean name="WSInjectionMetaDataDeploymentAspect" class="org.jboss.webservices.integration.aspects.InjectionMetaDataDeploymentAspect">
<property name="requires">WebMetaData</property>
<property name="provides">InjectionMetaData</property>
<property name="ejbReferenceResolver"><inject bean="org.jboss.ejb3.EjbReferenceResolver"/></property>
</bean>
- <bean name="WSInjectionMetaDataDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSInjectionMetaDataDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSInjectionMetaDataDeploymentAspect"/>
@@ -87,7 +87,7 @@
<property name="provides">ContextRoot</property>
</bean>
- <bean name="WSContextRootDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSContextRootDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSContextRootDeploymentAspect"/>
@@ -101,7 +101,7 @@
<property name="provides">VirtualHosts</property>
</bean>
- <bean name="WSVirtualHostDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSVirtualHostDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSVirtualHostDeploymentAspect"/>
@@ -115,7 +115,7 @@
<property name="provides">EndpointAddress</property>
</bean>
- <bean name="WSEndpointAddressDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSEndpointAddressDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSEndpointAddressDeploymentAspect"/>
@@ -128,7 +128,7 @@
<property name="provides">LifecycleHandler</property>
</bean>
- <bean name="WSEndpointLifecycleDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSEndpointLifecycleDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSEndpointLifecycleDeploymentAspect"/>
@@ -142,7 +142,7 @@
<property name="provides">EndpointMetrics</property>
</bean>
- <bean name="WSEndpointMetricsDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSEndpointMetricsDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSEndpointMetricsDeploymentAspect"/>
@@ -156,7 +156,7 @@
<property name="provides">EndpointName</property>
</bean>
- <bean name="WSEndpointNameDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSEndpointNameDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSEndpointNameDeploymentAspect"/>
@@ -170,7 +170,7 @@
<property name="provides">RegisteredEndpoint</property>
</bean>
- <bean name="WSEndpointRegistryDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSEndpointRegistryDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSEndpointRegistryDeploymentAspect"/>
@@ -184,7 +184,7 @@
<property name="provides">URLPattern</property>
</bean>
- <bean name="WSURLPatternDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSURLPatternDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSURLPatternDeploymentAspect"/>
@@ -193,13 +193,13 @@
<property name="relativeOrder">15</property> <!-- [JBDEPLOY-201] workaround -->
</bean>
- <bean name="WSWebAppDeploymentAspect" class="org.jboss.wsf.container.jboss50.transport.WebAppDeploymentAspect">
+ <bean name="WSWebAppDeploymentAspect" class="org.jboss.webservices.integration.aspects.WebAppDeploymentAspect">
<property name="requires">WebMetaData, ContextProperties, StackDescriptor</property>
<property name="provides">WebMetaData</property>
<property name="webMetaDataModifier"><inject bean="WSWebMetaDataModifier"/></property>
</bean>
- <bean name="WSWebAppDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSWebAppDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSWebAppDeploymentAspect"/>
@@ -208,14 +208,14 @@
<property name="relativeOrder">33</property> <!-- [JBDEPLOY-201] workaround -->
</bean>
- <bean name="WSWebAppGeneratorDeploymentAspect" class="org.jboss.wsf.container.jboss50.transport.WebAppGeneratorDeploymentAspect">
+ <bean name="WSWebAppGeneratorDeploymentAspect" class="org.jboss.webservices.integration.aspects.WebAppGeneratorDeploymentAspect">
<property name="requires">VirtualHosts,URLPattern</property>
<property name="provides">WebMetaData</property>
<property name="securityHandlerEJB21"><inject bean="WSSecurityHandlerEJB21"/></property>
<property name="securityHandlerEJB3"><inject bean="WSSecurityHandlerEJB3"/></property>
</bean>
- <bean name="WSWebAppGeneratorDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
+ <bean name="WSWebAppGeneratorDeployer" class="org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer">
<constructor>
<parameter>
<inject bean="WSWebAppGeneratorDeploymentAspect"/>
@@ -225,8 +225,8 @@
</bean>
<!-- Deployment aspect helper beans -->
- <bean name="WSSecurityHandlerEJB21" class="org.jboss.wsf.container.jboss50.deployment.tomcat.SecurityHandlerEJB21"/>
- <bean name="WSSecurityHandlerEJB3" class="org.jboss.wsf.container.jboss50.deployment.tomcat.SecurityHandlerEJB3"/>
- <bean name="WSWebMetaDataModifier" class="org.jboss.wsf.container.jboss50.deployment.tomcat.WebMetaDataModifierImpl"/>
+ <bean name="WSSecurityHandlerEJB21" class="org.jboss.webservices.integration.tomcat.SecurityHandlerEJB21"/>
+ <bean name="WSSecurityHandlerEJB3" class="org.jboss.webservices.integration.tomcat.SecurityHandlerEJB3"/>
+ <bean name="WSWebMetaDataModifier" class="org.jboss.webservices.integration.tomcat.WebMetaDataModifierImpl"/>
</deployment>
Modified: container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory 2009-07-02 18:28:31 UTC (rev 10298)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory 2009-07-02 19:17:30 UTC (rev 10299)
@@ -1 +1 @@
-org.jboss.wsf.container.jboss50.invocation.InvocationHandlerFactoryImpl
\ No newline at end of file
+org.jboss.webservices.integration.invocation.InvocationHandlerFactoryImpl
\ No newline at end of file
Modified: container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory 2009-07-02 18:28:31 UTC (rev 10298)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory 2009-07-02 19:17:30 UTC (rev 10299)
@@ -1 +1 @@
-org.jboss.wsf.container.jboss50.invocation.SecurityAdapterFactoryImpl
\ No newline at end of file
+org.jboss.webservices.integration.invocation.SecurityAdapterFactoryImpl
\ No newline at end of file
15 years, 6 months
JBossWS SVN: r10298 - stack/native/branches/ropalka/modules/core/src/main/resources.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-02 14:28:31 -0400 (Thu, 02 Jul 2009)
New Revision: 10298
Modified:
stack/native/branches/ropalka/modules/core/src/main/resources/jbossws-native-config.xml
Log:
[JBWS-2332][JBWS-2382] refactoring
Modified: stack/native/branches/ropalka/modules/core/src/main/resources/jbossws-native-config.xml
===================================================================
--- stack/native/branches/ropalka/modules/core/src/main/resources/jbossws-native-config.xml 2009-07-02 18:27:38 UTC (rev 10297)
+++ stack/native/branches/ropalka/modules/core/src/main/resources/jbossws-native-config.xml 2009-07-02 18:28:31 UTC (rev 10298)
@@ -22,7 +22,7 @@
<!-- The stack specific deployment aspects wrapped in deployers -->
<bean name="WSNativeContextPropertiesDeploymentAspect" class="org.jboss.wsf.framework.deployment.ContextPropertiesDeploymentAspect">
- <property name="provides">ContextProperties, StackDescriptor, StackSpecificMetaData</property>
+ <property name="provides">ContextProperties, StackDescriptor</property>
<property name="contextProperties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.jboss.ws.webapp.ServletClass</key><value>org.jboss.wsf.stack.jbws.EndpointServlet</value></entry>
@@ -41,7 +41,7 @@
<bean name="WSNativeEagerInitializeDeploymentAspect" class="org.jboss.wsf.stack.jbws.EagerInitializeDeploymentAspect">
<property name="requires">UnifiedMetaDataModel</property>
- <property name="provides">InitializedMetaDataModel, StackSpecificMetaData</property>
+ <property name="provides">InitializedMetaDataModel</property>
</bean>
<bean name="WSNativeEagerInitializeDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -55,7 +55,7 @@
<bean name="WSNativeEndpointHandlerDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointHandlerDeploymentAspect">
<property name="requires">ContainerMetaData</property>
- <property name="provides">StackEndpointHandler, StackSpecificMetaData</property>
+ <property name="provides">StackEndpointHandler</property>
</bean>
<bean name="WSNativeEndpointHandlerDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -70,7 +70,7 @@
<bean name="WSNativeEndpointRecordProcessorDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointRecordProcessorDeploymentAspect">
<property name="mbeanServer"><inject bean="WSMBeanServerLocator" property="mbeanServer"/></property>
<property name="requires">RegisteredEndpoint</property>
- <property name="provides">EndpointRecordProcessors, StackSpecificMetaData</property>
+ <property name="provides">EndpointRecordProcessors</property>
<property name="processors">
<list class="java.util.ArrayList" elementClass="org.jboss.wsf.spi.management.recording.RecordProcessor">
<inject bean="WSMemoryBufferRecorder"/>
@@ -90,7 +90,6 @@
<bean name="WSNativeEventingDeploymentAspect" class="org.jboss.wsf.stack.jbws.EventingDeploymentAspect">
<property name="requires">UnifiedMetaDataModel</property>
- <property name="provides">StackSpecificMetaData</property>
</bean>
<bean name="WSNativeEventingDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -104,7 +103,7 @@
<bean name="WSNativePublishContractDeploymentAspect" class="org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect">
<property name="requires">UnifiedMetaDataModel, JAXBIntros</property>
- <property name="provides">PublishedContract, StackSpecificMetaData</property>
+ <property name="provides">PublishedContract</property>
</bean>
<bean name="WSNativePublishContractDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -118,7 +117,6 @@
<bean name="WSNativeServiceEndpointInvokerDeploymentAspect" class="org.jboss.wsf.stack.jbws.ServiceEndpointInvokerDeploymentAspect">
<property name="requires">UnifiedMetaDataModel</property>
- <property name="provides">StackSpecificMetaData</property>
</bean>
<bean name="WSNativeServiceEndpointInvokerDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -132,7 +130,6 @@
<bean name="WSNativeRMDeploymentAspect" class="org.jboss.ws.extensions.wsrm.server.RMDeploymentAspect">
<property name="requires">StackEndpointHandler, UnifiedMetaDataModel</property>
- <property name="provides">StackSpecificMetaData</property>
</bean>
<bean name="WSNativeRMDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -145,8 +142,8 @@
</bean>
<bean name="WSNativeUnifiedMetaDataDeploymentAspect" class="org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect">
- <property name="requires">RuntimeLoader, ContainerMetaData, URLPattern, VFSRoot, JAXBIntros</property>
- <property name="provides">UnifiedMetaDataModel, StackSpecificMetaData</property>
+ <property name="requires">ContainerMetaData, URLPattern, VFSRoot, JAXBIntros</property>
+ <property name="provides">UnifiedMetaDataModel</property>
</bean>
<bean name="WSNativeUnifiedMetaDataDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -159,7 +156,7 @@
</bean>
<bean name="WSJAXBIntroDeploymentAspect" class="org.jboss.wsf.stack.jbws.JAXBIntroDeploymentAspect">
- <property name="provides">JAXBIntros, StackSpecificMetaData</property>
+ <property name="provides">JAXBIntros</property>
</bean>
<bean name="WSJAXBIntroDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
15 years, 6 months
JBossWS SVN: r10297 - stack/metro/branches/ropalka/modules/server/src/main/resources.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-02 14:27:38 -0400 (Thu, 02 Jul 2009)
New Revision: 10297
Modified:
stack/metro/branches/ropalka/modules/server/src/main/resources/jbossws-metro-config.xml
Log:
[JBWS-2332][JBWS-2382] refactoring
Modified: stack/metro/branches/ropalka/modules/server/src/main/resources/jbossws-metro-config.xml
===================================================================
--- stack/metro/branches/ropalka/modules/server/src/main/resources/jbossws-metro-config.xml 2009-07-02 18:27:00 UTC (rev 10296)
+++ stack/metro/branches/ropalka/modules/server/src/main/resources/jbossws-metro-config.xml 2009-07-02 18:27:38 UTC (rev 10297)
@@ -27,7 +27,7 @@
<!-- The stack specific deployment aspects wrapped in deployers -->
<bean name="WSMetroContextPropertiesDeploymentAspect" class="org.jboss.wsf.framework.deployment.ContextPropertiesDeploymentAspect">
- <property name="provides">ContextProperties, StackSpecificMetaData</property>
+ <property name="provides">ContextProperties</property>
<property name="contextProperties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.jboss.ws.webapp.ServletClass</key><value>org.jboss.wsf.stack.metro.EndpointServlet</value></entry>
@@ -46,7 +46,7 @@
<bean name="WSMetroEndpointHandlerDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointHandlerDeploymentAspect">
<property name="requires">ContainerMetaData</property>
- <property name="provides">StackEndpointHandler, StackSpecificMetaData</property>
+ <property name="provides">StackEndpointHandler</property>
</bean>
<bean name="WSMetroEndpointHandlerDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -61,7 +61,7 @@
<bean name="WSMetroEndpointRecordProcessorDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointRecordProcessorDeploymentAspect">
<property name="mbeanServer"><inject bean="WSMBeanServerLocator" property="mbeanServer"/></property>
<property name="requires">RegisteredEndpoint</property>
- <property name="provides">EndpointRecordProcessors, StackSpecificMetaData</property>
+ <property name="provides">EndpointRecordProcessors</property>
<property name="processors">
<list class="java.util.ArrayList" elementClass="org.jboss.wsf.spi.management.recording.RecordProcessor">
<inject bean="WSMemoryBufferRecorder"/>
@@ -81,7 +81,7 @@
<bean name="WSMetroDescriptorDeploymentAspect" class="org.jboss.wsf.stack.metro.SunJaxwsDeploymentAspect">
<property name="requires">URLPattern</property>
- <property name="provides">StackDescriptor, StackSpecificMetaData</property>
+ <property name="provides">StackDescriptor</property>
</bean>
<bean name="WSMetroDescriptorDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -94,8 +94,8 @@
</bean>
<bean name="WSRuntimeModelDeploymentAspect" class="org.jboss.wsf.stack.metro.metadata.RuntimeModelDeploymentAspect">
- <property name="requires">RuntimeLoader, StackDescriptor</property>
- <property name="provides">RuntimeModel, StackSpecificMetaData</property>
+ <property name="requires">StackDescriptor</property>
+ <property name="provides">RuntimeModel</property>
</bean>
<bean name="WSRuntimeModelDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
15 years, 6 months
JBossWS SVN: r10296 - stack/cxf/branches/ropalka/modules/server/src/main/resources.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-02 14:27:00 -0400 (Thu, 02 Jul 2009)
New Revision: 10296
Modified:
stack/cxf/branches/ropalka/modules/server/src/main/resources/jbossws-cxf-config.xml
Log:
[JBWS-2332][JBWS-2382] refactoring
Modified: stack/cxf/branches/ropalka/modules/server/src/main/resources/jbossws-cxf-config.xml
===================================================================
--- stack/cxf/branches/ropalka/modules/server/src/main/resources/jbossws-cxf-config.xml 2009-07-02 18:26:18 UTC (rev 10295)
+++ stack/cxf/branches/ropalka/modules/server/src/main/resources/jbossws-cxf-config.xml 2009-07-02 18:27:00 UTC (rev 10296)
@@ -26,7 +26,7 @@
<!-- The stack specific deployment aspects wrapped in deployers -->
<bean name="WSCXFContextPropertiesDeploymentAspect" class="org.jboss.wsf.framework.deployment.ContextPropertiesDeploymentAspect">
- <property name="provides">ContextProperties, StackSpecificMetaData</property>
+ <property name="provides">ContextProperties</property>
<property name="contextProperties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.jboss.ws.webapp.ServletClass</key><value>org.jboss.wsf.stack.cxf.CXFServletExt</value></entry>
@@ -45,7 +45,7 @@
<bean name="WSCXFDescriptorDeploymentAspect" class="org.jboss.wsf.stack.cxf.DescriptorDeploymentAspect">
<property name="requires">EndpointAddress</property>
- <property name="provides">StackDescriptor, StackSpecificMetaData</property>
+ <property name="provides">StackDescriptor</property>
<property name="invokerEJB3">org.jboss.wsf.stack.cxf.InvokerEJB3</property>
<property name="invokerJSE">org.jboss.wsf.stack.cxf.InvokerJSE</property>
</bean>
@@ -61,7 +61,7 @@
<bean name="WSCXFEndpointHandlerDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointHandlerDeploymentAspect">
<property name="requires">ContainerMetaData</property>
- <property name="provides">StackEndpointHandler, StackSpecificMetaData</property>
+ <property name="provides">StackEndpointHandler</property>
</bean>
<bean name="WSCXFEndpointHandlerDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
@@ -76,7 +76,7 @@
<bean name="WSCXFEndpointRecordProcessorDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointRecordProcessorDeploymentAspect">
<property name="mbeanServer"><inject bean="WSMBeanServerLocator" property="mbeanServer"/></property>
<property name="requires">RegisteredEndpoint</property>
- <property name="provides">EndpointRecordProcessors, StackSpecificMetaData</property>
+ <property name="provides">EndpointRecordProcessors</property>
<property name="processors">
<list class="java.util.ArrayList" elementClass="org.jboss.wsf.spi.management.recording.RecordProcessor">
<inject bean="WSMemoryBufferRecorder"/>
15 years, 6 months
JBossWS SVN: r10295 - in container/jboss50/branches/ropalka-jboss510/src/main: java/org/jboss/wsf/container/jboss50/deployment and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-02 14:26:18 -0400 (Thu, 02 Jul 2009)
New Revision: 10295
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployment/RuntimeLoaderDeploymentAspect.java
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentAspectDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/stack-agnostic-jboss-beans.xml
Log:
[JBWS-2332][JBWS-2382] refactoring
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentAspectDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentAspectDeployer.java 2009-07-02 15:16:43 UTC (rev 10294)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentAspectDeployer.java 2009-07-02 18:26:18 UTC (rev 10295)
@@ -41,6 +41,8 @@
/** JBossWS specific inputs/outputs prefix. */
private static final String JBOSSWS_ATTACHMENT_PREFIX = "jbossws.";
+ /** JBossWS specific metadata. */
+ private static final String JBOSSWS_METADATA = WSDeploymentAspectDeployer.JBOSSWS_ATTACHMENT_PREFIX + "metadata";
/** Delegee. */
private final DeploymentAspect aspect;
@@ -51,13 +53,25 @@
*/
public WSDeploymentAspectDeployer( final DeploymentAspect aspect )
{
+ this( aspect, false );
+ }
+ /**
+ * Constructor.
+ *
+ * @param aspect deployment aspect
+ * @param lastAspect if this is the last JBossWS aspect in deployers chain
+ */
+ public WSDeploymentAspectDeployer( final DeploymentAspect aspect, final boolean lastAspect )
+ {
super();
-
- this.aspect = aspect;
// inputs
this.addInput( JBossWebMetaData.class );
this.addInput( Deployment.class );
+ if ( lastAspect )
+ {
+ this.addInput( WSDeploymentAspectDeployer.JBOSSWS_METADATA );
+ }
// propagate DA requirements and map them to deployer inputs
final Set< String > inputs = aspect.getRequiresAsSet();
@@ -68,6 +82,10 @@
// outputs
this.addOutput( JBossWebMetaData.class );
+ if ( !lastAspect )
+ {
+ this.addOutput( WSDeploymentAspectDeployer.JBOSSWS_METADATA );
+ }
// propagate DA provides and map them to deployer outputs
final Set< String > outputs = aspect.getProvidesAsSet();
@@ -75,6 +93,8 @@
{
this.addOutput( WSDeploymentAspectDeployer.JBOSSWS_ATTACHMENT_PREFIX + output );
}
+
+ this.aspect = aspect;
}
/**
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java 2009-07-02 15:16:43 UTC (rev 10294)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java 2009-07-02 18:26:18 UTC (rev 10295)
@@ -111,9 +111,6 @@
private void newJaxrpcEjbDeployment( final DeploymentUnit unit )
{
ArchiveDeployment dep = newDeployment(unit);
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
- dep.setRuntimeClassLoader(unit.getClassLoader());
- dep.setType(unit.getAttachment( DeploymentType.class ));
Service service = dep.getService();
@@ -162,9 +159,6 @@
private void newJaxwsEjbDeployment( final DeploymentUnit unit )
{
ArchiveDeployment dep = newDeployment(unit);
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
- dep.setRuntimeClassLoader(unit.getClassLoader());
- dep.setType(unit.getAttachment( DeploymentType.class ));
Service service = dep.getService();
@@ -204,9 +198,6 @@
private void newJaxrpcPojoDeployment( final DeploymentUnit unit )
{
ArchiveDeployment dep = newDeployment(unit);
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
- dep.setRuntimeClassLoader(null);
- dep.setType(unit.getAttachment( DeploymentType.class ));
Service service = dep.getService();
@@ -247,8 +238,6 @@
private void newJaxwsPojoDeployment( final DeploymentUnit unit )
{
ArchiveDeployment dep = newDeployment(unit);
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
- dep.setType(unit.getAttachment( DeploymentType.class ));
Service service = dep.getService();
@@ -311,6 +300,11 @@
ArchiveDeployment parentDep = (ArchiveDeployment)this.deploymentModelFactory.newDeployment(parentUnit.getSimpleName(), parentUnit.getClassLoader());
dep.setParent(parentDep);
}
+
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setRuntimeClassLoader(unit.getClassLoader());
+ dep.setType(unit.getAttachment( DeploymentType.class ));
+
return dep;
}
catch (Exception ex)
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployment/RuntimeLoaderDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployment/RuntimeLoaderDeploymentAspect.java 2009-07-02 15:16:43 UTC (rev 10294)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployment/RuntimeLoaderDeploymentAspect.java 2009-07-02 18:26:18 UTC (rev 10295)
@@ -1,41 +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.wsf.container.jboss50.deployment;
-
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentAspect;
-
-/**
- * Determines the correct runtime loader and makes it available through the {@link Deployment}.
- *
- * @author Heiko.Braun(a)jboss.com
- * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
- */
-public class RuntimeLoaderDeploymentAspect extends DeploymentAspect
-{
-
- public void create( final Deployment dep )
- {
- dep.setRuntimeClassLoader( dep.getInitialClassLoader() );
- }
-
-}
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-02 15:16:43 UTC (rev 10294)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-07-02 18:26:18 UTC (rev 10295)
@@ -125,12 +125,6 @@
</bean>
<bean name="WSEndpointLifecycleDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointLifecycleDeploymentAspect">
- <property name="requires">
- ContainerMetaData, ContextProperties, ContextRoot, EndpointAddress,
- EndpointMetrics, EndpointName, EndpointRecordProcessors, InjectionMetaData,
- RegisteredEndpoint, RuntimeLoader, URLPattern, StackEndpointHandler,
- StackDescriptor, VirtualHosts, VFSRoot, WebMetaData, StackSpecificMetaData
- </property>
<property name="provides">LifecycleHandler</property>
</bean>
@@ -139,6 +133,7 @@
<parameter>
<inject bean="WSEndpointLifecycleDeploymentAspect"/>
</parameter>
+ <parameter>true</parameter>
</constructor>
<property name="relativeOrder">37</property> <!-- [JBDEPLOY-201] workaround -->
</bean>
@@ -184,20 +179,6 @@
<property name="relativeOrder">35</property> <!-- [JBDEPLOY-201] workaround -->
</bean>
- <bean name="WSRuntimeLoaderDeploymentAspect" class="org.jboss.wsf.container.jboss50.deployment.RuntimeLoaderDeploymentAspect">
- <property name="requires">ContainerMetaData</property>
- <property name="provides">RuntimeLoader</property>
- </bean>
-
- <bean name="WSRuntimeLoaderDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentAspectDeployer">
- <constructor>
- <parameter>
- <inject bean="WSRuntimeLoaderDeploymentAspect"/>
- </parameter>
- </constructor>
- <property name="relativeOrder">19</property> <!-- [JBDEPLOY-201] workaround -->
- </bean>
-
<bean name="WSURLPatternDeploymentAspect" class="org.jboss.wsf.framework.deployment.BackwardCompatibleURLPatternDeploymentAspect">
<property name="requires">ContextRoot, ContainerMetaData</property>
<property name="provides">URLPattern</property>
15 years, 6 months
JBossWS SVN: r10294 - in stack/native/branches/netty: modules/client and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-07-02 11:16:43 -0400 (Thu, 02 Jul 2009)
New Revision: 10294
Removed:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RemotingRMUnMarshaller.java
Modified:
stack/native/branches/netty/modules/client/pom.xml
stack/native/branches/netty/modules/core/pom.xml
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.java
stack/native/branches/netty/pom.xml
Log:
Removing remoting dependency
Modified: stack/native/branches/netty/modules/client/pom.xml
===================================================================
--- stack/native/branches/netty/modules/client/pom.xml 2009-07-02 14:38:33 UTC (rev 10293)
+++ stack/native/branches/netty/modules/client/pom.xml 2009-07-02 15:16:43 UTC (rev 10294)
@@ -49,7 +49,7 @@
<configuration>
<archive>
<manifestEntries>
- <Class-Path>jbossws-spi.jar jbossws-common.jar jbossws-framework.jar jbossws-native-core.jar jbossws-native-jaxrpc.jar jbossws-native-jaxws.jar jbossws-native-jaxws-ext.jar jbossws-native-saaj.jar activation.jar commons-logging.jar concurrent.jar javassist.jar jaxb-api.jar jaxb-impl.jar mail.jar jboss-remoting.jar jboss-xml-binding.jar netty.jar policy.jar stax-api.jar wsdl4j.jar</Class-Path>
+ <Class-Path>jbossws-spi.jar jbossws-common.jar jbossws-framework.jar jbossws-native-core.jar jbossws-native-jaxrpc.jar jbossws-native-jaxws.jar jbossws-native-jaxws-ext.jar jbossws-native-saaj.jar activation.jar commons-logging.jar concurrent.jar javassist.jar jaxb-api.jar jaxb-impl.jar mail.jar jboss-xml-binding.jar netty.jar policy.jar stax-api.jar wsdl4j.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Modified: stack/native/branches/netty/modules/core/pom.xml
===================================================================
--- stack/native/branches/netty/modules/core/pom.xml 2009-07-02 14:38:33 UTC (rev 10293)
+++ stack/native/branches/netty/modules/core/pom.xml 2009-07-02 15:16:43 UTC (rev 10294)
@@ -145,10 +145,6 @@
<artifactId>jboss-jaxb-intros</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.remoting</groupId>
- <artifactId>jboss-remoting</artifactId>
- </dependency>
- <dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
</dependency>
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-07-02 14:38:33 UTC (rev 10293)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-07-02 15:16:43 UTC (rev 10294)
@@ -49,11 +49,11 @@
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.soap.SOAPFaultException;
-import org.jboss.remoting.transport.http.HTTPMetadataConstants;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonClient;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.client.NettyClient;
import org.jboss.ws.core.jaxws.binding.BindingExt;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
@@ -216,7 +216,7 @@
Map<?, ?> remotingMetadata = (Map)msgContext.get(CommonMessageContext.REMOTING_METADATA);
// Get the HTTP_RESPONSE_CODE
- Integer resposeCode = (Integer)remotingMetadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ Integer resposeCode = (Integer)remotingMetadata.get(NettyClient.RESPONSE_CODE);
if (resposeCode != null)
msgContext.put(MessageContextJAXWS.HTTP_RESPONSE_CODE, resposeCode);
Deleted: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RemotingRMUnMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RemotingRMUnMarshaller.java 2009-07-02 14:38:33 UTC (rev 10293)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RemotingRMUnMarshaller.java 2009-07-02 15:16:43 UTC (rev 10294)
@@ -1,74 +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.ws.extensions.wsrm.transport;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
-import org.jboss.remoting.marshal.UnMarshaller;
-
-
-/**
- * Unmarshalls byte array from the input stream
- *
- * @author richard.opalka(a)jboss.com
- */
-public final class RemotingRMUnMarshaller implements UnMarshaller
-{
- private static final UnMarshaller instance = new RemotingRMUnMarshaller();
-
- public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
- {
- return getInstance();
- }
-
- public static UnMarshaller getInstance()
- {
- return instance;
- }
-
- public Object read(InputStream is, Map metadata) throws IOException
- {
- if (is == null)
- return RMMessageFactory.newMessage(null, new RMMetadata(metadata)); // TODO: investigate why is == null (WSAddressing reply-to test)
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buffer = new byte[1024];
- int count = -1;
- count = is.read(buffer);
- while (count != -1)
- {
- baos.write(buffer, 0, count);
- count = is.read(buffer);
- }
- return RMMessageFactory.newMessage(baos.toByteArray(), new RMMetadata(metadata));
- }
-
- public void setClassLoader(ClassLoader classloader)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.java 2009-07-02 14:38:33 UTC (rev 10293)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.java 2009-07-02 15:16:43 UTC (rev 10294)
@@ -98,7 +98,6 @@
Channel c = bootstrap.bind(new InetSocketAddress(this.port));
channelGroup.add(c);
LOG.debug("WS-RM Backports Server started on port: " + this.port);
- System.out.println("WS-RM Backports Server started on port: " + this.port);
}
catch (Exception e)
{
Modified: stack/native/branches/netty/pom.xml
===================================================================
--- stack/native/branches/netty/pom.xml 2009-07-02 14:38:33 UTC (rev 10293)
+++ stack/native/branches/netty/pom.xml 2009-07-02 15:16:43 UTC (rev 10294)
@@ -68,7 +68,6 @@
<jboss.common.version>1.2.1.GA</jboss.common.version>
<jboss.jaxbintros.version>1.0.0.GA</jboss.jaxbintros.version>
<jboss.logging.version>2.0.5.GA</jboss.logging.version>
- <jboss.remoting.version>2.5.0.SP2</jboss.remoting.version>
<jboss.jaxr.version>1.2.1.GA</jboss.jaxr.version>
<apache.scout.version>0.7rc2</apache.scout.version>
<juddi.version>0.9RC4</juddi.version>
@@ -216,11 +215,6 @@
<artifactId>jboss-common</artifactId>
<version>${jboss.common.version}</version>
</dependency>
- <dependency>
- <groupId>org.jboss.remoting</groupId>
- <artifactId>jboss-remoting</artifactId>
- <version>${jboss.remoting.version}</version>
- </dependency>
<!-- transitive dependencies -->
<dependency>
<groupId>commons-logging</groupId>
15 years, 6 months
JBossWS SVN: r10293 - in stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws: extensions/wsrm/transport/backchannel and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-07-02 10:38:33 -0400 (Thu, 02 Jul 2009)
New Revision: 10293
Added:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSServerPipelineFactory.java
Modified:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsInvocationHandler.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandler.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.java
Log:
Using Netty instead of Remoting for WS-RM back ports server
Added: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSServerPipelineFactory.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSServerPipelineFactory.java (rev 0)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSServerPipelineFactory.java 2009-07-02 14:38:33 UTC (rev 10293)
@@ -0,0 +1,82 @@
+/*
+ * 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.ws.core.client;
+
+import static org.jboss.netty.channel.Channels.pipeline;
+
+import org.jboss.netty.channel.ChannelHandler;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.handler.codec.http.HttpChunkAggregator;
+import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
+import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Jul-2009
+ *
+ */
+public class WSServerPipelineFactory implements ChannelPipelineFactory
+{
+ private static final int MAX_CONTENT_SIZE = 1073741824;
+ private ChannelHandler requestHandler;
+ private ChannelHandler sshHandler;
+
+ public ChannelPipeline getPipeline() throws Exception
+ {
+ // Create a default pipeline implementation.
+ ChannelPipeline pipeline = pipeline();
+ // Uncomment the following line if you want HTTPS
+ //SSLEngine engine = SecureChatSslContextFactory.getServerContext().createSSLEngine();
+ //engine.setUseClientMode(false);
+ //pipeline.addLast("ssl", new SslHandler(engine));
+
+ pipeline.addLast("decoder", new HttpRequestDecoder());
+ // Uncomment the following line if you don't want to handle HttpChunks.
+ pipeline.addLast("aggregator", new HttpChunkAggregator(MAX_CONTENT_SIZE));
+ pipeline.addLast("encoder", new HttpResponseEncoder());
+ pipeline.addLast("handler", requestHandler);
+ return pipeline;
+ }
+
+ public ChannelHandler getRequestHandler()
+ {
+ return requestHandler;
+ }
+
+ public void setRequestHandler(ChannelHandler requestHandler)
+ {
+ this.requestHandler = requestHandler;
+ }
+
+ public ChannelHandler getSshHandler()
+ {
+ return sshHandler;
+ }
+
+ public void setSshHandler(ChannelHandler sshHandler)
+ {
+ this.sshHandler = sshHandler;
+ }
+
+}
Property changes on: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSServerPipelineFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsInvocationHandler.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsInvocationHandler.java 2009-07-02 14:04:22 UTC (rev 10292)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsInvocationHandler.java 2009-07-02 14:38:33 UTC (rev 10293)
@@ -21,76 +21,179 @@
*/
package org.jboss.ws.extensions.wsrm.transport.backchannel;
+import java.net.URL;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import javax.management.MBeanServer;
-
import org.jboss.logging.Logger;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.coyote.RequestMap;
-import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferInputStream;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.ExceptionEvent;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.handler.codec.http.Cookie;
+import org.jboss.netty.handler.codec.http.CookieDecoder;
+import org.jboss.netty.handler.codec.http.CookieEncoder;
+import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
+import org.jboss.netty.handler.codec.http.HttpHeaders;
+import org.jboss.netty.handler.codec.http.HttpRequest;
+import org.jboss.netty.handler.codec.http.HttpResponse;
+import org.jboss.netty.handler.codec.http.HttpResponseStatus;
+import org.jboss.netty.handler.codec.http.HttpVersion;
+import org.jboss.ws.extensions.wsrm.transport.RMMessage;
+import org.jboss.ws.extensions.wsrm.transport.RMUnMarshaller;
/**
* TODO: Add comment
*
* @author richard.opalka(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
*
* @since Nov 20, 2007
*/
-public final class RMBackPortsInvocationHandler implements ServerInvocationHandler
+public final class RMBackPortsInvocationHandler extends SimpleChannelUpstreamHandler
{
private static final Logger LOG = Logger.getLogger(RMBackPortsInvocationHandler.class);
private final List<RMCallbackHandler> callbacks = new LinkedList<RMCallbackHandler>();
private final Lock lock = new ReentrantLock();
-
+
+
public RMBackPortsInvocationHandler()
{
}
- public RMCallbackHandler getCallback(String requestPath)
+ @Override
+ public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
{
+ // HERE: Add all accepted channels to the group
+ // so that they are closed properly on shutdown
+ // If the added channel is closed before shutdown,
+ // it will be removed from the group automatically.
+ RMBackPortsServer.channelGroup.add(ctx.getChannel());
+ }
+
+ @Override
+ public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
+ {
+ HttpRequest request = (HttpRequest)e.getMessage();
+ ChannelBuffer content = request.getContent();
+
+ Map<String, Object> requestHeaders = new HashMap<String, Object>();
+ for (String headerName : request.getHeaderNames())
+ {
+ requestHeaders.put(headerName, request.getHeaders(headerName));
+ }
+ boolean error = false;
+ try
+ {
+ String requestPath = new URL(request.getUri()).getPath();
+ RMMessage message = (RMMessage)RMUnMarshaller.getInstance().read(content.readable() ? new ChannelBufferInputStream(content) : null, requestHeaders);
+ handle(requestPath, message);
+ }
+ catch (Throwable t)
+ {
+ error = true;
+ LOG.error("Error decoding request to the backport", t);
+ }
+ finally
+ {
+ writeResponse(e, request, error);
+ }
+ }
+
+
+ private void handle(String requestPath, RMMessage message)
+ {
this.lock.lock();
try
{
+ boolean handlerExists = false;
for (RMCallbackHandler handler : this.callbacks)
{
if (handler.getHandledPath().equals(requestPath))
- return handler;
+ {
+ handlerExists = true;
+ LOG.debug("Handling request path: " + requestPath);
+ handler.handle(message);
+ break;
+ }
}
+ if (handlerExists == false)
+ LOG.warn("No callback handler registered for path: " + requestPath);
}
finally
{
this.lock.unlock();
}
+ }
+
+ private void writeResponse(MessageEvent e, HttpRequest request, boolean error)
+ {
+ // Build the response object.
+ HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, error ? HttpResponseStatus.INTERNAL_SERVER_ERROR : HttpResponseStatus.OK);
+ response.setHeader(HttpHeaders.Names.CONTENT_TYPE, "text/plain; charset=UTF-8");
- return null;
+ String cookieString = request.getHeader(HttpHeaders.Names.COOKIE);
+ if (cookieString != null)
+ {
+ CookieDecoder cookieDecoder = new CookieDecoder();
+ Set<Cookie> cookies = cookieDecoder.decode(cookieString);
+ if (!cookies.isEmpty())
+ {
+ // Reset the cookies if necessary.
+ CookieEncoder cookieEncoder = new CookieEncoder(true);
+ for (Cookie cookie : cookies)
+ {
+ cookieEncoder.addCookie(cookie);
+ }
+ response.addHeader(HttpHeaders.Names.SET_COOKIE, cookieEncoder.encode());
+ }
+ }
+
+ // Write the response.
+ e.getChannel().write(response);
+ e.getChannel().close();
}
- public void registerCallback(RMCallbackHandler callbackHandler)
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception
{
+ e.getCause().printStackTrace();
+ e.getChannel().close();
+ }
+
+ public RMCallbackHandler getCallback(String requestPath)
+ {
this.lock.lock();
try
{
- this.callbacks.add(callbackHandler);
+ for (RMCallbackHandler handler : this.callbacks)
+ {
+ if (handler.getHandledPath().equals(requestPath))
+ return handler;
+ }
}
finally
{
this.lock.unlock();
}
+
+ return null;
}
- public void unregisterCallback(RMCallbackHandler callbackHandler)
+ public void registerCallback(RMCallbackHandler callbackHandler)
{
this.lock.lock();
try
{
- this.callbacks.remove(callbackHandler);
+ this.callbacks.add(callbackHandler);
}
finally
{
@@ -98,53 +201,16 @@
}
}
- public Object invoke(InvocationRequest request) throws Throwable
+ public void unregisterCallback(RMCallbackHandler callbackHandler)
{
this.lock.lock();
try
{
- RequestMap rm = (RequestMap)request.getRequestPayload();
- String requestPath = (String)rm.get(HTTPMetadataConstants.PATH);
- boolean handlerExists = false;
- for (RMCallbackHandler handler : this.callbacks)
- {
- if (handler.getHandledPath().equals(requestPath))
- {
- handlerExists = true;
- LOG.debug("Handling request path: " + requestPath);
- handler.handle(request);
- break;
- }
- }
- if (handlerExists == false)
- LOG.warn("No callback handler registered for path: " + requestPath);
-
- return null;
+ this.callbacks.remove(callbackHandler);
}
finally
{
this.lock.unlock();
}
}
-
- public void addListener(InvokerCallbackHandler callbackHandler)
- {
- // do nothing - we're using custom callback handlers
- }
-
- public void removeListener(InvokerCallbackHandler callbackHandler)
- {
- // do nothing - we're using custom callback handlers
- }
-
- public void setInvoker(ServerInvoker arg0)
- {
- // do nothing
- }
-
- public void setMBeanServer(MBeanServer arg0)
- {
- // do nothing
- }
-
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.java 2009-07-02 14:04:22 UTC (rev 10292)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.java 2009-07-02 14:38:33 UTC (rev 10293)
@@ -21,19 +21,26 @@
*/
package org.jboss.ws.extensions.wsrm.transport.backchannel;
+import java.net.InetSocketAddress;
+import java.util.concurrent.Executors;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.transport.Connector;
+import org.jboss.netty.bootstrap.ServerBootstrap;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.group.ChannelGroup;
+import org.jboss.netty.channel.group.DefaultChannelGroup;
+import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
+import org.jboss.ws.core.client.WSServerPipelineFactory;
import org.jboss.ws.extensions.wsrm.api.RMException;
-import org.jboss.ws.extensions.wsrm.transport.RemotingRMUnMarshaller;
/**
* Back ports server used by addressable clients
*
* @author richard.opalka(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
*
* @since Nov 20, 2007
*/
@@ -43,9 +50,9 @@
private static final Lock CLASS_LOCK = new ReentrantLock();
private static final long WAIT_PERIOD = 100;
private static RMBackPortsServer INSTANCE;
+ static final ChannelGroup channelGroup = new DefaultChannelGroup("rmBackPortsServer");
private final Object instanceLock = new Object();
- private final Connector connector;
private final String scheme;
private final String host;
private final int port;
@@ -53,6 +60,7 @@
private boolean started;
private boolean stopped;
private boolean terminated;
+ private ChannelFactory factory;
public final void registerCallback(RMCallbackHandler callbackHandler)
{
@@ -69,8 +77,7 @@
return this.handler.getCallback(requestPath);
}
- private RMBackPortsServer(String scheme, String host, int port)
- throws RMException
+ private RMBackPortsServer(String scheme, String host, int port) throws RMException
{
super();
this.scheme = scheme;
@@ -78,17 +85,20 @@
this.port = port;
try
{
- // we have to use custom unmarshaller because default one removes CRNLs
- String customUnmarshaller = "/?unmarshaller=" + RemotingRMUnMarshaller.class.getName();
- InvokerLocator il = new InvokerLocator(this.scheme + "://" + this.host + ":" + this.port + customUnmarshaller);
- this.connector = new Connector();
- this.connector.setInvokerLocator(il.getLocatorURI());
- this.connector.create();
-
+ factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
+
+ ServerBootstrap bootstrap = new ServerBootstrap(factory);
this.handler = new RMBackPortsInvocationHandler();
- this.connector.addInvocationHandler("wsrmBackPortsHandler", this.handler);
- this.connector.start();
- LOG.debug("WS-RM Backports Server started on: " + il.getLocatorURI());
+ WSServerPipelineFactory channelPipelineFactory = new WSServerPipelineFactory();
+ channelPipelineFactory.setRequestHandler(this.handler);
+ bootstrap.setPipelineFactory(channelPipelineFactory);
+ bootstrap.setOption("child.tcpNoDelay", true);
+ bootstrap.setOption("child.keepAlive", true);
+ // Bind and start to accept incoming connections.
+ Channel c = bootstrap.bind(new InetSocketAddress(this.port));
+ channelGroup.add(c);
+ LOG.debug("WS-RM Backports Server started on port: " + this.port);
+ System.out.println("WS-RM Backports Server started on port: " + this.port);
}
catch (Exception e)
{
@@ -135,7 +145,13 @@
}
try
{
- connector.stop();
+ //Close all connections and server sockets.
+ channelGroup.close().awaitUninterruptibly();
+ //Shutdown the selector loop (boss and worker).
+ if (factory != null)
+ {
+ factory.releaseExternalResources();
+ }
}
finally
{
@@ -177,8 +193,7 @@
* @return WS-RM back ports server
* @throws RMException
*/
- public static RMBackPortsServer getInstance(String scheme, String host, int port)
- throws RMException
+ public static RMBackPortsServer getInstance(String scheme, String host, int port) throws RMException
{
CLASS_LOCK.lock();
try
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandler.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandler.java 2009-07-02 14:04:22 UTC (rev 10292)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandler.java 2009-07-02 14:38:33 UTC (rev 10293)
@@ -21,7 +21,6 @@
*/
package org.jboss.ws.extensions.wsrm.transport.backchannel;
-import org.jboss.remoting.InvocationRequest;
import org.jboss.ws.extensions.wsrm.transport.RMMessage;
import org.jboss.ws.extensions.wsrm.transport.RMUnassignedMessageListener;
@@ -35,7 +34,7 @@
public interface RMCallbackHandler
{
String getHandledPath();
- void handle(InvocationRequest payload);
+ void handle(RMMessage message);
RMMessage getMessage(String messageId);
Throwable getFault(String messageId);
void addUnassignedMessageListener(RMUnassignedMessageListener listener);
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.java 2009-07-02 14:04:22 UTC (rev 10292)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.java 2009-07-02 14:38:33 UTC (rev 10293)
@@ -27,7 +27,6 @@
import java.util.Map;
import org.jboss.logging.Logger;
-import org.jboss.remoting.InvocationRequest;
import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.extensions.wsrm.transport.RMMessage;
import org.jboss.ws.extensions.wsrm.transport.RMUnassignedMessageListener;
@@ -70,9 +69,8 @@
return this.handledPath;
}
- public final void handle(InvocationRequest request)
+ public final void handle(RMMessage message)
{
- RMMessage message = (RMMessage)request.getParameter();
synchronized (instanceLock)
{
String requestMessage = new String(message.getPayload());
15 years, 6 months
JBossWS SVN: r10292 - container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-07-02 10:04:22 -0400 (Thu, 02 Jul 2009)
New Revision: 10292
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java
Log:
[JBWS-2332][JBWS-2382] refactoring - avoiding concurrency issues (WIP)
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java 2009-07-02 13:24:31 UTC (rev 10291)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java 2009-07-02 14:04:22 UTC (rev 10292)
@@ -64,8 +64,8 @@
public final class WSDeploymentDeployer extends AbstractRealDeployer
{
- private static final WSVirtualFileFilter WS_FILEFILTER = new WSVirtualFileFilter();
- private DeploymentModelFactory deploymentModelFactory;
+ private static final WSVirtualFileFilter WS_FILE_FILTER = new WSVirtualFileFilter();
+ private final DeploymentModelFactory deploymentModelFactory;
/**
* Constructor.
@@ -81,6 +81,10 @@
// outputs
this.addOutput( JBossWebMetaData.class );
this.addOutput( Deployment.class );
+
+ // deployment factory
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
}
@Override
@@ -88,23 +92,23 @@
{
if ( ASIntegrationHelper.isJaxrpcEjbDeployment( unit ) )
{
- this.newJAXRPCEJB21Deployment( unit );
+ this.newJaxrpcEjbDeployment( unit );
}
else if ( ASIntegrationHelper.isJaxwsEjbDeployment( unit ) )
{
- this.newJAXWSEJB3Deployment( unit );
+ this.newJaxwsEjbDeployment( unit );
}
else if ( ASIntegrationHelper.isJaxrpcPojoDeployment( unit ) )
{
- this.newJAXRPCJSEDeployment( unit );
+ this.newJaxrpcPojoDeployment( unit );
}
else if ( ASIntegrationHelper.isJaxwsPojoDeployment( unit ) )
{
- this.newJAXWSJSEDeployment( unit );
+ this.newJaxwsPojoDeployment( unit );
}
}
- private void newJAXRPCEJB21Deployment( final DeploymentUnit unit )
+ private void newJaxrpcEjbDeployment( final DeploymentUnit unit )
{
ArchiveDeployment dep = newDeployment(unit);
dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
@@ -145,7 +149,7 @@
String ejbClass = beanMetaData.getEjbClass();
// Create the endpoint
- Endpoint ep = newEndpoint(ejbClass);
+ Endpoint ep = this.deploymentModelFactory.newEndpoint(ejbClass);
ep.setShortName(ejbLink);
service.addEndpoint(ep);
}
@@ -155,7 +159,7 @@
unit.addAttachment( Deployment.class, dep );
}
- private void newJAXWSEJB3Deployment( final DeploymentUnit unit )
+ private void newJaxwsEjbDeployment( final DeploymentUnit unit )
{
ArchiveDeployment dep = newDeployment(unit);
dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
@@ -181,7 +185,7 @@
String epBean = container.getComponentClassName();
// Create the endpoint
- Endpoint ep = newEndpoint(epBean);
+ Endpoint ep = this.deploymentModelFactory.newEndpoint(epBean);
ep.setShortName(ejbName);
String containName = container.getContainerName();
@@ -197,7 +201,7 @@
unit.addAttachment( Deployment.class, dep );
}
- private void newJAXRPCJSEDeployment( final DeploymentUnit unit )
+ private void newJaxrpcPojoDeployment( final DeploymentUnit unit )
{
ArchiveDeployment dep = newDeployment(unit);
dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
@@ -230,7 +234,7 @@
String targetBean = DeployerUtils.getTargetBean(servlet);
// Create the endpoint
- Endpoint ep = newEndpoint(targetBean);
+ Endpoint ep = this.deploymentModelFactory.newEndpoint(targetBean);
ep.setShortName(servletLink);
service.addEndpoint(ep);
}
@@ -240,7 +244,7 @@
unit.addAttachment( Deployment.class, dep );
}
- private void newJAXWSJSEDeployment( final DeploymentUnit unit )
+ private void newJaxwsPojoDeployment( final DeploymentUnit unit )
{
ArchiveDeployment dep = newDeployment(unit);
dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
@@ -262,7 +266,7 @@
String targetBean = DeployerUtils.getTargetBean(servlet);
// Create the endpoint
- Endpoint ep = newEndpoint(targetBean);
+ Endpoint ep = this.deploymentModelFactory.newEndpoint(targetBean);
ep.setShortName(servletName);
service.addEndpoint(ep);
}
@@ -287,12 +291,11 @@
{
try
{
- DeploymentModelFactory factory = getDeploymentModelFactory();
- ArchiveDeployment dep = (ArchiveDeployment)factory.newDeployment(unit.getSimpleName(), unit.getClassLoader());
+ ArchiveDeployment dep = (ArchiveDeployment)this.deploymentModelFactory.newDeployment(unit.getSimpleName(), unit.getClassLoader());
if (unit instanceof VFSDeploymentUnit)
{
VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
- List<VirtualFile> virtualFiles = vfsUnit.getMetaDataFiles(WS_FILEFILTER); //get all wsdl and xsd files
+ List<VirtualFile> virtualFiles = vfsUnit.getMetaDataFiles(WS_FILE_FILTER); //get all wsdl and xsd files
Set<UnifiedVirtualFile> uVirtualFiles = new HashSet<UnifiedVirtualFile>();
for (VirtualFile vf : virtualFiles)
{
@@ -305,7 +308,7 @@
if (unit.getParent() != null)
{
DeploymentUnit parentUnit = unit.getParent();
- ArchiveDeployment parentDep = (ArchiveDeployment)factory.newDeployment(parentUnit.getSimpleName(), parentUnit.getClassLoader());
+ ArchiveDeployment parentDep = (ArchiveDeployment)this.deploymentModelFactory.newDeployment(parentUnit.getSimpleName(), parentUnit.getClassLoader());
dep.setParent(parentDep);
}
return dep;
@@ -316,27 +319,4 @@
}
}
- private DeploymentModelFactory getDeploymentModelFactory()
- {
- if(null == deploymentModelFactory)
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
- }
-
- return deploymentModelFactory;
- }
-
- private Endpoint newEndpoint(String targetBean)
- {
- try
- {
- return getDeploymentModelFactory().newEndpoint(targetBean);
- }
- catch (Exception ex)
- {
- throw new WSFDeploymentException("Cannot load spi.deployment.Endpoint class", ex);
- }
- }
-
}
15 years, 6 months