[jboss-cvs] JBossAS SVN: r64765 - in branches/tdiesler/webservices: src and 14 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 22 04:42:54 EDT 2007
Author: thomas.diesler at jboss.com
Date: 2007-08-22 04:42:54 -0400 (Wed, 22 Aug 2007)
New Revision: 64765
Added:
branches/tdiesler/webservices/src/
branches/tdiesler/webservices/src/main/
branches/tdiesler/webservices/src/main/etc/
branches/tdiesler/webservices/src/main/etc/component-info.xml
branches/tdiesler/webservices/src/main/etc/default.mf
branches/tdiesler/webservices/src/main/java/
branches/tdiesler/webservices/src/main/java/org/
branches/tdiesler/webservices/src/main/java/org/jboss/
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHook.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHookEJB.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHookJSE.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractInvocationHandler.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractWebServiceDeployer.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ArchiveDeployerHook.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ContainerMetaDataAdapter.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ContainerMetaDataDeploymentAspect.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandler.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandlerJAXRPC.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandlerJAXWS.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeployerHook.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeployerHookPostJSE.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeploymentAspectHttpServer.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/EJBArchiveMetaDataAdapterEJB21.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/EJBArchiveMetaDataAdapterEJB3.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB21.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB3.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerFactoryImpl.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookPostJSE.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookPreJSE.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookPostJSE.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JSEArchiveMetaDataAdapter.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ModifyWebMetaDataDeploymentAspect.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/RewriteResults.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/RuntimeLoaderDeploymentAspect.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityAdapterFactoryImpl.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityAdaptorImpl.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB21.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB3.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ServiceEndpointInterceptor.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/VirtualFileAdaptor.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeployingHttpServer.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceContextFactoryImpl.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerEJB.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerPostJSE.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerPreJSE.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceMainDeployer.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java
branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/serviceref/
branches/tdiesler/webservices/src/main/resources/
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.deployer/
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.deployer/META-INF/
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-beans.xml
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.WebServiceContextFactory
branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory
Log:
partial commit
Added: branches/tdiesler/webservices/src/main/etc/component-info.xml
===================================================================
--- branches/tdiesler/webservices/src/main/etc/component-info.xml (rev 0)
+++ branches/tdiesler/webservices/src/main/etc/component-info.xml 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,28 @@
+<project name="jboss/jbossws-jboss50">
+
+ <component id="jboss/jbossws-jboss50"
+ description="JBossWS container integration layer"
+ version="@repository.id@"
+ licenseType="lgpl">
+
+ <artifact id="jbossws-jboss50.jar"/>
+ <artifact id="jbossws-jboss50-deployer.zip"/>
+ <artifact id="jbossws-jboss50-src.zip"/>
+
+ <import componentref="jboss/jbossws-common">
+ <compatible version="@jbossws-common@"/>
+ </import>
+ <import componentref="jboss/jbossws-framework">
+ <compatible version="@jbossws-framework@"/>
+ </import>
+ <import componentref="jboss/jbossws-spi">
+ <compatible version="@jbossws-spi@"/>
+ </import>
+
+ <export>
+ <include input="jbossws-jboss50.jar"/>
+ </export>
+
+ </component>
+
+</project>
Added: branches/tdiesler/webservices/src/main/etc/default.mf
===================================================================
--- branches/tdiesler/webservices/src/main/etc/default.mf (rev 0)
+++ branches/tdiesler/webservices/src/main/etc/default.mf 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,10 @@
+Manifest-Version: 1.2
+Created-By: @java.vm.version@ (@java.vm.vendor@)
+Specification-Title: @specification.title@
+Specification-Version: @specification.version@
+Specification-Vendor: @specification.vendor@
+Implementation-Title: @implementation.title@
+Implementation-URL: @implementation.url@
+Implementation-Version: @implementation.version@ (build=@build.id@)
+Implementation-Vendor: @implementation.vendor@
+Implementation-Vendor-Id: @implementation.vendor.id@
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHook.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHook.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHook.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.*;
+
+//$Id: AbstractDeployerHook.java 4239 2007-08-07 19:13:42Z heiko.braun at jboss.com $
+
+
+/**
+ * An abstract web service deployer.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Heiko.Braun at jboss.com
+ *
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHook implements DeployerHook
+{
+ // provide logging
+ protected final Logger log = Logger.getLogger(getClass());
+
+ private DeploymentAspectManager deploymentAspectManager;
+ private DeploymentModelFactory deploymentModelFactory;
+
+ protected String deploymentManagerName;
+
+ /** MC provided property **/
+ public void setDeploymentManagerName(String deploymentManagerName)
+ {
+ this.deploymentManagerName = deploymentManagerName;
+ }
+
+ public DeploymentAspectManager getDeploymentAspectManager()
+ {
+ if(null == deploymentAspectManager)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ deploymentAspectManager = spiProvider.getSPI(DeploymentAspectManagerFactory.class).getDeploymentAspectManager( deploymentManagerName );
+ }
+
+ return deploymentAspectManager;
+ }
+
+ public DeploymentModelFactory getDeploymentModelFactory()
+ {
+ if(null == deploymentModelFactory)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
+ }
+
+ return deploymentModelFactory;
+ }
+
+ public ArchiveDeployment newDeployment(DeploymentUnit unit)
+ {
+ try
+ {
+ DeploymentModelFactory factory = getDeploymentModelFactory();
+ ArchiveDeployment dep = (ArchiveDeployment)factory.newDeployment(unit.getSimpleName(), unit.getClassLoader());
+ if (unit.getParent() != null)
+ {
+ DeploymentUnit parentUnit = unit.getParent();
+ ArchiveDeployment parentDep = (ArchiveDeployment)factory.newDeployment(parentUnit.getSimpleName(), parentUnit.getClassLoader());
+ dep.setParent(parentDep);
+ }
+ return dep;
+ }
+ catch (Exception ex)
+ {
+ throw new WSFDeploymentException("Cannot load spi.deployment.Deployment class", ex);
+ }
+ }
+
+ public Endpoint newEndpoint(String targetBean)
+ {
+ try
+ {
+ return getDeploymentModelFactory().newEndpoint(targetBean);
+ }
+ catch (Exception ex)
+ {
+ throw new WSFDeploymentException("Cannot load spi.deployment.Endpoint class", ex);
+ }
+ }
+
+ /** Return true if this deployment should be ignored
+ */
+ public boolean ignoreDeployment(DeploymentUnit unit)
+ {
+ String name = unit.getName();
+ return (name.startsWith("jboss:id=") && name.indexOf("service=jacc") > 0);
+ }
+
+ /** Get the deployment type this deployer can handle
+ */
+ public abstract Deployment.DeploymentType getDeploymentType();
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHookEJB.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHookEJB.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHookEJB.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: AbstractDeployerHookEJB.java 3146 2007-05-18 22:55:26Z thomas.diesler at jboss.com $
+
+/**
+ * An abstract deployer for EJB Endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHookEJB extends ArchiveDeployerHook
+{
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHookJSE.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHookJSE.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractDeployerHookJSE.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.WebMetaData;
+
+//$Id: AbstractDeployerHookJSE.java 3772 2007-07-01 19:29:13Z thomas.diesler at jboss.com $
+
+/**
+ * An abstract deployer for JSE Endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHookJSE extends ArchiveDeployerHook
+{
+ public boolean isWebServiceDeployment(DeploymentUnit unit)
+ {
+ if (unit.getAttachment(WebMetaData.class) == null)
+ return false;
+
+ return true;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractInvocationHandler.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractInvocationHandler.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractInvocationHandler.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: InvocationHandlerEJB3.java 4023 2007-07-28 07:14:06Z thomas.diesler at jboss.com $
+
+import java.lang.reflect.Method;
+
+import org.jboss.wsf.common.JavaUtils;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+
+/**
+ * @author Thomas.Diesler at 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;
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractWebServiceDeployer.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractWebServiceDeployer.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/AbstractWebServiceDeployer.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: AbstractWebServiceDeployer.java 4276 2007-08-09 08:34:58Z thomas.diesler at jboss.com $
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+
+/**
+ * This deployer that calls the registered DeployerHooks
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Apr-2007
+ */
+public abstract class AbstractWebServiceDeployer<T> extends AbstractComponentDeployer
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(AbstractWebServiceDeployer.class);
+
+ private List<DeployerHook> deployerHooks = new LinkedList<DeployerHook>();
+
+ public void addDeployerHook(DeployerHook deployer)
+ {
+ log.debug("Add deployer hook: " + deployer);
+ deployerHooks.add(deployer);
+ }
+
+ public void removeDeployerHook(DeployerHook deployer)
+ {
+ log.debug("Remove deployer hook: " + deployer);
+ deployerHooks.remove(deployer);
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ for (DeployerHook deployer : deployerHooks)
+ deployer.deploy(unit);
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit)
+ {
+ for (DeployerHook deployer : deployerHooks)
+ deployer.undeploy(unit);
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ArchiveDeployerHook.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ArchiveDeployerHook.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ArchiveDeployerHook.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: ArchiveDeployerHook.java 4278 2007-08-09 09:13:34Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.w3c.dom.Element;
+
+import java.net.URL;
+
+/**
+ * An abstract web service deployer.
+ *
+ * deploy(unit)
+ * if(isWebServiceDeployment)
+ * dep = createDeployment(unit)
+ * deploy(dep)
+ *
+ * undeploy(unit)
+ * dep = getDeployment(unit)
+ * undeploy(dep)
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class ArchiveDeployerHook extends AbstractDeployerHook
+{
+
+ /** Depending on the type of deployment, this method should return true
+ * if the deployment contains web service endpoints.
+ */
+ public abstract boolean isWebServiceDeployment(DeploymentUnit unit);
+
+ /** Create the Deployment for a given DeploymentUnit
+ */
+ public abstract Deployment createDeployment(DeploymentUnit unit);
+
+ /** Get the Deployment for a given DeploymentUnit
+ */
+ public Deployment getDeployment(DeploymentUnit unit)
+ {
+ Deployment dep = unit.getAttachment(Deployment.class);
+ return (dep != null && dep.getType() == getDeploymentType() ? dep : null);
+ }
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ if (isWebServiceDeployment(unit))
+ {
+ log.debug("deploy: " + unit.getName());
+ Deployment dep = getDeployment(unit);
+ if (dep == null)
+ {
+ dep = createDeployment(unit);
+ dep.addAttachment(DeploymentUnit.class, unit);
+ }
+
+ getDeploymentAspectManager().deploy(dep);
+ unit.addAttachment(Deployment.class, dep);
+ }
+ }
+
+ public void undeploy(DeploymentUnit unit)
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ Deployment dep = getDeployment(unit);
+ if (dep != null)
+ {
+ log.debug("undeploy: " + unit.getName());
+ getDeploymentAspectManager().undeploy(dep);
+ }
+ }
+
+ /** Unmrashall the webservices.xml if there is one
+ */
+ protected WebservicesMetaData getWebservicesMetaData(DeploymentUnit unit)
+ {
+ WebservicesMetaData wsMetaData = unit.getAttachment(WebservicesMetaData.class);
+ UnifiedVirtualFile vfWebservices = getWebservicesFile(unit);
+ if (wsMetaData == null && vfWebservices != null)
+ {
+ try
+ {
+ URL wsURL = vfWebservices.toURL();
+ Element root = DOMUtils.parse(wsURL.openStream());
+ String namespaceURI = root.getNamespaceURI();
+ if (namespaceURI.equals("http://java.sun.com/xml/ns/j2ee"))
+ {
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new WebservicesFactory(wsURL);
+ wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(wsURL.openStream(), factory, null);
+ unit.addAttachment(WebservicesMetaData.class, wsMetaData);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new WSFDeploymentException(ex);
+ }
+ }
+ return wsMetaData;
+ }
+
+ private UnifiedVirtualFile getWebservicesFile(DeploymentUnit unit)
+ {
+ VirtualFile vf = ((VFSDeploymentUnit)unit).getMetaDataFile("webservices.xml");
+ return (vf != null ? new VirtualFileAdaptor(vf) : null);
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ContainerMetaDataAdapter.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ContainerMetaDataAdapter.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ContainerMetaDataAdapter.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: ContainerMetaDataAdapter.java 4022 2007-07-27 13:54:43Z heiko.braun at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+
+import java.net.URL;
+
+/**
+ * Build container independent deployment info.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public class ContainerMetaDataAdapter
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ContainerMetaDataAdapter.class);
+
+ private EJBArchiveMetaDataAdapterEJB3 applicationMetaDataAdapterEJB3 = new EJBArchiveMetaDataAdapterEJB3();
+ private EJBArchiveMetaDataAdapterEJB21 applicationMetaDataAdapterEJB21 = new EJBArchiveMetaDataAdapterEJB21();
+ private JSEArchiveMetaDataAdapter webMetaDataAdapter = new JSEArchiveMetaDataAdapter();
+
+ public void setApplicationMetaDataAdapterEJB21(EJBArchiveMetaDataAdapterEJB21 adapter)
+ {
+ this.applicationMetaDataAdapterEJB21 = adapter;
+ }
+
+ public void setApplicationMetaDataAdapterEJB3(EJBArchiveMetaDataAdapterEJB3 adapter)
+ {
+ this.applicationMetaDataAdapterEJB3 = adapter;
+ }
+
+ public void setWebMetaDataAdapter(JSEArchiveMetaDataAdapter adapter)
+ {
+ this.webMetaDataAdapter = adapter;
+ }
+
+ public void buildContainerMetaData(Deployment dep, DeploymentUnit unit)
+ {
+ dep.addAttachment(DeploymentUnit.class, unit);
+
+ try
+ {
+ // JSE endpoints
+ if (unit.getAttachment(WebMetaData.class) != null)
+ {
+ JSEArchiveMetaData webMetaData = webMetaDataAdapter.buildUnifiedWebMetaData(dep, unit);
+ if (webMetaData != null)
+ dep.addAttachment(JSEArchiveMetaData.class, webMetaData);
+
+ if (dep instanceof ArchiveDeployment)
+ {
+ URL webURL = ((ArchiveDeployment)dep).getRootFile().toURL();
+ dep.setProperty("org.jboss.ws.webapp.url", webURL);
+ }
+ }
+
+ // EJB3 endpoints
+ else if (unit.getAttachment(Ejb3Deployment.class) != null)
+ {
+ EJBArchiveMetaData appMetaData = applicationMetaDataAdapterEJB3.buildUnifiedApplicationMetaData(dep, unit);
+ if (appMetaData != null)
+ dep.addAttachment(EJBArchiveMetaData.class, appMetaData);
+ }
+
+ // EJB21 endpoints
+ else if (unit.getAttachment(ApplicationMetaData.class) != null)
+ {
+ EJBArchiveMetaData appMetaData = applicationMetaDataAdapterEJB21.buildUnifiedApplicationMetaData(dep, unit);
+ if (appMetaData != null)
+ dep.addAttachment(EJBArchiveMetaData.class, appMetaData);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ContainerMetaDataDeploymentAspect.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ContainerMetaDataDeploymentAspect.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ContainerMetaDataDeploymentAspect.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: UnifiedDeploymentInfoDeployer.java 3772 2007-07-01 19:29:13Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+
+/**
+ * A deployer that builds the UnifiedDeploymentInfo
+ *
+ * @author Thomas.Diesler at 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);
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandler.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandler.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandler.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: DefaultInvocationHandlerJAXWS.java 4023 2007-07-28 07:14:06Z thomas.diesler at jboss.com $
+
+import java.lang.reflect.Method;
+
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.wsf.common.JavaUtils;
+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;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class DefaultInvocationHandler extends InvocationHandler
+{
+ private SPIProvider spiProvider;
+ private ResourceInjectorFactory resourceInjectorFactory;
+
+ public DefaultInvocationHandler()
+ {
+ 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)
+ {
+ 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);
+ }
+ }
+ 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: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandlerJAXRPC.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandlerJAXRPC.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandlerJAXRPC.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: DefaultInvocationHandlerJAXRPC.java 3959 2007-07-20 14:44:19Z heiko.braun at jboss.com $
+
+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 at jboss.org
+ * @since 25-Apr-2007
+ */
+public class DefaultInvocationHandlerJAXRPC extends DefaultInvocationHandler
+{
+ 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: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandlerJAXWS.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandlerJAXWS.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultInvocationHandlerJAXWS.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: DefaultInvocationHandlerJAXWS.java 4023 2007-07-28 07:14:06Z thomas.diesler at jboss.com $
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class DefaultInvocationHandlerJAXWS extends DefaultInvocationHandler
+{
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.logging.Logger;
+import org.dom4j.Document;
+import org.dom4j.Element;
+
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * Modifies web.xml for jbossws
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-May-2006
+ */
+public class DefaultWebAppDesciptorModifierImpl implements WebAppDesciptorModifier
+{
+ // logging support
+ private static Logger log = Logger.getLogger(DefaultWebAppDesciptorModifierImpl.class);
+
+ public RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException
+ {
+ RewriteResults results = new RewriteResults();
+ Element root = webXml.getRootElement();
+
+ String propKey = "org.jboss.ws.webapp.ServletClass";
+ String servletClass = (String)dep.getProperty(propKey);
+ if (servletClass == null)
+ throw new IllegalStateException("Cannot obtain context property: " + propKey);
+
+ propKey = "org.jboss.ws.webapp.ContextParameterMap";
+ Map<String, String> contextParams = (Map<String, String>)dep.getProperty(propKey);
+ if (contextParams != null)
+ {
+ for (Map.Entry<String, String> entry : contextParams.entrySet())
+ {
+ Element contextParam = root.addElement("context-param");
+ contextParam.addElement("param-name").addText(entry.getKey());
+ contextParam.addElement("param-value").addText(entry.getValue());
+ }
+ }
+
+ propKey = "org.jboss.ws.webapp.ServletContextListener";
+ String listenerClass = (String)dep.getProperty(propKey);
+ if (listenerClass != null)
+ {
+ Element listener = root.addElement("listener");
+ listener.addElement("listener-class").setText(listenerClass);
+ }
+
+ for (Iterator it = root.elementIterator("servlet"); it.hasNext();)
+ {
+ Element servlet = (Element)it.next();
+ String linkName = servlet.element("servlet-name").getTextTrim();
+
+ // find the servlet-class
+ Element classElement = servlet.element("servlet-class");
+
+ // JSP
+ if (classElement == null)
+ continue;
+
+ String orgServletClassName = classElement.getTextTrim();
+
+ // 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 (Iterator itParam = servlet.elementIterator("init-param"); itParam.hasNext();)
+ {
+ Element elParam = (Element)itParam.next();
+ String paramName = elParam.element("param-name").getTextTrim();
+ String paramValue = elParam.element("param-value").getTextTrim();
+ 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;
+ }
+ else if (orgServletClassName.endsWith("Servlet"))
+ {
+ log.info("Ignore <servlet-class> that ends with 'Servlet': " + orgServletClassName);
+ continue;
+ }
+
+ classElement.setText(servletClass);
+
+ // add additional init params
+ if (orgServletClassName.equals(servletClass) == false)
+ {
+ targetBeanName = orgServletClassName;
+ Element paramElement = servlet.addElement("init-param");
+ paramElement.addElement("param-name").addText(Endpoint.SEPID_DOMAIN_ENDPOINT);
+ paramElement.addElement("param-value").addText(targetBeanName);
+ }
+ }
+
+ if (targetBeanName == null)
+ throw new IllegalStateException("Cannot obtain service endpoint bean for: " + linkName);
+
+ // remember the target bean name
+ results.sepTargetMap.put(linkName, targetBeanName);
+ }
+
+ return results;
+ }
+
+ // Return true if the web.xml is already modified
+ private boolean isAlreadyModified(Element servlet)
+ {
+ for (Iterator it = servlet.elementIterator("init-param"); it.hasNext();)
+ {
+ Element elParam = (Element)it.next();
+ String paramName = elParam.element("param-name").getTextTrim();
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(paramName))
+ return true;
+ }
+ return false;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeployerHook.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeployerHook.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeployerHook.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: DeployerHook.java 3772 2007-07-01 19:29:13Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * An interface for all web service deployer hooks
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Apr-2007
+ */
+public interface DeployerHook
+{
+ void deploy(DeploymentUnit unit) throws DeploymentException;
+
+ void undeploy(DeploymentUnit unit);
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeployerHookPostJSE.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeployerHookPostJSE.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeployerHookPostJSE.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: DeployerHookPostJSE.java 4276 2007-08-09 08:34:58Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.wsf.spi.deployment.Deployment;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * @author Thomas.Diesler at jboss.com
+ */
+public abstract class DeployerHookPostJSE extends AbstractDeployerHookJSE
+{
+ /**
+ * The deployment should be created in phase 1.
+ */
+ public Deployment createDeployment(DeploymentUnit unit)
+ {
+ Deployment dep = unit.getAttachment(Deployment.class);
+ if (null == dep)
+ throw new IllegalStateException("spi.Deployment missing. It should be created in Phase 1");
+
+ return dep;
+ }
+
+ /**
+ * A phase 2 deployer hook needs to reject first-place
+ * JSE deployments and wait for those that are re-written.
+ * We rely on the fact that spi.Deployment is created in phase 1.
+ */
+ @Override
+ public boolean isWebServiceDeployment(DeploymentUnit unit)
+ {
+ if (super.isWebServiceDeployment(unit) == false)
+ return false;
+
+ Deployment deployment = unit.getAttachment(Deployment.class);
+ return deployment != null;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeploymentAspectHttpServer.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeploymentAspectHttpServer.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/DeploymentAspectHttpServer.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: JBossHttpServer.java 1786 2007-01-04 14:30:04Z thomas.diesler at jboss.com $
+
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.AbstractExtensible;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspectManager;
+import org.jboss.wsf.spi.deployment.DeploymentAspectManagerFactory;
+import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
+import org.jboss.wsf.spi.deployment.Service;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
+import org.jboss.wsf.spi.http.HttpServer;
+
+/**
+ * A HTTP Server that uses DeploymentAspects
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 07-Jul-2006
+ */
+public class DeploymentAspectHttpServer extends AbstractExtensible implements HttpServer
+{
+ /** Start an instance of this HTTP server */
+ public void start()
+ {
+ // verify required properties
+ }
+
+ /** Create an HTTP context */
+ public HttpContext createContext(String contextRoot)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ HttpContext httpContext = spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this, contextRoot);
+ return httpContext;
+ }
+
+ /** Publish an JAXWS endpoint to the HTTP server */
+ public void publish(HttpContext context, Endpoint endpoint)
+ {
+ Class implClass = getImplementorClass(endpoint);
+
+ try
+ {
+ // Get the deployment model factory
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ DeploymentModelFactory depModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
+
+ // Create/Setup the deployment
+ Deployment dep = depModelFactory.newDeployment("endpoint-deployment", implClass.getClassLoader());
+ dep.setRuntimeClassLoader(dep.getInitialClassLoader());
+
+ // Create/Setup the service
+ Service service = dep.getService();
+ service.setContextRoot(context.getContextRoot());
+
+ // Create/Setup the endpoint
+ org.jboss.wsf.spi.deployment.Endpoint ep = depModelFactory.newEndpoint(implClass.getName());
+ service.addEndpoint(ep);
+
+ // Deploy using deployment aspects
+ DeploymentAspectManagerFactory depManagerFactory = spiProvider.getSPI(DeploymentAspectManagerFactory.class);
+ DeploymentAspectManager depManager = depManagerFactory.getDeploymentAspectManager("WSDeploymentAspectManagerEndpointAPI");
+ depManager.deploy(dep);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ /** Destroys an JAXWS endpoint on the HTTP server */
+ public void destroy(HttpContext context, Endpoint endpoint)
+ {
+ try
+ {
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ private Class getImplementorClass(Endpoint endpoint)
+ {
+ Object implementor = endpoint.getImplementor();
+ Class implClass = (implementor instanceof Class ? (Class)implementor : implementor.getClass());
+ return implClass;
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/EJBArchiveMetaDataAdapterEJB21.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/EJBArchiveMetaDataAdapterEJB21.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/EJBArchiveMetaDataAdapterEJB21.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: EJBArchiveMetaDataAdapterEJB21.java 4013 2007-07-27 04:37:52Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.*;
+import org.jboss.metadata.ApplicationMetaData.WebserviceDescription;
+import org.jboss.metadata.ApplicationMetaData.Webservices;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.*;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData.PublishLocationAdapter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Build container independent application meta data
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public class EJBArchiveMetaDataAdapterEJB21
+{
+ // logging support
+ private static Logger log = Logger.getLogger(EJBArchiveMetaDataAdapterEJB21.class);
+
+ public EJBArchiveMetaData buildUnifiedApplicationMetaData(Deployment dep, DeploymentUnit unit)
+ {
+ ApplicationMetaData appMetaData = unit.getAttachment(ApplicationMetaData.class);
+ dep.addAttachment(ApplicationMetaData.class, appMetaData);
+
+ EJBArchiveMetaData umd = new EJBArchiveMetaData();
+ buildUnifiedBeanMetaData(umd, appMetaData);
+ buildWebservicesMetaData(umd, appMetaData);
+ umd.setSecurityDomain(appMetaData.getSecurityDomain());
+
+ return umd;
+ }
+
+ private void buildWebservicesMetaData(EJBArchiveMetaData umd, ApplicationMetaData apmd)
+ {
+ Webservices webservices = apmd.getWebservices();
+ if (webservices != null)
+ {
+ String contextRoot = webservices.getContextRoot();
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(webservices));
+
+ List<WebserviceDescription> wsDescriptions = webservices.getWebserviceDescriptions();
+ if (wsDescriptions.size() > 1)
+ log.warn("Multiple <webservice-description> elements not supported");
+
+ if (wsDescriptions.size() > 0)
+ {
+ WebserviceDescription wsd = wsDescriptions.get(0);
+ umd.setConfigName(wsd.getConfigName());
+ umd.setConfigFile(wsd.getConfigFile());
+ }
+
+ umd.setWebServiceContextRoot(contextRoot);
+ }
+ }
+
+ private PublishLocationAdapter getPublishLocationAdpater(final Webservices webservices)
+ {
+ return new PublishLocationAdapter()
+ {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ String wsdlPublishLocation = null;
+ for (WebserviceDescription wsd : webservices.getWebserviceDescriptions())
+ {
+ if (wsd.getDescriptionName().equals(name))
+ {
+ wsdlPublishLocation = wsd.getWsdlPublishLocation();
+ }
+ }
+ return wsdlPublishLocation;
+ }
+ };
+ }
+
+ private void buildUnifiedBeanMetaData(EJBArchiveMetaData umd, ApplicationMetaData appMetaData)
+ {
+ List<EJBMetaData> beans = new ArrayList<EJBMetaData>();
+ Iterator it = appMetaData.getEnterpriseBeans();
+ while (it.hasNext())
+ {
+ BeanMetaData bmd = (BeanMetaData)it.next();
+ buildUnifiedBeanMetaData(beans, bmd);
+ }
+ umd.setEnterpriseBeans(beans);
+ }
+
+ private EJBMetaData buildUnifiedBeanMetaData(List<EJBMetaData> beans, BeanMetaData bmd)
+ {
+ EJBMetaData ubmd = null;
+ if (bmd instanceof SessionMetaData)
+ {
+ ubmd = new SLSBMetaData();
+ }
+ else if (bmd instanceof MessageDrivenMetaData)
+ {
+ ubmd = new MDBMetaData();
+ ((MDBMetaData)ubmd).setDestinationJndiName(((MessageDrivenMetaData)bmd).getDestinationJndiName());
+ }
+
+ if (ubmd != null)
+ {
+ ubmd.setEjbName(bmd.getEjbName());
+ ubmd.setEjbClass(bmd.getEjbClass());
+ ubmd.setServiceEndpointInterface(bmd.getServiceEndpoint());
+ ubmd.setHome(bmd.getHome());
+ ubmd.setLocalHome(bmd.getLocalHome());
+ ubmd.setJndiName(bmd.getJndiName());
+ ubmd.setLocalJndiName(bmd.getLocalJndiName());
+
+ EjbPortComponentMetaData pcmd = bmd.getPortComponent();
+ if (pcmd != null)
+ {
+ ubmd.setPortComponentName(pcmd.getPortComponentName());
+ ubmd.setPortComponentURI(pcmd.getPortComponentURI());
+ EJBSecurityMetaData smd = new EJBSecurityMetaData();
+ smd.setAuthMethod(pcmd.getAuthMethod());
+ smd.setTransportGuarantee(pcmd.getTransportGuarantee());
+ smd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
+ ubmd.setSecurityMetaData(smd);
+ }
+
+ beans.add(ubmd);
+ }
+ return ubmd;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/EJBArchiveMetaDataAdapterEJB3.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/EJBArchiveMetaDataAdapterEJB3.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/EJBArchiveMetaDataAdapterEJB3.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: EJBArchiveMetaDataAdapterEJB3.java 4239 2007-08-07 19:13:42Z heiko.braun at jboss.com $
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.mdb.MessagingContainer;
+import org.jboss.ejb3.metamodel.Ejb3PortComponent;
+import org.jboss.ejb3.metamodel.EjbJarDD;
+import org.jboss.ejb3.metamodel.EnterpriseBean;
+import org.jboss.ejb3.metamodel.WebserviceDescription;
+import org.jboss.ejb3.metamodel.Webservices;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+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 at jboss.org
+ * @since 14-Apr-2007
+ */
+public class EJBArchiveMetaDataAdapterEJB3
+{
+ // logging support
+ private static Logger log = Logger.getLogger(EJBArchiveMetaDataAdapterEJB3.class);
+
+ public EJBArchiveMetaData buildUnifiedApplicationMetaData(Deployment dep, DeploymentUnit unit)
+ {
+ Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
+ dep.addAttachment(Ejb3Deployment.class, ejb3Deployment);
+
+ EjbJarDD jarDD = unit.getAttachment(EjbJarDD.class);
+ EJBArchiveMetaData umd = new EJBArchiveMetaData();
+ buildUnifiedBeanMetaData(umd, ejb3Deployment);
+ buildWebservicesMetaData(umd, jarDD);
+
+ return umd;
+ }
+
+ private void buildWebservicesMetaData(EJBArchiveMetaData umd, EjbJarDD jarDD)
+ {
+ // nothing to do
+ if (jarDD == null)
+ return;
+
+ Webservices webservices = jarDD.getWebservices();
+ if (webservices != null)
+ {
+ String contextRoot = webservices.getContextRoot();
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(webservices));
+
+ List<WebserviceDescription> wsDescriptions = webservices.getWebserviceDescriptions();
+ if (wsDescriptions.size() > 1)
+ log.warn("Multiple <webservice-description> elements not supported");
+
+ if (wsDescriptions.size() > 0)
+ {
+ WebserviceDescription wsd = wsDescriptions.get(0);
+ umd.setConfigName(wsd.getConfigName());
+ umd.setConfigFile(wsd.getConfigFile());
+
+ // com/sun/ts/tests/webservices12/ejb/annotations/WSEjbWebServiceRefTest1
+ // WSEjbWebServiceRefTest1VerifyTargetEndpointAddress
+ if (contextRoot == null)
+ contextRoot = "/" + wsd.getDescriptionName();
+ }
+
+ umd.setWebServiceContextRoot(contextRoot);
+ }
+ }
+
+ private void buildUnifiedBeanMetaData(EJBArchiveMetaData umd, Ejb3Deployment ejb3Deployment)
+ {
+ List<EJBMetaData> ubmdList = new ArrayList<EJBMetaData>();
+ Iterator<Container> it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ EJBMetaData ubmd = null;
+ if (container instanceof SessionContainer)
+ {
+ ubmd = new SLSBMetaData();
+ }
+ else if (container instanceof MessagingContainer)
+ {
+ ubmd = new MDBMetaData();
+ log.warn("No implemented: initialize MDB destination");
+ //((UnifiedMessageDrivenMetaData)ubmd).setDestinationJndiName(((MessagingContainer)container).getDestination());
+ }
+
+ if (ubmd != null)
+ {
+ ubmd.setEjbName(container.getEjbName());
+ ubmd.setEjbClass(container.getBeanClassName());
+
+ EnterpriseBean bean = container.getXml();
+ Ejb3PortComponent pcmd = (bean != null ? bean.getPortComponent() : null);
+ if (pcmd != null)
+ {
+ ubmd.setPortComponentName(pcmd.getPortComponentName());
+ ubmd.setPortComponentURI(pcmd.getPortComponentURI());
+ EJBSecurityMetaData smd = new EJBSecurityMetaData();
+ smd.setAuthMethod(pcmd.getAuthMethod());
+ smd.setTransportGuarantee(pcmd.getTransportGuarantee());
+ smd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
+ ubmd.setSecurityMetaData(smd);
+ }
+
+ ubmdList.add(ubmd);
+ }
+ }
+ umd.setEnterpriseBeans(ubmdList);
+ }
+
+ private PublishLocationAdapter getPublishLocationAdpater(final Webservices webservices)
+ {
+ return new PublishLocationAdapter() {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ String wsdlPublishLocation = null;
+ for (WebserviceDescription wsd : webservices.getWebserviceDescriptions())
+ {
+ if (wsd.getDescriptionName().equals(name))
+ {
+ wsdlPublishLocation = wsd.getWsdlPublishLocation();
+ }
+ }
+ return wsdlPublishLocation;
+ }
+ };
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB21.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB21.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB21.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,188 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: InvocationHandlerEJB21.java 4023 2007-07-28 07:14:06Z thomas.diesler at jboss.com $
+
+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.plugins.SecurityContextAssociation;
+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 at 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 bean's JNDI name
+ jndiName = beanMetaData.getContainerObjectNameJndiName();
+ if (jndiName == null)
+ throw new WebServiceException("Cannot obtain JNDI name for: " + ejbName);
+
+ server = MBeanServerLocator.locateJBoss();
+ objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName + ",service=EJB");
+ if (server.isRegistered(objectName) == false)
+ throw new WebServiceException("Cannot find service endpoint target: " + objectName);
+
+ // 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);
+ }
+
+ }
+
+ public void invoke(Endpoint ep, Invocation inv) throws Exception
+ {
+ log.debug("Invoke: " + inv.getJavaMethod().getName());
+
+ // 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;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB3.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB3.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB3.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: InvocationHandlerEJB3.java 4099 2007-08-02 13:36:49Z thomas.diesler at jboss.com $
+
+import java.lang.reflect.Method;
+
+import javax.ejb.EJBContext;
+import javax.management.ObjectName;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.MethodInfo;
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.BeanContextLifecycleCallback;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.stateless.StatelessBeanContext;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.injection.lang.reflect.BeanProperty;
+import org.jboss.wsf.common.ObjectNameFactory;
+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.Endpoint;
+import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.InvocationType;
+import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB3 extends AbstractInvocationHandler
+{
+ private ObjectName objectName;
+
+ InvocationHandlerEJB3()
+ {
+ }
+
+ public Invocation createInvocation()
+ {
+ return new Invocation();
+ }
+
+ public void init(Endpoint ep)
+ {
+ String ejbName = ep.getShortName();
+ ArchiveDeployment dep = (ArchiveDeployment)ep.getService().getDeployment();
+ String nameStr = "jboss.j2ee:name=" + ejbName + ",service=EJB3,jar=" + dep.getSimpleName();
+ if (dep.getParent() != null)
+ {
+ nameStr += ",ear=" + dep.getParent().getSimpleName();
+ }
+
+ objectName = ObjectNameFactory.create(nameStr.toString());
+
+ Dispatcher dispatcher = Dispatcher.singleton;
+ if (dispatcher.getRegistered(objectName.getCanonicalName()) == null)
+ throw new WebServiceException("Cannot find service endpoint target: " + objectName);
+ }
+
+ public void invoke(Endpoint ep, Invocation wsInv) throws Exception
+ {
+ try
+ {
+ Dispatcher dispatcher = Dispatcher.singleton;
+ StatelessContainer container = (StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
+ Class beanClass = container.getBeanClass();
+
+ Method method = getImplMethod(beanClass, wsInv.getJavaMethod());
+ Object[] args = wsInv.getArgs();
+
+ MethodInfo info = container.getMethodInfo(method);
+ EJBContainerInvocation<StatelessContainer, StatelessBeanContext> jbInv = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+ jbInv.setAdvisor(container);
+ jbInv.setArguments(args);
+ jbInv.setContextCallback(new CallbackImpl(wsInv));
+
+ Object retObj = jbInv.invokeNext();
+
+ wsInv.setReturnValue(retObj);
+ }
+ catch (Throwable th)
+ {
+ handleInvocationException(th);
+ }
+ }
+
+ static class CallbackImpl implements BeanContextLifecycleCallback
+ {
+ private javax.xml.ws.handler.MessageContext jaxwsMessageContext;
+ private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
+
+ public CallbackImpl(Invocation epInv)
+ {
+ jaxrpcMessageContext = epInv.getInvocationContext().getAttachment(javax.xml.rpc.handler.MessageContext.class);
+ jaxwsMessageContext = epInv.getInvocationContext().getAttachment(javax.xml.ws.handler.MessageContext.class);
+ }
+
+ public void attached(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ {
+ EJBContext ejbCtx = beanCtx.getEJBContext();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ ExtensibleWebServiceContext wsContext = spiProvider.getSPI(WebServiceContextFactory.class).newWebServiceContext(InvocationType.JAXWS_EJB3, jaxwsMessageContext);
+ wsContext.addAttachment(EJBContext.class, ejbCtx);
+ beanProp.set(beanCtx.getInstance(), wsContext);
+ }
+ }
+
+ public void released(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(null);
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ beanProp.set(beanCtx.getInstance(), null);
+ }
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerFactoryImpl.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerFactoryImpl.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerFactoryImpl.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.wsf.spi.invocation.*;
+
+/**
+ * The default invocation model factory fro AS 5.0.
+ *
+ * @author Heiko.Braun at 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 DefaultInvocationHandlerJAXRPC();
+ break;
+ case JAXRPC_EJB21:
+ handler = new InvocationHandlerEJB21();
+ break;
+ case JAXWS_JSE:
+ handler = new DefaultInvocationHandlerJAXWS();
+ break;
+ case JAXWS_EJB21:
+ handler = new InvocationHandlerEJB21();
+ break;
+ case JAXWS_EJB3:
+ handler = new InvocationHandlerEJB3();
+ }
+
+ if(null == handler)
+ throw new IllegalArgumentException("Unable to resolve spi.invocation.InvocationHandler for type " +type);
+
+ return handler;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: JAXRPCDeployerHookEJB21.java 4239 2007-08-07 19:13:42Z heiko.braun at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Service;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * A deployer JAXRPC EJB21 Endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXRPCDeployerHookEJB21 extends AbstractDeployerHookEJB
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXRPC_EJB21;
+ }
+
+ @Override
+ public Deployment createDeployment(DeploymentUnit unit)
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setRuntimeClassLoader(unit.getClassLoader());
+ dep.setType(getDeploymentType());
+
+ Service service = dep.getService();
+
+ ApplicationMetaData appmd = unit.getAttachment(ApplicationMetaData.class);
+ if (appmd == null)
+ throw new IllegalStateException("Deployment unit does not contain application meta data");
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit);
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain webservices meta data");
+
+ // Copy the attachments
+ dep.addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.addAttachment(ApplicationMetaData.class, appmd);
+
+ 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");
+
+ BeanMetaData beanMetaData = appmd.getBeanByEjbName(ejbLink);
+ if (beanMetaData == null)
+ throw new IllegalStateException("Cannot obtain bean meta data for: " + ejbLink);
+
+ String ejbClass = beanMetaData.getEjbClass();
+
+ // Create the endpoint
+ Endpoint ep = newEndpoint(ejbClass);
+ ep.setShortName(ejbLink);
+ service.addEndpoint(ep);
+ }
+ }
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentUnit unit)
+ {
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit);
+ return wsMetaData != null && unit.getAllMetaData(ApplicationMetaData.class).size() > 0;
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookPostJSE.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookPostJSE.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookPostJSE.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: JAXRPCDeployerHookPostJSE.java 4244 2007-08-08 09:19:04Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * A deployer JAXRPC JSE Endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXRPCDeployerHookPostJSE extends DeployerHookPostJSE
+{
+ /** Get the deployment type this deployer can handle
+ */
+ public Deployment.DeploymentType getDeploymentType()
+ {
+ return Deployment.DeploymentType.JAXRPC_JSE;
+ }
+
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentUnit unit)
+ {
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit);
+ return (wsMetaData!=null && super.isWebServiceDeployment(unit));
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookPreJSE.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookPreJSE.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookPreJSE.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: JAXRPCDeployerHookPreJSE.java 4276 2007-08-09 08:34:58Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.metadata.web.Servlet;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Service;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * A deployer JAXRPC JSE Endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXRPCDeployerHookPreJSE extends AbstractDeployerHookJSE
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXRPC_JSE;
+ }
+
+ /**
+ * Create an endpoint for every servlet-link in webservices.xml
+ */
+ @Override
+ public Deployment createDeployment(DeploymentUnit unit)
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setRuntimeClassLoader(null);
+ dep.setType(getDeploymentType());
+
+ Service service = dep.getService();
+
+ WebMetaData webMetaData = unit.getAttachment(WebMetaData.class);
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta data");
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit);
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain webservices meta data");
+
+ // Copy the attachments
+ dep.addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.addAttachment(WebMetaData.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");
+
+ Servlet servlet = getServletForName(webMetaData, servletLink);
+ String servletClass = servlet.getServletClass();
+
+ // Create the endpoint
+ Endpoint ep = newEndpoint(servletClass);
+ ep.setShortName(servletLink);
+ service.addEndpoint(ep);
+ }
+ }
+
+ return dep;
+ }
+
+ private Servlet getServletForName(WebMetaData wmd, String servletLink)
+ {
+ for (Servlet servlet : wmd.getServlets())
+ {
+ if (servletLink.equals(servlet.getName()))
+ {
+ return servlet;
+ }
+ }
+ throw new IllegalStateException("Cannot find servlet for link: " + servletLink);
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentUnit unit)
+ {
+ if (super.isWebServiceDeployment(unit) == false)
+ return false;
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit);
+ return wsMetaData != null;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: JAXWSDeployerHookEJB3.java 4239 2007-08-07 19:13:42Z heiko.braun at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Service;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+import java.util.Iterator;
+
+/**
+ * A deployer JAXWS EJB3 Endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXWSDeployerHookEJB3 extends AbstractDeployerHookEJB
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXWS_EJB3;
+ }
+
+ @Override
+ public Deployment createDeployment(DeploymentUnit unit)
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setRuntimeClassLoader(unit.getClassLoader());
+ dep.setType(getDeploymentType());
+
+ Service service = dep.getService();
+
+ Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
+ if (ejb3Deployment == null)
+ throw new IllegalStateException("Deployment unit does not contain ejb3 deployment");
+
+ // Copy the attachments
+ dep.addAttachment(Ejb3Deployment.class, ejb3Deployment);
+
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ if (isWebServiceBean(container))
+ {
+ String ejbName = container.getEjbName();
+ String epBean = container.getBeanClassName();
+
+ // Create the endpoint
+ Endpoint ep = newEndpoint(epBean);
+ ep.setShortName(ejbName);
+ service.addEndpoint(ep);
+ }
+ }
+
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentUnit unit)
+ {
+ Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
+ if (ejb3Deployment == null)
+ return false;
+
+ boolean isWebServiceDeployment = false;
+
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ if (isWebServiceBean(container))
+ {
+ isWebServiceDeployment = true;
+ break;
+ }
+ }
+
+ return isWebServiceDeployment;
+ }
+
+ private boolean isWebServiceBean(EJBContainer container)
+ {
+ boolean isWebServiceBean = false;
+ if (container instanceof StatelessContainer)
+ {
+ boolean isWebService = container.resolveAnnotation(WebService.class) != null;
+ boolean isWebServiceProvider = container.resolveAnnotation(WebServiceProvider.class) != null;
+ isWebServiceBean = isWebService || isWebServiceProvider;
+ }
+ return isWebServiceBean;
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: JAXWSDeployerHookJSE.java 4239 2007-08-07 19:13:42Z heiko.braun at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.metadata.web.Servlet;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Service;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A deployer JAXWS JSE Endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXWSDeployerHookJSE extends AbstractDeployerHookJSE
+{
+ /** Get the deployment type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXWS_JSE;
+ }
+
+ @Override
+ public Deployment createDeployment(DeploymentUnit unit)
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setType(getDeploymentType());
+
+ Service service = dep.getService();
+
+ WebMetaData webMetaData = unit.getAttachment(WebMetaData.class);
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta data");
+
+ // Copy the attachments
+ dep.addAttachment(WebMetaData.class, webMetaData);
+
+ List<Servlet> servlets = getRelevantServlets(webMetaData, unit.getClassLoader());
+ for (Servlet servlet : servlets)
+ {
+ String servletName = servlet.getName();
+ String servletClass = servlet.getServletClass();
+
+ // Create the endpoint
+ Endpoint ep = newEndpoint(servletClass);
+ ep.setShortName(servletName);
+ service.addEndpoint(ep);
+ }
+
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentUnit unit)
+ {
+ if (super.isWebServiceDeployment(unit) == false)
+ return false;
+
+ boolean isWebServiceDeployment = false;
+ try
+ {
+ WebMetaData webMetaData = unit.getAttachment(WebMetaData.class);
+ List<Servlet> servlets = getRelevantServlets(webMetaData, unit.getClassLoader());
+ isWebServiceDeployment = servlets.size() > 0;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process web deployment", ex);
+ }
+
+ return isWebServiceDeployment;
+ }
+
+ private List<Servlet> getRelevantServlets(WebMetaData webMetaData, ClassLoader loader)
+ {
+ List<Servlet> servlets = new ArrayList<Servlet>();
+ for (Servlet servlet : webMetaData.getServlets())
+ {
+ String servletClassName = servlet.getServletClass();
+
+ // Skip JSPs
+ if (servletClassName == null || servletClassName.length() == 0)
+ continue;
+
+ try
+ {
+ Class<?> servletClass = loader.loadClass(servletClassName.trim());
+ boolean isWebService = servletClass.isAnnotationPresent(WebService.class);
+ boolean isWebServiceProvider = servletClass.isAnnotationPresent(WebServiceProvider.class);
+ if (isWebService || isWebServiceProvider)
+ servlets.add(servlet);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + servletClassName);
+ continue;
+ }
+ }
+ return servlets;
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookPostJSE.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookPostJSE.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookPostJSE.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: JAXWSDeployerHookPostJSE.java 4244 2007-08-08 09:19:04Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * @version $Revision: 4244 $
+ */
+public class JAXWSDeployerHookPostJSE extends DeployerHookPostJSE
+{
+ /** Get the deployment type this deployer can handle
+ */
+ public Deployment.DeploymentType getDeploymentType()
+ {
+ return Deployment.DeploymentType.JAXWS_JSE;
+ }
+
+ /**
+ * Reject JAX-RPC deployments.
+ *
+ * @param unit
+ * @return
+ */
+ public boolean isWebServiceDeployment(DeploymentUnit unit)
+ {
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit);// JAX-RPC artefact
+ return (wsMetaData == null && super.isWebServiceDeployment(unit));
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JSEArchiveMetaDataAdapter.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JSEArchiveMetaDataAdapter.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/JSEArchiveMetaDataAdapter.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: JSEArchiveMetaDataAdapter.java 4013 2007-07-27 04:37:52Z thomas.diesler at jboss.com $
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployment.J2eeApplicationMetaData;
+import org.jboss.deployment.J2eeModuleMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.metadata.WebSecurityMetaData;
+import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
+import org.jboss.metadata.web.Servlet;
+import org.jboss.metadata.web.ServletMapping;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData.PublishLocationAdapter;
+import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData.JSEResourceCollection;
+
+import java.util.*;
+
+/**
+ * Build container independent web meta data
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public class JSEArchiveMetaDataAdapter
+{
+ public JSEArchiveMetaData buildUnifiedWebMetaData(Deployment dep, DeploymentUnit unit)
+ {
+ String contextRoot = null;
+
+ WebMetaData wmd = unit.getAttachment(WebMetaData.class);
+ dep.addAttachment(WebMetaData.class, wmd);
+
+ if (unit.getParent() != null)
+ {
+ J2eeApplicationMetaData appmd = unit.getParent().getAttachment(J2eeApplicationMetaData.class);
+ if (appmd != null)
+ {
+ J2eeModuleMetaData module = appmd.getModule(dep.getSimpleName());
+ if (module != null)
+ contextRoot = module.getWebContext();
+ }
+ }
+
+ if (contextRoot == null)
+ contextRoot = wmd.getContextRoot();
+
+ JSEArchiveMetaData umd = new JSEArchiveMetaData();
+ umd.setContextRoot(contextRoot);
+ umd.setServletMappings(getServletMappings(wmd));
+ umd.setServletClassNames(getServletClassMap(wmd));
+ umd.setConfigName(wmd.getConfigName());
+ umd.setConfigFile(wmd.getConfigFile());
+ umd.setSecurityDomain(wmd.getSecurityDomain());
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(wmd));
+ umd.setSecurityMetaData(getSecurityMetaData(wmd.getSecurityContraints()));
+
+ return umd;
+ }
+
+ private PublishLocationAdapter getPublishLocationAdpater(final WebMetaData wmd)
+ {
+ return new PublishLocationAdapter()
+ {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ return wmd.getWsdlPublishLocationByName(name);
+ }
+ };
+ }
+
+ protected List<JSESecurityMetaData> getSecurityMetaData(final Iterator securityConstraints)
+ {
+ ArrayList<JSESecurityMetaData> unifiedsecurityMetaData = new ArrayList<JSESecurityMetaData>();
+
+ while (securityConstraints.hasNext())
+ {
+ WebSecurityMetaData securityMetaData = (WebSecurityMetaData)securityConstraints.next();
+
+ JSESecurityMetaData current = new JSESecurityMetaData();
+ unifiedsecurityMetaData.add(current);
+
+ current.setTransportGuarantee(securityMetaData.getTransportGuarantee());
+
+ Map<String, WebResourceCollection> resources = securityMetaData.getWebResources();
+ for (WebResourceCollection webResource : resources.values())
+ {
+ JSEResourceCollection currentResource = current.addWebResource(webResource.getName());
+ for (String currentPattern : webResource.getUrlPatterns())
+ {
+ currentResource.addPattern(currentPattern);
+ }
+ }
+ }
+
+ return unifiedsecurityMetaData;
+ }
+
+ private Map<String, String> getServletMappings(WebMetaData wmd)
+ {
+ Map<String, String> mappings = new HashMap<String, String>();
+ Iterator it = wmd.getServletMappings().iterator();
+ while (it.hasNext())
+ {
+ ServletMapping sm = (ServletMapping)it.next();
+ // FIXME - Add support for multiple mappings
+ mappings.put(sm.getName(), sm.getUrlPatterns().get(0));
+ }
+ return mappings;
+ }
+
+ private Map<String, String> getServletClassMap(WebMetaData wmd)
+ {
+ Map<String, String> mappings = new HashMap<String, String>();
+ Iterator it = wmd.getServlets().iterator();
+ while (it.hasNext())
+ {
+ Servlet servlet = (Servlet)it.next();
+ // Skip JSPs
+ if (servlet.getServletClass() == null || servlet.getServletClass().length() == 0)
+ continue;
+
+ mappings.put(servlet.getName(), servlet.getServletClass());
+ }
+ return mappings;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ModifyWebMetaDataDeploymentAspect.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ModifyWebMetaDataDeploymentAspect.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ModifyWebMetaDataDeploymentAspect.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: ModifyWebMetaDataDeployer.java 3150 2007-05-20 00:29:48Z thomas.diesler at jboss.com $
+
+import org.jboss.metadata.Listener;
+import org.jboss.metadata.NameValuePair;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.metadata.web.ParamValue;
+import org.jboss.metadata.web.ParamValue.ParamType;
+import org.jboss.metadata.web.Servlet;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * A deployer that modifies the web.xml meta data
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class ModifyWebMetaDataDeploymentAspect extends DeploymentAspect
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ String propKey = "org.jboss.ws.webapp.ServletClass";
+ String servletClass = (String)dep.getProperty(propKey);
+ if (servletClass == null)
+ throw new IllegalStateException("Cannot obtain context property: " + propKey);
+
+ modifyServletClass(dep, servletClass);
+
+ propKey = "org.jboss.ws.webapp.ServletContextListener";
+ String listenerClass = (String)dep.getProperty(propKey);
+ if (listenerClass != null)
+ modifyListener(dep, listenerClass);
+
+ propKey = "org.jboss.ws.webapp.ContextParameterMap";
+ Map<String, String> contextParams = (Map<String, String>)dep.getProperty(propKey);
+ if (contextParams != null)
+ modifyContextParams(dep, contextParams);
+ }
+
+ private void modifyServletClass(Deployment dep, String servletClass)
+ {
+
+ WebMetaData webMetaData = dep.getAttachment(WebMetaData.class);
+ if (webMetaData != null)
+ {
+ for (Servlet servlet : webMetaData.getServlets())
+ {
+ String orgServletClass = servlet.getServletClass();
+
+ // JSP
+ if (orgServletClass == null || orgServletClass.length() == 0)
+ {
+ log.debug("Innore servlet class: " + orgServletClass);
+ continue;
+ }
+
+ // Nothing to do if we have an <init-param>
+ if (!isAlreadyModified(servlet) && !isJavaxServlet(orgServletClass, dep.getInitialClassLoader()))
+ {
+ servlet.setServletClass(servletClass);
+ NameValuePair initParam = new NameValuePair(Endpoint.SEPID_DOMAIN_ENDPOINT, orgServletClass);
+ servlet.addInitParam(initParam);
+ }
+ }
+ }
+ }
+
+ private void modifyListener(Deployment dep, String listenerClass)
+ {
+ WebMetaData webMetaData = dep.getAttachment(WebMetaData.class);
+ if (webMetaData != null)
+ {
+ Listener listener = new Listener();
+ listener.setListenerClass(listenerClass);
+ webMetaData.addListener(listener);
+ }
+ }
+
+ private void modifyContextParams(Deployment dep, Map<String, String> contextParams)
+ {
+ WebMetaData webMetaData = dep.getAttachment(WebMetaData.class);
+ if (webMetaData != null)
+ {
+ for (Map.Entry<String, String> entry : contextParams.entrySet())
+ {
+ ParamValue ctxParam = new ParamValue();
+ ctxParam.setType(ParamType.CONTEXT_PARAM);
+ ctxParam.setName(entry.getKey());
+ ctxParam.setValue(entry.getValue());
+ webMetaData.addContextParam(ctxParam);
+ }
+ }
+ }
+
+ private boolean isJavaxServlet(String orgServletClass, ClassLoader loader)
+ {
+ boolean isServlet = false;
+ if (loader != null)
+ {
+ try
+ {
+ Class servletClass = loader.loadClass(orgServletClass);
+ isServlet = javax.servlet.Servlet.class.isAssignableFrom(servletClass);
+ if (isServlet == true)
+ {
+ log.info("Ignore servlet: " + orgServletClass);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.warn("Cannot load servlet class: " + orgServletClass);
+ }
+ }
+ return isServlet;
+ }
+
+ private boolean isAlreadyModified(Servlet servlet)
+ {
+ Iterator itParams = servlet.getInitParams().iterator();
+ while (itParams.hasNext())
+ {
+ NameValuePair pair = (NameValuePair)itParams.next();
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(pair.getName()))
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/RewriteResults.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/RewriteResults.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/RewriteResults.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import java.net.URL;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * Created: Jul 19, 2007
+ */
+public class RewriteResults
+{
+ // The URL to the rewritten web.xml
+ public URL webXML;
+ // Maps the servlet name to the target bean
+ public Map<String, String> sepTargetMap = new HashMap<String, String>();
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/RuntimeLoaderDeploymentAspect.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/RuntimeLoaderDeploymentAspect.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/RuntimeLoaderDeploymentAspect.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: RuntimeLoaderDeploymentAspect.java 4244 2007-08-08 09:19:04Z thomas.diesler at jboss.com $
+
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.ejb3.Ejb3Deployment;
+
+/**
+ * Determines the correct runtime loader for per deployment type
+ * and makes it available through the {@link Deployment}.
+ *
+ * @author Heiko.Braun at jboss.com
+ */
+public class RuntimeLoaderDeploymentAspect extends DeploymentAspect
+{
+
+ public void create(Deployment dep)
+ {
+
+ // JSE endpoints
+ if (dep.getAttachment(WebMetaData.class) != null)
+ {
+ WebMetaData webMetaData = dep.getAttachment(WebMetaData.class);
+ ClassLoader classLoader = webMetaData.getContextLoader();
+ dep.setRuntimeClassLoader(classLoader);
+ }
+
+ // EJB3 endpoints
+ else if (dep.getAttachment(Ejb3Deployment.class) != null)
+ {
+ dep.setRuntimeClassLoader(dep.getInitialClassLoader());
+ }
+
+ // EJB21 endpoints
+ else if (dep.getAttachment(ApplicationMetaData.class) != null)
+ {
+ dep.setRuntimeClassLoader(dep.getInitialClassLoader());
+ }
+
+ else
+ {
+ throw new IllegalArgumentException("Unable to determine runtime loader");
+ }
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityAdapterFactoryImpl.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityAdapterFactoryImpl.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityAdapterFactoryImpl.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * Created: Jul 24, 2007
+ */
+public class SecurityAdapterFactoryImpl extends SecurityAdaptorFactory
+{
+ public SecurityAdaptor newSecurityAdapter()
+ {
+ return new SecurityAdaptorImpl();
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityAdaptorImpl.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityAdaptorImpl.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityAdaptorImpl.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: SecurityAdaptorImpl.java 3978 2007-07-24 15:09:52Z heiko.braun at jboss.com $
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+
+import java.security.Principal;
+
+/**
+ * A JBoss specific SecurityAssociationAdaptor
+ *
+ * @author Thomas.Diesler at 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);
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB21.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB21.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB21.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: SecurityHandlerEJB21.java 4013 2007-07-27 04:37:52Z thomas.diesler at jboss.com $
+
+import org.dom4j.Element;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.AssemblyDescriptorMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.SecurityHandler;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Generate a service endpoint deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-May-2006
+ */
+public class SecurityHandlerEJB21 implements SecurityHandler
+{
+ public void addSecurityDomain(Element jbossWeb, Deployment dep)
+ {
+ EJBArchiveMetaData appMetaData = dep.getAttachment(EJBArchiveMetaData.class);
+ if (appMetaData == null)
+ throw new IllegalStateException("Cannot obtain application meta data");
+
+ String securityDomain = appMetaData.getSecurityDomain();
+ if (securityDomain != null)
+ {
+ if (securityDomain.startsWith("java:/jaas/") == false)
+ securityDomain = "java:/jaas/" + securityDomain;
+
+ jbossWeb.addElement("security-domain").addText(securityDomain);
+ }
+ }
+
+ public void addSecurityRoles(Element webApp, Deployment dep)
+ {
+ // Fix: http://jira.jboss.org/jira/browse/JBWS-309
+ ApplicationMetaData applMetaData = dep.getAttachment(ApplicationMetaData.class);
+ AssemblyDescriptorMetaData assemblyDescriptor = applMetaData.getAssemblyDescriptor();
+ if (assemblyDescriptor != null)
+ {
+ Map securityRoles = assemblyDescriptor.getSecurityRoles();
+ if (securityRoles != null)
+ {
+ Iterator it = securityRoles.keySet().iterator();
+ while (it.hasNext())
+ {
+ webApp.addElement("security-role").addElement("role-name").addText((String)it.next());
+ }
+ }
+ }
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB3.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB3.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB3.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: SecurityHandlerEJB3.java 4011 2007-07-27 02:45:35Z thomas.diesler at jboss.com $
+
+import org.dom4j.Element;
+import org.jboss.annotation.security.SecurityDomain;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.SecurityHandler;
+
+import javax.annotation.security.RolesAllowed;
+import java.util.Iterator;
+
+/**
+ * Generate a service endpoint deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-May-2006
+ */
+public class SecurityHandlerEJB3 implements SecurityHandler
+{
+ public void addSecurityDomain(Element jbossWeb, Deployment dep)
+ {
+ String securityDomain = null;
+
+ Ejb3Deployment ejb3Deployment = dep.getAttachment(Ejb3Deployment.class);
+ if (ejb3Deployment != null)
+ {
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ SecurityDomain anSecurityDomain = (SecurityDomain)container.resolveAnnotation(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.addElement("security-domain").addText(securityDomain);
+ }
+ }
+
+ public void addSecurityRoles(Element webApp, Deployment dep)
+ {
+ Ejb3Deployment ejb3Deployment = dep.getAttachment(Ejb3Deployment.class);
+ if (ejb3Deployment != null)
+ {
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ RolesAllowed anRolesAllowed = (RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
+ if (anRolesAllowed != null)
+ {
+ for (String role : anRolesAllowed.value())
+ {
+ webApp.addElement("security-role").addElement("role-name").addText(role);
+ }
+ }
+ }
+ }
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ServiceEndpointInterceptor.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ServiceEndpointInterceptor.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/ServiceEndpointInterceptor.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: ServiceEndpointInterceptor.java 3959 2007-07-20 14:44:19Z heiko.braun at jboss.com $
+
+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 at 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: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/VirtualFileAdaptor.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/VirtualFileAdaptor.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/VirtualFileAdaptor.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+
+import java.io.IOException;
+import java.net.URL;
+
+// $Id: VirtualFileAdaptor.java 4049 2007-08-01 11:26:30Z thomas.diesler at jboss.com $
+
+/**
+ * A JBoss50 VirtualFile adaptor
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public class VirtualFileAdaptor implements UnifiedVirtualFile
+{
+ private static final long serialVersionUID = 6547394037548338042L;
+
+ private VirtualFile root;
+
+ public VirtualFileAdaptor(VirtualFile root)
+ {
+ this.root = root;
+ }
+
+ public UnifiedVirtualFile findChild(String child) throws IOException
+ {
+ VirtualFile vf = root.findChild(child);
+ return new VirtualFileAdaptor(vf);
+ }
+
+ public URL toURL()
+ {
+ try
+ {
+ return root.toURL();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeployingHttpServer.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeployingHttpServer.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeployingHttpServer.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,247 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: JBossHttpServer.java 1786 2007-01-04 14:30:04Z thomas.diesler at jboss.com $
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.AbstractExtensible;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
+import org.jboss.wsf.spi.http.HttpServer;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.w3c.dom.Element;
+
+/**
+ * A Tomcat HTTP Server
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 07-Jul-2006
+ */
+public class WebAppDeployingHttpServer extends AbstractExtensible implements HttpServer
+{
+ private DeployerClient mainDeployer;
+ private Map<String, Deployment> deploymentMap = new HashMap<String, Deployment>();
+
+ public void setMainDeployer(DeployerClient mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ /** Start an instance of this HTTP server */
+ public void start()
+ {
+ // verify required properties
+ }
+
+ /** Create an HTTP context */
+ public HttpContext createContext(String contextRoot)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ HttpContext httpContext = spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this, contextRoot);
+ return httpContext;
+ }
+
+ /** Publish an JAXWS endpoint to the HTTP server */
+ public void publish(HttpContext context, Endpoint endpoint)
+ {
+ Class implClass = getImplementorClass(endpoint);
+ String implName = implClass.getName();
+
+ try
+ {
+ Element webDoc = createWebAppDescriptor(context, endpoint);
+ Element jbossDoc = createJBossWebAppDescriptor(context, endpoint);
+
+ File tmpWar = null;
+ try
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ ServerConfig serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
+ File tmpDir = new File(serverConfig.getServerTempDir().getCanonicalPath() + "/jbossws");
+ tmpDir.mkdirs();
+
+ String deploymentName = implName.substring(implName.lastIndexOf(".") + 1);
+ tmpWar = File.createTempFile(deploymentName, ".war", tmpDir);
+ tmpWar.delete();
+ File webInf = new File(tmpWar, "WEB-INF");
+ webInf.mkdirs();
+
+ File webXml = new File(webInf, "web.xml");
+ FileWriter fw = new FileWriter(webXml);
+ new DOMWriter(fw).setPrettyprint(true).print(webDoc);
+ fw.close();
+
+ File jbossWebXml = new File(webInf, "jboss-web.xml");
+ fw = new FileWriter(jbossWebXml);
+ new DOMWriter(fw).setPrettyprint(true).print(jbossDoc);
+ fw.close();
+ }
+ catch (IOException e)
+ {
+ throw new WebServiceException("Failed to create webservice war", e);
+ }
+
+ Map<String, Object> epProps = endpoint.getProperties();
+ epProps.put("jbossws-endpoint-war-url", tmpWar);
+
+ URL tmpURL = tmpWar.toURL();
+ Deployment deployment = createDeploymentContext(tmpURL);
+
+ mainDeployer.deploy(deployment);
+ deploymentMap.put(tmpURL.toExternalForm(), deployment);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ /** Destroys an JAXWS endpoint on the HTTP server */
+ public void destroy(HttpContext context, Endpoint endpoint)
+ {
+ Map<String, Object> epProps = endpoint.getProperties();
+ File tmpWar = (File)epProps.get("jbossws-endpoint-war-url");
+ if (tmpWar == null)
+ throw new IllegalStateException("Cannot find endpoint war property");
+
+ try
+ {
+ URL tmpURL = tmpWar.toURL();
+ Deployment deployment = deploymentMap.get(tmpURL.toExternalForm());
+ if (deployment != null)
+ {
+ mainDeployer.undeploy(deployment);
+ deploymentMap.remove(tmpURL.toExternalForm());
+ }
+
+ tmpWar.delete();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ private Class getImplementorClass(Endpoint endpoint)
+ {
+ Object implementor = endpoint.getImplementor();
+ Class implClass = (implementor instanceof Class ? (Class)implementor : implementor.getClass());
+ return implClass;
+ }
+
+ private Element createWebAppDescriptor(HttpContext context, Endpoint endpoint)
+ {
+ Class implClass = getImplementorClass(endpoint);
+ String implName = implClass.getName();
+
+ Element webApp = DOMUtils.createElement("web-app");
+
+ /*
+ <servlet>
+ <servlet-name>
+ <servlet-class>
+ </servlet>
+ */
+ Element servlet = (Element)webApp.appendChild(DOMUtils.createElement("servlet"));
+ Element servletName = (Element)servlet.appendChild(DOMUtils.createElement("servlet-name"));
+ servletName.appendChild(DOMUtils.createTextNode("JAXWSEndpoint"));
+ Element servletClass = (Element)servlet.appendChild(DOMUtils.createElement("servlet-class"));
+ servletClass.appendChild(DOMUtils.createTextNode(implName));
+
+ /*
+ <servlet-mapping>
+ <servlet-name>
+ <url-pattern>
+ </servlet-mapping>
+ */
+ Element servletMapping = (Element)webApp.appendChild(DOMUtils.createElement("servlet-mapping"));
+ servletName = (Element)servletMapping.appendChild(DOMUtils.createElement("servlet-name"));
+ servletName.appendChild(DOMUtils.createTextNode("JAXWSEndpoint"));
+ Element urlPatternElement = (Element)servletMapping.appendChild(DOMUtils.createElement("url-pattern"));
+
+ String urlPattern = "/*";
+ urlPatternElement.appendChild(DOMUtils.createTextNode(urlPattern));
+
+ // Add security-constraint in generated web.xml for Endpoint API
+ // FIXME: JBWS-1069
+
+ return webApp;
+ }
+
+ private Element createJBossWebAppDescriptor(HttpContext context, Endpoint endpoint)
+ {
+ /* Create a jboss-web
+ <jboss-web>
+ <security-domain>java:/jaas/cts</security-domain>
+ <context-root>/ws/ejbN/</context-root>
+ </jboss-web>
+ */
+ Element jbossWeb = DOMUtils.createElement("jboss-web");
+
+ // Get the context root for this deployment
+ String contextRoot = context.getContextRoot();
+ if (contextRoot == null)
+ throw new WebServiceException("Cannot obtain context root");
+
+ Element root = (Element)jbossWeb.appendChild(DOMUtils.createElement("context-root"));
+ root.appendChild(DOMUtils.createTextNode(contextRoot));
+
+ // Add security-constraint in generated web.xml for Endpoint API
+ // FIXME: JBWS-1069
+
+ return jbossWeb;
+ }
+
+ private Deployment createDeploymentContext(URL warURL) throws Exception
+ {
+ VirtualFile file = VFS.getRoot(warURL);
+ return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: WebAppDeployerDeployer.java 3772 2007-07-01 19:29:13Z thomas.diesler at jboss.com $
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+
+/**
+ * Publish the HTTP service endpoint to Tomcat
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-May-2006
+ */
+public class WebAppDeploymentAspect extends DeploymentAspect
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WebAppDeploymentAspect.class);
+
+ private DeployerClient mainDeployer;
+ private WebXMLRewriterImpl webXMLRewriter;
+ private Map<String, org.jboss.deployers.client.spi.Deployment> deploymentMap = new HashMap<String, org.jboss.deployers.client.spi.Deployment>();
+
+ public void setMainDeployer(DeployerClient mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ public void setWebXMLRewriter(WebXMLRewriterImpl serviceEndpointPublisher)
+ {
+ this.webXMLRewriter = serviceEndpointPublisher;
+ }
+
+ public void create(Deployment dep)
+ {
+ URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
+ if (warURL == null)
+ throw new IllegalStateException("Cannot obtain generated webapp URL");
+
+ log.debug("publishServiceEndpoint: " + warURL);
+ try
+ {
+ webXMLRewriter.rewriteWebXml(dep);
+ org.jboss.deployers.client.spi.Deployment deployment = createDeploymentContext(warURL);
+
+ mainDeployer.deploy(deployment);
+
+ deploymentMap.put(warURL.toExternalForm(), deployment);
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ public void destroy(Deployment dep)
+ {
+ URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
+ if (warURL == null)
+ {
+ log.error("Cannot obtain generated webapp URL");
+ return;
+ }
+
+ log.debug("destroyServiceEndpoint: " + warURL);
+ try
+ {
+ org.jboss.deployers.client.spi.Deployment deployment = deploymentMap.get(warURL.toExternalForm());
+ if (deployment != null)
+ {
+ mainDeployer.undeploy(deployment);
+ deploymentMap.remove(warURL.toExternalForm());
+ }
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ private org.jboss.deployers.client.spi.Deployment createDeploymentContext(URL warURL) throws Exception
+ {
+ VirtualFile file = VFS.getRoot(warURL);
+ return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.dom4j.Document;
+
+/**
+ * Modifies the web app according to the stack requirements.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-May-2007
+ */
+public interface WebAppDesciptorModifier
+{
+ final String SERVLET_CONTEXT_LISTENER = "org.jboss.ws.webapp.ServletContextListener";
+ final String CONTEXT_PARAMETER_MAP = "org.jboss.ws.webapp.ContextParameterMap";
+ final String SERVLET_CLASS = "org.jboss.ws.webapp.ServletClass";
+
+ RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException;
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceContextFactoryImpl.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceContextFactoryImpl.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceContextFactoryImpl.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.wsf.spi.invocation.*;
+
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * Created: Jul 25, 2007
+ */
+public class WebServiceContextFactoryImpl extends WebServiceContextFactory
+{
+ public ExtensibleWebServiceContext newWebServiceContext(InvocationType type, MessageContext messageContext)
+ {
+ ExtensibleWebServiceContext context = null;
+
+ if(type.toString().indexOf("EJB")!=-1 || type.toString().indexOf("MDB")!=-1)
+ context = new WebServiceContextEJB(messageContext);
+ else
+ context = new WebServiceContextJSE(messageContext);
+
+ return context;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerEJB.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerEJB.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerEJB.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: WebServiceDeployerEJB.java 3146 2007-05-18 22:55:26Z thomas.diesler at jboss.com $
+
+/**
+ * This web service deployer for EJB
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Apr-2007
+ */
+public class WebServiceDeployerEJB extends AbstractWebServiceDeployer
+{
+ private int relOrderEJB2x;
+ private int relOrderEJB3;
+
+ public void setRelOrderEJB2x(int relOrderEJB2x)
+ {
+ this.relOrderEJB2x = relOrderEJB2x;
+ }
+
+ public void setRelOrderEJB3(int relOrderEJB3)
+ {
+ this.relOrderEJB3 = relOrderEJB3;
+ }
+
+ @Override
+ public int getRelativeOrder()
+ {
+ return Math.max(relOrderEJB2x, relOrderEJB3) + 1;
+ }
+
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerPostJSE.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerPostJSE.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerPostJSE.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+// $Id: $
+
+/**
+ * @author Heiko.Braun at jboss.com
+ */
+public class WebServiceDeployerPostJSE extends AbstractWebServiceDeployer
+{
+ private int relOrderWar;
+
+
+ public void setRelOrderWar(int relOrder)
+ {
+ this.relOrderWar = relOrder;
+ }
+
+ @Override
+ public int getRelativeOrder()
+ {
+ return relOrderWar + 1;
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerPreJSE.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerPreJSE.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceDeployerPreJSE.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: WebServiceDeployerJSE.java 3146 2007-05-18 22:55:26Z thomas.diesler at jboss.com $
+
+/**
+ * This web service deployer for JSE
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Apr-2007
+ */
+public class WebServiceDeployerPreJSE extends AbstractWebServiceDeployer
+{
+ private int relOrderWar;
+
+ public void setRelOrderWar(int relOrderWar)
+ {
+ this.relOrderWar = relOrderWar;
+ }
+
+ @Override
+ public int getRelativeOrder()
+ {
+ return relOrderWar - 1;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceMainDeployer.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceMainDeployer.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebServiceMainDeployer.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+//$Id: WebServiceMainDeployer.java 3146 2007-05-18 22:55:26Z thomas.diesler at jboss.com $
+
+/**
+ * The main web service deployer
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Apr-2007
+ */
+public class WebServiceMainDeployer extends AbstractWebServiceDeployer
+{
+ private int relOrderJSE;
+ private int relOrderEJB;
+
+ public void setRelOrderEJB(int relOrderEJB)
+ {
+ this.relOrderEJB = relOrderEJB;
+ }
+
+ public void setRelOrderJSE(int relOrderJSE)
+ {
+ this.relOrderJSE = relOrderJSE;
+ }
+
+ @Override
+ public int getRelativeOrder()
+ {
+ return Math.max(relOrderEJB, relOrderJSE) + 1;
+ }
+}
Added: branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java
===================================================================
--- branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java (rev 0)
+++ branches/tdiesler/webservices/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.wsf.container.jboss50;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.common.IOUtils;
+import org.dom4j.io.SAXReader;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+import org.dom4j.Document;
+
+import javax.xml.ws.WebServiceException;
+import java.net.URL;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.FileOutputStream;
+
+/**
+ * The rewriter for web.xml
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-May-2007
+ */
+public class WebXMLRewriterImpl
+{
+ private WebAppDesciptorModifier desciptorModifier;
+
+ public WebXMLRewriterImpl()
+ {
+ this.desciptorModifier = new DefaultWebAppDesciptorModifierImpl();
+ }
+
+ public WebAppDesciptorModifier getDesciptorModifier()
+ {
+ return desciptorModifier;
+ }
+
+ public void setDesciptorModifier(WebAppDesciptorModifier desciptorModifier)
+ {
+ this.desciptorModifier = desciptorModifier;
+ }
+
+ public RewriteResults rewriteWebXml(Deployment dep)
+ {
+ URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
+ File warFile = new File(warURL.getFile());
+ if (warFile.isDirectory() == false)
+ throw new WebServiceException("Expected a war directory: " + warURL);
+
+ File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
+ if (webXML.isFile() == false)
+ throw new WebServiceException("Cannot find web.xml: " + webXML);
+
+ try
+ {
+ // After redeployment there might be a stale copy of the original web.xml.org, we delete it
+ File orgWebXML = new File(webXML.getCanonicalPath() + ".org");
+ orgWebXML.delete();
+
+ // Rename the web.xml
+ if (webXML.renameTo(orgWebXML) == false)
+ throw new WebServiceException("Cannot rename web.xml: " + orgWebXML);
+
+ FileInputStream stream = new FileInputStream(orgWebXML);
+ return rewriteWebXml(stream, webXML, dep);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+
+ private RewriteResults rewriteWebXml(InputStream source, File destFile, Deployment dep) throws Exception
+ {
+ if (destFile == null)
+ {
+ destFile = File.createTempFile("jbossws-alt-web", "xml", IOUtils.createTempDirectory());
+ destFile.deleteOnExit();
+ }
+
+ SAXReader reader = new SAXReader();
+ Document document = reader.read(source);
+
+ RewriteResults results = desciptorModifier.modifyDescriptor(dep, document);
+ results.webXML = destFile.toURL();
+
+ FileOutputStream fos = new FileOutputStream(destFile);
+ OutputFormat format = OutputFormat.createPrettyPrint();
+ XMLWriter writer = new XMLWriter(fos, format);
+ writer.write(document);
+ writer.close();
+
+ return results;
+ }
+}
Added: branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-beans.xml
===================================================================
--- branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-beans.xml (rev 0)
+++ branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-beans.xml 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- Locate the single instance of the kernel -->
+ <bean name="WSKernelLocator" class="org.jboss.wsf.spi.util.KernelLocator">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ </bean>
+
+ <!-- Locate the single instance of the MBeanServer -->
+ <bean name="WSMBeanServerLocator" class="org.jboss.wsf.framework.management.MBeanServerLocator">
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ </bean>
+
+ <!-- The HTTPServer used by the JAXWS Endpoint API -->
+ <bean name="WSHTTPServer" class="org.jboss.wsf.container.jboss50.DeploymentAspectHttpServer"/>
+
+ <!--
+ *********************************************************************************************************************
+ Web Service deployment
+
+ There are two deployers registered with the JBoss Main Deployer.
+ The order of which is important
+
+ 1) EJBDeployer < WebServiceDeployerEJB
+ 2) WebServiceDeployerPreJSE < WarDeployer
+ 3) WarDeployer < WebServiceDeployerPostJSE
+
+ Each WebServiceDeployer has a number of DeployerHooks registered with it
+
+ - WebServiceDeployerEJB
+ - WSDeployerHook_JAXRPC_EJB21
+ - WSDeployerHook_JAXWS_EJB3
+
+ - WebServiceDeployerPreJSE
+ - WSDeployerHook_JAXRPC_JSE
+ - WSDeployerHook_JAXWS_JSE
+
+ Conceptually, each of these hooks implements the following pattern:
+
+ DeployerHook.deploy(unit)
+ if(isWebServiceDeployment)
+ Deployment dep = createDeployment(unit)
+ DeploymentAspectManager.deploy(dep)
+
+ DeployerHook.undeploy(unit)
+ Deployment dep = getDeployment(unit)
+ DeploymentAspectManager.undeploy(dep)
+
+ Each deployer hook has a web service DeploymentAspectManager injected into it.
+ A web service DeploymentAspectManager maintains a list of DeploymentAspects, each of which
+ handles a single aspect of web service deployment.
+
+ Finally, each Endpoint is registered with the EndpointRegistry.
+
+ *********************************************************************************************************************
+ -->
+
+ <!--
+ A web service deployer that hooks in after the EJB deployers
+ -->
+ <bean name="WebServiceDeployerEJB" class="org.jboss.wsf.container.jboss50.WebServiceDeployerEJB">
+ <property name="relOrderEJB2x"><inject bean="EJB2xDeployer" property="relativeOrder"/></property>
+ <property name="relOrderEJB3"><inject bean="EJBRegistrationDeployer" property="relativeOrder"/></property>
+ <depends>EJB2xDeployer</depends>
+ <depends>EJBRegistrationDeployer</depends>
+ </bean>
+
+ <!--
+ A web service deployer that hooks in before the WAR deployer
+ -->
+ <bean name="WebServiceDeployerPreJSE" class="org.jboss.wsf.container.jboss50.WebServiceDeployerPreJSE">
+ <property name="relOrderWar"><inject bean="WarDeployer" property="relativeOrder"/></property>
+ <depends>WebAppParsingDeployer</depends>
+ </bean>
+
+ <!--
+ A web service deployer that hooks in after the WAR deployer
+ This deployer depends on the RuntimeClassloader being available.
+ -->
+ <bean name="WebServiceDeployerPostJSE" class="org.jboss.wsf.container.jboss50.WebServiceDeployerPostJSE">
+ <property name="relOrderWar"><inject bean="WarDeployer" property="relativeOrder"/></property>
+ <depends>WebAppParsingDeployer</depends>
+ </bean>
+
+ <!--
+ Register DeployerHooks with JBoss deployers
+ -->
+
+ <!-- Phase 1 of JSE JAX-RPC -->
+ <bean name="WSDeployerHook_JAXRPC_PRE_JSE" class="org.jboss.wsf.container.jboss50.JAXRPCDeployerHookPreJSE">
+ <property name="deploymentManagerName">WSDeploymentAspectManagerPreJSE</property>
+ <install bean="WebServiceDeployerPreJSE" method="addDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="WebServiceDeployerPreJSE" method="removeDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <depends>WebServiceDeployerPreJSE</depends>
+ </bean>
+ <!-- Phase 2 of JSE JAX-RPC -->
+ <bean name="WSDeployerHook_JAXRPC_POST_JSE" class="org.jboss.wsf.container.jboss50.JAXRPCDeployerHookPostJSE">
+ <property name="deploymentManagerName">WSDeploymentAspectManagerPostJSE</property>
+ <install bean="WebServiceDeployerPostJSE" method="addDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="WebServiceDeployerPostJSE" method="removeDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <depends>WebServiceDeployerPostJSE</depends>
+ </bean>
+
+ <bean name="WSDeployerHook_JAXRPC_EJB21" class="org.jboss.wsf.container.jboss50.JAXRPCDeployerHookEJB21">
+ <property name="deploymentManagerName">WSDeploymentAspectManagerEJB</property>
+ <install bean="WebServiceDeployerEJB" method="addDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="WebServiceDeployerEJB" method="removeDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <depends>WebServiceDeployerEJB</depends>
+ </bean>
+
+ <!-- Phase 1 of JSE JAX-WS-->
+ <bean name="WSDeployerHook_JAXWS_PRE_JSE" class="org.jboss.wsf.container.jboss50.JAXWSDeployerHookJSE">
+ <property name="deploymentManagerName">WSDeploymentAspectManagerPreJSE</property>
+ <install bean="WebServiceDeployerPreJSE" method="addDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="WebServiceDeployerPreJSE" method="removeDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <depends>WebServiceDeployerPreJSE</depends>
+ </bean>
+ <!-- Phase 2 of JSE JAX-WS -->
+ <bean name="WSDeployerHook_JAXWS_POST_JSE" class="org.jboss.wsf.container.jboss50.JAXWSDeployerHookPostJSE">
+ <property name="deploymentManagerName">WSDeploymentAspectManagerPostJSE</property>
+ <install bean="WebServiceDeployerPostJSE" method="addDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="WebServiceDeployerPostJSE" method="removeDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <depends>WebServiceDeployerPostJSE</depends>
+ </bean>
+
+ <bean name="WSDeployerHook_JAXWS_EJB3" class="org.jboss.wsf.container.jboss50.JAXWSDeployerHookEJB3">
+ <property name="deploymentManagerName">WSDeploymentAspectManagerEJB</property>
+ <install bean="WebServiceDeployerEJB" method="addDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="WebServiceDeployerEJB" method="removeDeployerHook">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <depends>WebServiceDeployerEJB</depends>
+ </bean>
+
+ <!--
+ Each DeploymentAspectManger maintains a list of DeploymentAspects
+ -->
+ <bean name="WSDeploymentAspectManagerPreJSE" class="org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl">
+ <property name="name">WSDeploymentAspectManagerPreJSE</property>
+ </bean>
+ <bean name="WSDeploymentAspectManagerPostJSE" class="org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl">
+ <property name="parent"><inject bean="WSDeploymentAspectManagerPreJSE"/></property>
+ <property name="name">WSDeploymentAspectManagerPostJSE</property>
+ </bean>
+ <bean name="WSDeploymentAspectManagerEJB" class="org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl">
+ <property name="name">WSDeploymentAspectManagerEJB</property>
+ </bean>
+ <bean name="WSDeploymentAspectManagerEndpointAPI" class="org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl">
+ <property name="name">WSDeploymentAspectManagerEndpointAPI</property>
+ </bean>
+
+ <!--
+ The container deployment aspects
+ -->
+ <bean name="WSContainerMetaDataDeploymentAspect" class="org.jboss.wsf.container.jboss50.ContainerMetaDataDeploymentAspect">
+ <property name="provides">ContainerMetaData, VFSRoot</property>
+ </bean>
+
+ <bean name="WSContextRootDeploymentAspect" class="org.jboss.wsf.framework.deployment.BackwardCompatibleContextRootDeploymentAspect">
+ <property name="requires">ContainerMetaData</property>
+ <property name="provides">ContextRoot</property>
+ </bean>
+
+ <bean name="WSEndpointAddressDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointAddressDeploymentAspect">
+ <property name="requires">URLPattern</property>
+ <property name="provides">EndpointAddress</property>
+ </bean>
+
+ <bean name="WSEndpointAPIDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointAPIDeploymentAspect">
+ <property name="provides">ContainerMetaData, RuntimeLoader, URLPattern, VFSRoot</property>
+ </bean>
+
+ <bean name="WSEndpointHandlerDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointHandlerDeploymentAspect">
+ <property name="requires">ContainerMetaData</property>
+ <property name="provides">ContainerEndpointHandler</property>
+ </bean>
+
+ <bean name="WSEndpointLifecycleDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointLifecycleDeploymentAspect">
+ <property name="requires">LAST_DEPLOYMENT_ASPECT</property>
+ </bean>
+
+ <bean name="WSEndpointMetricsDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointMetricsDeploymentAspect">
+ <property name="provides">EndpointMetrics</property>
+ </bean>
+
+ <bean name="WSEndpointNameDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointNameDeploymentAspect">
+ <property name="requires">URLPattern</property>
+ <property name="provides">EndpointName</property>
+ </bean>
+
+ <bean name="WSEndpointRegistryDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointRegistryDeploymentAspect">
+ <property name="requires">EndpointName</property>
+ <property name="provides">RegisteredEndpoint</property>
+ </bean>
+
+ <bean name="WSModifyWebMetaDataDeploymentAspect" class="org.jboss.wsf.container.jboss50.ModifyWebMetaDataDeploymentAspect">
+ <property name="requires">ContextProperties, StackDescriptor</property>
+ </bean>
+
+ <bean name="WSRuntimeLoaderDeploymentAspect" class="org.jboss.wsf.container.jboss50.RuntimeLoaderDeploymentAspect">
+ <property name="requires">ContainerMetaData</property>
+ <property name="provides">RuntimeLoader</property>
+ </bean>
+
+ <bean name="WSURLPatternDeploymentAspect" class="org.jboss.wsf.framework.deployment.BackwardCompatibleURLPatternDeploymentAspect">
+ <property name="requires">ContextRoot, ContainerMetaData</property>
+ <property name="provides">URLPattern</property>
+ </bean>
+
+ <bean name="WSWebAppDeploymentAspect" class="org.jboss.wsf.container.jboss50.WebAppDeploymentAspect">
+ <property name="requires">WebMetaData, ContextProperties</property>
+ <property name="webXMLRewriter"><inject bean="WSWebXMLRewriter"/></property>
+ <property name="mainDeployer"><inject bean="MainDeployer"/></property>
+ </bean>
+
+ <bean name="WSWebAppGeneratorDeploymentAspect" class="org.jboss.wsf.framework.deployment.WebAppGeneratorDeploymentAspect">
+ <property name="requires">URLPattern</property>
+ <property name="provides">WebMetaData</property>
+ <property name="securityHandlerEJB21"><inject bean="WSSecurityHandlerEJB21"/></property>
+ <property name="securityHandlerEJB3"><inject bean="WSSecurityHandlerEJB3"/></property>
+ </bean>
+
+ <!-- Deployment aspect helper beans -->
+ <bean name="WSSecurityHandlerEJB21" class="org.jboss.wsf.container.jboss50.SecurityHandlerEJB21"/>
+ <bean name="WSSecurityHandlerEJB3" class="org.jboss.wsf.container.jboss50.SecurityHandlerEJB3"/>
+ <bean name="WSWebAppDesciptorModifier" class="org.jboss.wsf.container.jboss50.DefaultWebAppDesciptorModifierImpl"/>
+ <bean name="WSWebXMLRewriter" class="org.jboss.wsf.container.jboss50.WebXMLRewriterImpl">
+ <property name="desciptorModifier"><inject bean="WSWebAppDesciptorModifier"/></property>
+ </bean>
+
+ <!-- Deployment aspect installers -->
+
+ <!-- Phase 1 -->
+ <bean name="WSDeploymentAspectInstallerPreJSE" class="org.jboss.wsf.framework.deployment.DeploymentAspectInstaller">
+ <property name="manager"><inject bean="WSDeploymentAspectManagerPreJSE"/></property>
+ <property name="sortAspectsOnCreate">false</property>
+ <property name="aspects">
+ <set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
+ <inject bean="WSContainerMetaDataDeploymentAspect"/>
+ <inject bean="WSContextRootDeploymentAspect"/>
+ <inject bean="WSEndpointAddressDeploymentAspect"/>
+ <inject bean="WSEndpointHandlerDeploymentAspect"/>
+ <inject bean="WSEndpointMetricsDeploymentAspect"/>
+ <inject bean="WSEndpointNameDeploymentAspect"/>
+ <inject bean="WSEndpointRegistryDeploymentAspect"/>
+ <inject bean="WSModifyWebMetaDataDeploymentAspect"/>
+ <inject bean="WSURLPatternDeploymentAspect"/>
+ </set>
+ </property>
+ </bean>
+
+ <!-- Phase 2 -->
+ <bean name="WSDeploymentAspectInstallerPostJSE" class="org.jboss.wsf.framework.deployment.DeploymentAspectInstaller">
+ <property name="manager"><inject bean="WSDeploymentAspectManagerPostJSE"/></property>
+ <property name="sortAspectsOnCreate">false</property>
+ <property name="aspects">
+ <set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
+ <inject bean="WSEndpointLifecycleDeploymentAspect"/>
+ <inject bean="WSRuntimeLoaderDeploymentAspect"/>
+ </set>
+ </property>
+ </bean>
+
+ <bean name="WSDeploymentAspectInstallerEJB" class="org.jboss.wsf.framework.deployment.DeploymentAspectInstaller">
+ <property name="manager"><inject bean="WSDeploymentAspectManagerEJB"/></property>
+ <property name="sortAspectsOnCreate">false</property>
+ <property name="aspects">
+ <set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
+ <inject bean="WSContainerMetaDataDeploymentAspect"/>
+ <inject bean="WSContextRootDeploymentAspect"/>
+ <inject bean="WSEndpointAddressDeploymentAspect"/>
+ <inject bean="WSEndpointHandlerDeploymentAspect"/>
+ <inject bean="WSEndpointLifecycleDeploymentAspect"/>
+ <inject bean="WSEndpointMetricsDeploymentAspect"/>
+ <inject bean="WSEndpointNameDeploymentAspect"/>
+ <inject bean="WSEndpointRegistryDeploymentAspect"/>
+ <inject bean="WSURLPatternDeploymentAspect"/>
+ <inject bean="WSRuntimeLoaderDeploymentAspect"/>
+ <inject bean="WSWebAppDeploymentAspect"/>
+ <inject bean="WSWebAppGeneratorDeploymentAspect"/>
+ </set>
+ </property>
+ </bean>
+
+ <bean name="WSDeploymentAspectInstallerEndpointAPI" class="org.jboss.wsf.framework.deployment.DeploymentAspectInstaller">
+ <property name="manager"><inject bean="WSDeploymentAspectManagerEndpointAPI"/></property>
+ <property name="sortAspectsOnCreate">false</property>
+ <property name="aspects">
+ <set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
+ <inject bean="WSEndpointAPIDeploymentAspect"/>
+ <inject bean="WSEndpointAddressDeploymentAspect"/>
+ <inject bean="WSEndpointHandlerDeploymentAspect"/>
+ <inject bean="WSEndpointLifecycleDeploymentAspect"/>
+ <inject bean="WSEndpointMetricsDeploymentAspect"/>
+ <inject bean="WSEndpointNameDeploymentAspect"/>
+ <inject bean="WSEndpointRegistryDeploymentAspect"/>
+ <inject bean="WSWebAppDeploymentAspect"/>
+ <inject bean="WSWebAppGeneratorDeploymentAspect"/>
+ </set>
+ </property>
+ </bean>
+
+</deployment>
Added: branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory
===================================================================
--- branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory (rev 0)
+++ branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1 @@
+org.jboss.wsf.framework.deployment.ArchiveDeploymentModelFactory
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
===================================================================
--- branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory (rev 0)
+++ branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1 @@
+org.jboss.wsf.container.jboss50.InvocationHandlerFactoryImpl
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
===================================================================
--- branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory (rev 0)
+++ branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1 @@
+org.jboss.wsf.container.jboss50.SecurityAdapterFactoryImpl
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.WebServiceContextFactory
===================================================================
--- branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.WebServiceContextFactory (rev 0)
+++ branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.invocation.WebServiceContextFactory 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1 @@
+org.jboss.wsf.container.jboss50.WebServiceContextFactoryImpl
\ No newline at end of file
Added: branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory
===================================================================
--- branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory (rev 0)
+++ branches/tdiesler/webservices/src/main/resources/jbossws-jboss50.jar/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory 2007-08-22 08:42:54 UTC (rev 64765)
@@ -0,0 +1 @@
+org.jboss.wsf.framework.management.ServerConfigFactoryImpl
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list