[jboss-cvs] JBossAS SVN: r58099 - in trunk: build ejb3 ejb3/src/main/org/jboss/ejb3/deployers server server/src/etc server/src/etc/deploy server/src/etc/deployers server/src/main/org/jboss/deployment server/src/main/org/jboss/ejb server/src/main/org/jboss/web server/src/main/org/jboss/webservice server/src/resources tomcat/src/main/org/jboss/web/tomcat/tc6/deployers
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 3 20:48:35 EST 2006
Author: thomas.diesler at jboss.com
Date: 2006-11-03 20:48:14 -0500 (Fri, 03 Nov 2006)
New Revision: 58099
Added:
trunk/server/src/etc/deployers/
trunk/server/src/etc/deployers/client-deployer-beans.xml
trunk/server/src/etc/deployers/ear-deployer-beans.xml
trunk/server/src/main/org/jboss/ejb/EjbUtil50.java
trunk/server/src/main/org/jboss/webservice/WebServiceRefHandler.java
trunk/server/src/main/org/jboss/webservice/WebServiceRefHandlerFactory.java
Removed:
trunk/server/src/etc/deploy/ear-deployer-beans.xml
trunk/server/src/main/org/jboss/webservice/WebServiceClientDeployment.java
trunk/server/src/main/org/jboss/webservice/WebServiceClientHandler.java
trunk/server/src/resources/client-deployer/
Modified:
trunk/build/build-distr.xml
trunk/ejb3/.classpath
trunk/ejb3/src/main/org/jboss/ejb3/deployers/AppClientParsingDeployer.java
trunk/ejb3/src/main/org/jboss/ejb3/deployers/JBossClientParsingDeployer.java
trunk/server/.classpath
trunk/server/build.xml
trunk/server/src/main/org/jboss/deployment/ClientDeployer.java
trunk/server/src/main/org/jboss/ejb/Container.java
trunk/server/src/main/org/jboss/web/AbstractWebDeployer.java
trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/WarDeployer.java
Log:
resurect service-ref in app client
Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/build/build-distr.xml 2006-11-04 01:48:14 UTC (rev 58099)
@@ -524,7 +524,6 @@
<!-- Deployable xml snipets -->
<fileset dir="${_module.output}/etc/deploy">
<include name="**"/>
- <exclude name="ear-deployer-beans.xml"/>
</fileset>
<!-- Deployable archives -->
@@ -534,12 +533,14 @@
<include name="client-deployer-service.xml"/>
</fileset>
</copy>
- <copy todir="${install.server}/all/deployers" filtering="no">
- <!-- Deployable xml snipets -->
- <fileset dir="${_module.output}/etc/deploy">
- <include name="ear-deployer-beans.xml"/>
- </fileset>
- </copy>
+
+ <!-- Copy the deployers -->
+ <copy todir="${install.server}/all/deployers" filtering="no">
+ <fileset dir="${_module.output}/etc/deployers">
+ <include name="**"/>
+ </fileset>
+ </copy>
+
<copy file="${_module.output}/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml"
tofile="${install.all.deploy}/jmx-invoker-service.xml"/>
Modified: trunk/ejb3/.classpath
===================================================================
--- trunk/ejb3/.classpath 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/ejb3/.classpath 2006-11-04 01:48:14 UTC (rev 58099)
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="src" path="docs/tutorial/ssl/src"/>
- <classpathentry excluding="org/jboss/ejb3/test/clusteredentity/|org/jboss/ejb3/test/clusteredsession/" kind="src" output="output/eclipse-test-classes" path="src/test"/>
+ <classpathentry excluding="org/jboss/ejb3/test/clusteredentity/|org/jboss/ejb3/test/clusteredsession/" output="output/eclipse-test-classes" kind="src" path="src/test"/>
<classpathentry kind="src" path="docs/embedded-tutorial/advanced-deployment/archive/src"/>
<classpathentry kind="src" path="docs/embedded-tutorial/advanced-deployment/archive-by-resource/src"/>
<classpathentry kind="src" path="docs/embedded-tutorial/advanced-deployment/deploy-dir/src"/>
@@ -89,7 +89,7 @@
<classpathentry kind="lib" path="/thirdparty/jboss/security/lib/jbosssx.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/security-spi/lib/jboss-security-spi.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/system-jmx"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
+ <classpathentry sourcepath="/home/tdiesler/svn/jbossmc/trunk/deployers/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/aop/lib/jboss-aop-jdk50.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/AppClientParsingDeployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/AppClientParsingDeployer.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/AppClientParsingDeployer.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -21,12 +21,17 @@
*/
package org.jboss.ejb3.deployers;
+import java.io.IOException;
+
import org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.ejb3.metamodel.ApplicationClientDD;
import org.jboss.ejb3.metamodel.ApplicationClientDDObjectFactory;
+import org.jboss.util.xml.DOMUtils;
+import org.jboss.virtual.VirtualFile;
import org.jboss.xb.binding.ObjectModelFactory;
+import org.w3c.dom.Element;
/**
* Comment
@@ -52,6 +57,38 @@
@Override
public void deploy(DeploymentUnit unit) throws DeploymentException
{
- createMetaData(unit, appClientXmlPath, null);
+ if (accepts(unit))
+ createMetaData(unit, appClientXmlPath, null);
}
+
+ /**
+ * This method looks to the deployment for a META-INF/application-client.xml
+ * descriptor to identify a j2ee client jar.
+ */
+ private boolean accepts(DeploymentUnit unit) throws DeploymentException
+ {
+ boolean accepts = false;
+
+ // The jar must contain an META-INF/application-client.xml
+ VirtualFile dd = unit.getMetaDataFile(appClientXmlPath);
+ if (dd != null)
+ {
+ log.debug("Found application-client.xml file: " + unit.getName());
+ try
+ {
+ Element root = DOMUtils.parse(dd.openStream());
+ String namespaceURI = root.getNamespaceURI();
+ // Accept the J2EE5 namespace
+ accepts = "http://java.sun.com/xml/ns/javaee".equals(namespaceURI);
+ if (accepts == false)
+ log.debug("Ignore application-client.xml with namespace: " + namespaceURI);
+ }
+ catch (IOException ex)
+ {
+ DeploymentException.rethrowAsDeploymentException("Cannot parse " + appClientXmlPath, ex);
+ }
+ }
+
+ return accepts;
+ }
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/JBossClientParsingDeployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/JBossClientParsingDeployer.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/JBossClientParsingDeployer.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -21,12 +21,18 @@
*/
package org.jboss.ejb3.deployers;
+import java.io.IOException;
+
import org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.ejb3.metamodel.ApplicationClientDD;
import org.jboss.ejb3.metamodel.JBossClientDDObjectFactory;
+import org.jboss.util.xml.DOMUtils;
+import org.jboss.virtual.VirtualFile;
import org.jboss.xb.binding.ObjectModelFactory;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
/**
* Comment
@@ -60,14 +66,42 @@
return new JBossClientDDObjectFactory(root);
}
- /* (non-Javadoc)
- * @see org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer#deploy(org.jboss.deployers.spi.deployer.DeploymentUnit)
- */
@Override
public void deploy(DeploymentUnit unit) throws DeploymentException
{
- log.debug("deploy " + unit.getName());
- createMetaData(unit, jbossClientXmlPath, null);
+ if (accepts(unit))
+ createMetaData(unit, jbossClientXmlPath, null);
}
+ /**
+ * This method looks to the deployment for a META-INF/application-client.xml
+ * descriptor to identify a j2ee client jar.
+ */
+ private boolean accepts(DeploymentUnit unit) throws DeploymentException
+ {
+ boolean accepts = false;
+
+ // The jar must contain an META-INF/application-client.xml
+ VirtualFile dd = unit.getMetaDataFile(jbossClientXmlPath);
+ if (dd != null)
+ {
+ log.debug("Found application-client.xml file: " + unit.getName());
+ try
+ {
+ Element root = DOMUtils.parse(dd.openStream());
+ DocumentType doctype = root.getOwnerDocument().getDoctype();
+ String publicId = (doctype != null ? doctype.getPublicId() : null);
+ // Accept the JBoss5 publicId
+ accepts = "-//JBoss//DTD Application Client 5.0//EN".equals(publicId);
+ if (accepts == false)
+ log.debug("Ignore jboss-client.xml with publicId: " + publicId);
+ }
+ catch (IOException ex)
+ {
+ DeploymentException.rethrowAsDeploymentException("Cannot parse " + jbossClientXmlPath, ex);
+ }
+ }
+
+ return accepts;
+ }
}
Modified: trunk/server/.classpath
===================================================================
--- trunk/server/.classpath 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/.classpath 2006-11-04 01:48:14 UTC (rev 58099)
@@ -31,5 +31,7 @@
<classpathentry sourcepath="C:/svn/JBossMC/jbossmc/deployers/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/transaction"/>
<classpathentry sourcepath="/home/svn/JBossMC/jbossmc/container/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar"/>
+ <classpathentry sourcepath="/connector/C:/cygwin/home/Kabir/sourcecontrol/microcontainer/dependency/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-microcontainer.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/server/build.xml
===================================================================
--- trunk/server/build.xml 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/build.xml 2006-11-04 01:48:14 UTC (rev 58099)
@@ -410,11 +410,6 @@
<exclude name="org/jboss/ejb/plugins/**"/>
<exclude name="org/jboss/metamodel/**"/>
</fileset>
-
- <!-- Include external model mbean definition for ClientDeployer -->
- <fileset dir="${build.resources}/client-deployer">
- <include name="client-deployer-xmbean.xml"/>
- </fileset>
</jar>
<!-- jboss-minimal.jar -->
@@ -537,10 +532,6 @@
<copy todir="${build.lib}"
file="${build.resources}/exception-processor/sqlexception-service.xml"/>
- <!-- The J2EE client deployer -->
- <copy todir="${build.lib}"
- file="${build.resources}/client-deployer/client-deployer-service.xml"/>
-
<!--
| JBoss/Testsuite Support
-->
Deleted: trunk/server/src/etc/deploy/ear-deployer-beans.xml
===================================================================
--- trunk/server/src/etc/deploy/ear-deployer-beans.xml 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/etc/deploy/ear-deployer-beans.xml 2006-11-04 01:48:14 UTC (rev 58099)
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- JCA Deployers
--->
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="EARStructureDeployer" class="org.jboss.deployment.EARStructure">
- <install bean="MainDeployer" method="addStructureDeployer">
- <parameter>
- <this/>
- </parameter>
- </install>
- <uninstall bean="MainDeployer" method="removeStructureDeployer">
- <parameter>
- <this/>
- </parameter>
- </uninstall>
- </bean>
-
- <bean name="AppParsingDeployer" class="org.jboss.deployment.AppParsingDeployer">
- <install bean="MainDeployer" method="addDeployer">
- <parameter>
- <this/>
- </parameter>
- </install>
- <uninstall bean="MainDeployer" method="removeDeployer">
- <parameter>
- <this/>
- </parameter>
- </uninstall>
- </bean>
- <bean name="JBossAppParsingDeployer" class="org.jboss.deployment.JBossAppParsingDeployer">
- <install bean="MainDeployer" method="addDeployer">
- <parameter>
- <this/>
- </parameter>
- </install>
- <uninstall bean="MainDeployer" method="removeDeployer">
- <parameter>
- <this/>
- </parameter>
- </uninstall>
- </bean>
-
-</deployment>
Added: trunk/server/src/etc/deployers/client-deployer-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/client-deployer-beans.xml 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/etc/deployers/client-deployer-beans.xml 2006-11-04 01:48:14 UTC (rev 58099)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ AppClient Deployer
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="AppClientDeployer" class="org.jboss.deployment.ClientDeployer">
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ </bean>
+</deployment>
\ No newline at end of file
Property changes on: trunk/server/src/etc/deployers/client-deployer-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/server/src/etc/deployers/ear-deployer-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/ear-deployer-beans.xml 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/etc/deployers/ear-deployer-beans.xml 2006-11-04 01:48:14 UTC (rev 58099)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ EAR Deployer
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="EARStructureDeployer" class="org.jboss.deployment.EARStructure">
+ <install bean="MainDeployer" method="addStructureDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeStructureDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ </bean>
+
+ <bean name="AppParsingDeployer" class="org.jboss.deployment.AppParsingDeployer">
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ </bean>
+ <bean name="JBossAppParsingDeployer" class="org.jboss.deployment.JBossAppParsingDeployer">
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ </bean>
+
+</deployment>
Property changes on: trunk/server/src/etc/deployers/ear-deployer-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/server/src/main/org/jboss/deployment/ClientDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/ClientDeployer.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/main/org/jboss/deployment/ClientDeployer.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -1,27 +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.
-*/
+ * 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.deployment;
-import org.jboss.ejb.EjbUtil;
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.management.MBeanServer;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.LinkRef;
+import javax.naming.NamingException;
+
+import org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.classloader.ClassLoaderFactory;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.ejb.EjbUtil50;
import org.jboss.metadata.ClientMetaData;
import org.jboss.metadata.EjbRefMetaData;
import org.jboss.metadata.EnvEntryMetaData;
@@ -29,130 +49,133 @@
import org.jboss.metadata.ResourceRefMetaData;
import org.jboss.metadata.XmlFileLoader;
import org.jboss.naming.Util;
-import org.jboss.webservice.WebServiceClientHandler;
+import org.jboss.util.xml.DOMUtils;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.webservice.WebServiceRefHandler;
+import org.jboss.webservice.WebServiceRefHandlerFactory;
import org.w3c.dom.Element;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.LinkRef;
-import javax.naming.NamingException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-
/**
- * An XMBean resource implementation of a deployer for j2ee application
- * client jars
+ * A deployer for j2ee application client jars
*
* @author Scott.Stark at jboss.org
+ * @author Thomas.Diesler at jboss.org
* @version $Revision$
*/
-public class ClientDeployer extends SubDeployerSupport
+public class ClientDeployer extends AbstractSimpleDeployer
{
- protected void startService() throws Exception
+ private static final String APPLICATION_CLIENT_XML = "application-client.xml";
+ private static final String JBOSS_CLIENT_XML = "jboss-client.xml";
+
+ private MBeanServer mbeanServer;
+
+ public MBeanServer getMbeanServer()
{
- // register with MainDeployer
- super.startService();
+ return mbeanServer;
}
- /**
- * Implements the template method in superclass. This method stops all the
- * applications in this server.
- */
- protected void stopService() throws Exception
+ public void setMbeanServer(MBeanServer server)
{
- // deregister with MainDeployer
- super.stopService();
+ this.mbeanServer = server;
}
/**
* This method looks to the deployment for a META-INF/application-client.xml
* descriptor to identify a j2ee client jar.
- *
- * @param di The deployment info instance for the jar
- * @return true if the deployment is a j2ee client jar, false otherwise
*/
- public boolean accepts(DeploymentInfo di)
+ private boolean accepts(DeploymentUnit unit) throws DeploymentException
{
- // To be accepted the deployment's root name must end in jar
- String urlStr = di.url.getFile();
- if (!urlStr.endsWith(".jar") && !urlStr.endsWith(".jar/"))
- {
- return false;
- }
-
- // However the jar must also contain an META-INF/application-client.xml
boolean accepts = false;
- try
+
+ // The jar must contain an META-INF/application-client.xml
+ VirtualFile dd = unit.getMetaDataFile(APPLICATION_CLIENT_XML);
+ if (dd != null)
{
- URL dd = di.localCl.findResource("META-INF/application-client.xml");
- if (dd != null)
+ log.debug("Found application-client.xml file: " + unit.getName());
+ try
{
- log.debug("Found a META-INF/application-client.xml file, di: " + di);
- accepts = true;
+ Element root = DOMUtils.parse(dd.openStream());
+ String namespaceURI = root.getNamespaceURI();
+ // Accept the J2EE-1.4 namespace
+ accepts = "http://java.sun.com/xml/ns/j2ee".equals(namespaceURI);
+ if (accepts == false)
+ log.debug("Ignore application-client.xml with namespace: " + namespaceURI);
}
+ catch (IOException ex)
+ {
+ DeploymentException.rethrowAsDeploymentException("Cannot parse " + APPLICATION_CLIENT_XML, ex);
+ }
}
- catch (Exception ignore)
- {
- }
return accepts;
}
- /**
- * Sub-classes should override this method to provide
- * custom 'create' logic.
- * <p/>
- * This method issues a JMX notification of type SubDeployer.CREATE_NOTIFICATION.
- */
- public void create(DeploymentInfo di) throws DeploymentException
+ @Override
+ public void deploy(DeploymentUnit unit) throws org.jboss.deployers.spi.DeploymentException
{
- super.create(di);
+ if (accepts(unit))
+ {
+ // Create the resource class loader
+ unit.createClassLoader(new RootURLClassLoaderFactory(unit));
+
+ // TODO: externalize in parser deployer
+ ClientMetaData metaData = buildClientMetaData(unit);
+ unit.addAttachment(ClientMetaData.class, metaData);
+
+ try
+ {
+ setupEnvironment(unit, metaData);
+ }
+ catch (Exception ex)
+ {
+ DeploymentException.rethrowAsDeploymentException("Failed to setup client ENC", ex);
+ }
+ }
}
- /**
- * Parse the application-client.xml and jboss-client.xml descriptors.
- *
- * @param di the application client jar deployment info
- */
- public void start(DeploymentInfo di) throws DeploymentException
+ @Override
+ public void undeploy(DeploymentUnit unit)
{
- ClientMetaData metaData = null;
- try
+ // Teardown the JNDI context
+ ClientMetaData metaData = unit.getAttachment(ClientMetaData.class);
+ if (metaData != null)
{
- InputStream in = null;
- if (di.alternativeDD == null)
+ String appClientName = metaData.getJndiName();
+ log.info("Removing client ENC from: " + appClientName);
+ try
{
- in = di.localCl.getResourceAsStream("META-INF/application-client.xml");
+ InitialContext iniCtx = new InitialContext();
+ Util.unbind(iniCtx, appClientName);
}
- else
+ catch (NamingException ex)
{
- String contentsDir = new File(di.url.getPath()).getParent();
- in = new FileInputStream(contentsDir + "/" + di.alternativeDD);
+ log.error("Failed to remove client ENC", ex);
}
+ }
+ }
+ private ClientMetaData buildClientMetaData(DeploymentUnit unit) throws DeploymentException
+ {
+ ClientMetaData metaData = null;
+ try
+ {
+ InputStream in = unit.getMetaDataFile(APPLICATION_CLIENT_XML).openStream();
if (in == null)
- throw new DeploymentException("No META-INF/application-client.xml found");
+ throw new DeploymentException("No application-client.xml found");
- metaData = null;
XmlFileLoader xfl = new XmlFileLoader(true);
- Element appClient = xfl.getDocument(in, "META-INF/application-client.xml").getDocumentElement();
+ Element appClient = xfl.getDocument(in, "application-client.xml").getDocumentElement();
in.close();
metaData = new ClientMetaData();
- metaData.setResourceClassLoader(di.localCl);
+ metaData.setResourceClassLoader((URLClassLoader)unit.getClassLoader());
metaData.importClientXml(appClient);
- di.metaData = metaData;
// Look for a jboss-client.xml descriptor
- in = di.localCl.getResourceAsStream("META-INF/jboss-client.xml");
+ in = unit.getMetaDataFile(JBOSS_CLIENT_XML).openStream();
if (in != null)
{
xfl = new XmlFileLoader(true);
- Element jbossClient = xfl.getDocument(in, "META-INF/jboss-client.xml").getDocumentElement();
+ Element jbossClient = xfl.getDocument(in, "jboss-client.xml").getDocumentElement();
in.close();
metaData.importJbossClientXml(jbossClient);
}
@@ -161,60 +184,11 @@
{
throw new DeploymentException("Failed to parse metadata", e);
}
-
- try
- {
- setupEnvironment(di, metaData);
- }
- catch (Exception e)
- {
- throw new DeploymentException("Failed to setup client ENC", e);
- }
-
- super.start(di);
+ return metaData;
}
- /**
- * Sub-classes should override this method to provide
- * custom 'stop' logic.
- * <p/>
- * This method issues a JMX notification of type SubDeployer.START_NOTIFICATION.
- */
- public void stop(DeploymentInfo di) throws DeploymentException
+ private void setupEnvironment(DeploymentUnit unit, ClientMetaData metaData) throws Exception
{
- // Teardown the JNDI context
- ClientMetaData metaData = (ClientMetaData) di.metaData;
- if (metaData != null)
- {
- String appClientName = metaData.getJndiName();
- log.info("Removing client ENC from: " + appClientName);
- try
- {
- InitialContext iniCtx = new InitialContext();
- Util.unbind(iniCtx, appClientName);
- }
- catch (NamingException e)
- {
- throw new DeploymentException("Failed to remove client ENC", e);
- }
- }
- super.stop(di);
- }
-
- /**
- * Sub-classes should override this method to provide
- * custom 'destroy' logic.
- * <p/>
- * This method issues a JMX notification of type SubDeployer.DESTROY_NOTIFICATION.
- */
- public void destroy(DeploymentInfo di) throws DeploymentException
- {
- super.destroy(di);
- }
-
- private void setupEnvironment(DeploymentInfo di, ClientMetaData metaData)
- throws Exception
- {
// Setup a JNDI context which contains
String appClientName = metaData.getJndiName();
InitialContext iniCtx = new InitialContext();
@@ -224,9 +198,8 @@
Iterator i = metaData.getEnvironmentEntries().iterator();
while (i.hasNext())
{
- EnvEntryMetaData entry = (EnvEntryMetaData) i.next();
- log.debug("Binding env-entry: " + entry.getName() + " of type: " +
- entry.getType() + " to value:" + entry.getValue());
+ EnvEntryMetaData entry = (EnvEntryMetaData)i.next();
+ log.debug("Binding env-entry: " + entry.getName() + " of type: " + entry.getType() + " to value:" + entry.getValue());
EnvEntryMetaData.bindEnvEntry(envCtx, entry);
}
@@ -235,19 +208,19 @@
i = ejbRefs.values().iterator();
while (i.hasNext())
{
- EjbRefMetaData ref = (EjbRefMetaData) i.next();
+ EjbRefMetaData ref = (EjbRefMetaData)i.next();
log.debug("Binding an EJBReference " + ref.getName());
if (ref.getLink() != null)
{
// Internal link
String linkName = ref.getLink();
- String jndiName = EjbUtil.findEjbLink(server, di, linkName);
+ String jndiName = EjbUtil50.findEjbLink(mbeanServer, unit, linkName);
+
log.debug("Binding " + ref.getName() + " to ejb-link: " + linkName + " -> " + jndiName);
if (jndiName == null)
{
- String msg = "Failed to resolve ejb-link: " + linkName
- + " make by ejb-name: " + ref.getName();
+ String msg = "Failed to resolve ejb-link: " + linkName + " make by ejb-name: " + ref.getName();
throw new DeploymentException(msg);
}
log.debug("Link resolved to:" + jndiName);
@@ -258,25 +231,25 @@
// Bind the bean level ejb-ref/jndi-name
if (ref.getJndiName() == null)
{
- throw new DeploymentException("ejb-ref " + ref.getName() +
- ", expected either ejb-link in ejb-jar.xml " +
- "or jndi-name in jboss.xml");
+ throw new DeploymentException("ejb-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml " + "or jndi-name in jboss.xml");
}
log.debug("Binding " + ref.getName() + " to : " + ref.getJndiName());
Util.bind(envCtx, ref.getName(), new LinkRef(ref.getJndiName()));
}
}
- // Bind service references
+ // Bind <service-ref> elements
Iterator serviceRefs = metaData.getServiceReferences().values().iterator();
- WebServiceClientHandler.setupServiceRefEnvironment(envCtx, serviceRefs, di);
-
+ WebServiceRefHandler refHandler = WebServiceRefHandlerFactory.newInstance();
+ if (refHandler != null && serviceRefs.hasNext())
+ refHandler.setupServiceRefEnvironment(envCtx, serviceRefs, unit);
+
// Bind resource references
HashMap resRefs = metaData.getResourceReferences();
i = resRefs.values().iterator();
while (i.hasNext())
{
- ResourceRefMetaData ref = (ResourceRefMetaData) i.next();
+ ResourceRefMetaData ref = (ResourceRefMetaData)i.next();
String refName = ref.getRefName();
String jndiName = ref.getJndiName();
@@ -310,15 +283,40 @@
i = envRefs.values().iterator();
while (i.hasNext())
{
- ResourceEnvRefMetaData resRef = (ResourceEnvRefMetaData) i.next();
+ ResourceEnvRefMetaData resRef = (ResourceEnvRefMetaData)i.next();
String encName = resRef.getRefName();
String jndiName = resRef.getJndiName();
// Should validate the type...
- log.debug("Binding env resource: " + encName +
- " to JDNI as: " + jndiName);
+ log.debug("Binding env resource: " + encName + " to JDNI as: " + jndiName);
Util.bind(envCtx, encName, new LinkRef(jndiName));
}
log.info("Client ENC bound under: " + appClientName);
}
-}
+ static class RootURLClassLoaderFactory implements ClassLoaderFactory
+ {
+ URL rootURL;
+
+ RootURLClassLoaderFactory(DeploymentUnit unit)
+ {
+ try
+ {
+ rootURL = unit.getDeploymentContext().getRoot().toURL();
+ }
+ catch (Exception ex)
+ {
+ // ignore
+ }
+ }
+
+ public ClassLoader createClassLoader(DeploymentContext context) throws Exception
+ {
+ return new URLClassLoader(new URL[] {rootURL});
+ }
+
+ public void removeClassLoader(DeploymentContext context) throws Exception
+ {
+ // nothing to do
+ }
+ }
+}
Modified: trunk/server/src/main/org/jboss/ejb/Container.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/Container.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/main/org/jboss/ejb/Container.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -80,7 +80,8 @@
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.util.NestedError;
import org.jboss.util.NestedRuntimeException;
-import org.jboss.webservice.WebServiceClientHandler;
+import org.jboss.webservice.WebServiceRefHandler;
+import org.jboss.webservice.WebServiceRefHandlerFactory;
import org.omg.CORBA.ORB;
/**
@@ -1256,7 +1257,9 @@
// Bind service references
Iterator serviceRefs = metaData.getServiceReferences().values().iterator();
- WebServiceClientHandler.setupServiceRefEnvironment(envCtx, serviceRefs, di);
+ WebServiceRefHandler refHandler = WebServiceRefHandlerFactory.newInstance();
+ if (refHandler != null && serviceRefs.hasNext())
+ refHandler.setupServiceRefEnvironment(envCtx, serviceRefs, null); // FIXME
// Bind resource references
{
Added: trunk/server/src/main/org/jboss/ejb/EjbUtil50.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbUtil50.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/main/org/jboss/ejb/EjbUtil50.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -0,0 +1,426 @@
+/*
+ * 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.ejb;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import javax.management.MBeanServer;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployment.MainDeployerMBean;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.metadata.MessageDestinationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.util.Strings;
+
+/** Utility methods for resolving ejb-ref and ejb-local-ref within the
+ * scope of a deployment.
+ *
+ * @author <a href="mailto:criege at riege.com">Christian Riege</a>
+ * @author Scott.Stark at jboss.org
+ * @author Thomas.Diesler at jboss.org
+ *
+ * @version $Revision$
+ */
+public final class EjbUtil50
+{
+ private static final Logger log = Logger.getLogger(EjbUtil50.class);
+
+ /**
+ * Resolves an <ejb-link> target for an <ejb-ref> entry and
+ * returns the name of the target in the JNDI tree.
+ *
+ * @param unit DeploymentUnit
+ * @param link Content of the <ejb-link> entry.
+ *
+ * @return The JNDI Entry of the target bean; <code>null</code> if
+ * no appropriate target could be found.
+ */
+ public static String findEjbLink(MBeanServer server, DeploymentUnit unit, String link)
+ {
+ return resolveLink(server, unit, link, false);
+ }
+
+ /**
+ * Resolves an <ejb-link> target for an <ejb-local-ref> entry
+ * and returns the name of the target in the JNDI tree.
+ *
+ * @param unit DeploymentUnit
+ * @param link Content of the <ejb-link> entry.
+ *
+ * @return The JNDI Entry of the target bean; <code>null</code> if
+ * no appropriate target could be found.
+ */
+ public static String findLocalEjbLink(MBeanServer server, DeploymentUnit unit, String link)
+ {
+ return resolveLink(server, unit, link, true);
+ }
+
+ /**
+ * Resolves a <message-destination> target for a <message-destination-link>
+ * entry and returns the name of the target in the JNDI tree.
+ *
+ * @param di DeploymentUnit
+ * @param link Content of the <message-driven-link> entry.
+ *
+ * @return The JNDI Entry of the target; <code>null</code> if
+ * no appropriate target could be found.
+ */
+ public static MessageDestinationMetaData findMessageDestination(MBeanServer server, DeploymentUnit di, String link)
+ {
+ return resolveMessageDestination(server, di, link);
+ }
+
+ private static String resolveLink(MBeanServer server, DeploymentUnit di, String link, boolean isLocal)
+ {
+ if (link == null)
+ {
+ return null;
+ }
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("resolveLink( {" + di + "}, {" + link + "}, {" + isLocal + "}");
+ }
+
+ if (di == null)
+ {
+ // We should throw an IllegalArgumentException here probably?
+ return null;
+ }
+
+ if (link.indexOf('#') != -1)
+ {
+ // <ejb-link> is specified in the form path/file.jar#Bean
+ return resolveRelativeLink(server, di, link, isLocal);
+ }
+ else
+ {
+ // <ejb-link> contains a Bean Name, scan the DeploymentUnit tree
+ DeploymentUnit top = di;
+ while (top.getDeploymentContext().getParent() != null)
+ {
+ top = top.getDeploymentContext().getParent().getDeploymentUnit();
+ }
+
+ return resolveAbsoluteLink(top, link, isLocal);
+ }
+ }
+
+ private static String resolveRelativeLink(MBeanServer server, DeploymentUnit unit, String link, boolean isLocal)
+ {
+
+ String path = link.substring(0, link.indexOf('#'));
+ String ejbName = link.substring(link.indexOf('#') + 1);
+ String us = unit.getName();
+
+ // Remove the trailing slash for unpacked deployments
+ if (us.charAt(us.length() - 1) == '/')
+ us = us.substring(0, us.length() - 1);
+
+ String ourPath = us.substring(0, us.lastIndexOf('/'));
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Resolving relative link: " + link);
+ log.trace("Looking for: '" + link + "', we're located at: '" + ourPath + "'");
+ }
+
+ for (StringTokenizer st = new StringTokenizer(path, "/"); st.hasMoreTokens();)
+ {
+ String s = st.nextToken();
+ if (s.equals(".."))
+ {
+ ourPath = ourPath.substring(0, ourPath.lastIndexOf('/'));
+ }
+ else
+ {
+ ourPath += "/" + s;
+ }
+ }
+
+ URL target = null;
+
+ try
+ {
+ target = Strings.toURL(ourPath);
+ }
+ catch (MalformedURLException mue)
+ {
+ log.warn("Can't construct URL for: " + ourPath);
+ return null;
+ }
+
+ DeploymentUnit targetUnit = null;
+ try
+ {
+ targetUnit = (DeploymentUnit)server.invoke(MainDeployerMBean.OBJECT_NAME, "getDeployment", new Object[] { target }, new String[] { URL.class.getName() });
+ }
+ catch (Exception e)
+ {
+ log.warn("Got Exception when looking for DeploymentUnit: " + e);
+ return null;
+ }
+
+ if (targetUnit == null)
+ {
+ log.warn("Can't locate DeploymentUnit for target: " + target);
+ return null;
+ }
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Found appropriate DeploymentUnit: " + targetUnit);
+ }
+
+ String linkTarget = null;
+ if (targetUnit.getAttachment(ApplicationMetaData.class) != null)
+ {
+ ApplicationMetaData appMD = targetUnit.getAttachment(ApplicationMetaData.class);
+ BeanMetaData beanMD = appMD.getBeanByEjbName(ejbName);
+
+ if (beanMD != null)
+ {
+ linkTarget = getJndiName(beanMD, isLocal);
+ }
+ else
+ {
+ log.warn("No Bean named '" + ejbName + "' found in '" + path + "'!");
+ }
+ }
+ else
+ {
+ log.warn("DeploymentUnit " + targetUnit + " is not an EJB .jar " + "file!");
+ }
+
+ return linkTarget;
+ }
+
+ private static String resolveAbsoluteLink(DeploymentUnit unit, String link, boolean isLocal)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Resolving absolute link, di: " + unit);
+ }
+
+ String ejbName = null;
+
+ // Search current DeploymentUnit
+ if (unit.getAttachment(ApplicationMetaData.class) != null)
+ {
+ ApplicationMetaData appMD = unit.getAttachment(ApplicationMetaData.class);
+ BeanMetaData beanMD = appMD.getBeanByEjbName(link);
+ if (beanMD != null)
+ {
+ ejbName = getJndiName(beanMD, isLocal);
+ if (log.isTraceEnabled())
+ {
+ log.trace("Found Bean: " + beanMD + ", resolves to: " + ejbName);
+ }
+
+ return ejbName;
+ }
+ else if (log.isTraceEnabled())
+ {
+ // Dump the ejb module ejbNames
+ log.trace("No match for ejb-link: " + link + ", module names:");
+ Iterator iter = appMD.getEnterpriseBeans();
+ while (iter.hasNext())
+ {
+ beanMD = (BeanMetaData)iter.next();
+ String beanEjbName = getJndiName(beanMD, isLocal);
+ log.trace("... ejbName: " + beanEjbName);
+ }
+ }
+ }
+
+ // Search each subcontext
+ Iterator it = unit.getDeploymentContext().getChildren().iterator();
+ while (it.hasNext() && ejbName == null)
+ {
+ DeploymentUnit child = ((DeploymentContext)it.next()).getDeploymentUnit();
+ ejbName = resolveAbsoluteLink(child, link, isLocal);
+ }
+
+ return ejbName;
+ }
+
+ private static String getJndiName(BeanMetaData beanMD, boolean isLocal)
+ {
+ String jndiName = null;
+ if (isLocal)
+ {
+ // Validate that there is a local home associated with this bean
+ String localHome = beanMD.getLocalHome();
+ if (localHome != null)
+ jndiName = beanMD.getLocalJndiName();
+ else
+ {
+ log.warn("LocalHome jndi name requested for: '" + beanMD.getEjbName() + "' but there is no LocalHome class");
+ }
+ }
+ else
+ {
+ jndiName = beanMD.getJndiName();
+ }
+ return jndiName;
+ }
+
+ private static MessageDestinationMetaData resolveMessageDestination(MBeanServer server, DeploymentUnit di, String link)
+ {
+ if (link == null)
+ return null;
+
+ if (log.isTraceEnabled())
+ log.trace("resolveLink( {" + di + "}, {" + link + "})");
+
+ if (di == null)
+ // We should throw an IllegalArgumentException here probably?
+ return null;
+
+ if (link.indexOf('#') != -1)
+ // link is specified in the form path/file.jar#Bean
+ return resolveRelativeMessageDestination(server, di, link);
+ else
+ {
+ // link contains a Bean Name, scan the DeploymentUnit tree
+ DeploymentUnit top = di;
+ while (top.getDeploymentContext().getParent() != null)
+ top = top.getDeploymentContext().getParent().getDeploymentUnit();
+
+ return resolveAbsoluteMessageDestination(top, link);
+ }
+ }
+
+ private static MessageDestinationMetaData resolveRelativeMessageDestination(MBeanServer server, DeploymentUnit unit, String link)
+ {
+ String path = link.substring(0, link.indexOf('#'));
+ String destinationName = link.substring(link.indexOf('#') + 1);
+ String us = unit.getName();
+
+ // Remove the trailing slash for unpacked deployments
+ if (us.charAt(us.length() - 1) == '/')
+ us = us.substring(0, us.length() - 1);
+
+ String ourPath = us.substring(0, us.lastIndexOf('/'));
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Resolving relative message-destination-link: " + link);
+ log.trace("Looking for: '" + link + "', we're located at: '" + ourPath + "'");
+ }
+
+ for (StringTokenizer st = new StringTokenizer(path, "/"); st.hasMoreTokens();)
+ {
+ String s = st.nextToken();
+ if (s.equals(".."))
+ ourPath = ourPath.substring(0, ourPath.lastIndexOf('/'));
+ else ourPath += "/" + s;
+ }
+
+ URL target = null;
+ try
+ {
+ target = Strings.toURL(ourPath);
+ }
+ catch (MalformedURLException mue)
+ {
+ log.warn("Can't construct URL for: " + ourPath);
+ return null;
+ }
+
+ DeploymentUnit targetUnit = null;
+ try
+ {
+ targetUnit = (DeploymentUnit)server.invoke(MainDeployerMBean.OBJECT_NAME, "getDeployment", new Object[] { target }, new String[] { URL.class.getName() });
+ }
+ catch (Exception e)
+ {
+ log.warn("Got Exception when looking for DeploymentUnit: " + e);
+ return null;
+ }
+
+ if (targetUnit == null)
+ {
+ log.warn("Can't locate DeploymentUnit for target: " + target);
+ return null;
+ }
+
+ if (log.isTraceEnabled())
+ log.trace("Found appropriate DeploymentUnit: " + targetUnit);
+
+ if (targetUnit.getAttachment(ApplicationMetaData.class) != null)
+ {
+ ApplicationMetaData appMD = targetUnit.getAttachment(ApplicationMetaData.class);
+ return appMD.getMessageDestination(destinationName);
+ }
+ if (targetUnit.getAttachment(WebMetaData.class) != null)
+ {
+ WebMetaData webMD = targetUnit.getAttachment(WebMetaData.class);
+ return webMD.getMessageDestination(destinationName);
+ }
+ else
+ {
+ log.warn("DeploymentUnit " + targetUnit + " is not an EJB .jar " + "file!");
+ return null;
+ }
+ }
+
+ private static MessageDestinationMetaData resolveAbsoluteMessageDestination(DeploymentUnit unit, String link)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Resolving absolute link, di: " + unit);
+
+ // Search current DeploymentUnit
+ if (unit.getAttachment(ApplicationMetaData.class) != null)
+ {
+ ApplicationMetaData appMD = unit.getAttachment(ApplicationMetaData.class);
+ MessageDestinationMetaData mdMD = appMD.getMessageDestination(link);
+ if (mdMD != null)
+ return mdMD;
+ }
+ if (unit.getAttachment(WebMetaData.class) != null)
+ {
+ WebMetaData webMD = unit.getAttachment(WebMetaData.class);
+ return webMD.getMessageDestination(link);
+ }
+
+ // Search each subcontext
+ Iterator it = unit.getDeploymentContext().getChildren().iterator();
+ while (it.hasNext())
+ {
+ DeploymentUnit child = ((DeploymentContext)it.next()).getDeploymentUnit();
+ MessageDestinationMetaData mdMD = resolveAbsoluteMessageDestination(child, link);
+ if (mdMD != null)
+ return mdMD;
+ }
+
+ // Not found
+ return null;
+ }
+}
\ No newline at end of file
Property changes on: trunk/server/src/main/org/jboss/ejb/EjbUtil50.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/server/src/main/org/jboss/web/AbstractWebDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/AbstractWebDeployer.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/main/org/jboss/web/AbstractWebDeployer.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -60,7 +60,8 @@
import org.jboss.security.authorization.PolicyRegistration;
import org.jboss.security.plugins.AuthorizationManagerServiceMBean;
import org.jboss.web.AbstractWebContainer.WebDescriptorParser;
-import org.jboss.webservice.WebServiceClientHandler;
+import org.jboss.webservice.WebServiceRefHandler;
+import org.jboss.webservice.WebServiceRefHandlerFactory;
import org.omg.CORBA.ORB;
/** A template pattern class for web deployer integration into JBoss. This class
@@ -558,7 +559,10 @@
linkEjbLocalRefs(ejbLocalRefs, envCtx, di);
Iterator serviceRefs = metaData.getServiceReferences();
log.debug("linkServiceRefs");
- WebServiceClientHandler.setupServiceRefEnvironment(envCtx, serviceRefs, di);
+ WebServiceRefHandler refHandler = WebServiceRefHandlerFactory.newInstance();
+ //FIXME
+ //if (refHandler != null && serviceRefs.hasNext())
+ // refHandler.setupServiceRefEnvironment(envCtx, serviceRefs, unit);
}
protected void addEnvEntries(Iterator envEntries, Context envCtx)
Deleted: trunk/server/src/main/org/jboss/webservice/WebServiceClientDeployment.java
===================================================================
--- trunk/server/src/main/org/jboss/webservice/WebServiceClientDeployment.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/main/org/jboss/webservice/WebServiceClientDeployment.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -1,50 +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.webservice;
-
-// $Id$
-
-import java.util.Iterator;
-
-import javax.naming.Context;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-
-/**
- * Implemtent to bind JAXRPC ServiceRefs
- *
- * @author Thomas.Diesler at jboss.org
- * @since 05-May-2004
- */
-public interface WebServiceClientDeployment
-{
- /**
- * Binds a JAXRPC Service into the callers ENC for every service-ref element
- *
- * @param envCtx ENC to bind the javax.rpc.xml.Service object to
- * @param serviceRefs An iterator of the service-ref elements in the client deployment descriptor
- * @param di The client's deployment info
- * @throws org.jboss.deployment.DeploymentException if it goes wrong
- */
- void setupServiceRefEnvironment(Context envCtx, Iterator serviceRefs, DeploymentInfo di) throws DeploymentException;
-}
Deleted: trunk/server/src/main/org/jboss/webservice/WebServiceClientHandler.java
===================================================================
--- trunk/server/src/main/org/jboss/webservice/WebServiceClientHandler.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/main/org/jboss/webservice/WebServiceClientHandler.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -1,90 +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.webservice;
-
-// $Id$
-
-import java.util.Iterator;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.naming.Context;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.mx.util.ObjectNameFactory;
-
-/**
- * Delegate to JBossWS WebServiceClientDeployment.setupServiceRefEnvironment()
- *
- * @author Thomas.Diesler at jboss.org
- * @since 05-May-2004
- */
-public class WebServiceClientHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WebServiceClientHandler.class);
-
- /**
- * This binds a jaxrpc Service into the callers ENC for every service-ref element
- *
- * @param envCtx ENC to bind the javax.rpc.xml.Service object to
- * @param serviceRefs An iterator of the service-ref elements in the client deployment descriptor
- * @param di The client's deployment info
- * @throws org.jboss.deployment.DeploymentException if it goes wrong
- */
- public static void setupServiceRefEnvironment(Context envCtx, Iterator serviceRefs, DeploymentInfo di) throws DeploymentException
- {
- // nothing to do
- if (serviceRefs.hasNext() == false)
- return;
-
- MBeanServer server = MBeanServerLocator.locateJBoss();
- ObjectName jbosswsObjectName = ObjectNameFactory.create("jboss.ws:service=WebServiceClientDeployer");
-
- ObjectName objectName = null;
- WebServiceClientDeployment wsClientDeployment;
- try
- {
- if (server.isRegistered(jbosswsObjectName))
- {
- objectName = jbosswsObjectName;
- wsClientDeployment = (WebServiceClientDeployment)MBeanProxyExt.create(WebServiceClientDeployment.class, jbosswsObjectName, server);
- }
- else
- {
- log.warn("No web service client deployer registered");
- return;
- }
- }
- catch (Exception e)
- {
- throw new DeploymentException("Cannot create proxy to the web service client deployer: " + objectName, e);
- }
-
- // Delegate to the web service client deloyer
- wsClientDeployment.setupServiceRefEnvironment(envCtx, serviceRefs, di);
- }
-}
Added: trunk/server/src/main/org/jboss/webservice/WebServiceRefHandler.java
===================================================================
--- trunk/server/src/main/org/jboss/webservice/WebServiceRefHandler.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/main/org/jboss/webservice/WebServiceRefHandler.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -0,0 +1,50 @@
+/*
+* 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.webservice;
+
+// $Id$
+
+import java.util.Iterator;
+
+import javax.naming.Context;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+
+/**
+ * Implemtent to bind JAXRPC ServiceRefs
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2004
+ */
+public interface WebServiceRefHandler
+{
+ /**
+ * Binds a JAXRPC Service into the callers ENC for every service-ref element
+ *
+ * @param envCtx ENC to bind the javax.rpc.xml.Service object to
+ * @param serviceRefs An iterator of the service-ref elements in the client deployment descriptor
+ * @param unit The client's deployment unit
+ * @throws DeploymentException if it goes wrong
+ */
+ void setupServiceRefEnvironment(Context envCtx, Iterator serviceRefs, DeploymentUnit unit) throws DeploymentException;
+}
Property changes on: trunk/server/src/main/org/jboss/webservice/WebServiceRefHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/server/src/main/org/jboss/webservice/WebServiceRefHandlerFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/webservice/WebServiceRefHandlerFactory.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/server/src/main/org/jboss/webservice/WebServiceRefHandlerFactory.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -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.webservice;
+
+// $Id$
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxyExt;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.ObjectNameFactory;
+
+/**
+ * Factory for WebServiceRefHandler
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2004
+ */
+public class WebServiceRefHandlerFactory
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WebServiceRefHandlerFactory.class);
+
+ /** Get the WebServiceRefHandler MBean proxy
+ */
+ public static WebServiceRefHandler newInstance()
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ ObjectName objectName = ObjectNameFactory.create("jboss.ws:service=WebServiceRefHandler");
+
+ WebServiceRefHandler refHandler = null;
+ if (server.isRegistered(objectName))
+ {
+ refHandler = (WebServiceRefHandler)MBeanProxyExt.create(WebServiceRefHandler.class, objectName, server);
+ }
+ else
+ {
+ log.warn("Not registered: " + objectName);
+ }
+ return refHandler;
+ }
+}
Property changes on: trunk/server/src/main/org/jboss/webservice/WebServiceRefHandlerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/WarDeployer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/WarDeployer.java 2006-11-04 01:10:11 UTC (rev 58098)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/WarDeployer.java 2006-11-04 01:48:14 UTC (rev 58099)
@@ -21,7 +21,6 @@
*/
package org.jboss.web.tomcat.tc6.deployers;
-import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.Policy;
@@ -34,10 +33,6 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.LinkRef;
-import javax.naming.NamingException;
import javax.security.jacc.PolicyConfiguration;
import javax.security.jacc.PolicyConfigurationFactory;
import javax.security.jacc.PolicyContextException;
@@ -46,35 +41,18 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.J2eeApplicationMetaData;
import org.jboss.ejb.Container;
-import org.jboss.ejb.EjbUtil;
-import org.jboss.metadata.EjbLocalRefMetaData;
-import org.jboss.metadata.EjbRefMetaData;
-import org.jboss.metadata.EnvEntryMetaData;
-import org.jboss.metadata.MessageDestinationMetaData;
-import org.jboss.metadata.MessageDestinationRefMetaData;
-import org.jboss.metadata.ResourceEnvRefMetaData;
-import org.jboss.metadata.ResourceRefMetaData;
import org.jboss.metadata.WebMetaData;
-import org.jboss.mx.loading.LoaderRepositoryFactory;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.naming.NonSerializableFactory;
-import org.jboss.naming.Util;
-import org.jboss.resource.metadata.ConnectorMetaData;
import org.jboss.security.AuthorizationManager;
import org.jboss.security.authorization.PolicyRegistration;
import org.jboss.system.metadata.ServiceAttributeMetaData;
import org.jboss.system.metadata.ServiceConstructorMetaData;
import org.jboss.system.metadata.ServiceInjectionValueMetaData;
import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.web.AbstractWebContainer;
import org.jboss.web.WebApplication;
import org.jboss.web.WebPermissionMapping;
import org.jboss.web.tomcat.tc6.DeployerConfig;
-import org.jboss.webservice.WebServiceClientHandler;
-import org.omg.CORBA.ORB;
/**
* The war deployer that transforms a WebMetaData deployment type into a kernel bean
More information about the jboss-cvs-commits
mailing list