Author: thomas.diesler(a)jboss.com
Date: 2007-05-03 15:18:24 -0400 (Thu, 03 May 2007)
New Revision: 2955
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PortComponentLinkServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/SecurityAssociationAdaptorFactoryImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/ServiceEndpointInvokerMDB.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java
Removed:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSEMBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossContextServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossHttpServer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java
Modified:
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ApplicationMetaDataAdapter.java
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21MBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3MBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSEMBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service.xml
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/DeployerHook.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ArchiveDeployerHook.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookEJB21.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookJSE.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookEJB3.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookJSE.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java
trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
Log:
Use new deployer architectur with AS42
Modified:
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ApplicationMetaDataAdapter.java
===================================================================
---
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ApplicationMetaDataAdapter.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ApplicationMetaDataAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -27,7 +27,7 @@
import org.jboss.metadata.EjbPortComponentMetaData;
import org.jboss.metadata.MessageDrivenMetaData;
import org.jboss.metadata.SessionMetaData;
-import org.jboss.ws.integration.jboss42.AbstractApplicationMetaDataAdapter;
+import org.jboss.ws.integration.jboss42.jbossws.AbstractApplicationMetaDataAdapter;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
Modified:
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java
===================================================================
---
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -36,7 +36,7 @@
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.integration.URLLoaderAdapter;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.integration.jboss42.DeploymentInfoAdapterFactory;
+import org.jboss.ws.integration.jboss42.jbossws.DeploymentInfoAdapterFactory;
import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientDeployment;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,84 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData.PublishLocationAdapter;
-
-/**
- * Build container independent application meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public abstract class AbstractApplicationMetaDataAdapter
-{
- public UnifiedApplicationMetaData buildUnifiedApplicationMetaData(ApplicationMetaData
apmd)
- {
- UnifiedApplicationMetaData umd = new UnifiedApplicationMetaData();
- buildUnifiedBeanMetaData(umd, apmd);
- umd.setConfigName(apmd.getConfigName());
- umd.setConfigFile(apmd.getConfigFile());
- umd.setWebServiceContextRoot(apmd.getWebServiceContextRoot());
- umd.setSecurityDomain(apmd.getSecurityDomain());
- umd.setPublishLocationAdapter(getPublishLocationAdpater(apmd));
- return umd;
- }
-
- protected PublishLocationAdapter getPublishLocationAdpater(final ApplicationMetaData
apmd)
- {
- return new PublishLocationAdapter ()
- {
- public String getWsdlPublishLocationByName(String name)
- {
- return apmd.getWsdlPublishLocationByName(name);
- }
- };
- }
-
- protected void buildUnifiedBeanMetaData(UnifiedApplicationMetaData umd,
ApplicationMetaData metaData)
- {
- List<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
- Iterator it = metaData.getEnterpriseBeans();
- while (it.hasNext())
- {
- BeanMetaData bmd = (BeanMetaData)it.next();
- UnifiedBeanMetaData ubmd = buildUnifiedBeanMetaData(bmd);
- if (ubmd != null)
- {
- beans.add(ubmd);
- }
- }
- umd.setEnterpriseBeans(beans);
- }
-
- protected abstract UnifiedBeanMetaData buildUnifiedBeanMetaData(BeanMetaData bmd);
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,80 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.metadata.EjbPortComponentMetaData;
-import org.jboss.metadata.MessageDrivenMetaData;
-import org.jboss.metadata.SessionMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedSessionMetaData;
-
-/**
- * Build container independent application meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class ApplicationMetaDataAdapter extends AbstractApplicationMetaDataAdapter
-{
- protected UnifiedBeanMetaData buildUnifiedBeanMetaData(BeanMetaData bmd)
- {
- UnifiedBeanMetaData ubmd = null;
- if (bmd instanceof SessionMetaData)
- {
- ubmd = new UnifiedSessionMetaData();
- }
- else if (bmd instanceof MessageDrivenMetaData)
- {
- ubmd = new UnifiedMessageDrivenMetaData();
-
((UnifiedMessageDrivenMetaData)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)
- {
- UnifiedEjbPortComponentMetaData upcmd = new
UnifiedEjbPortComponentMetaData();
- upcmd.setPortComponentName(pcmd.getPortComponentName());
- upcmd.setPortComponentURI(pcmd.getPortComponentURI());
- upcmd.setAuthMethod(pcmd.getAuthMethod());
- upcmd.setTransportGuarantee(pcmd.getTransportGuarantee());
- upcmd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
- ubmd.setPortComponent(upcmd);
- }
- }
- return ubmd;
- }
-}
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,41 @@
+/*
+ * 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.ws.integration.jboss42;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+
+//$Id$
+
+
+/**
+ * An interface for all web service deployer hooks
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 24-Apr-2007
+ */
+public interface DeployerHook
+{
+ void deploy(DeploymentInfo unit) throws DeploymentException;
+
+ void undeploy(DeploymentInfo unit);
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -23,176 +23,115 @@
//$Id$
-import org.jboss.deployment.DeploymentException;
+import java.util.LinkedList;
+import java.util.List;
+
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.MainDeployerMBean;
import org.jboss.deployment.SubDeployerInterceptorSupport;
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.jboss.metadata.WebMetaData;
import org.jboss.mx.server.Invocation;
import org.jboss.mx.util.MBeanProxy;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.legacy.ServiceEndpointDeployer;
-import org.jboss.ws.integration.KernelLocator;
-import org.jboss.ws.integration.deployment.WSDeploymentException;
/**
* A deployer service that manages WS4EE compliant Web Services
*
- * This service is called from the {@see org.jboss.ws.metadata.WebServiceInterceptor}
- *
* @author Thomas.Diesler(a)jboss.org
- * @author Dimitris.Andreadis(a)jboss.org
- * @since 15-Jan-2005
+ * @since 03-May-2007
*/
-public abstract class DeployerInterceptor extends SubDeployerInterceptorSupport
+public abstract class DeployerInterceptor extends SubDeployerInterceptorSupport
implements DeployerInterceptorMBean
{
// The main deployer
private MainDeployerMBean mainDeployer;
- /** Create the deployer service
- */
- protected void createService() throws Exception
- {
- mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class,
MainDeployerMBean.OBJECT_NAME, server);
- super.attach();
- }
+ private List<DeployerHook> phaseOneHooks = new
LinkedList<DeployerHook>();
+ private List<DeployerHook> phaseTwoHooks = new
LinkedList<DeployerHook>();
- /** Destroy the deployer service
- */
- protected void destroyService()
+ public void addPhaseOneHook(DeployerHook hook)
{
- super.detach();
+ log.debug("Add phase-one deployer hook: " + hook);
+ phaseOneHooks.add(hook);
}
- /** Overwrite to create the webservice
- */
- protected final Object create(Invocation invocation, DeploymentInfo di) throws
Throwable
+ public void removePhaseOneHook(DeployerHook hook)
{
- Object retn = invokeNext(invocation);
- if (isWebserviceDeployment(di))
- {
- try
- {
- createServiceEndpoint(di);
- }
- catch (Exception ex)
- {
- destroyServiceEndpoint(di);
- DeploymentException.rethrowAsDeploymentException("Cannot create service
endpoint", ex);
- }
- }
- return retn;
+ log.debug("Remove phase-one deployer hook: " + hook);
+ phaseOneHooks.remove(hook);
}
- /** Overwrite to start the webservice
- */
- protected final Object start(Invocation invocation, DeploymentInfo di) throws
Throwable
+ public void addPhaseTwoHook(DeployerHook hook)
{
- Object retn = invokeNext(invocation);
- try
- {
- startServiceEndpoint(di);
- }
- catch (Exception ex)
- {
- destroyServiceEndpoint(di);
- DeploymentException.rethrowAsDeploymentException("Cannot start service
endpoint", ex);
- }
- return retn;
+ log.debug("Add phase-two deployer hook: " + hook);
+ phaseTwoHooks.add(hook);
}
- /** Overwrite to stop the webservice
- */
- protected final Object stop(Invocation invocation, DeploymentInfo di) throws
Throwable
+ public void removePhaseTwoHook(DeployerHook hook)
{
- stopServiceEndpoint(di);
- return invokeNext(invocation);
+ log.debug("Remove phase-two deployer hook: " + hook);
+ phaseTwoHooks.remove(hook);
}
- /** Overwrite to destroy the webservice
- */
- protected final Object destroy(Invocation invocation, DeploymentInfo di) throws
Throwable
+ @Override
+ protected final Object create(Invocation invocation, DeploymentInfo unit) throws
Throwable
{
- destroyServiceEndpoint(di);
- return invokeNext(invocation);
- }
+ Object retn = invokeNext(invocation);
- protected void createServiceEndpoint(DeploymentInfo di) throws Exception
- {
- log.debug("create: " + di.url);
- UnifiedDeploymentInfo udi = createUnifiedDeploymentInfo(di);
- di.context.put(UnifiedDeploymentInfo.class.getName(), udi);
- getServiceEndpointDeployer().create(udi);
+ for (DeployerHook deployer : phaseOneHooks)
+ deployer.deploy(unit);
+
+ return retn;
}
- protected void startServiceEndpoint(DeploymentInfo di) throws Exception
+ @Override
+ protected final Object start(Invocation invocation, DeploymentInfo unit) throws
Throwable
{
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- log.debug("start: " + di.url);
-
- // late initialization of the web context loader
- if (di.metaData instanceof WebMetaData)
- {
- ClassLoader classLoader = ((WebMetaData)di.metaData).getContextLoader();
- udi.classLoader = classLoader;
- }
+ Object retn = invokeNext(invocation);
- getServiceEndpointDeployer().start(udi);
- }
- }
+ for (DeployerHook deployer : phaseTwoHooks)
+ deployer.deploy(unit);
- protected void stopServiceEndpoint(DeploymentInfo di) throws Exception
- {
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- log.debug("stop: " + di.url);
- getServiceEndpointDeployer().stop(udi);
- }
+ return retn;
}
- protected void destroyServiceEndpoint(DeploymentInfo di) throws Exception
+ @Override
+ protected final Object stop(Invocation invocation, DeploymentInfo unit) throws
Throwable
{
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- log.debug("destroy: " + di.url);
- getServiceEndpointDeployer().destroy(udi);
- }
+ Object retn = invokeNext(invocation);
+
+ for (DeployerHook deployer : phaseTwoHooks)
+ deployer.undeploy(unit);
+
+ return retn;
}
- protected ServiceEndpointDeployer getServiceEndpointDeployer()
+ @Override
+ protected final Object destroy(Invocation invocation, DeploymentInfo unit) throws
Throwable
{
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry = registry.getEntry(ServiceEndpointDeployer.BEAN_NAME);
- return (ServiceEndpointDeployer)entry.getTarget();
+ Object retn = invokeNext(invocation);
+
+ for (DeployerHook deployer : phaseOneHooks)
+ deployer.undeploy(unit);
+
+ return retn;
}
- protected AbstractServiceEndpointPublisher getServiceEndpointPublisher()
+ /** Create the deployer service
+ */
+ protected void createService() throws Exception
{
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry =
registry.getEntry(AbstractServiceEndpointPublisher.BEAN_NAME);
- return (AbstractServiceEndpointPublisher)entry.getTarget();
+ mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class,
MainDeployerMBean.OBJECT_NAME, server);
+ super.attach();
}
- /** Return true if the deployment contains a web service endpoint
+ /** Destroy the deployer service
*/
- protected abstract boolean isWebserviceDeployment(DeploymentInfo di);
-
- protected abstract UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo
di) throws Exception;
-
- protected UnifiedDeploymentInfo getUnifiedDeploymentInfo(DeploymentInfo di)
+ protected void destroyService()
{
- return
(UnifiedDeploymentInfo)di.context.get(UnifiedDeploymentInfo.class.getName());
+ super.detach();
}
- /** Handle all webservice deployment exceptions.
- * You can either simply logs the problem and keep the EJB/WAR module
+ /**
+ * Handle all webservice deployment exceptions.
+ * You can either simply log the problem and keep the EJB/WAR module
* alive or undeploy properly.
*/
protected void handleStartupException(DeploymentInfo di, Throwable th)
@@ -201,7 +140,8 @@
mainDeployer.undeploy(di);
}
- /** Handle all webservice deployment exceptions.
+ /**
+ * Handle all webservice deployment exceptions.
*
* You can either simply logs the problem and keep the EJB/WAR module
* alive or undeploy properly.
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,67 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-//$Id$
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer service that manages WS4EE compliant Web-Services for EJB Endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Jan-2005
- */
-public abstract class DeployerInterceptorEJB extends DeployerInterceptor
-{
- protected void createServiceEndpoint(DeploymentInfo di) throws Exception
- {
- super.createServiceEndpoint(di);
-
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- UnifiedMetaData wsMetaData =
getServiceEndpointDeployer().getUnifiedMetaData(udi);
- udi.webappURL = generateWebDeployment(udi, wsMetaData);
- udi.addAttachment(DeploymentInfo.class, di);
- getServiceEndpointPublisher().publishServiceEndpoint(udi);
- }
- }
-
- protected abstract URL generateWebDeployment(UnifiedDeploymentInfo udi,
UnifiedMetaData wsMetaData) throws IOException;
-
- protected void destroyServiceEndpoint(DeploymentInfo di) throws Exception
- {
- super.destroyServiceEndpoint(di);
-
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- getServiceEndpointPublisher().destroyServiceEndpoint(udi);
- }
- }
-}
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -23,97 +23,13 @@
//$Id$
-import java.io.IOException;
-import java.net.URL;
-import java.util.Iterator;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
/**
* A deployer service that manages WS4EE compliant Web-Services for EJB-2.1 Endpoints
*
* @author Thomas.Diesler(a)jboss.org
* @since 15-Jan-2005
*/
-public class DeployerInterceptorEJB21 extends DeployerInterceptorEJB implements
DeployerInterceptorEJB21MBean
+public class DeployerInterceptorEJB21 extends DeployerInterceptor implements
DeployerInterceptorEJB21MBean
{
- protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws
Exception
- {
- UnifiedVirtualFile vfsWebservices = getWebservicesFile(di);
- UnifiedDeploymentInfo udi = new JAXRPCDeployment(DeploymentType.JAXRPC_EJB21,
vfsWebservices);
- DeploymentInfoAdapterFactory.newInstance().buildDeploymentInfo(udi, di);
- return udi;
- }
- /** Return true if the deployment is a web service endpoint
- */
- protected boolean isWebserviceDeployment(DeploymentInfo di)
- {
- ApplicationMetaData applMetaData = (ApplicationMetaData)di.metaData;
- boolean isWebserviceDeployment = applMetaData.isWebServiceDeployment();
-
- // Check if we have a webservices.xml descriptor
- if (isWebserviceDeployment == false)
- {
- isWebserviceDeployment = getWebservicesFile(di) != null;
- }
-
- // Check if the ejb-jar contains annotated endpoints
- if (isWebserviceDeployment == false)
- {
- try
- {
- Iterator itBeans = applMetaData.getEnterpriseBeans();
- while (itBeans.hasNext() && isWebserviceDeployment == false)
- {
- BeanMetaData beanMetaData = (BeanMetaData)itBeans.next();
- String ejbClassName = beanMetaData.getEjbClass();
- Class ejbClass = di.annotationsCl.loadClass(ejbClassName);
- if (ejbClass.isAnnotationPresent(javax.jws.WebService.class))
- throw new UnsupportedOperationException("JAXWS not supported on
EJB2.1 endpoints");
- }
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-
- applMetaData.setWebServiceDeployment(isWebserviceDeployment);
- return isWebserviceDeployment;
- }
-
- private UnifiedVirtualFile getWebservicesFile(DeploymentInfo di)
- {
- UnifiedVirtualFile vfsRoot = new ResourceLoaderAdapter(di.localCl);
- try
- {
- return vfsRoot.findChild("META-INF/webservices.xml");
- }
- catch (IOException e)
- {
- return null;
- }
- }
-
- @Override
- protected URL generateWebDeployment(UnifiedDeploymentInfo udi, UnifiedMetaData
wsMetaData) throws IOException
- {
- ServiceEndpointGeneratorEJB21 generator = new ServiceEndpointGeneratorEJB21();
- return generator.generatWebDeployment(wsMetaData, udi);
- }
-
}
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21MBean.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21MBean.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21MBean.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,36 +1,35 @@
/*
-* 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.
-*/
+ * 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.ws.integration.jboss42;
import javax.management.ObjectName;
-import org.jboss.deployment.SubDeployerInterceptorMBean;
import org.jboss.ws.integration.ObjectNameFactory;
/**
* MBean interface.
* @since 19-Jan-2005
*/
-public interface DeployerInterceptorEJB21MBean extends SubDeployerInterceptorMBean
+public interface DeployerInterceptorEJB21MBean extends DeployerInterceptorMBean
{
//default object name
public static final ObjectName OBJECT_NAME =
ObjectNameFactory.create("jboss.ws:service=WebServiceDeployerEJB21");
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -23,109 +23,12 @@
// $Id$
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-
-import javax.jws.WebService;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ejb3.Ejb3ModuleMBean;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.JAXWSDeployment;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
/**
* A deployer service that manages WS4EE compliant Web-Services for EJB3 Endpoints
*
* @author Thomas.Diesler(a)jboss.org
* @since 10-May-2005
*/
-public class DeployerInterceptorEJB3 extends DeployerInterceptorEJB implements
DeployerInterceptorEJB3MBean
+public class DeployerInterceptorEJB3 extends DeployerInterceptor implements
DeployerInterceptorEJB3MBean
{
- protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws
Exception
- {
- UnifiedDeploymentInfo udi = new JAXWSDeployment(DeploymentType.JAXWS_EJB3);
- DeploymentInfoAdapterFactory.newInstance().buildDeploymentInfo(udi, di);
-
- Ejb3ModuleMBean ejb3Module = getEJB3Module(udi.deployedObject);
-
- // The container objects below provide access to all of the ejb metadata
- ArrayList<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
- for (Object container : ejb3Module.getContainers().values())
- {
- if (container instanceof StatelessContainer)
- {
- StatelessContainer slc = (StatelessContainer)container;
- UnifiedBeanMetaData uslc = new UnifiedBeanMetaData();
- uslc.setEjbName(slc.getEjbName());
- uslc.setEjbClass(slc.getBeanClassName());
- beans.add(uslc);
- }
- }
-
- UnifiedApplicationMetaData appMetaData = new UnifiedApplicationMetaData();
- appMetaData.setEnterpriseBeans(beans);
- udi.metaData = appMetaData;
-
- return udi;
- }
-
- /** Return true if the deployment is a web service endpoint
- */
- protected boolean isWebserviceDeployment(DeploymentInfo di)
- {
- boolean isWebserviceDeployment = false;
-
- // Check if the ejb3 contains annotated endpoints
- Ejb3ModuleMBean ejb3Module = getEJB3Module(di.deployedObject);
- for (Object manager : ejb3Module.getContainers().values())
- {
- if (manager instanceof StatelessContainer)
- {
- StatelessContainer container = (StatelessContainer)manager;
- if (container.resolveAnnotation(WebService.class) != null)
- {
- isWebserviceDeployment = true;
- break;
- }
- }
- }
-
- return isWebserviceDeployment;
- }
-
- private Ejb3ModuleMBean getEJB3Module(ObjectName objectName)
- {
- Ejb3ModuleMBean ejb3Module;
- try
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- ejb3Module = (Ejb3ModuleMBean)MBeanProxy.get(Ejb3ModuleMBean.class, objectName,
server);
- if (ejb3Module == null)
- throw new WSException("Cannot obtain EJB3 module: " + objectName);
-
- return ejb3Module;
- }
- catch (MBeanProxyCreationException ex)
- {
- throw new WSException("Cannot obtain proxy to EJB3 module");
- }
- }
-
- @Override
- protected URL generateWebDeployment(UnifiedDeploymentInfo udi, UnifiedMetaData
wsMetaData) throws IOException
- {
- return new ServiceEndpointGeneratorEJB3().generatWebDeployment(wsMetaData, udi);
- }
}
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3MBean.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3MBean.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3MBean.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,36 +1,35 @@
/*
-* 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.
-*/
+ * 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.ws.integration.jboss42;
import javax.management.ObjectName;
-import org.jboss.deployment.SubDeployerInterceptorMBean;
import org.jboss.ws.integration.ObjectNameFactory;
/**
* MBean interface.
* @since 19-Jan-2005
*/
-public interface DeployerInterceptorEJB3MBean extends SubDeployerInterceptorMBean
+public interface DeployerInterceptorEJB3MBean extends DeployerInterceptorMBean
{
//default object name
public static final ObjectName OBJECT_NAME =
ObjectNameFactory.create("jboss.ws:service=WebServiceDeployerEJB3");
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -23,29 +23,6 @@
// $Id$
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.jws.WebService;
-import javax.xml.ws.WebServiceProvider;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.JAXWSDeployment;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher.RewriteResults;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
/**
* A deployer service that manages WS4EE compliant Web Services for WAR
*
@@ -54,117 +31,4 @@
*/
public class DeployerInterceptorJSE extends DeployerInterceptor implements
DeployerInterceptorJSEMBean
{
- /** Return true if the deployment is a web service endpoint
- */
- protected boolean isWebserviceDeployment(DeploymentInfo di)
- {
- WebMetaData webMetaData = (WebMetaData)di.metaData;
- boolean isWebserviceDeployment = webMetaData.isWebServiceDeployment();
-
- // Check if we have a webservices.xml descriptor
- if (isWebserviceDeployment == false)
- {
- if (getWebservicesFile(di) != null)
- {
- di.context.put("UnifiedDeploymentInfo.Type",
DeploymentType.JAXRPC_JSE);
- isWebserviceDeployment = true;
- }
- }
-
- // Check if the web.xml contains annotated endpoint impl
- if (isWebserviceDeployment == false)
- {
- Map servletClassMap = webMetaData.getServletClassMap();
- Iterator<String> it = servletClassMap.values().iterator();
- while (it.hasNext() && isWebserviceDeployment == false)
- {
- String servletClassName = it.next();
- try
- {
- Class servletClass = di.annotationsCl.loadClass(servletClassName);
- if (servletClass.isAnnotationPresent(WebService.class) ||
servletClass.isAnnotationPresent(WebServiceProvider.class))
- {
- di.context.put("UnifiedDeploymentInfo.Type",
DeploymentType.JAXWS_JSE);
- isWebserviceDeployment = true;
- }
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClassName);
- }
- }
- }
-
- webMetaData.setWebServiceDeployment(isWebserviceDeployment);
- return isWebserviceDeployment;
- }
-
- protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws
Exception
- {
- UnifiedDeploymentInfo udi;
-
- DeploymentType type =
(DeploymentType)di.context.get("UnifiedDeploymentInfo.Type");
- if (type == DeploymentType.JAXRPC_JSE)
- {
- UnifiedVirtualFile vfsWebservices = getWebservicesFile(di);
- udi = new JAXRPCDeployment(DeploymentType.JAXRPC_JSE, vfsWebservices);
- DeploymentInfoAdapterFactory.newInstance().buildDeploymentInfo(udi, di);
- }
- else if (type == DeploymentType.JAXWS_JSE)
- {
- udi = new JAXWSDeployment(DeploymentType.JAXWS_JSE);
- DeploymentInfoAdapterFactory.newInstance().buildDeploymentInfo(udi, di);
- }
- else
- {
- throw new WSException("Unexpected type: " + type);
- }
-
- return udi;
- }
-
- /** Overwrite to create the webservice
- *
- * This implemantation modifies the servlet entries in web.xml
- */
- protected void createServiceEndpoint(DeploymentInfo di) throws Exception
- {
- super.createServiceEndpoint(di);
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- AbstractServiceEndpointPublisher endpointPublisher =
getServiceEndpointPublisher();
- RewriteResults results = endpointPublisher.rewriteWebXml(udi);
- updateServiceEndpointTargetBeans(udi, results);
- }
- }
-
- private void updateServiceEndpointTargetBeans(UnifiedDeploymentInfo udi,
RewriteResults results)
- {
- UnifiedMetaData wsMetaData = getServiceEndpointDeployer().getUnifiedMetaData(udi);
- Map<String, String> sepTargetMap = results.sepTargetMap;
-
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String targetBean = sepTargetMap.get(sepMetaData.getLinkName());
- sepMetaData.setServiceEndpointImplName(targetBean);
- }
- }
- }
-
- private UnifiedVirtualFile getWebservicesFile(DeploymentInfo di)
- {
- UnifiedVirtualFile vfsRoot = new ResourceLoaderAdapter(di.localCl);
- try
- {
- return vfsRoot.findChild("WEB-INF/webservices.xml");
- }
- catch (IOException e)
- {
- return null;
- }
- }
}
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSEMBean.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSEMBean.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSEMBean.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -30,7 +30,7 @@
* MBean interface.
* @since 19-Jan-2005
*/
-public interface DeployerInterceptorJSEMBean extends SubDeployerInterceptorMBean
+public interface DeployerInterceptorJSEMBean extends DeployerInterceptorMBean
{
//default object name
public static final ObjectName OBJECT_NAME =
ObjectNameFactory.create("jboss.ws:service=WebServiceDeployerJSE");
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,39 @@
+/*
+ * 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.ws.integration.jboss42;
+
+import org.jboss.deployment.SubDeployerInterceptorMBean;
+
+/**
+ * MBean interface.
+ * @since 19-Jan-2005
+ */
+public interface DeployerInterceptorMBean extends SubDeployerInterceptorMBean
+{
+ void addPhaseOneHook(DeployerHook deployer);
+
+ void removePhaseOneHook(DeployerHook deployer);
+
+ void addPhaseTwoHook(DeployerHook deployer);
+
+ void removePhaseTwoHook(DeployerHook deployer);
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSE.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSE.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSE.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,133 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.deployment.SubDeployerSupport;
-import org.jboss.system.server.ServerConfig;
-import org.jboss.system.server.ServerConfigLocator;
-import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.integration.deployment.WSDeploymentException;
-
-/**
- * A deployer service that manages WS4EE compliant Web Services for
- * nested POJO endpoints.
- *
- * The WebServiceDeployerJSE attaches itself as an deployment interceptor to
- * the jboss.web:service=WebServer deployer. As a consequence, all *.war deployments
- * that are picked up before the interceptor is installed are not treated as potential
- * web service endpoint deployments.
- *
- * Nested POJO endpoints can be packaged in *.jse deployments that are then picked up by
this
- * deployer.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Mar-2005
- */
-public class DeployerInterceptorNestedJSE extends SubDeployerSupport implements
DeployerInterceptorNestedJSEMBean
-{
- private static final String NESTED_JSE_WAR_FILE =
"org.jboss.ws.server.nested.jse";
-
- // The MainDeployer
- protected MainDeployerMBean mainDeployer;
-
- public void setMainDeployer(MainDeployerMBean mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- public boolean accepts(DeploymentInfo sdi)
- {
- setSuffixes(new String[] { ".jse" });
- return super.accepts(sdi);
- }
-
- /** Copy the *.jse to a *.war and deploy through the main deployer
- */
- public void create(DeploymentInfo di) throws DeploymentException
- {
- log.debug("create: " + di.url);
-
- try
- {
- File jseFile = new File(di.localUrl.getFile());
- if (jseFile.isFile() == false)
- throw new DeploymentException("Expected a file: " + di.localUrl);
-
- ServerConfig config = ServerConfigLocator.locate();
- String warFileName = config.getServerTempDir().getCanonicalPath() +
"/deploy/" + di.shortName;
- warFileName = warFileName.substring(0, warFileName.length() - 4) +
".war";
- File warFile = new File(warFileName);
-
- FileOutputStream fos = new FileOutputStream(warFile);
- FileInputStream fis = new FileInputStream(jseFile);
- try
- {
- IOUtils.copyStream(fos, fis);
- }
- finally
- {
- fos.close();
- fis.close();
- }
-
- mainDeployer.deploy(warFile.toURL());
-
- // remember the war url that we deployed
- di.context.put(NESTED_JSE_WAR_FILE, warFile);
-
- super.create(di);
- }
- catch (IOException ex)
- {
- throw new DeploymentException("Failed to create: " + di.url, ex);
- }
- }
-
- /** Undeploy the *.war through the main deployer
- */
- public void destroy(DeploymentInfo di) throws DeploymentException
- {
- log.debug("destroy: " + di.url);
- try
- {
- File warFile = (File)di.context.get(NESTED_JSE_WAR_FILE);
- mainDeployer.undeploy(warFile.toURL());
- warFile.delete();
-
- super.destroy(di);
- }
- catch (IOException ex)
- {
- throw new WSDeploymentException("Failed to destroy: " + di.url, ex);
- }
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSEMBean.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSEMBean.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSEMBean.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,42 +0,0 @@
-/*
-* 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.ws.integration.jboss42;
-
-// $Id$
-
-import javax.management.ObjectName;
-
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.deployment.SubDeployerMBean;
-import org.jboss.ws.integration.ObjectNameFactory;
-
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Mar-2005
- */
-public interface DeployerInterceptorNestedJSEMBean extends SubDeployerMBean
-{
- //default object name
- public static final ObjectName OBJECT_NAME =
ObjectNameFactory.create("jboss.ws:service=WebServiceDeployerNestedJSE");
-
- void setMainDeployer(MainDeployerMBean mainDeployer);
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,103 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
-
-/**
- * Build container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class DeploymentInfoAdapter
-{
- private WebMetaDataAdapter webMetaDataAdapter;
- private AbstractApplicationMetaDataAdapter applicationMetaDataAdapter;
-
- public void setApplicationMetaDataAdapter(AbstractApplicationMetaDataAdapter
applicationMetaDataAdapter)
- {
- this.applicationMetaDataAdapter = applicationMetaDataAdapter;
- }
-
- public void setWebMetaDataAdapter(WebMetaDataAdapter webMetaDataAdapter)
- {
- this.webMetaDataAdapter = webMetaDataAdapter;
- }
-
- public UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi,
DeploymentInfo di) throws Exception
- {
- if (di.parent != null)
- {
- udi.parent = new UnifiedDeploymentInfo(null);
- buildDeploymentInfo(udi.parent, di.parent);
- }
-
- udi.vfRoot = new ResourceLoaderAdapter(di.localCl);
- udi.name = di.getCanonicalName();
- udi.simpleName = di.shortName;
- udi.url = getDeploymentURL(di);
- udi.classLoader = di.annotationsCl;
- udi.deployedObject = di.deployedObject;
-
- buildMetaData(udi, di.metaData);
-
- return udi;
- }
-
- private URL getDeploymentURL(DeploymentInfo di) throws MalformedURLException
- {
- URL deploymentURL = (di.localUrl != null ? di.localUrl : di.url);
- if ("file".equals(deploymentURL.getProtocol()))
- {
- String path = deploymentURL.getPath();
- if (new File(path).isFile())
- {
- deploymentURL = new URL("jar:file:" + path + "!/");
- }
- }
- return deploymentURL;
- }
-
- private void buildMetaData(UnifiedDeploymentInfo udi, Object metaData)
- {
- if (metaData instanceof WebMetaData)
- {
- udi.metaData =
webMetaDataAdapter.buildUnifiedWebMetaData((WebMetaData)metaData);
- udi.webappURL = udi.url;
- }
- else if (metaData instanceof ApplicationMetaData)
- {
- udi.metaData =
applicationMetaDataAdapter.buildUnifiedApplicationMetaData((ApplicationMetaData)metaData);
- }
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,47 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.jboss.ws.integration.KernelLocator;
-
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Mar-2007
- */
-public class DeploymentInfoAdapterFactory
-{
- // Hide ctor
- private DeploymentInfoAdapterFactory()
- {
- }
-
- public static DeploymentInfoAdapter newInstance()
- {
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry = registry.getEntry("DeploymentInfoAdapter");
- return (DeploymentInfoAdapter)entry.getTarget();
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossContextServlet.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossContextServlet.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossContextServlet.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,46 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.server.legacy.CommonContextServlet;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
-
-/**
- * The servlet that that is associated with context /jbossws
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Mar-2005
- */
-public class JBossContextServlet extends CommonContextServlet
-{
- // provide logging
- protected final Logger log = Logger.getLogger(JBossContextServlet.class);
-
- protected void initServiceEndpointManager()
- {
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossHttpServer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossHttpServer.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossHttpServer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,231 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-//$Id$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Map;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.xml.ws.Endpoint;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.HttpContext;
-import org.jboss.ws.core.server.HttpServer;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.integration.management.ServerConfig;
-import org.jboss.ws.integration.management.ServerConfigFactory;
-import org.w3c.dom.Element;
-
-/**
- * A Tomcat HTTP Server
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 07-Jul-2006
- */
-public class JBossHttpServer extends HttpServer
-{
- private static final String MAIN_DEPLOYER =
"jboss.system:service=MainDeployer";
-
- /** Start an instance of this HTTP server */
- @Override
- public void start()
- {
- // verify required properties
- }
-
- /** Create an HTTP context */
- public HttpContext createContext(String contextRoot)
- {
- return new HttpContext(this, contextRoot);
- }
-
- /** Publish an JAXWS endpoint to the HTTP server */
- @Override
- 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
- {
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig serverConfig = factory.getServerConfig();
- File tmpDir = new File(serverConfig.getServerTempDir().getCanonicalPath() +
"/jbossws");
-
- 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 WSException("Failed to create webservice war", e);
- }
-
- Map<String, Object> epProps = endpoint.getProperties();
- epProps.put("jbossws-endpoint-war-url", tmpWar);
-
- URL tmpURL = tmpWar.toURL();
- MBeanServerConnection server = getServer();
- server.invoke(new ObjectName(MAIN_DEPLOYER), "deploy", new Object[] {
tmpURL }, new String[] { "java.net.URL" });
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException(ex);
- }
- }
-
- /** Destroys an JAXWS endpoint on the HTTP server */
- @Override
- 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();
- MBeanServerConnection server = getServer();
- server.invoke(new ObjectName(MAIN_DEPLOYER), "undeploy", new Object[]
{ tmpURL }, new String[] { "java.net.URL" });
-
- tmpWar.delete();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException(ex);
- }
- }
-
- private Class getImplementorClass(Endpoint endpoint)
- {
- Object implementor = endpoint.getImplementor();
- Class implClass = (implementor instanceof Class ? (Class)implementor :
implementor.getClass());
- return implClass;
- }
-
- private MBeanServerConnection getServer() throws NamingException
- {
- InitialContext iniCtx = new InitialContext();
- MBeanServerConnection server =
(MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
- return server;
- }
-
- 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 WSException("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;
- }
-}
-
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,68 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import javax.servlet.ServletContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.legacy.AbstractServiceEndpointServlet;
-import org.jboss.ws.core.server.legacy.ServiceEndpoint;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-May-2006
- */
-public class JBossServiceEndpointServlet extends AbstractServiceEndpointServlet
-{
- // provide logging
- private static final Logger log =
Logger.getLogger(JBossServiceEndpointServlet.class);
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- super.initServiceEndpoint(contextPath);
-
- ServiceEndpoint wsEndpoint = epManager.getServiceEndpointByID(sepId);
- if (wsEndpoint == null)
- throw new WSException("Cannot obtain endpoint for: " + sepId);
-
- // read the config name/file from web.xml
- ServletContext ctx = getServletContext();
- String configName = ctx.getInitParameter("jbossws-config-name");
- String configFile = ctx.getInitParameter("jbossws-config-file");
- if (configName != null || configFile != null)
- {
- log.debug("Updating service endpoint config\n config-name: " +
configName + "\n config-file: " + configFile);
- ServerEndpointMetaData sepMetaData =
wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
- sepMetaData.setConfigName(configName, configFile);
-
- log.debug("Updated server meta data" + sepMetaData);
- }
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,93 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.legacy.ServiceEndpoint;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
-
-/**
- * A servlet that reports the serviceURL for a given service ID.
- * <p/>
- * When the web service client ENC is setup, it may contain port-component-link
- * entries that point to service endpoints in the same top level deployment.
- * The final serviceURL of those endpoints will become available after the
- * reference to the javax.xml.rpc.Service is bound to JNDI.
- * <p/>
- * When the client does a lookup of the javax.xml.rpc.Service from JNDI the
ObjectFactory
- * will contact this servlet for the final serviceURL. It is acceptable that the client
- * wsdl does not contain the correct serviceURL if the client is using the
port-component-link element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-May-2004
- */
-public class PortComponentLinkServlet extends HttpServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class);
-
- protected ServiceEndpointManager epManager;
-
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-
- /**
- * Get the serviceURL as string for a given serviceID.
- */
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
- {
- String pcLink = req.getParameter("pcLink");
- if (pcLink == null)
- throw new IllegalArgumentException("Cannot obtain request parameter
'pcLink'");
-
- ServiceEndpoint serviceEndpoint = epManager.resolvePortComponentLink(pcLink);
- ;
- if (serviceEndpoint == null)
- throw new WSException("Cannot resolve port-component-link: " +
pcLink);
-
- res.setContentType("text/plain");
- PrintWriter out = res.getWriter();
-
- String endpointAddress =
serviceEndpoint.getServiceEndpointInfo().getServerEndpointMetaData().getEndpointAddress();
- out.println(endpointAddress);
-
- log.debug("Resolved " + pcLink + " to: " + endpointAddress);
- out.close();
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,57 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.security.Principal;
-
-import org.jboss.security.SecurityAssociation;
-import org.jboss.ws.extensions.security.SecurityAssociationAdaptor;
-import org.jboss.ws.extensions.security.SecurityAssociationAdaptorFactory;
-
-/**
- * A JBoss specific SecurityAdaptorFactory
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class SecurityAssociationAdaptorFactoryImpl implements
SecurityAssociationAdaptorFactory
-{
- public SecurityAssociationAdaptor getSecurityAssociationAdaptor()
- {
- return new SecurityAccociationAdaptorImpl();
- }
-
- public class SecurityAccociationAdaptorImpl implements SecurityAssociationAdaptor
- {
- public void setPrincipal(Principal pricipal)
- {
- SecurityAssociation.setPrincipal(pricipal);
- }
-
- public void setCredential(Object credential)
- {
- SecurityAssociation.setCredential(credential);
- }
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,70 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-//$Id$
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.AssemblyDescriptorMetaData;
-import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * Generate a service endpoint deployment for EJB endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointGeneratorEJB21 extends ServiceEndpointGeneratorEJB
-{
- // logging support
- protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB21.class);
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- protected void addEJBSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
- {
- // Fix:
http://jira.jboss.org/jira/browse/JBWS-309
- ApplicationMetaData applMetaData = (ApplicationMetaData)udi.metaData;
- AssemblyDescriptorMetaData assemblyDescriptor =
applMetaData.getAssemblyDescriptor();
- if (assemblyDescriptor != null)
- {
- Map securityRoles = assemblyDescriptor.getSecurityRoles();
- if (securityRoles != null)
- {
- Iterator it = securityRoles.keySet().iterator();
- while (it.hasNext())
- {
- Element securityRole =
(Element)webApp.appendChild(DOMUtils.createElement("security-role"));
- Element roleName =
(Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode((String)it.next()));
- }
- }
- }
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,96 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-//$Id$
-
-import javax.annotation.security.RolesAllowed;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.ejb3.Ejb3ModuleMBean;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * Generate a service endpoint deployment for EJB endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointGeneratorEJB3 extends ServiceEndpointGeneratorEJB
-{
- // logging support
- protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB3.class);
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- protected void addEJBSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
- {
- // The container objects below provide access to all of the ejb metadata
- Ejb3ModuleMBean ejb3Module = getEJB3Module(udi.deployedObject);
- for (Object manager : ejb3Module.getContainers().values())
- {
- if (manager instanceof StatelessContainer)
- {
- StatelessContainer container = (StatelessContainer)manager;
-
- RolesAllowed anRolesAllowed =
(RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
- if (anRolesAllowed != null)
- {
- for (String role : anRolesAllowed.value())
- {
- Element securityRole =
(Element)webApp.appendChild(DOMUtils.createElement("security-role"));
- Element roleName =
(Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode(role));
- }
- }
- }
- }
- }
-
- private Ejb3ModuleMBean getEJB3Module(ObjectName objectName)
- {
- Ejb3ModuleMBean ejb3Module;
- try
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- ejb3Module = (Ejb3ModuleMBean)MBeanProxy.get(Ejb3ModuleMBean.class, objectName,
server);
- if (ejb3Module == null)
- throw new WSException("Cannot obtain EJB3 module: " + objectName);
-
- return ejb3Module;
- }
- catch (MBeanProxyCreationException ex)
- {
- throw new WSException("Cannot obtain proxy to EJB3 module");
- }
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,141 +0,0 @@
-/*
-* 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.ws.integration.jboss42;
-
-// $Id$
-
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ejb.plugins.AbstractInterceptor;
-import org.jboss.invocation.Invocation;
-import org.jboss.invocation.InvocationKey;
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/**
- * This Interceptor does the ws4ee handler processing.
- *
- * According to the ws4ee spec the handler logic must be invoked after the container
- * applied method level security to the invocation.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Sep-2005
- */
-public class ServiceEndpointInterceptor extends AbstractInterceptor
-{
- // provide logging
- private static Logger log = Logger.getLogger(ServiceEndpointInterceptor.class);
-
- // Interceptor implementation --------------------------------------
-
- /** Before and after we call the service endpoint bean, we process the handler
chains.
- */
- public Object invoke(final Invocation mi) throws Exception
- {
- // If no msgContext, it's not for us
- CommonMessageContext msgContext =
(CommonMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
- if (msgContext == null)
- {
- return getNext().invoke(mi);
- }
-
- // Get the endpoint invocation
- EndpointInvocation epInv =
(EndpointInvocation)mi.getValue(EndpointInvocation.class.getName());
- OperationMetaData opMetaData = epInv.getOperationMetaData();
-
- // Get the handler callback
- String key = ServiceEndpointInvokerEJB21.HandlerCallback.class.getName();
- ServiceEndpointInvokerEJB21.HandlerCallback callback =
(ServiceEndpointInvokerEJB21.HandlerCallback)mi.getValue(key);
-
- // Handlers need to be Tx. Therefore we must invoke the handler chain after the
TransactionInterceptor.
- if (callback != null && epInv != null)
- {
- try
- {
- // call the request handlers
- boolean handlersPass =
callback.callRequestHandlerChain(HandlerType.ENDPOINT);
- handlersPass = handlersPass &&
callback.callRequestHandlerChain(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 = epInv.getRequestPayload();
- mi.setArguments(reqParams);
- Object resObj = getNext().invoke(mi);
- epInv.setReturnValue(resObj);
-
- // Bind the response message
- CommonBindingProvider bindingProvider = new
CommonBindingProvider(opMetaData.getEndpointMetaData());
- CommonBinding binding =
(CommonBinding)bindingProvider.getCommonBinding();
- SOAPMessage resMessage =
(SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
- msgContext.setSOAPMessage(resMessage);
- }
-
- // call the response handlers
- handlersPass = callback.callResponseHandlerChain(HandlerType.POST);
- handlersPass = handlersPass &&
callback.callResponseHandlerChain(HandlerType.ENDPOINT);
-
- // update the return value after response handler processing
- Object resObj = epInv.getReturnValue();
-
- return resObj;
- }
- catch (Exception ex)
- {
- try
- {
- SOAPMessage faultMessage =
SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
- msgContext.setSOAPMessage(faultMessage);
-
- // call the fault handlers
- boolean handlersPass = callback.callFaultHandlerChain(HandlerType.POST,
ex);
- handlersPass = handlersPass &&
callback.callFaultHandlerChain(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(mi);
- }
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,269 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.lang.reflect.Method;
-import java.security.Principal;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.ejb.EjbModule;
-import org.jboss.ejb.Interceptor;
-import org.jboss.ejb.StatelessSessionContainer;
-import org.jboss.invocation.Invocation;
-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.SecurityAssociation;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.server.legacy.AbstractServiceEndpointInvoker;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInfo;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInvoker;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.ObjectNameFactory;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/**
- * Handles invocations on EJB2.1 endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-Jan-2005
- */
-public class ServiceEndpointInvokerEJB21 extends AbstractServiceEndpointInvoker
implements ServiceEndpointInvoker
-{
- // provide logging
- private Logger log = Logger.getLogger(ServiceEndpointInvokerEJB21.class);
-
- private String jndiName;
- private MBeanServer server;
- private ObjectName objectName;
-
- public ServiceEndpointInvokerEJB21()
- {
- server = MBeanServerLocator.locateJBoss();
- }
-
- /** Initialize the service endpoint */
- @Override
- public void init(ServiceEndpointInfo seInfo)
- {
- super.init(seInfo);
-
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
- String ejbName = epMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port component");
-
- UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)seInfo.getUnifiedDeploymentInfo().metaData;
- UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
-
- // verify the service endpoint
- String seiName = epMetaData.getServiceEndpointInterfaceName();
- if (epMetaData.getType() == Type.JAXRPC && seiName != null)
- {
- String bmdSEI = beanMetaData.getServiceEndpointInterface();
- if (seiName.equals(bmdSEI) == false)
- throw new WSException("Endpoint meta data defines SEI '" +
seiName + "', <service-endpoint> in ejb-jar.xml defines '" +
bmdSEI + "'");
- }
-
- // get the bean's JNDI name
- jndiName = beanMetaData.getContainerObjectNameJndiName();
- if (jndiName == null)
- throw new WSException("Cannot obtain JNDI name for: " + ejbName);
-
- objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName +
",service=EJB");
-
- // 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);
- }
- }
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint()
- {
- if (server.isRegistered(objectName) == false)
- throw new WSException("Cannot find service endpoint target: " +
objectName);
-
- return null;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpointInstance(Object endpointContext, Class
seiImplClass)
- {
- return null;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
-
- // these are provided by the ServerLoginHandler
- Principal principal = SecurityAssociation.getPrincipal();
- Object credential = SecurityAssociation.getCredential();
-
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
-
- // invoke on the container
- try
- {
- // setup the invocation
- Method method = epInv.getJavaMethod();
- Object[] args = epInv.getRequestPayload();
- Invocation inv = new Invocation(null, method, args, null, principal,
credential);
-
- // EJB2.1 endpoints will only get an JAXRPC context
- if ((msgContext instanceof javax.xml.rpc.handler.MessageContext) == false)
- msgContext = new SOAPMessageContextJAXRPC(msgContext);
-
- inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
- inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
- inv.setType(InvocationType.SERVICE_ENDPOINT);
-
- // Set the handler callback and endpoint invocation
- ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
- inv.setValue(HandlerCallback.class.getName(), new HandlerCallback(sepMetaData),
PayloadKey.TRANSIENT);
- inv.setValue(EndpointInvocation.class.getName(), epInv, PayloadKey.TRANSIENT);
-
- String[] sig = { Invocation.class.getName() };
- Object retObj = server.invoke(objectName, "invoke", new Object[] { inv
}, sig);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- // do nothing
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- @Override
- public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
- {
- if (type == HandlerType.PRE)
- return delegate.callRequestHandlerChain(sepMetaData, type);
- else
- return true;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type)
- {
- if (type == HandlerType.PRE)
- return delegate.callResponseHandlerChain(sepMetaData, type);
- else
- return true;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type, Exception ex)
- {
- if (type == HandlerType.PRE)
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- else
- return true;
- }
-
- // The ServiceEndpointInterceptor calls the methods in this callback
- public class HandlerCallback
- {
- private ServerEndpointMetaData sepMetaData;
-
- public HandlerCallback(ServerEndpointMetaData sepMetaData)
- {
- this.sepMetaData = sepMetaData;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callRequestHandlerChain(HandlerType type)
- {
- if (type == HandlerType.PRE)
- return true;
- else
- return delegate.callRequestHandlerChain(sepMetaData, type);
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callResponseHandlerChain(HandlerType type)
- {
- if (type == HandlerType.PRE)
- return true;
- else
- return delegate.callResponseHandlerChain(sepMetaData, type);
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callFaultHandlerChain(HandlerType type, Exception ex)
- {
- if (type == HandlerType.PRE)
- return true;
- else
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- }
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,130 +0,0 @@
-/*
-* 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.legacy.AbstractServiceEndpointInvoker;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInfo;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInvoker;
-import org.jboss.ws.integration.ObjectNameFactory;
-
-/**
- * Handles invocations on EJB3 endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 23-Jul-2005
- */
-public class ServiceEndpointInvokerEJB3 extends AbstractServiceEndpointInvoker implements
ServiceEndpointInvoker
-{
- // provide logging
- private Logger log = Logger.getLogger(ServiceEndpointInvokerEJB3.class);
-
- private MBeanServer server;
- private ObjectName objectName;
-
- public ServiceEndpointInvokerEJB3()
- {
- server = MBeanServerLocator.locateJBoss();
- }
-
- /** Initialize the service endpoint */
- @Override
- public void init(ServiceEndpointInfo seInfo)
- {
- super.init(seInfo);
-
- String ejbName = seInfo.getServerEndpointMetaData().getLinkName();
- UnifiedDeploymentInfo udi = seInfo.getUnifiedDeploymentInfo();
- String nameStr = "jboss.j2ee:name=" + ejbName +
",service=EJB3,jar=" + udi.simpleName;
- if (udi.parent != null)
- {
- nameStr += ",ear=" + udi.parent.simpleName;
- }
-
- objectName = ObjectNameFactory.create(nameStr.toString());
- }
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint()
- {
- if (server.isRegistered(objectName) == false)
- throw new WSException("Cannot find service endpoint target: " +
objectName);
-
- return null;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpointInstance(Object endpointContext, Class
seiImplClass)
- {
- return null;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- // setup the invocation
- Method seiMethod = epInv.getJavaMethod();
- Object[] args = epInv.getRequestPayload();
-
- Dispatcher dispatcher = Dispatcher.singleton;
- String canonicalName = objectName.getCanonicalName();
- StatelessContainer container =
(StatelessContainer)dispatcher.getRegistered(canonicalName);
- if (container == null)
- throw new WSException("Cannot obtain container from Dispatcher: " +
canonicalName);
-
- Class beanClass = container.getBeanClass();
-
- Method implMethod = getImplMethod(beanClass, seiMethod);
- Object retObj = container.localInvoke(implMethod, args);
-
- epInv.setReturnValue(retObj);
- }
- catch (Throwable e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- // do nothing
- }
-
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,94 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.server.legacy.AbstractServiceEndpointInvoker;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInvoker;
-import org.jboss.ws.core.utils.ThreadLocalAssociation;
-
-/**
- * Handles invocations on MDB endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Mar-2006
- */
-public class ServiceEndpointInvokerMDB extends AbstractServiceEndpointInvoker implements
ServiceEndpointInvoker
-{
- // provide logging
- private Logger log = Logger.getLogger(ServiceEndpointInvokerMDB.class);
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint() throws ClassNotFoundException
- {
- return null;
- }
-
- // The dispatcher sets the target bean object
- public void setTargetBeanObject(Object targetMDB)
- {
- ThreadLocalAssociation.localInvokerMDBAssoc().set(targetMDB);
- }
-
- /** Create an instance of the SEI implementation bean if necessary
- */
- public Object createServiceEndpointInstance(Object endpointContext, Class
seiImplClass) throws InstantiationException, IllegalAccessException
- {
- return ThreadLocalAssociation.localInvokerMDBAssoc().get();
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- Class implClass = seiImpl.getClass();
- Method seiMethod = epInv.getJavaMethod();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
- Object[] args = epInv.getRequestPayload();
- Object retObj = implMethod.invoke(seiImpl, args);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- finally
- {
- // cleanup thread local
- setTargetBeanObject(null);
- }
- }
-
- /** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,87 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.net.URL;
-
-import javax.management.MBeanServer;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-
-/**
- * Publish the HTTP service endpoint to Tomcat
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointPublisher extends AbstractServiceEndpointPublisher
-{
- // provide logging
- private static Logger log = Logger.getLogger(ServiceEndpointPublisher.class);
-
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- DeploymentInfo di = udi.getAttachment(DeploymentInfo.class);
- if (di == null)
- throw new IllegalStateException("Cannot obtain DeploymentInfo from
context");
-
- rewriteWebXml(udi);
-
- // Preserve the repository config
- URL warURL = udi.webappURL;
- DeploymentInfo auxdi = new DeploymentInfo(warURL, null,
MBeanServerLocator.locateJBoss());
- auxdi.repositoryConfig = di.getTopRepositoryConfig();
- getMainDeployer().deploy(auxdi);
- return "OK";
- }
-
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- URL warURL = udi.webappURL;
- if (warURL == null)
- {
- log.error("Cannot obtain waURL for: " + udi.name);
- return "FAIL";
- }
-
- log.debug("destroyServiceEndpoint: " + warURL);
-
- getMainDeployer().undeploy(warURL);
- return "OK";
- }
-
- private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- MainDeployerMBean mainDeployer =
(MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME,
server);
- return mainDeployer;
- }
-}
Deleted:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,119 +0,0 @@
-/*
- * 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.ws.integration.jboss42;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.jboss.metadata.WebMetaData;
-import org.jboss.metadata.WebSecurityMetaData;
-import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData.PublishLocationAdapter;
-import
org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
-
-/**
- * Build container independent web meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class WebMetaDataAdapter
-{
- public UnifiedWebMetaData buildUnifiedWebMetaData(WebMetaData wmd)
- {
- UnifiedWebMetaData umd = new UnifiedWebMetaData();
- umd.setContextRoot(wmd.getContextRoot());
- umd.setServletMappings(wmd.getServletMappings());
- 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);
- }
- };
- }
-
- private List<UnifiedWebSecurityMetaData> getSecurityMetaData(final Iterator
securityConstraints)
- {
- ArrayList<UnifiedWebSecurityMetaData> unifiedsecurityMetaData = new
ArrayList<UnifiedWebSecurityMetaData>();
-
- while (securityConstraints.hasNext())
- {
- WebSecurityMetaData securityMetaData =
(WebSecurityMetaData)securityConstraints.next();
-
- UnifiedWebSecurityMetaData current = new UnifiedWebSecurityMetaData();
- unifiedsecurityMetaData.add(current);
-
- current.setTransportGuarantee(securityMetaData.getTransportGuarantee());
-
- HashMap resources = securityMetaData.getWebResources();
- for (Object webResourceObj : resources.values())
- {
- WebResourceCollection webResource = (WebResourceCollection)webResourceObj;
- UnifiedWebResourceCollection currentResource =
current.addWebResource(webResource.getName());
- for (String currentPattern : webResource.getUrlPatterns())
- {
- currentResource.addPattern(currentPattern);
- }
- }
-
- }
-
- return unifiedsecurityMetaData;
- }
-
- private Map<String, String> getServletClassMap(WebMetaData wmd)
- {
- Map<String, String> mappings = new HashMap<String, String>();
- Iterator it = wmd.getServletClassMap().entrySet().iterator();
- while(it.hasNext())
- {
- Map.Entry entry = (Entry)it.next();
- String servletName = (String)entry.getKey();
- String servletClass = (String)entry.getValue();
- // Skip JSPs
- if (servletClass != null)
- mappings.put(servletName, servletClass);
- }
- return mappings;
- }
-}
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,87 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData.PublishLocationAdapter;
+
+/**
+ * Build container independent application meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public abstract class AbstractApplicationMetaDataAdapter
+{
+ public UnifiedApplicationMetaData
buildUnifiedApplicationMetaData(UnifiedDeploymentInfo udi, ApplicationMetaData apmd)
+ {
+ udi.addAttachment(ApplicationMetaData.class, apmd);
+
+ UnifiedApplicationMetaData umd = new UnifiedApplicationMetaData();
+ buildUnifiedBeanMetaData(umd, apmd);
+ umd.setConfigName(apmd.getConfigName());
+ umd.setConfigFile(apmd.getConfigFile());
+ umd.setWebServiceContextRoot(apmd.getWebServiceContextRoot());
+ umd.setSecurityDomain(apmd.getSecurityDomain());
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(apmd));
+ return umd;
+ }
+
+ protected PublishLocationAdapter getPublishLocationAdpater(final ApplicationMetaData
apmd)
+ {
+ return new PublishLocationAdapter ()
+ {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ return apmd.getWsdlPublishLocationByName(name);
+ }
+ };
+ }
+
+ protected void buildUnifiedBeanMetaData(UnifiedApplicationMetaData umd,
ApplicationMetaData metaData)
+ {
+ List<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
+ Iterator it = metaData.getEnterpriseBeans();
+ while (it.hasNext())
+ {
+ BeanMetaData bmd = (BeanMetaData)it.next();
+ UnifiedBeanMetaData ubmd = buildUnifiedBeanMetaData(bmd);
+ if (ubmd != null)
+ {
+ beans.add(ubmd);
+ }
+ }
+ umd.setEnterpriseBeans(beans);
+ }
+
+ protected abstract UnifiedBeanMetaData buildUnifiedBeanMetaData(BeanMetaData bmd);
+}
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,139 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.util.List;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.integration.deployment.DeployerManager;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+import org.jboss.ws.integration.jboss42.DeployerHook;
+import org.jboss.ws.integration.jboss42.DeployerInterceptorMBean;
+
+/**
+ * An abstract web service deployer.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHook implements DeployerHook
+{
+ // provide logging
+ protected final Logger log = Logger.getLogger(getClass());
+
+ protected DeployerManager deployerManager;
+ private List<ObjectName> phaseOneInterceptors;
+ private List<ObjectName> phaseTwoInterceptors;
+
+ public void setDeployerManager(DeployerManager deploymentManager)
+ {
+ this.deployerManager = deploymentManager;
+ }
+
+ public void setPhaseOneInterceptors(List<ObjectName> phaseOneInterceptors)
+ {
+ this.phaseOneInterceptors = phaseOneInterceptors;
+ }
+
+ public void setPhaseTwoInterceptors(List<ObjectName> phaseTwoInterceptors)
+ {
+ this.phaseTwoInterceptors = phaseTwoInterceptors;
+ }
+
+ /** Return true if this deployment should be ignored
+ */
+ public boolean ignoreDeployment(DeploymentInfo unit)
+ {
+ return false;
+ }
+
+ /** Add the hooks to the interceptors
+ */
+ public void start()
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ try
+ {
+ if (phaseOneInterceptors != null)
+ {
+ for (ObjectName oname : phaseOneInterceptors)
+ {
+ DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
+ interceptor.addPhaseOneHook(this);
+ }
+ }
+
+ if (phaseTwoInterceptors != null)
+ {
+ for (ObjectName oname : phaseTwoInterceptors)
+ {
+ DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
+ interceptor.addPhaseTwoHook(this);
+ }
+ }
+ }
+ catch (MBeanProxyCreationException e)
+ {
+ throw new WSDeploymentException(e);
+ }
+ }
+
+ /** Add the hooks to the interceptors
+ */
+ public void stop()
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ try
+ {
+ if (phaseOneInterceptors != null)
+ {
+ for (ObjectName oname : phaseOneInterceptors)
+ {
+ DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
+ interceptor.removePhaseOneHook(this);
+ }
+ }
+
+ if (phaseTwoInterceptors != null)
+ {
+ for (ObjectName oname : phaseTwoInterceptors)
+ {
+ DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
+ interceptor.removePhaseTwoHook(this);
+ }
+ }
+ }
+ catch (MBeanProxyCreationException e)
+ {
+ throw new WSDeploymentException(e);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+/**
+ * An abstract deployer for EJB Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHookEJB extends ArchiveDeployerHook
+{
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,63 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.WebMetaData;
+
+//$Id$
+
+/**
+ * An abstract deployer for JSE Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHookJSE extends ArchiveDeployerHook
+{
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ if ((unit.metaData instanceof WebMetaData) == false)
+ return false;
+
+ return true;
+ }
+
+ static class Servlet
+ {
+ String servletName;
+ String servletClass;
+ public Servlet(String servletName, String servletClass)
+ {
+ this.servletName = servletName;
+ this.servletClass = servletClass;
+ }
+ public String getServletClass()
+ {
+ return servletClass;
+ }
+ public String getServletName()
+ {
+ return servletName;
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,431 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.HashMap;
+
+import javax.activation.DataHandler;
+import javax.management.MBeanException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.DirectionHolder;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.DirectionHolder.Direction;
+import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.core.server.ServerHandlerDelegate;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/** An implementation handles invocations on the endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractInvocationHandler implements InvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(AbstractInvocationHandler.class);
+
+ protected Endpoint endpoint;
+ protected CommonBindingProvider bindingProvider;
+ protected ServerHandlerDelegate delegate;
+
+ /** Initialize the service endpoint */
+ public void init(Endpoint endpoint)
+ {
+ this.endpoint = endpoint;
+
+ ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ bindingProvider = new CommonBindingProvider(sepMetaData);
+ delegate = new HandlerDelegateJAXRPC(sepMetaData);
+ }
+ else
+ {
+ bindingProvider = new BindingProviderImpl(sepMetaData);
+ delegate = new HandlerDelegateJAXWS(sepMetaData);
+ }
+ }
+
+ /** Load the SEI implementation bean if necessary */
+ protected abstract Class loadServiceEndpoint() throws ClassNotFoundException;
+
+ /** Create the instance of the SEI implementation bean if necessary */
+ protected abstract Object createServiceEndpointInstance(Class seiImplClass,
InvocationContext context) throws Exception;
+
+ /** Invoke the instance of the SEI implementation bean */
+ protected abstract void invokeServiceEndpointInstance(Object seiImpl,
EndpointInvocation epInv) throws Exception;
+
+ /** Destroy the instance of the SEI implementation bean if necessary */
+ protected abstract void destroyServiceEndpointInstance(Object seiImpl);
+
+ public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
+ {
+ return delegate.callRequestHandlerChain(sepMetaData, type);
+ }
+
+ public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type)
+ {
+ return delegate.callResponseHandlerChain(sepMetaData, type);
+ }
+
+ public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ delegate.closeHandlerChain(sepMetaData, type);
+ }
+
+ public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type, Exception ex)
+ {
+ return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ }
+
+ /** Invoke the the service endpoint */
+ public void invoke(InvocationContext reqContext) throws Exception
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ ServerEndpointMetaData sepMetaData =
(ServerEndpointMetaData)msgContext.getEndpointMetaData();
+ MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
+
+ // Load the endpoint implementation bean
+ Class seImpl = loadServiceEndpoint();
+
+ // Create an instance of the endpoint implementation bean
+ Object seInstance = createServiceEndpointInstance(seImpl, reqContext);
+
+ // The direction of the message
+ DirectionHolder direction = new DirectionHolder(Direction.InBound);
+
+ // Get the order of pre/post handlerchains
+ HandlerType[] handlerType = delegate.getHandlerTypeOrder();
+ HandlerType[] faultType = delegate.getHandlerTypeOrder();
+
+ // Set the required inbound context properties
+ setInboundContextProperties();
+
+ try
+ {
+ boolean oneway = false;
+ EndpointInvocation epInv = null;
+ OperationMetaData opMetaData = null;
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ binding.setHeaderSource(delegate);
+
+ // call the request handler chain
+ boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);
+
+ // Unbind the request message
+ if (handlersPass)
+ {
+ // Get the operation meta data from the SOAP message
+ opMetaData = getDispatchDestination(sepMetaData, reqMessage);
+ msgContext.setOperationMetaData(opMetaData);
+ oneway = opMetaData.isOneWay();
+
+ /*
+ * From JAX-WS 10.2.1 - "7. If the node does not understand how to
process
+ * the message, then neither handlers nor the endpoint
+ * are invoked and instead the binding generates a SOAP must
+ * understand exception"
+ *
+ * Therefore, this must precede the ENDPOINT chain; however, The PRE
+ * chain still must happen first since the message may be encrypted, in
which
+ * case the operation is still not known. Without knowing the operation, it
+ * is not possible to determine what headers are understood by the endpoint.
+ */
+ if (binding instanceof CommonSOAPBinding)
+ ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
+
+ // Unbind the request message
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
handlerType[1]);
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
handlerType[2]);
+
+ if (handlersPass)
+ {
+ msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ try
+ {
+ // Check if protocol handlers modified the payload
+ if (msgContext.isModified())
+ {
+ log.debug("Handler modified payload, unbind message again");
+ reqMessage = msgContext.getMessageAbstraction();
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ // Invoke the service endpoint
+ invokeServiceEndpointInstance(seInstance, epInv);
+ }
+ finally
+ {
+ msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ }
+
+ // Reverse the message direction
+ msgContext = processPivotInternal(msgContext, direction);
+
+ // Set the required outbound context properties
+ setOutboundContextProperties();
+
+ if (binding instanceof CommonSOAPBinding)
+ XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
+
+ // Bind the response message
+ MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData,
epInv);
+ msgContext.setMessageAbstraction(resMessage);
+ }
+ else
+ {
+ // Reverse the message direction without calling the endpoint
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ msgContext = processPivotInternal(msgContext, direction);
+ msgContext.setMessageAbstraction(resMessage);
+ }
+
+ if (oneway == false)
+ {
+ // call the response handler chain, removing the fault type entry will not
call handleFault for that chain
+ handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
+ faultType[2] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
handlerType[1]);
+ faultType[1] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
handlerType[0]);
+ faultType[0] = null;
+ }
+ }
+ catch (RuntimeException ex)
+ {
+ // Reverse the message direction
+ processPivotInternal(msgContext, direction);
+
+ try
+ {
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ binding.bindFaultMessage(ex);
+
+ // call the fault handler chain
+ boolean handlersPass = true;
+ if (faultType[2] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[2], ex);
+ if (faultType[1] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[1], ex);
+ if (faultType[0] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[0], ex);
+ }
+ catch (RuntimeException subEx)
+ {
+ log.warn("Exception while processing handleFault: ", ex);
+ ex = subEx;
+ }
+ throw ex;
+ }
+ finally
+ {
+ closeHandlerChain(sepMetaData, handlerType[2]);
+ closeHandlerChain(sepMetaData, handlerType[1]);
+ closeHandlerChain(sepMetaData, handlerType[0]);
+
+ destroyServiceEndpointInstance(seInstance);
+ }
+ }
+
+ protected void setInboundContextProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ // Map of attachments to a message for the outbound message, key is the MIME
Content-ID, value is a DataHandler
+ msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
+ }
+ }
+
+ protected void setOutboundContextProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ // Map of attachments to a message for the outbound message, key is the MIME
Content-ID, value is a DataHandler
+ msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
+ }
+ }
+
+ private CommonMessageContext processPivotInternal(CommonMessageContext msgContext,
DirectionHolder direction)
+ {
+ if (direction.getDirection() == Direction.InBound)
+ {
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ msgContext = MessageContextJAXRPC.processPivot(msgContext);
+ }
+ else
+ {
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ }
+ direction.setDirection(Direction.OutBound);
+ }
+ return msgContext;
+ }
+
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
MessageAbstraction reqMessage) throws SOAPException
+ {
+ OperationMetaData opMetaData;
+
+ String bindingID = epMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ if (epMetaData.getOperations().size() != 1)
+ throw new IllegalStateException("Multiple operations not supported for
HTTP binding");
+
+ opMetaData = epMetaData.getOperations().get(0);
+ }
+ else
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+
+ // Report a MustUnderstand fault
+ if (opMetaData == null)
+ {
+ String faultString;
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ if (soapBody.getChildElements().hasNext())
+ {
+ SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
+ Name soapName = soapBodyElement.getElementName();
+ faultString = "Endpoint " + epMetaData.getPortName() + "
does not contain operation meta data for: " + soapName;
+ }
+ else
+ {
+ faultString = "Endpoint " + epMetaData.getPortName() + "
does not contain operation meta data for empty soap body";
+ }
+
+ // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL
description, it SHOULD generate a soap:Fault
+ // with a faultcode of "Client", unless a
"MustUnderstand" or "VersionMismatch" fault is generated.
+ if (soapHeader != null &&
soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ else
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ }
+ }
+ return opMetaData;
+ }
+
+ 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;
+ }
+
+ /** handle invocation exceptions */
+ public void handleInvocationException(Throwable th) throws Exception
+ {
+ if (th instanceof InvocationTargetException)
+ {
+ // unwrap the throwable raised by the service endpoint implementation
+ Throwable targetEx = ((InvocationTargetException)th).getTargetException();
+ handleInvocationThrowable(targetEx);
+ }
+
+ if (th instanceof MBeanException)
+ {
+ throw ((MBeanException)th).getTargetException();
+ }
+
+ handleInvocationThrowable(th);
+ }
+
+ private void handleInvocationThrowable(Throwable th) throws Exception
+ {
+ if (th instanceof Exception)
+ {
+ throw (Exception)th;
+ }
+ else if (th instanceof Error)
+ {
+ throw (Error)th;
+ }
+ else
+ {
+ throw new UndeclaredThrowableException(th);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,178 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.rpc.JAXRPCException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServletRequestContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.management.EndpointRegistry;
+import org.jboss.ws.integration.management.EndpointRegistryFactory;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractServiceEndpointServlet extends HttpServlet
+{
+ // provide logging
+ private static final Logger log =
Logger.getLogger(AbstractServiceEndpointServlet.class);
+
+ protected Endpoint endpoint;
+ protected EndpointRegistry epRegistry;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ epRegistry = EndpointRegistryFactory.getEndpointRegistry();
+ }
+
+ public void destroy()
+ {
+ super.destroy();
+ }
+
+ public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ if (endpoint == null)
+ {
+ String contextPath = req.getContextPath();
+ initServiceEndpoint(contextPath);
+ }
+ super.service(req, res);
+ }
+
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ // Process a WSDL request
+ if (req.getParameter("wsdl") != null ||
req.getParameter("WSDL") != null)
+ {
+ res.setContentType("text/xml");
+ try
+ {
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ ServletRequestContext context = new
ServletRequestContext(getServletContext(), req, res);
+ requestHandler.handleWSDLRequest(endpoint, res.getOutputStream(), context);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+ else
+ {
+ res.setStatus(405);
+ res.setContentType("text/plain");
+ Writer out = res.getWriter();
+ out.write("HTTP GET not supported");
+ out.flush();
+ out.close();
+ }
+ }
+
+ public void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ log.debug("doPost: " + req.getRequestURI());
+
+ ServletInputStream inputStream = req.getInputStream();
+ ServletOutputStream outputStream = res.getOutputStream();
+ try
+ {
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ ServletRequestContext context = new ServletRequestContext(getServletContext(),
req, res);
+ requestHandler.handleRequest(endpoint, inputStream, outputStream, context);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ finally
+ {
+ try
+ {
+ outputStream.flush();
+ outputStream.close();
+ }
+ catch (IOException ioex)
+ {
+ log.error("Cannot flush output stream");
+ }
+
+ }
+ }
+
+ private void handleException(Exception ex) throws ServletException
+ {
+ log.error("Error processing web service request", ex);
+
+ if (ex instanceof JAXRPCException)
+ throw (JAXRPCException)ex;
+
+ throw new ServletException(ex);
+ }
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ String servletName = getServletName();
+ if (contextPath.startsWith("/"))
+ contextPath = contextPath.substring(1);
+
+ for (ObjectName sepId : epRegistry.getEndpoints())
+ {
+ String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
+ String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (servletName.equals(propEndpoint) &&
contextPath.equals(propContext))
+ {
+ endpoint = epRegistry.getEndpoint(sepId);
+ break;
+ }
+ }
+
+ if (endpoint == null)
+ {
+ ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN +
":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath +
","
+ + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
+ throw new WSException("Cannot obtain endpoint for: " + oname);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,80 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.metadata.EjbPortComponentMetaData;
+import org.jboss.metadata.MessageDrivenMetaData;
+import org.jboss.metadata.SessionMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedSessionMetaData;
+
+/**
+ * Build container independent application meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class ApplicationMetaDataAdapter extends AbstractApplicationMetaDataAdapter
+{
+ protected UnifiedBeanMetaData buildUnifiedBeanMetaData(BeanMetaData bmd)
+ {
+ UnifiedBeanMetaData ubmd = null;
+ if (bmd instanceof SessionMetaData)
+ {
+ ubmd = new UnifiedSessionMetaData();
+ }
+ else if (bmd instanceof MessageDrivenMetaData)
+ {
+ ubmd = new UnifiedMessageDrivenMetaData();
+
((UnifiedMessageDrivenMetaData)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)
+ {
+ UnifiedEjbPortComponentMetaData upcmd = new
UnifiedEjbPortComponentMetaData();
+ upcmd.setPortComponentName(pcmd.getPortComponentName());
+ upcmd.setPortComponentURI(pcmd.getPortComponentURI());
+ upcmd.setAuthMethod(pcmd.getAuthMethod());
+ upcmd.setTransportGuarantee(pcmd.getTransportGuarantee());
+ upcmd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
+ ubmd.setPortComponent(upcmd);
+ }
+ }
+ return ubmd;
+ }
+}
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,157 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.webservices.WebservicesFactory;
+import org.jboss.ws.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;
+
+/**
+ * An abstract web service deployer.
+ *
+ * deploy(unit)
+ * if(isWebServiceDeployment)
+ * dep = createDeployment(unit)
+ * deploy(dep)
+ *
+ * undeploy(unit)
+ * dep = getDeployment(unit)
+ * undeploy(dep)
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class ArchiveDeployerHook extends AbstractDeployerHook
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public abstract DeploymentType getDeploymentType();
+
+ /** Depending on the type of deployment, this method should return true
+ * if the deployment contains web service endpoints.
+ */
+ public abstract boolean isWebServiceDeployment(DeploymentInfo unit);
+
+ /** Create the Deployment for a given DeploymentInfo
+ */
+ public abstract Deployment createDeployment(DeploymentInfo unit);
+
+ /** Get the Deployment for a given DeploymentInfo
+ */
+ public Deployment getDeployment(DeploymentInfo unit)
+ {
+ Deployment dep = (Deployment)unit.context.get(Deployment.class);
+ return (dep != null && dep.getType() == getDeploymentType() ? dep : null);
+ }
+
+ public void deploy(DeploymentInfo unit) throws DeploymentException
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ if (isWebServiceDeployment(unit))
+ {
+ log.debug("deploy: " + unit.shortName);
+ Deployment dep = getDeployment(unit);
+ if (dep == null)
+ {
+ dep = createDeployment(unit);
+ dep.getContext().addAttachment(DeploymentInfo.class, unit);
+ }
+
+ deployerManager.deploy(dep);
+ unit.context.put(Deployment.class, dep);
+ }
+ }
+
+ public void undeploy(DeploymentInfo unit)
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ Deployment dep = getDeployment(unit);
+ if (dep != null)
+ {
+ log.debug("undeploy: " + unit.shortName);
+ deployerManager.undeploy(dep);
+ unit.context.remove(Deployment.class);
+ }
+ }
+
+ /** Unmrashall the webservices.xml if there is one
+ */
+ protected WebservicesMetaData getWebservicesMetaData(DeploymentInfo unit, String
wsFile)
+ {
+ WebservicesMetaData wsMetaData =
(WebservicesMetaData)unit.context.get(WebservicesMetaData.class);
+ UnifiedVirtualFile vfWebservices = getWebservicesFile(unit, wsFile);
+ 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.context.put(WebservicesMetaData.class, wsMetaData);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new WSDeploymentException(ex);
+ }
+ }
+ return wsMetaData;
+ }
+
+ private UnifiedVirtualFile getWebservicesFile(DeploymentInfo unit, String wsFile)
+ {
+ try
+ {
+ UnifiedVirtualFile vfsRoot = new ResourceLoaderAdapter(unit.localCl);
+ return (wsFile != null ? vfsRoot.findChild(wsFile) : null);
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that injects the correct classloader into the UMDM
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ClassLoaderInjectionDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ DeploymentInfo unit = dep.getContext().getAttachment(DeploymentInfo.class);
+ if (unit == null)
+ throw new IllegalStateException("Cannot obtain deployement unit");
+
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ ClassLoader classLoader = unit.ucl;
+
+ // Get the webapp context classloader and use it as the deploymet class loader
+ WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
+ if (webMetaData != null)
+ {
+ classLoader = webMetaData.getContextLoader();
+ }
+
+ umd.setClassLoader(classLoader);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,117 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+
+/**
+ * Build container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class DeploymentInfoAdapter
+{
+ // logging support
+ private static Logger log = Logger.getLogger(DeploymentInfoAdapter.class);
+
+ private WebMetaDataAdapter webMetaDataAdapter;
+ private AbstractApplicationMetaDataAdapter appMetaDataAdapter;
+
+ public void setAppMetaDataAdapter(AbstractApplicationMetaDataAdapter
applicationMetaDataAdapter)
+ {
+ this.appMetaDataAdapter = applicationMetaDataAdapter;
+ }
+
+ public void setWebMetaDataAdapter(WebMetaDataAdapter webMetaDataAdapter)
+ {
+ this.webMetaDataAdapter = webMetaDataAdapter;
+ }
+
+ public UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi,
DeploymentInfo di)
+ {
+ udi.addAttachment(DeploymentInfo.class, di);
+
+ if (di.parent != null)
+ {
+ udi.parent = new UnifiedDeploymentInfo(null);
+ buildDeploymentInfo(udi.parent, di.parent);
+ }
+
+ udi.vfRoot = new ResourceLoaderAdapter(di.localCl);
+ udi.name = di.getCanonicalName();
+ udi.simpleName = di.shortName;
+ udi.url = getDeploymentURL(di);
+ udi.classLoader = di.annotationsCl;
+ udi.deployedObject = di.deployedObject;
+
+ buildMetaData(udi, di.metaData);
+
+ log.debug("UnifiedDeploymentInfo:\n" + udi);
+ return udi;
+ }
+
+ private URL getDeploymentURL(DeploymentInfo di)
+ {
+ URL deploymentURL = (di.localUrl != null ? di.localUrl : di.url);
+ if ("file".equals(deploymentURL.getProtocol()))
+ {
+ String path = deploymentURL.getPath();
+ if (new File(path).isFile())
+ {
+ try
+ {
+ deploymentURL = new URL("jar:file:" + path + "!/");
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+ }
+ return deploymentURL;
+ }
+
+ private void buildMetaData(UnifiedDeploymentInfo udi, Object metaData)
+ {
+ if (metaData instanceof WebMetaData)
+ {
+ udi.metaData = webMetaDataAdapter.buildUnifiedWebMetaData(udi,
(WebMetaData)metaData);
+ udi.webappURL = udi.url;
+ }
+ else if (metaData instanceof ApplicationMetaData)
+ {
+ udi.metaData = appMetaDataAdapter.buildUnifiedApplicationMetaData(udi,
(ApplicationMetaData)metaData);
+ }
+ }
+}
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,47 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.ws.integration.KernelLocator;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 10-Mar-2007
+ */
+public class DeploymentInfoAdapterFactory
+{
+ // Hide ctor
+ private DeploymentInfoAdapterFactory()
+ {
+ }
+
+ public static DeploymentInfoAdapter newInstance()
+ {
+ KernelRegistry registry = KernelLocator.getKernel().getRegistry();
+ KernelRegistryEntry entry = registry.getEntry("DeploymentInfoAdapter");
+ return (DeploymentInfoAdapter)entry.getTarget();
+ }
+}
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,47 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that initializes the UMDM
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EagerInitializeDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ umd.eagerInitialize();
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,115 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.util.Map;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.LifecycleHandler;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+
+/**
+ * A deployer that assigns the handlers to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointHandlerDeployer extends AbstractDeployer
+{
+ private String requestHandler;
+ private String lifecycleHandler;
+ private Map<String,String> invocationHandler;
+
+ public void setLifecycleHandler(String handler)
+ {
+ this.lifecycleHandler = handler;
+ }
+
+ public void setRequestHandler(String handler)
+ {
+ this.requestHandler = handler;
+ }
+
+ public void setInvocationHandler(Map<String,String> handlers)
+ {
+ this.invocationHandler = handlers;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.setRequestHandler(getRequestHandler(dep));
+ ep.setLifecycleHandler(getLifecycleHandler(dep));
+ ep.setInvocationHandler(getInvocationHandler(dep));
+ }
+ }
+
+ private RequestHandler getRequestHandler(Deployment dep)
+ {
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(requestHandler);
+ return (RequestHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load request handler: " +
requestHandler);
+ }
+ }
+
+ private LifecycleHandler getLifecycleHandler(Deployment dep)
+ {
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(lifecycleHandler);
+ return (LifecycleHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load lifecycle handler: " +
lifecycleHandler);
+ }
+ }
+
+ private InvocationHandler getInvocationHandler(Deployment dep)
+ {
+ String className = invocationHandler.get(dep.getType().toString());
+ if (className == null)
+ throw new IllegalStateException("Cannot obtain invocation handler for:
" + dep.getType());
+
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(className);
+ return (InvocationHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load invocation handler: " +
className);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,80 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+
+/**
+ * A deployer that that calls the endpoint lifecycle handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointLifecycleDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ ep.getLifecycleHandler().create(ep);
+ }
+
+ @Override
+ public void start(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.getLifecycleHandler().start(ep);
+ }
+ }
+
+ @Override
+ public void stop(Deployment dep)
+ {
+ Service service = dep.getService();
+ if (service != null)
+ {
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().stop(ep);
+ }
+ }
+ }
+
+ @Override
+ public void destroy(Deployment dep)
+ {
+ Service service = dep.getService();
+ if (service != null)
+ {
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().destroy(ep);
+ }
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A deployer that assigns the complete name to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointNameDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ServerEndpointMetaData sepMetaData =
ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta
data");
+
+ ObjectName sepID = sepMetaData.getServiceEndpointID();
+ ep.setName(sepID);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,266 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.lang.reflect.Method;
+import java.security.Principal;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.ejb.EjbModule;
+import org.jboss.ejb.Interceptor;
+import org.jboss.ejb.StatelessSessionContainer;
+import org.jboss.invocation.Invocation;
+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.SecurityAssociation;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * Handles invocations on EJB21 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB21 extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerEJB21.class);
+
+ private String jndiName;
+ private MBeanServer server;
+ private ObjectName objectName;
+
+ /** Initialize the service endpoint */
+ @Override
+ public void init(Endpoint endpoint)
+ {
+ super.init(endpoint);
+
+ server = MBeanServerLocator.locateJBoss();
+
+ ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port component");
+
+ UnifiedDeploymentInfo udi =
endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
+ UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
+
+ // verify the service endpoint
+ String seiName = sepMetaData.getServiceEndpointInterfaceName();
+ if (sepMetaData.getType() == Type.JAXRPC && seiName != null)
+ {
+ String bmdSEI = beanMetaData.getServiceEndpointInterface();
+ if (seiName.equals(bmdSEI) == false)
+ throw new WSException("Endpoint meta data defines SEI '" +
seiName + "', <service-endpoint> in ejb-jar.xml defines '" +
bmdSEI + "'");
+ }
+
+ // get the bean's JNDI name
+ jndiName = beanMetaData.getContainerObjectNameJndiName();
+ if (jndiName == null)
+ throw new WSException("Cannot obtain JNDI name for: " + ejbName);
+
+ objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName +
",service=EJB");
+
+ // 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);
+ }
+ }
+
+ /** Load the SEI implementation bean if necessary
+ */
+ public Class loadServiceEndpoint()
+ {
+ if (server.isRegistered(objectName) == false)
+ throw new WSException("Cannot find service endpoint target: " +
objectName);
+
+ return null;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ @Override
+ protected Object createServiceEndpointInstance(Class seiImplClass, InvocationContext
context) throws Exception
+ {
+ return null;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+
+ // these are provided by the ServerLoginHandler
+ Principal principal = SecurityAssociation.getPrincipal();
+ Object credential = SecurityAssociation.getCredential();
+
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+
+ // invoke on the container
+ try
+ {
+ // setup the invocation
+ Method method = epInv.getJavaMethod();
+ Object[] args = epInv.getRequestPayload();
+ Invocation inv = new Invocation(null, method, args, null, principal,
credential);
+
+ // EJB2.1 endpoints will only get an JAXRPC context
+ if ((msgContext instanceof javax.xml.rpc.handler.MessageContext) == false)
+ msgContext = new SOAPMessageContextJAXRPC(msgContext);
+
+ inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
+ inv.setType(InvocationType.SERVICE_ENDPOINT);
+
+ // Set the handler callback and endpoint invocation
+ ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ inv.setValue(HandlerCallback.class.getName(), new
HandlerCallbackImpl(sepMetaData), PayloadKey.TRANSIENT);
+ inv.setValue(EndpointInvocation.class.getName(), epInv, PayloadKey.TRANSIENT);
+
+ String[] sig = { Invocation.class.getName() };
+ Object retObj = server.invoke(objectName, "invoke", new Object[] { inv
}, sig);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ // do nothing
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ @Override
+ public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callRequestHandlerChain(sepMetaData, type);
+ else return true;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callResponseHandlerChain(sepMetaData, type);
+ else return true;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type, Exception ex)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ else return true;
+ }
+
+ // The ServiceEndpointInterceptor calls the methods in this callback
+ public class HandlerCallbackImpl implements HandlerCallback
+ {
+ private ServerEndpointMetaData sepMetaData;
+
+ public HandlerCallbackImpl(ServerEndpointMetaData sepMetaData)
+ {
+ this.sepMetaData = sepMetaData;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public boolean callRequestHandlerChain(HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callRequestHandlerChain(sepMetaData, type);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public boolean callResponseHandlerChain(HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callResponseHandlerChain(sepMetaData, type);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public boolean callFaultHandlerChain(HandlerType type, Exception ex)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,191 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.ejb.EJBContext;
+import javax.management.ObjectName;
+
+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.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.WebServiceContextEJB;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB3 extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerEJB3.class);
+
+ private ObjectName objectName;
+
+ /** Initialize the service endpoint */
+ @Override
+ public void init(Endpoint endpoint)
+ {
+ super.init(endpoint);
+
+ ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port component");
+
+ UnifiedDeploymentInfo udi =
endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
+ String nameStr = "jboss.j2ee:name=" + ejbName +
",service=EJB3,jar=" + udi.simpleName;
+ if (udi.parent != null)
+ {
+ nameStr += ",ear=" + udi.parent.simpleName;
+ }
+
+ objectName = ObjectNameFactory.create(nameStr.toString());
+ }
+
+ /** Load the SEI implementation bean if necessary
+ */
+ public Class loadServiceEndpoint()
+ {
+ Dispatcher dispatcher = Dispatcher.singleton;
+ if (dispatcher.getRegistered(objectName.getCanonicalName()) == null)
+ throw new WSException("Cannot find service endpoint target: " +
objectName);
+
+ return null;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ @Override
+ protected Object createServiceEndpointInstance(Class seiImplClass, InvocationContext
context) throws Exception
+ {
+ return null;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+
+ // invoke on the container
+ try
+ {
+ // setup the invocation
+ Method seiMethod = epInv.getJavaMethod();
+ Object[] args = epInv.getRequestPayload();
+
+ Dispatcher dispatcher = Dispatcher.singleton;
+ StatelessContainer container =
(StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
+ Class beanClass = container.getBeanClass();
+
+ Method implMethod = getImplMethod(beanClass, seiMethod);
+ MethodInfo info = container.getMethodInfo(implMethod);
+
+ EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb3Inv =
new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+ ejb3Inv.setAdvisor(container);
+ ejb3Inv.setArguments(args);
+ ejb3Inv.setContextCallback(new ContextCallback());
+
+ Object retObj = ejb3Inv.invokeNext();
+
+ epInv.setReturnValue(retObj);
+ }
+ catch (Throwable th)
+ {
+ handleInvocationException(th);
+ }
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ // do nothing
+ }
+
+ class ContextCallback implements BeanContextLifecycleCallback
+ {
+ private SOAPMessageContextJAXWS jaxwsMessageContext;
+ private SOAPMessageContextJAXRPC jaxrpcMessageContext;
+
+ public ContextCallback()
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXRPC)
+ {
+ jaxrpcMessageContext = (SOAPMessageContextJAXRPC)msgContext;
+ jaxwsMessageContext = new SOAPMessageContextJAXWS(msgContext);
+ }
+ else if (msgContext instanceof SOAPMessageContextJAXWS)
+ {
+ jaxwsMessageContext = (SOAPMessageContextJAXWS)msgContext;
+ jaxrpcMessageContext = new SOAPMessageContextJAXRPC(msgContext);
+ }
+ }
+
+ public void attached(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ {
+ EJBContext ejbCtx = beanCtx.getEJBContext();
+ beanProp.set(beanCtx.getInstance(), new
WebServiceContextEJB(jaxwsMessageContext, ejbCtx));
+ }
+ }
+
+ public void released(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(null);
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ beanProp.set(beanCtx.getInstance(), null);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
+import org.jboss.ws.core.jaxws.WebServiceContextInjector;
+import org.jboss.ws.core.jaxws.WebServiceContextJSE;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.server.ServletRequestContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJSE extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerJSE.class);
+
+ /** Load the SEI implementation bean if necessary */
+ public Class loadServiceEndpoint() throws ClassNotFoundException
+ {
+ ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ClassLoader cl = sepMetaData.getClassLoader();
+ String seiImplName = sepMetaData.getServiceEndpointImplName();
+ Class seiImplClass = cl.loadClass(seiImplName);
+ return seiImplClass;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public Object createServiceEndpointInstance(Class seiImplClass, InvocationContext
context) throws IllegalAccessException, InstantiationException
+ {
+ Object seiImpl = seiImplClass.newInstance();
+ if (seiImpl instanceof ServiceLifecycle && context != null)
+ {
+ try
+ {
+ ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
+ ServletEndpointContext servletEndpointContext = new
ServletEndpointContextImpl((ServletRequestContext)context);
+ serviceLifecycle.init(servletEndpointContext);
+ }
+ catch (ServiceException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+ return seiImpl;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws SOAPFaultException, Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXWS)
+ {
+ WebServiceContext wsContext = new
WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext);
+ new WebServiceContextInjector().injectContext(seiImpl, wsContext);
+ }
+
+ Class implClass = seiImpl.getClass();
+ Method seiMethod = epInv.getJavaMethod();
+ Method implMethod = getImplMethod(implClass, seiMethod);
+
+ Object[] args = epInv.getRequestPayload();
+ Object retObj = implMethod.invoke(seiImpl, args);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ /** Destroy an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ if (seiImpl instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)seiImpl).destroy();
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.EndpointImpl;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.DeploymentImpl;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.webservices.PortComponentMetaData;
+import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
+
+/**
+ * A deployer JAXRPC EJB21 Endpoints
+ *
+ * @author Thomas.Diesler(a)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(DeploymentInfo unit)
+ {
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.ucl);
+
+ Service service = dep.getService();
+
+ ApplicationMetaData appmd = (ApplicationMetaData)unit.metaData;
+ if (appmd == null)
+ throw new IllegalStateException("Deployment unit does not contain
application meta data");
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit, null);
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain
webservices meta data");
+
+ // Copy the attachments
+ dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.getContext().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();
+ try
+ {
+ ClassLoader loader = unit.ucl;
+ Class<?> epBean = loader.loadClass(ejbClass.trim());
+
+ // Create the endpoint
+ Endpoint endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbLink;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(endpoint);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + ejbClass);
+ }
+ }
+ }
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ if ((unit.metaData instanceof ApplicationMetaData) == false)
+ return false;
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"META-INF/webservices.xml");
+ return wsMetaData != null;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,140 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.EndpointImpl;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.DeploymentImpl;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.webservices.PortComponentMetaData;
+import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
+
+/**
+ * A deployer JAXRPC JSE Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXRPCDeployerHookJSE 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(DeploymentInfo unit)
+ {
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.annotationsCl);
+
+ Service service = dep.getService();
+
+ WebMetaData webMetaData = (WebMetaData)unit.metaData;
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta
data");
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"WEB-INF/webservices.xml");
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain
webservices meta data");
+
+ // Copy the attachments
+ dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.getContext().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();
+
+ try
+ {
+ ClassLoader loader = unit.annotationsCl;
+ Class<?> epBean = loader.loadClass(servletClass.trim());
+
+ // Create the endpoint
+ Endpoint endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletLink;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(endpoint);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + servletClass);
+ }
+ }
+ }
+
+ return dep;
+ }
+
+ private Servlet getServletForName(WebMetaData wmd, String servletLink)
+ {
+ Iterator it = wmd.getServletClassMap().entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Entry)it.next();
+ String servletName = (String)entry.getKey();
+ String servletClass = (String)entry.getValue();
+ if (servletLink.equals(servletName))
+ {
+ return new Servlet(servletName, servletClass);
+ }
+ }
+ throw new IllegalStateException("Cannot find servlet for link: " +
servletLink);
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ if (super.isWebServiceDeployment(unit) == false)
+ return false;
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"WEB-INF/webservices.xml");
+ return wsMetaData != null;
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,133 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.EndpointImpl;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.DeploymentImpl;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+
+/**
+ * A deployer JAXWS EJB3 Endpoints
+ *
+ * @author Thomas.Diesler(a)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(DeploymentInfo unit)
+ {
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.ucl);
+
+ Service service = dep.getService();
+
+ Ejb3Deployment ejb3Deployment =
(Ejb3Deployment)unit.context.get(Ejb3Deployment.class);
+ if (ejb3Deployment == null)
+ throw new IllegalStateException("Deployment unit does not contain ejb3
deployment");
+
+ // Copy the attachments
+ dep.getContext().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();
+ Class epBean = container.getBeanClass();
+
+ // Create the endpoint
+ Endpoint endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(endpoint);
+ }
+ }
+
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ Ejb3Deployment ejb3Deployment =
(Ejb3Deployment)unit.context.get(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
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,158 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.EndpointImpl;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.DeploymentImpl;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+
+/**
+ * A deployer JAXWS JSE Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXWSDeployerHookJSE extends AbstractDeployerHookJSE
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXWS_JSE;
+ }
+
+ @Override
+ public Deployment createDeployment(DeploymentInfo unit)
+ {
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.annotationsCl);
+
+ Service service = dep.getService();
+
+ WebMetaData webMetaData = (WebMetaData)unit.context.get(WebMetaData.class);
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta
data");
+
+ // Copy the attachments
+ dep.getContext().addAttachment(WebMetaData.class, webMetaData);
+
+ List<Servlet> servlets = getRelevantServlets(webMetaData, unit.ucl);
+ for (Servlet servlet : servlets)
+ {
+ String servletName = servlet.getServletName();
+ String servletClass = servlet.getServletClass();
+
+ try
+ {
+ ClassLoader loader = unit.annotationsCl;
+ Class<?> epBean = loader.loadClass(servletClass.trim());
+
+ // Create the endpoint
+ Endpoint endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(endpoint);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + servletClass);
+ continue;
+ }
+ }
+
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ if (super.isWebServiceDeployment(unit) == false)
+ return false;
+
+ boolean isWebServiceDeployment = false;
+ try
+ {
+ WebMetaData webMetaData = (WebMetaData)unit.metaData;
+ List<Servlet> servlets = getRelevantServlets(webMetaData, unit.ucl);
+ 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>();
+ Iterator it = webMetaData.getServletClassMap().entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Entry)it.next();
+ String servletName = (String)entry.getKey();
+ String servletClassName = (String)entry.getValue();
+
+ // 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(new Servlet(servletName, servletClassName));
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + servletClassName);
+ continue;
+ }
+ }
+ return servlets;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,57 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A lifecycle handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class LifecycleHandlerImpl extends org.jboss.ws.integration.LifecycleHandlerImpl
+{
+ public void start(Endpoint endpoint)
+ {
+ super.start(endpoint);
+ log.info("WebService started: " + getEndpointAddress(endpoint));
+ }
+
+ public void stop(Endpoint endpoint)
+ {
+ super.stop(endpoint);
+ log.info("WebService stoped: " + getEndpointAddress(endpoint));
+ }
+
+ private String getEndpointAddress(Endpoint ep)
+ {
+ ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ return sepMetaData.getEndpointAddress();
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ws.integration.deployment.Deployment;
+
+/**
+ * A basic hook that delegates a deployment manger.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class MainDeployerHook extends AbstractDeployerHook
+{
+ public void deploy(DeploymentInfo unit) throws DeploymentException
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ Deployment dep = (Deployment)unit.context.get(Deployment.class);
+ if (dep != null)
+ {
+ deployerManager.deploy(dep);
+ }
+ }
+
+ public void undeploy(DeploymentInfo unit)
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ Deployment dep = (Deployment)unit.context.get(Deployment.class);
+ if (dep != null)
+ {
+ deployerManager.undeploy(dep);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+
+/**
+ * A deployer that modifies the web.xml meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ModifyWebMetaDataDeployer extends AbstractDeployer
+{
+ private ServiceEndpointPublisher serviceEndpointPublisher;
+
+ public void setServiceEndpointPublisher(ServiceEndpointPublisher
serviceEndpointPublisher)
+ {
+ this.serviceEndpointPublisher = serviceEndpointPublisher;
+ }
+
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ serviceEndpointPublisher.rewriteWebXml(udi);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PortComponentLinkServlet.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PortComponentLinkServlet.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PortComponentLinkServlet.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,93 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.legacy.ServiceEndpoint;
+import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
+import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
+
+/**
+ * A servlet that reports the serviceURL for a given service ID.
+ * <p/>
+ * When the web service client ENC is setup, it may contain port-component-link
+ * entries that point to service endpoints in the same top level deployment.
+ * The final serviceURL of those endpoints will become available after the
+ * reference to the javax.xml.rpc.Service is bound to JNDI.
+ * <p/>
+ * When the client does a lookup of the javax.xml.rpc.Service from JNDI the
ObjectFactory
+ * will contact this servlet for the final serviceURL. It is acceptable that the client
+ * wsdl does not contain the correct serviceURL if the client is using the
port-component-link element.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-May-2004
+ */
+public class PortComponentLinkServlet extends HttpServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class);
+
+ protected ServiceEndpointManager epManager;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
+ epManager = factory.getServiceEndpointManager();
+ }
+
+ /**
+ * Get the serviceURL as string for a given serviceID.
+ */
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ String pcLink = req.getParameter("pcLink");
+ if (pcLink == null)
+ throw new IllegalArgumentException("Cannot obtain request parameter
'pcLink'");
+
+ ServiceEndpoint serviceEndpoint = epManager.resolvePortComponentLink(pcLink);
+ ;
+ if (serviceEndpoint == null)
+ throw new WSException("Cannot resolve port-component-link: " +
pcLink);
+
+ res.setContentType("text/plain");
+ PrintWriter out = res.getWriter();
+
+ String endpointAddress =
serviceEndpoint.getServiceEndpointInfo().getServerEndpointMetaData().getEndpointAddress();
+ out.println(endpointAddress);
+
+ log.debug("Resolved " + pcLink + " to: " + endpointAddress);
+ out.close();
+ }
+}
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,64 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.io.IOException;
+
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.WSDLFilePublisher;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that publishes the wsdl
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class PublishContractDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ try
+ {
+ WSDLFilePublisher publisher = new WSDLFilePublisher(udi);
+ publisher.publishWsdlFiles(umd);
+ }
+ catch (IOException ex)
+ {
+ throw new WSDeploymentException(ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,415 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.MessageTrace;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.server.MimeHeaderSource;
+import org.jboss.ws.core.server.ServletHeaderSource;
+import org.jboss.ws.core.server.ServletRequestContext;
+import org.jboss.ws.core.server.WSDLRequestHandler;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.ThreadLocalAssociation;
+import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.Endpoint.EndpointState;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.integration.management.ServerConfig;
+import org.jboss.ws.integration.management.ServerConfigFactory;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.w3c.dom.Document;
+
+/**
+ * A request handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class RequestHandlerImpl implements RequestHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(RequestHandlerImpl.class);
+
+ public void handleRequest(Endpoint endpoint, InputStream inputStream, OutputStream
outputStream, InvocationContext context)
+ {
+ log.debug("handleRequest: " + endpoint.getName());
+
+ ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ServletRequestContext reqContext = (ServletRequestContext)context;
+
+ Type type = sepMetaData.getType();
+
+ ServletContext servletContext = reqContext.getServletContext();
+ HttpServletRequest httpRequest = reqContext.getHttpServletRequest();
+ HttpServletResponse httpResponse = reqContext.getHttpServletResponse();
+ ServletHeaderSource headerSource = new ServletHeaderSource(httpRequest,
httpResponse);
+
+ // Build the message context
+ CommonMessageContext msgContext;
+ if (type == EndpointMetaData.Type.JAXRPC)
+ {
+ msgContext = new SOAPMessageContextJAXRPC();
+ msgContext.put(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext);
+ msgContext.put(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest);
+ msgContext.put(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
+ }
+ else
+ {
+ msgContext = new SOAPMessageContextJAXWS();
+ msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new
Boolean(false));
+ msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
+ msgContext.put(MessageContextJAXWS.HTTP_REQUEST_HEADERS,
headerSource.getHeaderMap());
+ msgContext.put(MessageContextJAXWS.HTTP_REQUEST_METHOD,
httpRequest.getMethod());
+ msgContext.put(MessageContextJAXWS.QUERY_STRING, httpRequest.getQueryString());
+ msgContext.put(MessageContextJAXWS.PATH_INFO, httpRequest.getPathInfo());
+ msgContext.put(MessageContextJAXWS.SERVLET_CONTEXT, servletContext);
+ msgContext.put(MessageContextJAXWS.SERVLET_REQUEST, httpRequest);
+ msgContext.put(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse);
+
+ }
+ msgContext.setEndpointMetaData(sepMetaData);
+
+ // Associate a message context with the current thread
+ MessageContextAssociation.pushMessageContext(msgContext);
+
+ try
+ {
+ MessageAbstraction resMessage = processRequest(endpoint, headerSource,
reqContext, inputStream);
+
+ // Replace the message context with the response context
+ msgContext = MessageContextAssociation.peekMessageContext();
+
+ Map<String, List<String>> headers = (Map<String,
List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
+ if (headers != null)
+ headerSource.setHeaderMap(headers);
+
+ Integer code = (Integer)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_CODE);
+ if (code != null)
+ httpResponse.setStatus(code.intValue());
+
+ boolean isFault = false;
+ if (resMessage instanceof SOAPMessage)
+ {
+ SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
+ if (part == null)
+ throw new SOAPException("Cannot obtain SOAPPart from response
message");
+
+ // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP
status code
+ // if the response envelope is a Fault.
+ //
+ // Also, a one-way operation must show up as empty content, and can be
detected
+ // by a null envelope.
+ SOAPEnvelope soapEnv = part.getEnvelope();
+ isFault = soapEnv != null && soapEnv.getBody().hasFault();
+ if (isFault && httpResponse != null)
+ {
+ httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+
+ sendResponse(outputStream, msgContext, isFault);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ finally
+ {
+ // Reset the message context association
+ MessageContextAssociation.popMessageContext();
+
+ // clear thread local storage
+ ThreadLocalAssociation.clear();
+ }
+ }
+
+ private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext,
boolean isFault) throws SOAPException, IOException
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ String wsaTo = null;
+
+ // Get the destination from the AddressingProperties
+ AddressingProperties outProps =
(AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
+ if (outProps != null && outProps.getTo() != null)
+ {
+ AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
+ wsaTo = outProps.getTo().getURI().toString();
+ if (wsaTo.equals(ADDR.getAnonymousURI()))
+ wsaTo = null;
+ }
+ if (wsaTo != null)
+ {
+ log.debug("Sending response to addressing destination: " + wsaTo);
+ new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo);
+ }
+ else
+ {
+ resMessage.writeTo(outputStream);
+ }
+ }
+
+ /**
+ * Handle a request to this web service endpoint
+ */
+ private MessageAbstraction processRequest(Endpoint endpoint, MimeHeaderSource
headerSource, ServletRequestContext reqContext, InputStream inputStream)
+ throws BindingException
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+
+ ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ long beginProcessing = 0;
+ ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ EndpointState state = endpoint.getState();
+ if (state != EndpointState.STARTED)
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER;
+ String faultString = "Endpoint cannot handle requests in state: " +
state;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+
+ log.debug("BEGIN handleRequest: " + endpoint.getName());
+ beginProcessing = initRequestMetrics(endpoint);
+
+ MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() :
null);
+
+ MessageAbstraction reqMessage;
+
+ String bindingID = sepMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ reqMessage = new HTTPMessageImpl(headers, inputStream);
+ }
+ else
+ {
+ MessageFactoryImpl msgFactory = new MessageFactoryImpl();
+ msgFactory.setServiceMode(sepMetaData.getServiceMode());
+ msgFactory.setStyle(sepMetaData.getStyle());
+
+ reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers,
inputStream);
+ }
+
+ // Associate current message with message context
+ msgContext.setMessageAbstraction(reqMessage);
+
+ // debug the incomming message
+ MessageTrace.traceMessage("Incoming Request Message", reqMessage);
+
+ // Set the thread context class loader
+ ClassLoader classLoader = sepMetaData.getClassLoader();
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ // Invoke the service endpoint
+ InvocationHandler invoker = endpoint.getInvocationHandler();
+ invoker.invoke(reqContext);
+
+ // Get the response message context
+ msgContext = MessageContextAssociation.peekMessageContext();
+
+ // Get the response message
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
+ postProcessResponse(headerSource, resMessage);
+
+ return resMessage;
+ }
+ catch (Exception ex)
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+
+ // In case we have an exception before the invoker is called
+ // we create the fault message here.
+ if (resMessage == null || resMessage.isFaultMessage() == false)
+ {
+ CommonBindingProvider bindingProvider = new
CommonBindingProvider(sepMetaData);
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ resMessage = binding.bindFaultMessage(ex);
+ }
+
+ if (resMessage != null)
+ postProcessResponse(headerSource, resMessage);
+
+ return resMessage;
+ }
+ finally
+ {
+ try
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
+ {
+ if (resMessage.isFaultMessage())
+ {
+ processFaultMetrics(endpoint, beginProcessing);
+ }
+ else
+ {
+ processResponseMetrics(endpoint, beginProcessing);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process metrics", ex);
+ }
+
+ // Reset the thread context class loader
+ Thread.currentThread().setContextClassLoader(ctxClassLoader);
+ log.debug("END handleRequest: " + endpoint.getName());
+ }
+ }
+
+ private long initRequestMetrics(Endpoint endpoint)
+ {
+ return 0;
+ }
+
+ private void processResponseMetrics(Endpoint endpoint, long beginProcessing)
+ {
+ }
+
+ private void processFaultMetrics(Endpoint endpoint, long beginProcessing)
+ {
+ }
+
+ /** Set response mime headers
+ */
+ private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction
resMessage)
+ {
+ try
+ {
+ // Set the outbound headers
+ if (headerSource != null && resMessage instanceof SOAPMessage)
+ {
+ XOPContext.eagerlyCreateAttachments();
+ ((SOAPMessage)resMessage).saveChanges();
+ headerSource.setMimeHeaders(resMessage.getMimeHeaders());
+ }
+
+ // debug the outgoing message
+ MessageTrace.traceMessage("Outgoing Response Message", resMessage);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow("Faild to post process response message", ex);
+ }
+ }
+
+ public void handleWSDLRequest(Endpoint endpoint, OutputStream outputStream,
InvocationContext context)
+ {
+ log.debug("handleWSDLRequest: " + endpoint.getName());
+
+ ServerEndpointMetaData epMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ServletRequestContext reqContext = (ServletRequestContext)context;
+ HttpServletRequest req = reqContext.getHttpServletRequest();
+
+ try
+ {
+ // For the base document the resourcePath should be null
+ String resPath = (String)req.getParameter("resource");
+ URL reqURL = new URL(req.getRequestURL().toString());
+
+ String wsdlHost = reqURL.getProtocol() + "://" + reqURL.getHost() +
":" + reqURL.getPort();
+
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ if (config.getWebServiceHost().equals(ServerConfig.UNDEFINED_HOSTNAME) ==
false)
+ {
+ wsdlHost = config.getWebServiceHost();
+ }
+ log.debug("WSDL request, using host: " + wsdlHost);
+
+ WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
+ Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost,
resPath);
+
+ OutputStreamWriter writer = new OutputStreamWriter(outputStream);
+ new
DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
+ outputStream.flush();
+ outputStream.close();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (IOException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/SecurityAssociationAdaptorFactoryImpl.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/SecurityAssociationAdaptorFactoryImpl.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/SecurityAssociationAdaptorFactoryImpl.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,57 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.security.Principal;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.ws.extensions.security.SecurityAssociationAdaptor;
+import org.jboss.ws.extensions.security.SecurityAssociationAdaptorFactory;
+
+/**
+ * A JBoss specific SecurityAdaptorFactory
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class SecurityAssociationAdaptorFactoryImpl implements
SecurityAssociationAdaptorFactory
+{
+ public SecurityAssociationAdaptor getSecurityAssociationAdaptor()
+ {
+ return new SecurityAccociationAdaptorImpl();
+ }
+
+ public class SecurityAccociationAdaptorImpl implements SecurityAssociationAdaptor
+ {
+ public void setPrincipal(Principal pricipal)
+ {
+ SecurityAssociation.setPrincipal(pricipal);
+ }
+
+ public void setCredential(Object credential)
+ {
+ SecurityAssociation.setCredential(credential);
+ }
+ }
+}
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,70 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.AssemblyDescriptorMetaData;
+import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Generate a service endpoint deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class ServiceEndpointGeneratorEJB21 extends ServiceEndpointGeneratorEJB
+{
+ // logging support
+ protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB21.class);
+
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ protected void addEJBSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
+ {
+ // Fix:
http://jira.jboss.org/jira/browse/JBWS-309
+ ApplicationMetaData applMetaData =
(ApplicationMetaData)udi.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())
+ {
+ Element securityRole =
(Element)webApp.appendChild(DOMUtils.createElement("security-role"));
+ Element roleName =
(Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
+ roleName.appendChild(DOMUtils.createTextNode((String)it.next()));
+ }
+ }
+ }
+ }
+}
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,96 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import javax.annotation.security.RolesAllowed;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.ejb3.Ejb3ModuleMBean;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Generate a service endpoint deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class ServiceEndpointGeneratorEJB3 extends ServiceEndpointGeneratorEJB
+{
+ // logging support
+ protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB3.class);
+
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ protected void addEJBSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
+ {
+ // The container objects below provide access to all of the ejb metadata
+ Ejb3ModuleMBean ejb3Module = getEJB3Module(udi.deployedObject);
+ for (Object manager : ejb3Module.getContainers().values())
+ {
+ if (manager instanceof StatelessContainer)
+ {
+ StatelessContainer container = (StatelessContainer)manager;
+
+ RolesAllowed anRolesAllowed =
(RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
+ if (anRolesAllowed != null)
+ {
+ for (String role : anRolesAllowed.value())
+ {
+ Element securityRole =
(Element)webApp.appendChild(DOMUtils.createElement("security-role"));
+ Element roleName =
(Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
+ roleName.appendChild(DOMUtils.createTextNode(role));
+ }
+ }
+ }
+ }
+ }
+
+ private Ejb3ModuleMBean getEJB3Module(ObjectName objectName)
+ {
+ Ejb3ModuleMBean ejb3Module;
+ try
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ ejb3Module = (Ejb3ModuleMBean)MBeanProxy.get(Ejb3ModuleMBean.class, objectName,
server);
+ if (ejb3Module == null)
+ throw new WSException("Cannot obtain EJB3 module: " + objectName);
+
+ return ejb3Module;
+ }
+ catch (MBeanProxyCreationException ex)
+ {
+ throw new WSException("Cannot obtain proxy to EJB3 module");
+ }
+ }
+}
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,145 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * This Interceptor does the ws4ee handler processing.
+ *
+ * According to the ws4ee spec the handler logic must be invoked after the container
+ * applied method level security to the invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Sep-2005
+ */
+public class ServiceEndpointInterceptor extends AbstractInterceptor
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ServiceEndpointInterceptor.class);
+
+ // Interceptor implementation --------------------------------------
+
+ /** Before and after we call the service endpoint bean, we process the handler
chains.
+ */
+ public Object invoke(final Invocation mi) throws Exception
+ {
+ // If no msgContext, it's not for us
+ CommonMessageContext msgContext =
(CommonMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ if (msgContext == null)
+ {
+ return getNext().invoke(mi);
+ }
+
+ // Get the endpoint invocation
+ EndpointInvocation epInv =
(EndpointInvocation)mi.getValue(EndpointInvocation.class.getName());
+ OperationMetaData opMetaData = epInv.getOperationMetaData();
+
+ // Get the handler callback
+ HandlerCallback callback =
(HandlerCallback)mi.getValue(HandlerCallback.class.getName());
+
+ // Handlers need to be Tx. Therefore we must invoke the handler chain after the
TransactionInterceptor.
+ if (callback != null && epInv != null)
+ {
+ try
+ {
+ // call the request handlers
+ boolean handlersPass =
callback.callRequestHandlerChain(HandlerType.ENDPOINT);
+ handlersPass = handlersPass &&
callback.callRequestHandlerChain(HandlerType.POST);
+
+ // Call the next interceptor in the chain
+ if (handlersPass)
+ {
+ CommonBindingProvider bindingProvider = new
CommonBindingProvider(opMetaData.getEndpointMetaData());
+ CommonBinding binding = bindingProvider.getCommonBinding();
+
+ // Verify that the the message has not been mofified
+ CommonMessageContext messageContext =
MessageContextAssociation.peekMessageContext();
+ if (messageContext.isModified())
+ {
+ log.debug("Handler modified payload, unbind message and update
invocation args");
+ epInv =
bindingProvider.getCommonBinding().unbindRequestMessage(opMetaData,
messageContext.getMessageAbstraction());
+ }
+
+ // 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 = epInv.getRequestPayload();
+ mi.setArguments(reqParams);
+ Object resObj = getNext().invoke(mi);
+ epInv.setReturnValue(resObj);
+
+ // Bind the response message
+ SOAPMessage resMessage =
(SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
+ msgContext.setSOAPMessage(resMessage);
+ }
+
+ // call the response handlers
+ handlersPass = callback.callResponseHandlerChain(HandlerType.POST);
+ handlersPass = handlersPass &&
callback.callResponseHandlerChain(HandlerType.ENDPOINT);
+
+ // update the return value after response handler processing
+ Object resObj = epInv.getReturnValue();
+
+ return resObj;
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ SOAPMessage faultMessage =
SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
+ msgContext.setSOAPMessage(faultMessage);
+
+ // call the fault handlers
+ boolean handlersPass = callback.callFaultHandlerChain(HandlerType.POST,
ex);
+ handlersPass = handlersPass &&
callback.callFaultHandlerChain(HandlerType.ENDPOINT, ex);
+ }
+ catch (Exception subEx)
+ {
+ log.warn("Cannot process handlerChain.handleFault, ignoring: ",
subEx);
+ }
+ throw ex;
+ }
+ }
+ else
+ {
+ log.warn("Handler callback not available");
+ return getNext().invoke(mi);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import javax.servlet.ServletContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ServiceEndpointServlet extends AbstractServiceEndpointServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServiceEndpointServlet.class);
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ super.initServiceEndpoint(contextPath);
+
+ // read the config name/file from web.xml
+ ServletContext ctx = getServletContext();
+ String configName = ctx.getInitParameter("jbossws-config-name");
+ String configFile = ctx.getInitParameter("jbossws-config-file");
+ if (configName != null || configFile != null)
+ {
+ ServerEndpointMetaData epMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta
data");
+
+ log.debug("Updating service endpoint config\n config-name: " +
configName + "\n config-file: " + configFile);
+ epMetaData.setConfigName(configName, configFile);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,76 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ws.core.server.JAXWSDeployment;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
+
+/**
+ * A deployer that builds the UnifiedDeploymentInfo
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class UnifiedDeploymentInfoDeployer extends AbstractDeployer
+{
+ private DeploymentInfoAdapter deploymentInfoAdapter;
+
+ public void setDeploymentInfoAdapter(DeploymentInfoAdapter deploymentInfoAdapter)
+ {
+ this.deploymentInfoAdapter = deploymentInfoAdapter;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ {
+ DeploymentInfo unit = dep.getContext().getAttachment(DeploymentInfo.class);
+ if (unit == null)
+ throw new IllegalStateException("Cannot obtain deployment unit");
+
+ DeploymentType type = dep.getType();
+ if (type.toString().startsWith("JAXWS"))
+ {
+ udi = new JAXWSDeployment(type);
+ deploymentInfoAdapter.buildDeploymentInfo(udi, unit);
+ }
+ else
+ {
+ WebservicesMetaData wsMetaData =
dep.getContext().getAttachment(WebservicesMetaData.class);
+ udi = new JAXRPCDeployment(type, wsMetaData);
+ deploymentInfoAdapter.buildDeploymentInfo(udi, unit);
+ }
+
+ dep.getContext().addAttachment(UnifiedDeploymentInfo.class, udi);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,86 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that assigns the EndpointMetaData to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class UnifiedMetaDataAssociationDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ServerEndpointMetaData sepMetaData =
ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ {
+ sepMetaData = getEndpointMetaData(umd, ep.getName());
+ sepMetaData.setServiceEndpointImplName(ep.getEndpointImpl().getName());
+ ep.addMetaData(ServerEndpointMetaData.class, sepMetaData);
+ }
+ }
+ }
+
+ private ServerEndpointMetaData getEndpointMetaData(UnifiedMetaData umd, ObjectName
epName)
+ {
+ String propEndpoint = epName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+
+ ServerEndpointMetaData epMetaData = null;
+ for (ServiceMetaData serviceMetaData : umd.getServices())
+ {
+ for (EndpointMetaData aux : serviceMetaData.getEndpoints())
+ {
+ String linkName = ((ServerEndpointMetaData)aux).getLinkName();
+ if (propEndpoint.equals(linkName))
+ {
+ epMetaData = (ServerEndpointMetaData)aux;
+ break;
+ }
+ }
+ }
+
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot find endpoint meta data for: "
+ epName);
+
+ return epMetaData;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,82 @@
+/*
+ * 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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that builds the UnifiedDeploymentInfo
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class UnifiedMetaDataDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ if (udi.type == DeploymentType.JAXRPC_JSE)
+ {
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ umd = builder.buildMetaData((JAXRPCDeployment)udi);
+ }
+ else if (udi.type == DeploymentType.JAXRPC_EJB21)
+ {
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ umd = builder.buildMetaData((JAXRPCDeployment)udi);
+ }
+ else if (udi.type == DeploymentType.JAXWS_JSE)
+ {
+ JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
+ umd = builder.buildMetaData(udi);
+ }
+ else if (udi.type == DeploymentType.JAXWS_EJB3)
+ {
+ JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
+ umd = builder.buildMetaData(udi);
+ }
+ else
+ {
+ throw new IllegalStateException("Invalid type: " + udi.type);
+ }
+
+ dep.getContext().addAttachment(UnifiedMetaData.class, umd);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.net.URL;
+
+import javax.management.MBeanServer;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.MainDeployerMBean;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.Deployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+
+/**
+ * Publish the HTTP service endpoint to Tomcat
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class WebAppDeployerDeployer implements Deployer
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WebAppDeployerDeployer.class);
+
+ private ServiceEndpointPublisher serviceEndpointPublisher;
+
+ public void setServiceEndpointPublisher(ServiceEndpointPublisher
serviceEndpointPublisher)
+ {
+ this.serviceEndpointPublisher = serviceEndpointPublisher;
+ }
+
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ URL warURL = udi.webappURL;
+
+ log.debug("publishServiceEndpoint: " + warURL);
+ try
+ {
+ DeploymentInfo di = udi.getAttachment(DeploymentInfo.class);
+ if (di == null)
+ throw new IllegalStateException("Cannot obtain DeploymentInfo from
context");
+
+ serviceEndpointPublisher.rewriteWebXml(udi);
+
+ // Preserve the repository config
+ DeploymentInfo auxdi = new DeploymentInfo(warURL, null,
MBeanServerLocator.locateJBoss());
+ auxdi.repositoryConfig = di.getTopRepositoryConfig();
+ getMainDeployer().deploy(auxdi);
+ }
+ catch (Exception ex)
+ {
+ WSDeploymentException.rethrow(ex);
+ }
+ }
+
+ public void destroy(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ URL warURL = udi.webappURL;
+ if (warURL == null)
+ {
+ log.error("Cannot obtain warURL for: " + udi.name);
+ return;
+ }
+
+ log.debug("destroyServiceEndpoint: " + warURL);
+ try
+ {
+ getMainDeployer().undeploy(warURL);
+ }
+ catch (Exception ex)
+ {
+ WSDeploymentException.rethrow(ex);
+ }
+ }
+
+ public void start(Deployment dep)
+ {
+ }
+
+ public void stop(Deployment dep)
+ {
+ }
+
+ private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ MainDeployerMBean mainDeployer =
(MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME,
server);
+ return mainDeployer;
+ }
+}
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+//$Id$
+
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that generates a webapp for an EJB endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class WebAppGeneratorDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ if (dep.getType().toString().endsWith("EJB21"))
+ {
+ ServiceEndpointGeneratorEJB21 generator = new ServiceEndpointGeneratorEJB21();
+ udi.webappURL = generator.generatWebDeployment(umd, udi);
+ }
+ else if (dep.getType().toString().endsWith("EJB3"))
+ {
+ ServiceEndpointGeneratorEJB3 generator = new ServiceEndpointGeneratorEJB3();
+ udi.webappURL = generator.generatWebDeployment(umd, udi);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -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.ws.integration.jboss42.jbossws;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jboss.metadata.WebMetaData;
+import org.jboss.metadata.WebSecurityMetaData;
+import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData.PublishLocationAdapter;
+import
org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
+
+/**
+ * Build container independent web meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class WebMetaDataAdapter
+{
+ public UnifiedWebMetaData buildUnifiedWebMetaData(UnifiedDeploymentInfo udi,
WebMetaData webMetaData)
+ {
+ udi.addAttachment(WebMetaData.class, webMetaData);
+
+ UnifiedWebMetaData umd = new UnifiedWebMetaData();
+ umd.setContextRoot(webMetaData.getContextRoot());
+ umd.setServletMappings(webMetaData.getServletMappings());
+ umd.setServletClassNames(getServletClassMap(webMetaData));
+ umd.setConfigName(webMetaData.getConfigName());
+ umd.setConfigFile(webMetaData.getConfigFile());
+ umd.setSecurityDomain(webMetaData.getSecurityDomain());
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(webMetaData));
+ umd.setSecurityMetaData(getSecurityMetaData(webMetaData.getSecurityContraints()));
+
+ return umd;
+ }
+
+ private PublishLocationAdapter getPublishLocationAdpater(final WebMetaData wmd)
+ {
+ return new PublishLocationAdapter()
+ {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ return wmd.getWsdlPublishLocationByName(name);
+ }
+ };
+ }
+
+ private List<UnifiedWebSecurityMetaData> getSecurityMetaData(final Iterator
securityConstraints)
+ {
+ ArrayList<UnifiedWebSecurityMetaData> unifiedsecurityMetaData = new
ArrayList<UnifiedWebSecurityMetaData>();
+
+ while (securityConstraints.hasNext())
+ {
+ WebSecurityMetaData securityMetaData =
(WebSecurityMetaData)securityConstraints.next();
+
+ UnifiedWebSecurityMetaData current = new UnifiedWebSecurityMetaData();
+ unifiedsecurityMetaData.add(current);
+
+ current.setTransportGuarantee(securityMetaData.getTransportGuarantee());
+
+ HashMap resources = securityMetaData.getWebResources();
+ for (Object webResourceObj : resources.values())
+ {
+ WebResourceCollection webResource = (WebResourceCollection)webResourceObj;
+ UnifiedWebResourceCollection currentResource =
current.addWebResource(webResource.getName());
+ for (String currentPattern : webResource.getUrlPatterns())
+ {
+ currentResource.addPattern(currentPattern);
+ }
+ }
+
+ }
+
+ return unifiedsecurityMetaData;
+ }
+
+ private Map<String, String> getServletClassMap(WebMetaData wmd)
+ {
+ Map<String, String> mappings = new HashMap<String, String>();
+ Iterator it = wmd.getServletClassMap().entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Entry)it.next();
+ String servletName = (String)entry.getKey();
+ String servletClass = (String)entry.getValue();
+ // Skip JSPs
+ if (servletClass != null)
+ mappings.put(servletName, servletClass);
+ }
+ return mappings;
+ }
+}
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -43,7 +43,6 @@
import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.jboss42.ServiceEndpointInvokerMDB;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
/**
Copied:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/ServiceEndpointInvokerMDB.java
(from rev 2953,
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java)
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/ServiceEndpointInvokerMDB.java
(rev 0)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/ServiceEndpointInvokerMDB.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,94 @@
+/*
+ * 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.ws.integration.jboss42.jms;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.server.legacy.AbstractServiceEndpointInvoker;
+import org.jboss.ws.core.server.legacy.ServiceEndpointInvoker;
+import org.jboss.ws.core.utils.ThreadLocalAssociation;
+
+/**
+ * Handles invocations on MDB endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Mar-2006
+ */
+public class ServiceEndpointInvokerMDB extends AbstractServiceEndpointInvoker implements
ServiceEndpointInvoker
+{
+ // provide logging
+ private Logger log = Logger.getLogger(ServiceEndpointInvokerMDB.class);
+
+ /** Load the SEI implementation bean if necessary
+ */
+ public Class loadServiceEndpoint() throws ClassNotFoundException
+ {
+ return null;
+ }
+
+ // The dispatcher sets the target bean object
+ public void setTargetBeanObject(Object targetMDB)
+ {
+ ThreadLocalAssociation.localInvokerMDBAssoc().set(targetMDB);
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary
+ */
+ public Object createServiceEndpointInstance(Object endpointContext, Class
seiImplClass) throws InstantiationException, IllegalAccessException
+ {
+ return ThreadLocalAssociation.localInvokerMDBAssoc().get();
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+ try
+ {
+ Class implClass = seiImpl.getClass();
+ Method seiMethod = epInv.getJavaMethod();
+ Method implMethod = getImplMethod(implClass, seiMethod);
+
+ Object[] args = epInv.getRequestPayload();
+ Object retObj = implMethod.invoke(seiImpl, args);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ finally
+ {
+ // cleanup thread local
+ setTargetBeanObject(null);
+ }
+ }
+
+ /** Destroy an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ }
+}
Modified: trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
---
trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,26 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
-<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
- xmlns="urn:jboss:bean-deployer">
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer">
- <bean name="KernelLocator"
class="org.jboss.ws.integration.KernelLocator">
- <property name="kernel"><inject
bean="jboss.kernel:service=Kernel"/></property>
- </bean>
-
- <bean name="ServiceEndpointManager"
class="org.jboss.ws.core.server.ServiceEndpointManager">
-
+ <!-- An abstraction of server configuration aspects. -->
+ <bean name="WSServerConfig"
class="org.jboss.ws.integration.management.ServerConfigImpl">
<!--
The WSDL, that is a required deployment artifact for an endpoint, has a
<soap:address>
element which points to the location of the endpoint. JBoss supports rewriting of
that SOAP address.
- If the content of <soap:address> is a valid URL, JBossWS will not rewrite
it unless 'alwaysModifySOAPAddress' is true.
+ If the content of <soap:address> is a valid URL, JBossWS will not rewrite
it unless 'modifySOAPAddress' is true.
If the content of <soap:address> is not a valid URL, JBossWS will rewrite
it using the attribute values given below.
- If next line (webServiceHost) is commented, JBossWS uses requesters protocolo,
host and port when rewriting the <soap:address>.
+ If 'webServiceHost' is not set, JBossWS uses requesters protocol host and
port when rewriting the <soap:address>.
-->
<property
name="webServiceHost">${jboss.bind.address}</property>
- <property name="alwaysModifySOAPAddress">true</property>
+ <property name="modifySOAPAddress">true</property>
<!--
Set these properties to explicitly define the ports that will be used for rewriting
the SOAP address.
@@ -29,40 +23,197 @@
<property name="webServiceSecurePort">8443</property>
<property name="webServicePort">8080</property>
-->
-
- <property
name="serviceEndpointInvokerJSE">org.jboss.ws.core.server.ServiceEndpointInvokerJSE</property>
- <property
name="serviceEndpointInvokerEJB3">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerEJB3</property>
- <property
name="serviceEndpointInvokerEJB21">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerEJB21</property>
- <property
name="serviceEndpointInvokerMDB">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerMDB</property>
</bean>
+
+ <!-- The registry for web service endpoints -->
+ <bean name="WSEndpointRegistry"
class="org.jboss.ws.integration.management.EndpointRegistryImpl"/>
- <bean name="ServiceEndpointDeployer"
class="org.jboss.ws.core.server.ServiceEndpointDeployer">
- <property name="serviceEndpointManager">
- <inject bean="ServiceEndpointManager"/>
- </property>
- </bean>
+ <!-- A subscription manager for WS-Eventing -->
+ <bean name="WSSubscriptionManager"
class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager"/>
- <bean name="ServiceEndpointPublisher"
class="org.jboss.ws.integration.jboss42.ServiceEndpointPublisher">
- <property
name="serviceEndpointServlet">org.jboss.ws.integration.jboss42.JBossServiceEndpointServlet</property>
- </bean>
-
<!-- Bind Service objects in client environment context -->
+ <!-- The bean name is compiled into the server. Changeit with the next release.
-->
<bean name="ServiceRefHandler"
class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
- <!-- A subscription manager for WS-Eventing -->
- <bean name="SubscriptionManager"
class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager"/>
+ <!-- Locate the single instance of the kernel -->
+ <bean name="WSKernelLocator"
class="org.jboss.ws.integration.KernelLocator">
+ <property name="kernel"><inject
bean="jboss.kernel:service=Kernel"/></property>
+ </bean>
- <bean name="ServerConfig"
class="org.jboss.ws.integration.jboss42.ServerConfigImpl"/>
+ <!--
+
*********************************************************************************************************************
+ Web Service deployment
+
+ There are three deployers registered with the JBoss Main Deployer.
+ The order of which is important
+
+ 1) EJBDeployer < WebServiceDeployerEJB
+ 2) WebServiceDeployerJSE < WarDeployer
+ 3) WebServiceMainDeployer
+
+ Each WebServiceDeployer has a number of DeployerHooks registerd with it
+
+ - WebServiceDeployerEJB
+ - WSDeployerHook_JAXRPC_EJB21
+ - WSDeployerHook_JAXWS_EJB3
+
+ - WebServiceDeployerJSE
+ - WSDeployerHook_JAXRPC_JSE
+ - WSDeployerHook_JAXWS_JSE
+
+ - WebServiceMainDeployer
+ - WSMainDeployerHook
+
+ Conceptually, each of these hooks implements the following pattern:
+
+ DployerHook.deploy(unit)
+ if(isWebServiceDeployment)
+ Deployment dep = createDeployment(unit)
+ DeployerManager.deploy(dep)
+
+ DeployerHook.undeploy(unit)
+ Deployment dep = getDeployment(unit)
+ DeployerManager.undeploy(dep)
+
+ Each deployer hook has a web service DeployerManager injected into it.
+ A web service DeployerManager maintains a list of Deployers, each of which
+ handles a single aspect of web service deployment.
+
+ Finally, each Endpoint is registered with the EndpointRegistry.
+
+
*********************************************************************************************************************
+ -->
+
+ <!--
+ Each DeploymentManger maintains a list of Deployers
+ Each Deployer handles a single aspect of web service deployment.
+ -->
+ <bean name="WSDeployerManagerJSE"
class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList"
elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSUnifiedMetaDataDeployer"/>
+ <inject bean="WSUnifiedMetaDataAssociationDeployer"/>
+ <inject bean="WSModifyWebMetaDataDeployer"/>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSDeployerManagerEJB"
class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList"
elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSUnifiedMetaDataDeployer"/>
+ <inject bean="WSUnifiedMetaDataAssociationDeployer"/>
+ <inject bean="WSWebAppGeneratorDeployer"/>
+ <inject bean="WSWebAppDeployerDeployer"/>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSMainDeployerManager"
class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList"
elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSEndpointNameDeployer"/>
+ <inject bean="WSEndpointHandlerDeployer"/>
+ <inject bean="WSPublishContractDeployer"/>
+ <inject bean="WSClassLoaderInjectionDeployer"/>
+ <inject bean="WSEagerInitializeDeployer"/>
+ <inject bean="WSEndpointRegistryDeployer"/>
+ <inject bean="WSEndpointLifecycleDeployer"/>
+ </list>
+ </property>
+ </bean>
+
+ <!--
+ The Deployers
+ Each handles a single aspect of web service deployment
+ -->
+ <bean name="WSClassLoaderInjectionDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.ClassLoaderInjectionDeployer"/>
+ <bean name="WSEagerInitializeDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.EagerInitializeDeployer"/>
+ <bean name="WSEndpointHandlerDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.EndpointHandlerDeployer">
+ <property
name="requestHandler">org.jboss.ws.integration.jboss42.jbossws.RequestHandlerImpl</property>
+ <property
name="lifecycleHandler">org.jboss.ws.integration.jboss42.jbossws.LifecycleHandlerImpl</property>
+ <property name="invocationHandler">
+ <map keyClass="java.lang.String"
valueClass="java.lang.String">
+
<entry><key>JAXRPC_JSE</key><value>org.jboss.ws.integration.jboss42.jbossws.InvocationHandlerJSE</value></entry>
+
<entry><key>JAXRPC_EJB21</key><value>org.jboss.ws.integration.jboss42.jbossws.InvocationHandlerEJB21</value></entry>
+
<entry><key>JAXWS_JSE</key><value>org.jboss.ws.integration.jboss42.jbossws.InvocationHandlerJSE</value></entry>
+
<entry><key>JAXWS_EJB3</key><value>org.jboss.ws.integration.jboss42.jbossws.InvocationHandlerEJB3</value></entry>
+ </map>
+ </property>
+ </bean>
+ <bean name="WSEndpointLifecycleDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.EndpointLifecycleDeployer"/>
+ <bean name="WSEndpointNameDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.EndpointNameDeployer"/>
+ <bean name="WSEndpointRegistryDeployer"
class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
+ <bean name="WSEndpointValidationDeployer"
class="org.jboss.ws.integration.deployment.EndpointValidationDeployer"/>
+ <bean name="WSModifyWebMetaDataDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.ModifyWebMetaDataDeployer">
+ <property name="serviceEndpointPublisher"><inject
bean="WSServiceEndpointPublisher"/></property>
+ </bean>
+ <bean name="WSPublishContractDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.PublishContractDeployer"/>
+ <bean name="WSUnifiedDeploymentInfoDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.UnifiedDeploymentInfoDeployer">
+ <property name="deploymentInfoAdapter"><inject
bean="WSDeploymentInfoAdapter"/></property>
+ </bean>
+ <bean name="WSUnifiedMetaDataAssociationDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.UnifiedMetaDataAssociationDeployer"/>
+ <bean name="WSUnifiedMetaDataDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.UnifiedMetaDataDeployer"/>
+ <bean name="WSWebAppGeneratorDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.WebAppGeneratorDeployer"/>
+ <bean name="WSWebAppDeployerDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.WebAppDeployerDeployer">
+ <property name="serviceEndpointPublisher"><inject
bean="WSServiceEndpointPublisher"/></property>
+ </bean>
- <bean name="DeploymentInfoAdapter"
class="org.jboss.ws.integration.jboss42.DeploymentInfoAdapter">
- <property name="applicationMetaDataAdapter">
- <inject bean="ApplicationMetaDataAdapter"/>
+ <!-- Deployer helper beans -->
+ <bean name="WSServiceEndpointPublisher"
class="org.jboss.ws.core.server.ServiceEndpointPublisher">
+ <property
name="servletClass">org.jboss.ws.integration.jboss42.jbossws.ServiceEndpointServlet</property>
+ </bean>
+ <bean name="WSDeploymentInfoAdapter"
class="org.jboss.ws.integration.jboss42.jbossws.DeploymentInfoAdapter">
+ <property name="appMetaDataAdapter"><inject
bean="WSAppMetaDataAdapter"/></property>
+ <property name="webMetaDataAdapter"><inject
bean="WSWebMetaDataAdapter"/></property>
+ </bean>
+ <bean name="WSAppMetaDataAdapter"
class="org.jboss.ws.integration.jboss42.jbossws.ApplicationMetaDataAdapter"/>
+ <bean name="WSWebMetaDataAdapter"
class="org.jboss.ws.integration.jboss42.jbossws.WebMetaDataAdapter"/>
+
+ <!--
+ Register DeployerHooks with JBoss deployers
+ -->
+ <bean name="WSDeployerHook_JAXRPC_JSE"
class="org.jboss.ws.integration.jboss42.jbossws.JAXRPCDeployerHookJSE">
+ <property name="deployerManager"><inject
bean="WSDeployerManagerJSE"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList"
elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ </list>
</property>
- <property name="webMetaDataAdapter">
- <inject bean="WebMetaDataAdapter"/>
+ </bean>
+ <bean name="WSDeployerHook_JAXRPC_EJB21"
class="org.jboss.ws.integration.jboss42.jbossws.JAXRPCDeployerHookEJB21">
+ <property name="deployerManager"><inject
bean="WSDeployerManagerEJB"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList"
elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorEJB21</value>
+ </list>
</property>
</bean>
- <bean name="ApplicationMetaDataAdapter"
class="org.jboss.ws.integration.jboss42.ApplicationMetaDataAdapter"/>
- <bean name="WebMetaDataAdapter"
class="org.jboss.ws.integration.jboss42.WebMetaDataAdapter"/>
+ <bean name="WSDeployerHook_JAXWS_JSE"
class="org.jboss.ws.integration.jboss42.jbossws.JAXWSDeployerHookJSE">
+ <property name="deployerManager"><inject
bean="WSDeployerManagerJSE"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList"
elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSDeployerHook_JAXWS_EJB3"
class="org.jboss.ws.integration.jboss42.jbossws.JAXWSDeployerHookEJB3">
+ <property name="deployerManager"><inject
bean="WSDeployerManagerEJB"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList"
elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorEJB3</value>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSMainDeployerHook"
class="org.jboss.ws.integration.jboss42.jbossws.MainDeployerHook">
+ <property name="deployerManager"><inject
bean="WSMainDeployerManager"/></property>
+ <property name="phaseTwoInterceptors">
+ <list class="java.util.LinkedList"
elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ <value>jboss.ws:service=DeployerInterceptorEJB21</value>
+ <value>jboss.ws:service=DeployerInterceptorEJB3</value>
+ </list>
+ </property>
+ </bean>
</deployment>
Deleted:
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml
===================================================================
---
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id$ -->
-
-<server>
-
- <!--
- A deployer service for JSE endpoints.
- -->
- <mbean name="jboss.ws:service=WebServiceDeployerJSE"
code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
- <depends-list optional-attribute-name="Interceptables">
-
<depends-list-element>jboss.web:service=WebServer</depends-list-element>
- </depends-list>
- </mbean>
-
- <!--
- A deployer service for EJB2.1 endpoints.
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorEJB21"
code="org.jboss.ws.integration.jboss42.DeployerInterceptorEJB21">
- <depends-list optional-attribute-name="Interceptables">
-
<depends-list-element>jboss.ejb:service=EJBDeployer</depends-list-element>
- </depends-list>
- </mbean>
-
- <!--
- A deployer service for EJB3 endpoints.
- <mbean name="jboss.ws:service=DeployerInterceptorEJB3"
code="org.jboss.ws.integration.jboss42.DeployerInterceptorEJB3">
- <depends-list optional-attribute-name="Interceptables">
-
<depends-list-element>jboss.ejb3:service=EJB3Deployer</depends-list-element>
- </depends-list>
- </mbean>
- -->
-
- <!--
- A deployer service for JSE endpoints that are nested in service archives (sar).
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorNestedJSE"
code="org.jboss.ws.integration.jboss42.DeployerInterceptorNestedJSE">
- <depends optional-attribute-name="MainDeployer"
proxy-type="attribute">jboss.system:service=MainDeployer</depends>
- <depends>jboss.ws:service=WebServiceDeployerJSE</depends>
- </mbean>
-
-</server>
Modified: trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service.xml
===================================================================
---
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service.xml 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service.xml 2007-05-03
19:18:24 UTC (rev 2955)
@@ -7,7 +7,7 @@
<!--
A deployer service for JSE endpoints.
-->
- <mbean name="jboss.ws:service=WebServiceDeployerJSE"
code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
+ <mbean name="jboss.ws:service=DeployerInterceptorJSE"
code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
<depends-list optional-attribute-name="Interceptables">
<depends-list-element>jboss.web:service=WebServer</depends-list-element>
</depends-list>
@@ -31,12 +31,4 @@
</depends-list>
</mbean>
- <!--
- A deployer service for JSE endpoints that are nested in service archives (sar).
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorNestedJSE"
code="org.jboss.ws.integration.jboss42.DeployerInterceptorNestedJSE">
- <depends optional-attribute-name="MainDeployer"
proxy-type="attribute">jboss.system:service=MainDeployer</depends>
- <depends>jboss.ws:service=WebServiceDeployerJSE</depends>
- </mbean>
-
</server>
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/DeployerHook.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/DeployerHook.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/DeployerHook.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -27,7 +27,7 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
/**
- * An interface for all web service deployers
+ * An interface for all web service deployer hooks
*
* @author Thomas.Diesler(a)jboss.org
* @since 24-Apr-2007
@@ -36,5 +36,5 @@
{
void deploy(DeploymentUnit unit) throws DeploymentException;
- public void undeploy(DeploymentUnit unit);
+ void undeploy(DeploymentUnit unit);
}
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ArchiveDeployerHook.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ArchiveDeployerHook.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ArchiveDeployerHook.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -23,14 +23,13 @@
//$Id$
-import java.io.InputStream;
import java.net.URL;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
-import org.jboss.logging.Logger;
import org.jboss.virtual.VirtualFile;
import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.integration.UnifiedVirtualFile;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.integration.deployment.WSDeploymentException;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
@@ -83,7 +82,7 @@
{
if (ignoreDeployment(unit))
return;
-
+
if (isWebServiceDeployment(unit))
{
log.debug("deploy: " + unit.getName());
@@ -103,7 +102,7 @@
{
if (ignoreDeployment(unit))
return;
-
+
Deployment dep = getDeployment(unit);
if (dep != null)
{
@@ -118,29 +117,21 @@
protected WebservicesMetaData getWebservicesMetaData(DeploymentUnit unit)
{
WebservicesMetaData wsMetaData = unit.getAttachment(WebservicesMetaData.class);
- VirtualFile vfWebservices = unit.getMetaDataFile("webservices.xml");
+ UnifiedVirtualFile vfWebservices = getWebservicesFile(unit);
if (wsMetaData == null && vfWebservices != null)
{
try
{
- URL webservicesURL = vfWebservices.toURL();
- InputStream is = webservicesURL.openStream();
- 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"))
{
- Element root = DOMUtils.parse(vfWebservices.openStream());
- String namespaceURI = root.getNamespaceURI();
- if (
namespaceURI.equals("http://java.sun.com/xml/ns/j2ee"))
- {
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
- wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(is, factory,
null);
- unit.addAttachment(WebservicesMetaData.class, wsMetaData);
- }
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new WebservicesFactory(wsURL);
+ wsMetaData =
(WebservicesMetaData)unmarshaller.unmarshal(wsURL.openStream(), factory, null);
+ unit.addAttachment(WebservicesMetaData.class, wsMetaData);
}
- finally
- {
- is.close();
- }
}
catch (Exception ex)
{
@@ -149,4 +140,10 @@
}
return wsMetaData;
}
+
+ private UnifiedVirtualFile getWebservicesFile(DeploymentUnit unit)
+ {
+ VirtualFile vf = unit.getMetaDataFile("webservices.xml");
+ return (vf != null ? new VirtualFileAdaptor(vf) : null);
+ }
}
Copied:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java
(from rev 2953,
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java)
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java
(rev 0)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,101 @@
+/*
+ * 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.ws.integration.jboss50.jbossws;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+
+// $Id$
+
+/**
+ * Build container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class DeploymentInfoAdapter
+{
+ // logging support
+ private static Logger log = Logger.getLogger(DeploymentInfoAdapter.class);
+
+ public static void buildDeploymentInfo(UnifiedDeploymentInfo udi, DeploymentUnit
unit)
+ {
+ udi.addAttachment(DeploymentUnit.class, unit);
+
+ try
+ {
+ if (unit.getDeploymentContext().getParent() != null)
+ {
+ udi.parent = new UnifiedDeploymentInfo(null);
+ buildDeploymentInfo(udi.parent,
unit.getDeploymentContext().getParent().getDeploymentUnit());
+ }
+
+ udi.vfRoot = new VirtualFileAdaptor(unit.getDeploymentContext().getRoot());
+
+ udi.name = unit.getName();
+ udi.simpleName = unit.getSimpleName();
+ udi.url = udi.vfRoot.toURL();
+
+ buildMetaData(udi, unit);
+
+ // Since we create temporary classes, we need to create a delegate loader
+ // This prevents CCE problems where the parent loader is available at deploy
time,
+ // and a child loader is available at start time.
+ udi.classLoader = new URLClassLoader(new URL[] {}, unit.getClassLoader());
+
+ log.debug("UnifiedDeploymentInfo:\n" + udi);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex.getMessage(), ex);
+ }
+ }
+
+ private static void buildMetaData(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
+ {
+ if (unit.getAttachment(Ejb3Deployment.class) != null)
+ {
+ udi.metaData =
ApplicationMetaDataAdaptorEJB3.buildUnifiedApplicationMetaData(udi, unit);
+ }
+ else if (unit.getAttachment(ApplicationMetaData.class) != null)
+ {
+ udi.metaData = ApplicationMetaDataAdaptor.buildUnifiedApplicationMetaData(udi,
unit);
+ }
+ else if (unit.getAttachment(WebMetaData.class) != null)
+ {
+ udi.metaData = WebMetaDataAdaptor.buildUnifiedWebMetaData(udi, unit);
+ udi.webappURL = udi.vfRoot.toURL();
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot build meta data");
+ }
+ }
+}
Deleted:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,99 +0,0 @@
-/*
- * 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.ws.integration.jboss50.jbossws;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import org.jboss.deployers.spi.deployer.DeploymentUnit;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-
-// $Id$
-
-/**
- * Build container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class DeploymentInfoAdaptor
-{
- // logging support
- private static Logger log = Logger.getLogger(DeploymentInfoAdaptor.class);
-
- public static void buildDeploymentInfo(UnifiedDeploymentInfo udi, DeploymentUnit
unit)
- {
- try
- {
- if (unit.getDeploymentContext().getParent() != null)
- {
- udi.parent = new UnifiedDeploymentInfo(null);
- buildDeploymentInfo(udi.parent,
unit.getDeploymentContext().getParent().getDeploymentUnit());
- }
-
- udi.vfRoot = new VirtualFileAdaptor(unit.getDeploymentContext().getRoot());
-
- udi.name = unit.getName();
- udi.simpleName = unit.getSimpleName();
- udi.url = udi.vfRoot.toURL();
-
- buildMetaData(udi, unit);
-
- // Since we create temporary classes, we need to create a delegate loader
- // This prevents CCE problems where the parent loader is available at deploy
time,
- // and a child loader is available at start time.
- udi.classLoader = new URLClassLoader(new URL[] {}, unit.getClassLoader());
-
- log.debug("UnifiedDeploymentInfo:\n" + udi);
- }
- catch (Exception ex)
- {
- WSException.rethrow(ex.getMessage(), ex);
- }
- }
-
- private static void buildMetaData(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
- {
- if (unit.getAttachment(Ejb3Deployment.class) != null)
- {
- udi.metaData =
ApplicationMetaDataAdaptorEJB3.buildUnifiedApplicationMetaData(udi, unit);
- }
- else if (unit.getAttachment(ApplicationMetaData.class) != null)
- {
- udi.metaData = ApplicationMetaDataAdaptor.buildUnifiedApplicationMetaData(udi,
unit);
- }
- else if (unit.getAttachment(WebMetaData.class) != null)
- {
- udi.metaData = WebMetaDataAdaptor.buildUnifiedWebMetaData(udi, unit);
- udi.webappURL = udi.vfRoot.toURL();
- }
- else
- {
- throw new IllegalStateException("Cannot build meta data");
- }
- }
-}
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -24,6 +24,7 @@
//$Id$
import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
@@ -54,16 +55,26 @@
@Override
public void stop(Deployment dep)
{
- for (Endpoint ep : dep.getService().getEndpoints())
+ Service service = dep.getService();
+ if (service != null)
{
- ep.getLifecycleHandler().stop(ep);
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().stop(ep);
+ }
}
}
@Override
public void destroy(Deployment dep)
{
- for (Endpoint ep : dep.getService().getEndpoints())
- ep.getLifecycleHandler().destroy(ep);
+ Service service = dep.getService();
+ if (service != null)
+ {
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().destroy(ep);
+ }
+ }
}
}
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookEJB21.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -56,11 +56,11 @@
@Override
public Deployment createDeployment(DeploymentUnit unit)
{
- Deployment deployment = new DeploymentImpl();
- deployment.setType(getDeploymentType());
- deployment.setClassLoader(unit.getClassLoader());
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.getClassLoader());
- Service service = deployment.getService();
+ Service service = dep.getService();
ApplicationMetaData appmd = unit.getAttachment(ApplicationMetaData.class);
if (appmd == null)
@@ -71,8 +71,8 @@
throw new IllegalStateException("Deployment unit does not contain
webservices meta data");
// Copy the attachments
- deployment.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
- deployment.getContext().addAttachment(ApplicationMetaData.class, appmd);
+ dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.getContext().addAttachment(ApplicationMetaData.class, appmd);
for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
{
@@ -105,7 +105,7 @@
}
}
}
- return deployment;
+ return dep;
}
@Override
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookJSE.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookJSE.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookJSE.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -58,11 +58,11 @@
@Override
public Deployment createDeployment(DeploymentUnit unit)
{
- Deployment deployment = new DeploymentImpl();
- deployment.setType(getDeploymentType());
- deployment.setClassLoader(unit.getClassLoader());
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.getClassLoader());
- Service service = deployment.getService();
+ Service service = dep.getService();
WebMetaData webMetaData = unit.getAttachment(WebMetaData.class);
if (webMetaData == null)
@@ -73,18 +73,9 @@
throw new IllegalStateException("Deployment unit does not contain
webservices meta data");
// Copy the attachments
- deployment.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
- deployment.getContext().addAttachment(WebMetaData.class, webMetaData);
+ dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.getContext().addAttachment(WebMetaData.class, webMetaData);
- // Get the context root
- String contextRoot = webMetaData.getContextRoot();
- if (contextRoot == null)
- {
- contextRoot = unit.getSimpleName();
- if (contextRoot.endsWith(".war"))
- contextRoot = contextRoot.substring(0, contextRoot.length() - 4);
- }
-
for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
{
for (PortComponentMetaData pcmd : wsd.getPortComponents())
@@ -115,7 +106,7 @@
}
}
- return deployment;
+ return dep;
}
private Servlet getServletForName(WebMetaData wmd, String servletLink)
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookEJB3.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookEJB3.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookEJB3.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -58,18 +58,18 @@
@Override
public Deployment createDeployment(DeploymentUnit unit)
{
- Deployment deployment = new DeploymentImpl();
- deployment.setType(getDeploymentType());
- deployment.setClassLoader(unit.getClassLoader());
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.getClassLoader());
- Service service = deployment.getService();
+ 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
- deployment.getContext().addAttachment(Ejb3Deployment.class, ejb3Deployment);
+ dep.getContext().addAttachment(Ejb3Deployment.class, ejb3Deployment);
Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
while (it.hasNext())
@@ -89,7 +89,7 @@
}
}
- return deployment;
+ return dep;
}
@Override
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookJSE.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookJSE.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookJSE.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -58,18 +58,18 @@
@Override
public Deployment createDeployment(DeploymentUnit unit)
{
- Deployment deployment = new DeploymentImpl();
- deployment.setType(getDeploymentType());
- deployment.setClassLoader(unit.getClassLoader());
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.getClassLoader());
- Service service = deployment.getService();
+ 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
- deployment.getContext().addAttachment(WebMetaData.class, webMetaData);
+ dep.getContext().addAttachment(WebMetaData.class, webMetaData);
List<Servlet> servlets = getRelevantServlets(webMetaData,
unit.getClassLoader());
for (Servlet servlet : servlets)
@@ -96,7 +96,7 @@
}
}
- return deployment;
+ return dep;
}
@Override
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -28,6 +28,7 @@
import org.jboss.metadata.NameValuePair;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.AbstractDeployer;
@@ -41,19 +42,13 @@
*/
public class ModifyWebMetaDataDeployer extends AbstractDeployer
{
- // The service endpoint servlet that is specific for the deployed stack
- private String servletClass;
+ private ServiceEndpointPublisher serviceEndpointPublisher;
- public String getServletClass()
+ public void setServiceEndpointPublisher(ServiceEndpointPublisher
serviceEndpointPublisher)
{
- return servletClass;
+ this.serviceEndpointPublisher = serviceEndpointPublisher;
}
- public void setServletClass(String servletName)
- {
- this.servletClass = servletName;
- }
-
@Override
public void create(Deployment dep)
{
@@ -74,7 +69,7 @@
// Nothing to do if we have an <init-param>
if (!isAlreadyModified(servlet) && !isJavaxServlet(orgServletClass,
dep.getClassLoader()))
{
- servlet.setServletClass(getServletClass());
+ servlet.setServletClass(serviceEndpointPublisher.getServletClass());
NameValuePair initParam = new
NameValuePair(Endpoint.SEPID_DOMAIN_ENDPOINT, orgServletClass);
servlet.addInitParam(initParam);
}
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -54,13 +54,13 @@
if (type.toString().startsWith("JAXWS"))
{
udi = new JAXWSDeployment(type);
- DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
+ DeploymentInfoAdapter.buildDeploymentInfo(udi, unit);
}
else
{
WebservicesMetaData wsMetaData =
dep.getContext().getAttachment(WebservicesMetaData.class);
udi = new JAXRPCDeployment(type, wsMetaData);
- DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
+ DeploymentInfoAdapter.buildDeploymentInfo(udi, unit);
}
dep.getContext().addAttachment(UnifiedDeploymentInfo.class, udi);
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -34,7 +34,7 @@
import org.jboss.logging.Logger;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.Deployer;
import org.jboss.ws.integration.deployment.Deployment;
@@ -46,22 +46,23 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2006
*/
-public class WebAppDeployerDeployer extends AbstractServiceEndpointPublisher implements
Deployer
+public class WebAppDeployerDeployer implements Deployer
{
// provide logging
private static Logger log = Logger.getLogger(WebAppDeployerDeployer.class);
private MainDeployer mainDeployer;
+ private ServiceEndpointPublisher serviceEndpointPublisher;
private Map<String, DeploymentContext> contextMap = new HashMap<String,
DeploymentContext>();
- public MainDeployer getMainDeployer()
+ public void setMainDeployer(MainDeployer mainDeployer)
{
- return mainDeployer;
+ this.mainDeployer = mainDeployer;
}
- public void setMainDeployer(MainDeployer mainDeployer)
+ public void setServiceEndpointPublisher(ServiceEndpointPublisher
serviceEndpointPublisher)
{
- this.mainDeployer = mainDeployer;
+ this.serviceEndpointPublisher = serviceEndpointPublisher;
}
public void create(Deployment dep)
@@ -75,7 +76,7 @@
log.debug("publishServiceEndpoint: " + warURL);
try
{
- rewriteWebXml(udi);
+ serviceEndpointPublisher.rewriteWebXml(udi);
DeploymentContext context = createDeploymentContext(warURL);
mainDeployer.addDeploymentContext(context);
Modified: trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml
===================================================================
---
trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-03
19:18:24 UTC (rev 2955)
@@ -146,7 +146,7 @@
<bean name="WSEndpointRegistryDeployer"
class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
<bean name="WSEndpointValidationDeployer"
class="org.jboss.ws.integration.deployment.EndpointValidationDeployer"/>
<bean name="WSModifyWebMetaDataDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.ModifyWebMetaDataDeployer">
- <property
name="servletClass">org.jboss.ws.integration.jboss50.jbossws.ServiceEndpointServlet</property>
+ <property name="serviceEndpointPublisher"><inject
bean="WSServiceEndpointPublisher"/></property>
</bean>
<bean name="WSPublishContractDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.PublishContractDeployer"/>
<bean name="WSUnifiedDeploymentInfoDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.UnifiedDeploymentInfoDeployer"/>
@@ -154,10 +154,15 @@
<bean name="WSUnifiedMetaDataDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.UnifiedMetaDataDeployer"/>
<bean name="WSWebAppGeneratorDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.WebAppGeneratorDeployer"/>
<bean name="WSWebAppDeployerDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.WebAppDeployerDeployer">
- <property name="servletClass"><inject
bean="WSModifyWebMetaDataDeployer"
property="servletClass"/></property>
+ <property name="serviceEndpointPublisher"><inject
bean="WSServiceEndpointPublisher"/></property>
<property name="mainDeployer"><inject
bean="MainDeployer"/></property>
</bean>
+ <!-- Deployer helper beans -->
+ <bean name="WSServiceEndpointPublisher"
class="org.jboss.ws.core.server.ServiceEndpointPublisher">
+ <property
name="servletClass">org.jboss.ws.integration.jboss50.jbossws.ServiceEndpointServlet</property>
+ </bean>
+
<!--
Register DeployerHooks with JBoss deployers
-->
Modified:
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
===================================================================
---
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -37,7 +37,7 @@
import javax.servlet.ServletContext;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.integration.Endpoint;
Modified:
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
===================================================================
---
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -31,9 +31,7 @@
import java.util.Set;
import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
/**
* Publish the HTTP service endpoint to Tomcat
@@ -41,11 +39,11 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2006
*/
-public class TomcatServiceEndpointPublisher extends AbstractServiceEndpointPublisher
+public class TomcatServiceEndpointPublisher extends ServiceEndpointPublisher
{
// logging support
private static Logger log = Logger.getLogger(TomcatServiceEndpointPublisher.class);
-
+
private boolean isRunning;
private File targetDir;
private File deployDir;
@@ -67,7 +65,7 @@
{
this.targetDir = new File(dirName);
if (targetDir.isDirectory() == false)
- throw new IllegalArgumentException ("Target dir does not exist: " +
targetDir);
+ throw new IllegalArgumentException("Target dir does not exist: " +
targetDir);
}
public void setInterval(long interval)
@@ -86,24 +84,13 @@
File targetFile = new File(targetDir.getAbsolutePath() + "/" + new
File(warURL.getFile()).getName());
if (targetFile.delete())
return "OK";
- else
- return "NOT FOUND";
+ else return "NOT FOUND";
}
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi)
- {
- throw new NotImplementedException();
- }
-
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi)
- {
- throw new NotImplementedException();
- }
-
private void scanDeployDir()
{
List<File> fileList = Arrays.asList(deployDir.listFiles());
-
+
// deploy new files
for (File file : fileList)
{
@@ -113,7 +100,7 @@
deployedFiles.add(file);
}
}
-
+
// undeploy files
for (File file : deployedFiles)
{
@@ -133,7 +120,7 @@
{
System.out.println("Deploy file: " + file);
publishServiceEndpoint(file.toURL());
- }
+ }
else
{
System.out.println("Ignore file: " + file);
@@ -142,7 +129,7 @@
catch (Exception ex)
{
log.error("Cannot deploy file: " + file, ex);
- }
+ }
}
private void undeployFile(File file)
@@ -153,7 +140,7 @@
{
System.out.println("Undeploy file: " + file);
destroyServiceEndpoint(file.toURL());
- }
+ }
else
{
System.out.println("Ignore file: " + file);
@@ -162,7 +149,7 @@
catch (Exception ex)
{
log.error("Cannot undeploy file: " + file, ex);
- }
+ }
}
// bean lifecycle start
Modified:
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
---
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -46,7 +46,7 @@
// provide logging
protected final Logger log = Logger.getLogger(wspublish.class);
- public static final String DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET =
"org.jboss.ws.integration.tomcat.TomcatServiceEndpointServlet";
+ public static final String DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET =
TomcatServiceEndpointServlet.class.getName();
public URL process(URL warURL, File destDir, String servletClass) throws IOException
{
Deleted:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java 2007-05-03
15:43:45 UTC (rev 2954)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -1,278 +0,0 @@
-/*
- * 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.ws.core.server;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.Servlet;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.integration.Endpoint;
-import org.w3c.dom.Element;
-
-/**
- * The publisher for web service endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public abstract class AbstractServiceEndpointPublisher
-{
- // logging support
- private static Logger log = Logger.getLogger(AbstractServiceEndpointPublisher.class);
-
- // The default bean name
- public static final String BEAN_NAME = "ServiceEndpointPublisher";
-
- // The configured service endpoint servlet
- private String servletClass;
-
- // The results of the URL rewriting
- public class RewriteResults
- {
- // The URL to the rewrittn web.xml
- public URL webXML;
- // Map<servlet-name, servlet-class> the servlet-class enties are the
implementation beans
- public Map<String, String> sepTargetMap = new HashMap<String,
String>();
- }
-
- public String getServletClass()
- {
- return servletClass;
- }
-
- public void setServletClass(String servletClass)
- {
- this.servletClass = servletClass;
- }
-
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- throw new NotImplementedException("Subclass should overwrite this
method");
- }
-
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- throw new NotImplementedException("Subclass should overwrite this
method");
- }
-
- public RewriteResults rewriteWebXml(UnifiedDeploymentInfo udi)
- {
- URL warURL = udi.webappURL;
- File warFile = new File(warURL.getFile());
- if (warFile.isDirectory() == false)
- throw new WSException("Expected a war directory: " + warURL);
-
- File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
- if (webXML.isFile() == false)
- throw new WSException("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 WSException("Cannot rename web.xml: " + orgWebXML);
-
- FileInputStream stream = new FileInputStream(orgWebXML);
- return rewriteWebXml(stream, webXML, udi.classLoader);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-
- public RewriteResults rewriteWebXml(InputStream source, File dest, ClassLoader loader)
throws Exception
- {
- if (dest == null)
- {
- dest = File.createTempFile("jbossws-alt-web", "xml",
IOUtils.createTempDirectory());
- dest.deleteOnExit();
- }
-
- Element root = DOMUtils.parse(source);
- RewriteResults results = modifyServletConfig(root, loader);
- results.webXML = dest.toURL();
-
- FileOutputStream fos = new FileOutputStream(dest);
- new DOMWriter(fos).setPrettyprint(true).print(root);
- fos.flush();
- fos.close();
-
- return results;
- }
-
- private RewriteResults modifyServletConfig(Element root, ClassLoader loader) throws
ClassNotFoundException
- {
- RewriteResults results = new RewriteResults();
- Iterator itServlets = DOMUtils.getChildElements(root, "servlet");
- while (itServlets.hasNext())
- {
- Element servletElement = (Element)itServlets.next();
- String linkName =
DOMUtils.getTextContent(DOMUtils.getFirstChildElement(servletElement,
"servlet-name"));
-
- // find the servlet-class
- Element classElement = DOMUtils.getFirstChildElement(servletElement,
"servlet-class");
-
- // JSP
- if (classElement == null)
- continue;
-
- String orgServletClassName = DOMUtils.getTextContent(classElement).trim();
-
- // Get the servlet class
- Class orgServletClass = null;
- if (loader != null)
- {
- try
- {
- 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(servletElement))
- {
- Iterator itParams = DOMUtils.getChildElements(servletElement,
"init-param");
- while (itParams.hasNext())
- {
- Element elParam = (Element)itParams.next();
- Element elParamName = DOMUtils.getFirstChildElement(elParam,
"param-name");
- Element elParamValue = DOMUtils.getFirstChildElement(elParam,
"param-value");
- if
(Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
- {
- targetBeanName = DOMUtils.getTextContent(elParamValue);
- }
- }
- }
- else
- {
- // Check if it is a real servlet that we can ignore
- if (orgServletClass != null &&
JavaUtils.isAssignableFrom(Servlet.class, orgServletClass))
- {
- log.info("Ignore servlet: " + orgServletClassName);
- continue;
- }
- else if (orgServletClassName.endsWith("Servlet"))
- {
- log.info("Ignore <servlet-class> that ends with
'Servlet': " + orgServletClassName);
- continue;
- }
-
- // build a list of detached elements that come after <servlet-class>
- boolean startDetach = false;
- List<Element> detachedElements = new ArrayList<Element>();
- Iterator itDetached = DOMUtils.getChildElements(servletElement);
- while (itDetached.hasNext())
- {
- Element el = (Element)itDetached.next();
- if (startDetach == true)
- {
- detachedElements.add(el);
- servletElement.removeChild(el);
- }
- if (el.equals(classElement))
- {
- servletElement.removeChild(el);
- startDetach = true;
- }
- }
-
- // replace the class name
- classElement = (Element)DOMUtils.createElement("servlet-class");
- classElement.appendChild(DOMUtils.createTextNode(servletClass));
- classElement =
(Element)servletElement.getOwnerDocument().importNode(classElement, true);
- servletElement.appendChild(classElement);
-
- // add additional init params
- if (orgServletClassName.equals(servletClass) == false)
- {
- Element paramElement = DOMUtils.createElement("init-param");
-
paramElement.appendChild(DOMUtils.createElement("param-name")).appendChild(DOMUtils.createTextNode(Endpoint.SEPID_DOMAIN_ENDPOINT));
-
paramElement.appendChild(DOMUtils.createElement("param-value")).appendChild(DOMUtils.createTextNode(orgServletClassName));
- paramElement =
(Element)servletElement.getOwnerDocument().importNode(paramElement, true);
- servletElement.appendChild(paramElement);
- targetBeanName = orgServletClassName;
- }
-
- // reattach the elements
- itDetached = detachedElements.iterator();
- while (itDetached.hasNext())
- {
- Element el = (Element)itDetached.next();
- servletElement.appendChild(el);
- }
- }
-
- if (targetBeanName == null)
- throw new IllegalStateException("Cannot obtain service endpoint bean
for: " + linkName);
-
- // remember the target bean name
- results.sepTargetMap.put(linkName, targetBeanName.trim());
- }
-
- return results;
- }
-
- // Return true if the web.xml is already modified
- private boolean isAlreadyModified(Element servletElement)
- {
- Iterator itParams = DOMUtils.getChildElements(servletElement,
"init-param");
- while (itParams.hasNext())
- {
- Element elParam = (Element)itParams.next();
- Element elParamName = DOMUtils.getFirstChildElement(elParam,
"param-name");
- if
(Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
- return true;
- }
- return false;
- }
-}
\ No newline at end of file
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java
(from rev 2953,
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java
(rev 0)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java 2007-05-03
19:18:24 UTC (rev 2955)
@@ -0,0 +1,267 @@
+/*
+ * 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.ws.core.server;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.Servlet;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.IOUtils;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.integration.Endpoint;
+import org.w3c.dom.Element;
+
+/**
+ * The publisher for web service endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class ServiceEndpointPublisher
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceEndpointPublisher.class);
+
+ // The default bean name
+ public static final String BEAN_NAME = "ServiceEndpointPublisher";
+
+ // The configured service endpoint servlet
+ private String servletClass;
+
+ // The results of the URL rewriting
+ public class RewriteResults
+ {
+ // The URL to the rewrittn web.xml
+ public URL webXML;
+ // Map<servlet-name, servlet-class> the servlet-class enties are the
implementation beans
+ public Map<String, String> sepTargetMap = new HashMap<String,
String>();
+ }
+
+ public String getServletClass()
+ {
+ return servletClass;
+ }
+
+ public void setServletClass(String servletClass)
+ {
+ this.servletClass = servletClass;
+ }
+
+ public RewriteResults rewriteWebXml(UnifiedDeploymentInfo udi)
+ {
+ URL warURL = udi.webappURL;
+ File warFile = new File(warURL.getFile());
+ if (warFile.isDirectory() == false)
+ throw new WSException("Expected a war directory: " + warURL);
+
+ File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
+ if (webXML.isFile() == false)
+ throw new WSException("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 WSException("Cannot rename web.xml: " + orgWebXML);
+
+ FileInputStream stream = new FileInputStream(orgWebXML);
+ return rewriteWebXml(stream, webXML, udi.classLoader);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException(e);
+ }
+ }
+
+ public RewriteResults rewriteWebXml(InputStream source, File dest, ClassLoader loader)
throws Exception
+ {
+ if (dest == null)
+ {
+ dest = File.createTempFile("jbossws-alt-web", "xml",
IOUtils.createTempDirectory());
+ dest.deleteOnExit();
+ }
+
+ Element root = DOMUtils.parse(source);
+ RewriteResults results = modifyServletConfig(root, loader);
+ results.webXML = dest.toURL();
+
+ FileOutputStream fos = new FileOutputStream(dest);
+ new DOMWriter(fos).setPrettyprint(true).print(root);
+ fos.flush();
+ fos.close();
+
+ return results;
+ }
+
+ private RewriteResults modifyServletConfig(Element root, ClassLoader loader) throws
ClassNotFoundException
+ {
+ RewriteResults results = new RewriteResults();
+ Iterator itServlets = DOMUtils.getChildElements(root, "servlet");
+ while (itServlets.hasNext())
+ {
+ Element servletElement = (Element)itServlets.next();
+ String linkName =
DOMUtils.getTextContent(DOMUtils.getFirstChildElement(servletElement,
"servlet-name"));
+
+ // find the servlet-class
+ Element classElement = DOMUtils.getFirstChildElement(servletElement,
"servlet-class");
+
+ // JSP
+ if (classElement == null)
+ continue;
+
+ String orgServletClassName = DOMUtils.getTextContent(classElement).trim();
+
+ // Get the servlet class
+ Class orgServletClass = null;
+ if (loader != null)
+ {
+ try
+ {
+ 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(servletElement))
+ {
+ Iterator itParams = DOMUtils.getChildElements(servletElement,
"init-param");
+ while (itParams.hasNext())
+ {
+ Element elParam = (Element)itParams.next();
+ Element elParamName = DOMUtils.getFirstChildElement(elParam,
"param-name");
+ Element elParamValue = DOMUtils.getFirstChildElement(elParam,
"param-value");
+ if
(Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
+ {
+ targetBeanName = DOMUtils.getTextContent(elParamValue);
+ }
+ }
+ }
+ else
+ {
+ // Check if it is a real servlet that we can ignore
+ if (orgServletClass != null &&
JavaUtils.isAssignableFrom(Servlet.class, orgServletClass))
+ {
+ log.info("Ignore servlet: " + orgServletClassName);
+ continue;
+ }
+ else if (orgServletClassName.endsWith("Servlet"))
+ {
+ log.info("Ignore <servlet-class> that ends with
'Servlet': " + orgServletClassName);
+ continue;
+ }
+
+ // build a list of detached elements that come after <servlet-class>
+ boolean startDetach = false;
+ List<Element> detachedElements = new ArrayList<Element>();
+ Iterator itDetached = DOMUtils.getChildElements(servletElement);
+ while (itDetached.hasNext())
+ {
+ Element el = (Element)itDetached.next();
+ if (startDetach == true)
+ {
+ detachedElements.add(el);
+ servletElement.removeChild(el);
+ }
+ if (el.equals(classElement))
+ {
+ servletElement.removeChild(el);
+ startDetach = true;
+ }
+ }
+
+ // replace the class name
+ classElement = (Element)DOMUtils.createElement("servlet-class");
+ classElement.appendChild(DOMUtils.createTextNode(servletClass));
+ classElement =
(Element)servletElement.getOwnerDocument().importNode(classElement, true);
+ servletElement.appendChild(classElement);
+
+ // add additional init params
+ if (orgServletClassName.equals(servletClass) == false)
+ {
+ Element paramElement = DOMUtils.createElement("init-param");
+
paramElement.appendChild(DOMUtils.createElement("param-name")).appendChild(DOMUtils.createTextNode(Endpoint.SEPID_DOMAIN_ENDPOINT));
+
paramElement.appendChild(DOMUtils.createElement("param-value")).appendChild(DOMUtils.createTextNode(orgServletClassName));
+ paramElement =
(Element)servletElement.getOwnerDocument().importNode(paramElement, true);
+ servletElement.appendChild(paramElement);
+ targetBeanName = orgServletClassName;
+ }
+
+ // reattach the elements
+ itDetached = detachedElements.iterator();
+ while (itDetached.hasNext())
+ {
+ Element el = (Element)itDetached.next();
+ servletElement.appendChild(el);
+ }
+ }
+
+ if (targetBeanName == null)
+ throw new IllegalStateException("Cannot obtain service endpoint bean
for: " + linkName);
+
+ // remember the target bean name
+ results.sepTargetMap.put(linkName, targetBeanName.trim());
+ }
+
+ return results;
+ }
+
+ // Return true if the web.xml is already modified
+ private boolean isAlreadyModified(Element servletElement)
+ {
+ Iterator itParams = DOMUtils.getChildElements(servletElement,
"init-param");
+ while (itParams.hasNext())
+ {
+ Element elParam = (Element)itParams.next();
+ Element elParamName = DOMUtils.getFirstChildElement(elParam,
"param-name");
+ if
(Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file