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