[jboss-cvs] JBossAS SVN: r70239 - in projects/ejb3/trunk/core/src: main/java/org/jboss/ejb3/deployers and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 28 23:27:11 EST 2008
Author: scott.stark at jboss.org
Date: 2008-02-28 23:27:11 -0500 (Thu, 28 Feb 2008)
New Revision: 70239
Removed:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJB3Deployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AbstractOptionalVFSRealDeployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AppClientParsingDeployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AppClientScanningDeployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/EJBRegistrationDeployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/EJBStage2Deployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3Deployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/JBossClientParsingDeployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java
Modified:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3JmxDeployment.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/EJB3StandaloneDeployment.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/JavaCompInitializer.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java
Log:
Trim org.jboss.ejb3.deployers down to minimum 3 classes for now
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJB3Deployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJB3Deployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJB3Deployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,561 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3;
-
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.BufferedInputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Properties;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.naming.LinkRef;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.SubDeployer;
-import org.jboss.deployment.SubDeployerSupport;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.MetaData;
-import org.jboss.metadata.XmlFileLoader;
-import org.jboss.mx.loading.LoaderRepositoryFactory;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.ObjectNameConverter;
-import org.jboss.system.ServiceControllerMBean;
-import org.jboss.util.file.ArchiveBrowser;
-import org.jboss.util.file.ClassFileFilter;
-import org.w3c.dom.Element;
-
-import javassist.bytecode.AnnotationsAttribute;
-import javassist.bytecode.ClassFile;
-
-/**
- * Deployer for Aspects
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
- at Deprecated
-public class EJB3Deployer extends SubDeployerSupport
- implements SubDeployer, EJB3DeployerMBean
-{
- private final static Logger log = Logger.getLogger(EJB3Deployer.class);
-
- private ServiceControllerMBean serviceController;
-
- /** A map of current deployments */
- private HashMap deployments = new HashMap();
-
- /** Hold a proxy reference to myself, used when registering to MainDeployer */
- private SubDeployer thisProxy;
-
- private Properties DefaultProperties;
-
- private boolean deployEjb3ExtensionOnly;
-
- private HashSet ignoredJarsSet;
- private HashMap<DeploymentInfo, String> jmxNames = new HashMap();
-
- private boolean requireDeploymentDescriptor;
-
- /**
- * Default CTOR used to set default values to the Suffixes and RelativeOrder
- * attributes. Those are read at subdeployer registration time by the MainDeployer
- * to alter its SuffixOrder.
- */
- public EJB3Deployer()
- {
- setSuffixes(new String[]{".jar", ".ejb3", ".par"});
- setRelativeOrder(400); // before old EJB 2.1 deployer
- }
-
- public static boolean hasFile(DeploymentInfo di, String filePath)
- {
- String urlStr = di.url.getFile();
- try
- {
- URL dd = di.localCl.findResource(filePath);
- if (dd != null)
- {
-
- // If the DD url is not a subset of the urlStr then this is coming
- // from a jar referenced by the deployment jar manifest and the
- // this deployment jar it should not be treated as persistence
- if (di.localUrl != null)
- {
- urlStr = di.localUrl.toString();
- }
-
- String ddStr = dd.toString();
- if (ddStr.indexOf(urlStr) >= 0)
- {
- return true;
- }
- }
- }
- catch (Exception ignore)
- {
- }
- return false;
- }
-
- public static boolean hasPersistenceXml(DeploymentInfo di)
- {
- return hasFile(di, "META-INF/persistence.xml");
- }
-
- public static boolean has30EjbJarXml(DeploymentInfo di)
- {
- if (!hasFile(di, "META-INF/ejb-jar.xml")) return false;
- InputStream ddStream = di.localCl.getResourceAsStream("META-INF/ejb-jar.xml");
-
- return has30EjbJarXml(ddStream);
- }
-
- public static boolean has30EjbJarXml(InputStream ddStream)
- {
- try
- {
- // look for version="3.0" in the file
- byte[] stringToFind = "version=\"3.0\"".getBytes();
- InputStreamReader reader = new InputStreamReader(ddStream);
- try
- {
- int idx = 0;
- int len = stringToFind.length;
- while (reader.ready())
- {
- int read = reader.read();
- if (read == stringToFind[idx])
- {
- idx++;
- if (idx == len)
- {
- return true;
- }
- }
- else
- {
- idx = 0;
- }
- }
-
- }
- finally
- {
- try
- {
- reader.close();
- ddStream.close();
- }
- catch (IOException ignored)
- {
- }
- }
- }
- catch (Exception ignore)
- {
- }
- return false;
- }
-
- protected boolean hasJbossXml(DeploymentInfo di)
- {
- return hasFile(di, "META-INF/jboss.xml");
- }
-
- protected boolean hasOnlyJbossXml(DeploymentInfo di)
- {
- if (!hasFile(di, "META-INF/ejb-jar.xml")
- && this.hasJbossXml(di))
- {
- return true;
- }
- return false;
- }
-
- public boolean hasEjbAnnotation(DeploymentInfo di)
- {
- Iterator it = ArchiveBrowser.getBrowser(di.localUrl, new ClassFileFilter());
- try
- {
- while (it.hasNext())
- {
- InputStream stream = (InputStream) it.next();
- DataInputStream dstream = new DataInputStream(new BufferedInputStream(stream));
- ClassFile cf = null;
- try
- {
- cf = new ClassFile(dstream);
- AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
- if (visible != null)
- {
- if (EJB3Util.isStateless(visible)) return true;
- if (EJB3Util.isStatefulSession(visible)) return true;
- if (EJB3Util.isMessageDriven(visible)) return true;
- if (EJB3Util.isConsumer(visible)) return true;
- if (EJB3Util.isService(visible)) return true;
- }
- }
- finally
- {
- dstream.close();
- stream.close();
- }
- }
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- return false;
- }
-
- /**
- * Returns true if this deployer can deploy the given DeploymentInfo.
- *
- * @return True if this deployer can deploy the given DeploymentInfo.
- * @jmx:managed-operation
- */
- public boolean accepts(DeploymentInfo di)
- {
-
- // Check for deployment descriptor if the deployer is
- // configured to require one for deployment
- // EJBTHREE-1040
- if (this.getRequireDeploymentDescriptor() && !(EJB3Deployer.has30EjbJarXml(di) || this.hasJbossXml(di)))
- {
- log.trace(EJB3Deployer.class.getSimpleName() + " skipping deployment of \"" + di.localUrl
- + "\"; deployer is configured to require DD and none was found.");
- return false;
- }
-
- String urlStr = di.url.getFile();
- if (urlStr.endsWith(".ejb3") || urlStr.endsWith(".ejb3/") || urlStr.endsWith(".par") || urlStr.endsWith(".par/"))
- {
- return true;
- }
-
- // To be accepted the deployment's root name must end in jar
- if (!urlStr.endsWith(".jar") && !urlStr.endsWith(".jar/"))
- {
- return false;
- }
-
- if (ignoredJarsSet.contains(di.shortName))
- {
- return false;
- }
-
- if (has30EjbJarXml(di)) return true;
-
- if (!deployEjb3ExtensionOnly)
- {
- if (hasPersistenceXml(di)) return true;
- if (hasOnlyJbossXml(di)) return true;
- if (hasEjbAnnotation(di)) return true;
- }
-
- return false;
- }
-
- public Properties getDefaultProperties()
- {
- return DefaultProperties;
- }
-
- public void setJarsIgnoredForScanning(JarsIgnoredForScanningMBean mbean)
- {
- ignoredJarsSet = mbean.getIgnoredJarsSet();
- }
-
- public boolean getDeployEjb3ExtensionOnly()
- {
- return deployEjb3ExtensionOnly;
- }
-
- public void setDeployEjb3ExtensionOnly(boolean deployEjb3ExtensionOnly)
- {
- this.deployEjb3ExtensionOnly = deployEjb3ExtensionOnly;
- }
-
-
- public boolean getRequireDeploymentDescriptor()
- {
- return requireDeploymentDescriptor;
- }
-
- public void setRequireDeploymentDescriptor(boolean requireDeploymentDescriptor)
- {
- this.requireDeploymentDescriptor = requireDeploymentDescriptor;
- }
-
- /**
- * Overriden to set the hibernate.bytecode.provider from the
- *
- * @throws Exception
- */
- protected void createService() throws Exception
- {
- URL propsUrl = this.getClass().getClassLoader().getResource("META-INF/persistence.properties");
- DefaultProperties = new Properties();
- DefaultProperties.load(propsUrl.openStream());
- log.debug("Default persistence.properties: " + DefaultProperties);
- /* Current hack to establish the hibernate bytecode provider from the
- externalized persistence.properties
- */
- String bcprovider = DefaultProperties.getProperty("hibernate.bytecode.provider", "javassist");
- System.setProperty("hibernate.bytecode.provider", bcprovider);
- super.createService();
- }
-
- /**
- * Get a reference to the ServiceController
- */
- protected void startService() throws Exception
- {
- serviceController = (ServiceControllerMBean)
- MBeanProxyExt.create(ServiceControllerMBean.class,
- ServiceControllerMBean.OBJECT_NAME, server);
-
- // make a proxy to myself, so that calls from the MainDeployer
- // can go through the MBeanServer, so interceptors can be added
- thisProxy = (SubDeployer)
- MBeanProxyExt.create(SubDeployer.class, super.getServiceName(), super.getServer());
-
- // register with the main deployer
- mainDeployer.addDeployer(thisProxy);
-
- // todo remove when we merge older model of ENC
- InitialContext iniCtx = InitialContextFactory.getInitialContext();
- initializeJavaComp(iniCtx);
- }
-
- public static void initializeJavaComp(InitialContext iniCtx)
- throws NamingException
- {
- Context ctx = (Context) iniCtx.lookup("java:");
- ctx.rebind("comp.ejb3", new LinkRef("java:comp"));
- }
-
- /**
- * Implements the template method in superclass. This method stops all the
- * applications in this server.
- */
- protected void stopService() throws Exception
- {
- for (Iterator modules = deployments.values().iterator();
- modules.hasNext();)
- {
- DeploymentInfo di = (DeploymentInfo) modules.next();
- stop(di);
- } // avoid concurrent modification exception
- for (Iterator modules = new ArrayList(deployments.values()).iterator();
- modules.hasNext();)
- {
- DeploymentInfo di = (DeploymentInfo) modules.next();
- destroy(di);
- }
- deployments.clear();
-
- // deregister with MainDeployer
- mainDeployer.removeDeployer(thisProxy);
-
- serviceController = null;
- }
-
- public void init(DeploymentInfo di) throws DeploymentException
- {
- try
- {
- if( di.url.getProtocol().equalsIgnoreCase("file") )
- {
- File file = new File(di.url.getFile());
-
- if( !file.isDirectory() )
- {
- // If not directory we watch the package
- di.watch = di.url;
- }
- else
- {
- // If directory we watch the xml files
- di.watch = new URL(di.url, "META-INF/ejb-jar.xml");
- }
- }
- else
- {
- // We watch the top only, no directory support
- di.watch = di.url;
- }
-
- XmlFileLoader xfl = new XmlFileLoader();
- InputStream in = di.localCl.getResourceAsStream("META-INF/jboss.xml");
- if( in != null )
- {
- try
- {
- Element jboss = xfl.getDocument(in, "META-INF/jboss.xml").getDocumentElement();
- // Check for a ejb level class loading config
- Element loader = MetaData.getOptionalChild(jboss, "loader-repository");
- if( loader != null )
- {
- LoaderRepositoryFactory.LoaderRepositoryConfig config =
- LoaderRepositoryFactory.parseRepositoryConfig(loader);
- di.setRepositoryInfo(config);
- }
-
- Element jmxNameElement = MetaData.getOptionalChild(jboss, "jmx-name");
- if (jmxNameElement != null)
- {
- jmxNames.put(di, jmxNameElement.getChildNodes().item(0).getNodeValue());
- }
- }
- finally
- {
- in.close();
- }
- }
- }
- catch (Exception e)
- {
- if (e instanceof DeploymentException)
- {
- throw (DeploymentException) e;
- }
- throw new DeploymentException( "failed to initialize", e );
- }
-
- // invoke super-class initialization
- super.init(di);
- }
-
- public synchronized void create(DeploymentInfo di) throws DeploymentException
- {
- log.debug("create, " + di.shortName);
-
- try
- {
- // initialize the annotations loader
- URL loaderURL = (di.localUrl != null ? di.localUrl : di.url);
- di.annotationsCl = new URLClassLoader(new URL[]{loaderURL}, di.ucl);
-
- Ejb3Module ejbModule = new Ejb3Module(di);
- String name = jmxNames.get(di);
- if (name == null)
- name = Ejb3Module.BASE_EJB3_JMX_NAME + ",module=" + di.shortName;
- // Build an escaped JMX name including deployment shortname
- ObjectName ejbModuleName = ObjectNameConverter.convert(name);
- // Check that the name is not registered
- if (server.isRegistered(ejbModuleName) == true)
- {
- log.debug("The EJBModule name: " + ejbModuleName
- + "is already registered, adding uid=" + System.identityHashCode(ejbModule));
- name = name + ",uid=" + System.identityHashCode(ejbModule);
- ejbModuleName = ObjectNameConverter.convert(name);
- }
- server.registerMBean(ejbModule, ejbModuleName);
- di.deployedObject = ejbModuleName;
- log.debug("Deploying: " + di.url);
- // Invoke the create life cycle method
- serviceController.create(di.deployedObject);
- }
- catch (Exception e)
- {
- throw new DeploymentException("Error during create of EjbModule: "
- + di.url, e);
- }
- super.create(di);
- }
-
- public synchronized void start(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- // Start application
- log.debug("start application, deploymentInfo: " + di +
- ", short name: " + di.shortName +
- ", parent short name: " +
- (di.parent == null ? "null" : di.parent.shortName));
- serviceController.start(di.deployedObject);
- log.info("Deployed: " + di.url); // Register deployment. Use the application name in the hashtable
- // FIXME: this is obsolete!! (really?!)
- deployments.put(di.url, di);
- }
- catch (Exception e)
- {
- stop(di);
- destroy(di);
- throw new DeploymentException("Could not deploy " + di.url, e);
- }
- super.start(di);
- }
-
- public void stop(DeploymentInfo di)
- throws DeploymentException
- {
- log.debug("init, " + di.shortName);
- try
- {
- serviceController.stop(di.deployedObject);
- }
- catch (Exception e)
- {
- throw new DeploymentException("problem stopping ejb module: " +
- di.url, e);
- }
-
- super.stop(di);
- }
-
- public void destroy(DeploymentInfo di)
- throws DeploymentException
- {
- // FIXME: If the put() is obsolete above, this is obsolete, too
- deployments.remove(di.url);
- try
- {
- serviceController.destroy(di.deployedObject);
- serviceController.remove(di.deployedObject);
- }
- catch (Exception e)
- {
- throw new DeploymentException("problem destroying ejb module: " +
- di.url, e);
- }
-
- jmxNames.remove(di);
-
- super.destroy(di);
- }
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -71,7 +71,6 @@
import org.jboss.ejb3.annotation.Clustered;
import org.jboss.ejb3.annotation.SecurityDomain;
import org.jboss.ejb3.annotation.defaults.PoolDefaults;
-import org.jboss.ejb3.deployers.Ejb3Deployer;
import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
import org.jboss.ejb3.entity.PersistenceUnitDeployment;
import org.jboss.ejb3.interceptor.InterceptorInfo;
@@ -860,8 +859,7 @@
}
int maxSize = poolAnnotation.maxSize();
long timeout = poolAnnotation.timeout();
- Ejb3Deployer deployer = deployment.getDeployer();
- PoolFactoryRegistry registry = deployer.getPoolFactoryRegistry();
+ PoolFactoryRegistry registry = deployment.getPoolFactoryRegistry();
PoolFactory factory = registry.getPoolFactory(registeredPoolName);
pool = factory.createPool();
pool.initialize(this, maxSize, timeout);
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -46,7 +46,6 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.ejb3.cache.CacheFactoryRegistry;
import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
-import org.jboss.ejb3.deployers.Ejb3Deployer;
import org.jboss.ejb3.enc.EjbModuleEjbResolver;
import org.jboss.ejb3.enc.EjbModulePersistenceUnitResolver;
import org.jboss.ejb3.enc.MessageDestinationResolver;
@@ -57,6 +56,7 @@
import org.jboss.ejb3.javaee.JavaEEModule;
import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitMetaData;
import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
+import org.jboss.ejb3.pool.PoolFactoryRegistry;
import org.jboss.ejb3.remoting.RemoteProxyFactoryRegistry;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossMetaData;
@@ -85,8 +85,6 @@
protected DeploymentUnit unit;
- protected Ejb3Deployer deployer;
-
protected LinkedHashMap<ObjectName, Container> ejbContainers = new LinkedHashMap<ObjectName, Container>();
protected boolean hasEntities;
@@ -119,19 +117,20 @@
protected EjbModulePersistenceUnitResolver persistenceUnitResolver;
protected MessageDestinationResolver messageDestinationResolver;
+ protected CacheFactoryRegistry cacheFactoryRegistry;
+ protected RemoteProxyFactoryRegistry remoteProxyFactoryRegistry;
+ protected PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry;
+ protected PoolFactoryRegistry poolFactoryRegistry;
protected ObjectName objectName;
protected boolean reinitialize = false;
- public Ejb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData,
- Ejb3Deployer deployer)
+ public Ejb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData)
{
assert unit != null : "unit is null";
- assert deployer != null : "deployer is null";
this.unit = unit;
- this.deployer = deployer;
this.deploymentScope = deploymentScope;
this.metaData = metaData;
this.persistenceUnitsMetaData = persistenceUnitsMetaData;
@@ -187,26 +186,42 @@
return defaultSLSBDomain;
}
- public Ejb3Deployer getDeployer()
+ public CacheFactoryRegistry getCacheFactoryRegistry()
{
- return this.deployer;
+ return cacheFactoryRegistry;
}
-
- public CacheFactoryRegistry getCacheFactoryRegistry()
+ public void setCacheFactoryRegistry(CacheFactoryRegistry registry)
{
- return this.getDeployer().getCacheFactoryRegistry();
+ this.cacheFactoryRegistry = registry;
}
-
+
public RemoteProxyFactoryRegistry getRemoteProxyFactoryRegistry()
{
- return this.getDeployer().getRemoteProxyFactoryRegistry();
+ return remoteProxyFactoryRegistry;
}
+ public void setRemoteProxyFactoryRegistry(RemoteProxyFactoryRegistry registry)
+ {
+ this.remoteProxyFactoryRegistry = registry;
+ }
public PersistenceManagerFactoryRegistry getPersistenceManagerFactoryRegistry()
{
- return this.getDeployer().getPersistenceManagerFactoryRegistry();
+ return persistenceManagerFactoryRegistry;
}
+ public void setPersistenceManagerFactoryRegistry(PersistenceManagerFactoryRegistry registry)
+ {
+ this.persistenceManagerFactoryRegistry = registry;
+ }
+ public PoolFactoryRegistry getPoolFactoryRegistry()
+ {
+ return poolFactoryRegistry;
+ }
+ public void setPoolFactoryRegistry(PoolFactoryRegistry poolFactoryRegistry)
+ {
+ this.poolFactoryRegistry = poolFactoryRegistry;
+ }
+
/**
* Returns a partial MBean attribute name of the form
* ",ear=foo.ear,jar=foo.jar"
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3JmxDeployment.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3JmxDeployment.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3JmxDeployment.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -42,7 +42,7 @@
public Ejb3JmxDeployment(DeploymentInfo di, DeploymentScope deploymentScope)
{
- super(new JmxDeploymentUnit(di), deploymentScope, null, null, null);
+ super(new JmxDeploymentUnit(di), deploymentScope, null, null);
this.deploymentInfo = di;
kernelAbstraction = new JmxKernelAbstraction(di);
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AbstractOptionalVFSRealDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AbstractOptionalVFSRealDeployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AbstractOptionalVFSRealDeployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.deployers;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-
-/**
- * An abstract more complicated VFS real deployer where the input
- * is optional instead of mandatory.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision$
- */
-public abstract class AbstractOptionalVFSRealDeployer<T> extends AbstractRealDeployer
-{
- private Class<T> optionalInput;
-
- public AbstractOptionalVFSRealDeployer(Class<T> optionalInput)
- {
- assert optionalInput != null : "optionalInput is null";
-
- this.optionalInput = optionalInput;
- setInputs(optionalInput);
- }
-
- public void internalDeploy(DeploymentUnit unit) throws DeploymentException
- {
- deploy(unit, unit.getAttachment(optionalInput));
- }
-
- public void deploy(DeploymentUnit unit, T deployment) throws DeploymentException
- {
- if (unit instanceof VFSDeploymentUnit == false)
- return;
-
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
- deploy(vfsDeploymentUnit, deployment);
- }
-
- /**
- * Deploy a deployment
- *
- * @param unit the unit
- * @param deployment the attachment
- * @throws DeploymentException for any error
- */
- public abstract void deploy(VFSDeploymentUnit unit, T deployment) throws DeploymentException;
-
- @Override
- public void internalUndeploy(DeploymentUnit unit)
- {
- undeploy(unit, unit.getAttachment(optionalInput));
- }
-
- public void undeploy(DeploymentUnit unit, T deployment)
- {
- if (unit instanceof VFSDeploymentUnit == false)
- return;
-
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
- undeploy(vfsDeploymentUnit, deployment);
- }
-
- /**
- * Undeploy a deployment
- *
- * @param unit the unit
- * @param deployment the attachment
- */
- public void undeploy(VFSDeploymentUnit unit, T deployment)
- {
- // Nothing
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AppClientParsingDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AppClientParsingDeployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AppClientParsingDeployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, Red Hat Middleware LLC, 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.ejb3.deployers;
-
-import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
-import org.jboss.metadata.client.spec.ApplicationClientMetaData;
-
-/**
- * The javaee application client descriptor parsing deployer
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @author adrian at jboss.org
- * @author Scott.Stark at jboss.org
- * @version $Revision: $
- */
-public class AppClientParsingDeployer extends SchemaResolverDeployer<ApplicationClientMetaData>
-{
- public AppClientParsingDeployer()
- {
- super(ApplicationClientMetaData.class);
- setName("application-client.xml");
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AppClientScanningDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AppClientScanningDeployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/AppClientScanningDeployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,133 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, 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.ejb3.deployers;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.client.jboss.JBossClientMetaData;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Scan the main & super classes for annotations.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @author adrian at jboss.org
- * @version $Revision: $
- */
-public class AppClientScanningDeployer extends AbstractOptionalVFSRealDeployer<JBossClientMetaData>
-{
-
- public AppClientScanningDeployer()
- {
- super(JBossClientMetaData.class);
- setOutput(JBossClientMetaData.class);
- }
-
- /* (non-Javadoc)
- * @see org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer#deploy(org.jboss.deployers.spi.deployer.DeploymentUnit)
- */
- @Override
- public void deploy(VFSDeploymentUnit unit, JBossClientMetaData dd) throws DeploymentException
- {
- // FIXME: implement metadata complete
-// if(dd != null && dd.getMetaDataComplete())
-// return;
- // for now the EJB3 client deployer handles all
- if(dd != null)
- return;
-
- try
- {
- String mainClassName = getMainClassName(unit);
- if(mainClassName == null)
- return;
-
- Class<?> mainClass = unit.getClassLoader().loadClass(mainClassName);
-
- log.info("mainClass = " + mainClass);
-
- if(hasAnnotations(mainClass))
- {
- // add a dummy application client dd to fire up the ejb3 client deployer
- dd = new JBossClientMetaData();
- unit.addAttachment(JBossClientMetaData.class, dd);
- }
- }
- catch(ClassNotFoundException e)
- {
- throw new DeploymentException(e);
- }
- catch(IOException e)
- {
- throw new DeploymentException(e);
- }
- }
-
- // TODO: integrate with Ejb3ClientDeployer.getMainClassName
- private String getMainClassName(VFSDeploymentUnit unit) throws IOException
- {
- VirtualFile file = unit.getMetaDataFile("MANIFEST.MF");
- log.trace("parsing " + file);
-
- if(file == null)
- {
- return null;
- }
-
- try
- {
- Manifest mf = VFSUtils.readManifest(file);
- Attributes attrs = mf.getMainAttributes();
- String className = attrs.getValue(Attributes.Name.MAIN_CLASS);
- return className;
- }
- finally
- {
- file.close();
- }
- }
-
- // TODO: should we check for type of annotations?
- private boolean hasAnnotations(Class<?> cls)
- {
- if(cls == null)
- return false;
-
- // Note: this also returns true if super class has annotations
- if(cls.getAnnotations().length > 0)
- return true;
-
- for(Field f : cls.getDeclaredFields())
- {
- if(f.getAnnotations().length > 0)
- return true;
- }
-
- return hasAnnotations(cls.getSuperclass());
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/EJBRegistrationDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/EJBRegistrationDeployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/EJBRegistrationDeployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,249 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, Red Hat Middleware LLC., 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.ejb3.deployers;
-
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-
-import javax.management.MBeanServer;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.deployment.security.JaccPolicyUtil;
-import org.jboss.ejb3.DeploymentScope;
-import org.jboss.ejb3.EJB3Deployer;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.kernel.Kernel;
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Creates initial EJB deployments and initializes only basic metadata.
- * A registration process is required so that
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
- * @version $Revision: 57082 $
- * @deprecated use Ejb3Deployer
- */
- at Deprecated
-public class EJBRegistrationDeployer extends AbstractVFSRealDeployer
-{
- private static final Logger log = Logger.getLogger(EJBRegistrationDeployer.class);
-
- private HashSet ignoredJarsSet;
- private MBeanServer mbeanServer;
- private Kernel kernel;
- private Properties defaultPersistenceProperties;
- private List<String> allowedSuffixes;
- private boolean requireDeploymentDescriptor;
-
- /**
- * Create a new EJBRegistrationDeployer.
- */
- public EJBRegistrationDeployer()
- {
- // TODO: Temporary JBMICROCONT-190 workaround for deployer order
- setRelativeOrder(-1);
- setOutputs(Ejb3Deployment.class.getName(), JaccPolicyUtil.IGNORE_ME_NAME);
- }
-
- public List<String> getAllowedSuffixes()
- {
- return allowedSuffixes;
- }
-
- public void setAllowedSuffixes(List<String> allowedSuffixes)
- {
- this.allowedSuffixes = allowedSuffixes;
- }
-
- public HashSet getIgnoredJarsSet()
- {
- return ignoredJarsSet;
- }
-
- public void setIgnoredJarsSet(HashSet ignoredJarsSet)
- {
- this.ignoredJarsSet = ignoredJarsSet;
- }
-
- public MBeanServer getMbeanServer()
- {
- return mbeanServer;
- }
-
- public void setMbeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
- public Kernel getKernel()
- {
- return kernel;
- }
-
- public void setKernel(Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- public Properties getDefaultPersistenceProperties()
- {
- return defaultPersistenceProperties;
- }
-
- public void setDefaultPersistenceProperties(Properties defaultPersistenceProperties)
- {
- this.defaultPersistenceProperties = defaultPersistenceProperties;
- }
-
- public boolean getRequireDeploymentDescriptor()
- {
- return requireDeploymentDescriptor;
- }
-
- public void setRequireDeploymentDescriptor(boolean requireDeploymentDescriptor)
- {
- this.requireDeploymentDescriptor = requireDeploymentDescriptor;
- }
-
- public void deploy(VFSDeploymentUnit unit) throws DeploymentException
- {
- try
- {
- // Initialize
- boolean hasEjbDd = false;
- boolean hasJbossDd = false;
-
- VirtualFile jar = unit.getRoot();
- if (jar.isLeaf() || ignoredJarsSet.contains(jar.getName()))
- {
- log.trace("EJBRegistrationDeployer ignoring: " + jar.getName());
- return;
- }
- if(!hasAllowedSuffix(jar.getName()))
- {
- log.trace("EJBRegistrationDeployer suffix not allowed: " + jar.getName());
- return;
- }
-
- VirtualFile ejbjar = unit.getMetaDataFile("ejb-jar.xml");
- if (ejbjar != null)
- {
- InputStream is = ejbjar.openStream();
- boolean has30EjbJarXml = EJB3Deployer.has30EjbJarXml(is);
- is.close();
- if (!has30EjbJarXml) {
- return;
- }
- else {
- hasEjbDd = true;
- }
- }
-
- // Determine if jboss.xml is specified
- hasJbossDd = unit.getMetaDataFile("jboss.xml")!=null;
-
- // If DDs are required and none are present, skip deployment
- // EJBTHREE-1040
- if (this.getRequireDeploymentDescriptor() && !(hasJbossDd || hasEjbDd))
- {
- log.trace(EJBRegistrationDeployer.class.getSimpleName() + " skipping deployment \"" + unit.getSimpleName()
- + "\", jar: \"" + jar.getName()
- + "\" - either EJB3 Deployment Descriptor or \"jboss.xml\" is required and neither were found.");
- return;
- }
-
- log.debug("********* EJBRegistrationDepoyer Begin Unit: " + unit.getSimpleName() + " jar: " + jar.getName());
- DeploymentScope scope = null;
- VFSDeploymentUnit parent = unit.getParent();
- if (parent != null && parent.getSimpleName().endsWith(".ear")) // todo should look for metadata instead of ".ear"
- {
- scope = parent.getAttachment(DeploymentScope.class);
- if (scope == null)
- {
- scope = new JBoss5DeploymentScope(unit.getParent());
- parent.addAttachment(DeploymentScope.class, scope);
- }
- }
- JBoss5DeploymentUnit du = new JBoss5DeploymentUnit(unit);
- du.setDefaultPersistenceProperties(defaultPersistenceProperties);
- Ejb3JBoss5Deployment deployment = new Ejb3JBoss5Deployment(du, kernel, mbeanServer, unit, scope, null, null, null);
- if (scope != null) scope.register(deployment);
- // create() creates initial EJB containers and initializes metadata.
- deployment.create();
- if (deployment.getEjbContainers().size() == 0 && deployment.getPersistenceUnitDeployments().size() == 0)
- {
- log.trace("EJBRegistrationDeployer no containers in scanned jar, consider adding it to the ignore list: " + jar.getName() + " url: " + jar.toURL() + " unit: " + unit.getSimpleName());
- return;
- }
- unit.addAttachment(Ejb3Deployment.class, deployment);
- // TODO: temporarily disable the security deployment
- unit.addAttachment(JaccPolicyUtil.IGNORE_ME_NAME, true, Boolean.class);
- }
- catch (Exception e)
- {
- throw new DeploymentException(e);
- }
- }
-
- private boolean hasAllowedSuffix(String name)
- {
- if(allowedSuffixes == null)
- return true;
-
- for (String suffix : allowedSuffixes)
- {
- if (name.endsWith(suffix))
- {
- return true;
- }
- }
- return false;
- }
-
- public void undeploy(VFSDeploymentUnit unit)
- {
- Ejb3Deployment deployment = unit.getAttachment(Ejb3Deployment.class);
- if (deployment == null) return;
- try
- {
- deployment.stop();
- }
- catch (Exception e)
- {
- log.error("failed to stop deployment", e);
- }
- try
- {
- deployment.destroy();
- }
- catch (Exception e)
- {
- log.error("failed to destroy deployment", e);
- }
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/EJBStage2Deployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/EJBStage2Deployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/EJBStage2Deployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,73 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, Red Hat Middleware LLC., 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.ejb3.deployers;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.ejb3.Ejb3Deployment;
-
-/**
- * Starts any initial EJB deployment created and initialized
- * by the EJBRegistrationDeployer
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
- * @version $Revision: 57082 $
- */
-public class EJBStage2Deployer extends AbstractSimpleRealDeployer<Ejb3Deployment>
-{
- /**
- * Create a new EJBStage2Deployer.
- */
- public EJBStage2Deployer()
- {
- super(Ejb3Deployment.class);
- }
-
- @Override
- public void deploy(DeploymentUnit unit, Ejb3Deployment deployment) throws DeploymentException
- {
- try
- {
- log.debug("********* EJBStage2 Begin Unit: " + unit.getName() + " jar: " + unit.getSimpleName());
- deployment.start();
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, Ejb3Deployment deployment)
- {
- try
- {
- deployment.stop();
- }
- catch(Exception e)
- {
- log.warn("Failed to stop deployment " + deployment, e);
- }
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,268 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, Red Hat Middleware LLC, 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.ejb3.deployers;
-
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-import javax.management.MBeanServer;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.structure.ClassPathEntry;
-import org.jboss.deployers.spi.structure.StructureMetaData;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.ejb3.InitialContextFactory;
-import org.jboss.ejb3.KernelAbstraction;
-import org.jboss.ejb3.MCKernelAbstraction;
-import org.jboss.ejb3.clientmodule.ClientENCInjectionContainer;
-import org.jboss.kernel.Kernel;
-import org.jboss.metadata.client.jboss.JBossClientMetaData;
-import org.jboss.util.naming.Util;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Deploys a client application jar.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @author adrian at jboss.org
- * @version $Revision: $
- */
-public class Ejb3ClientDeployer extends AbstractSimpleVFSRealDeployer<JBossClientMetaData>
-{
- private Kernel kernel;
- private MBeanServer server;
- /** A flag indicating if a deployment based jndi should be linked to the JBossClientMetaData.jndiName */
- private boolean linkDeploymentJndiName = true;
-
- /**
- * Create a new Ejb3ClientDeployer.
- */
- public Ejb3ClientDeployer()
- {
- super(JBossClientMetaData.class);
- setOutput(ClientENCInjectionContainer.class);
- }
-
- public boolean isLinkDeploymentJndiName()
- {
- return linkDeploymentJndiName;
- }
-
- public void setLinkDeploymentJndiName(boolean linkDeploymentJndiName)
- {
- this.linkDeploymentJndiName = linkDeploymentJndiName;
- }
-
- @Override
- public void deploy(VFSDeploymentUnit unit, JBossClientMetaData metaData) throws DeploymentException
- {
- log.debug("deploy " + unit.getName());
-
- String appClientName = getJndiName(metaData);
- String deploymentClientName = null;
- if(appClientName == null)
- appClientName = getDeploymentJndiName(unit);
- else if(linkDeploymentJndiName)
- deploymentClientName = getDeploymentJndiName(unit);
-
- try
- {
- // I create the namespace here, because I destroy it in undeploy
- InitialContext iniCtx = InitialContextFactory.getInitialContext();
- Context encCtx = Util.createSubcontext(iniCtx, appClientName);
- log.debug("Creating client ENC binding under: " + appClientName);
- if(deploymentClientName != null && deploymentClientName.equals(appClientName) == false)
- {
- Util.createLinkRef(iniCtx, deploymentClientName, appClientName);
- }
-
- // Notify the client launcher of extra class path entries in an EAR (See EE 8.2)
- encCtx.bind("classPathEntries", getClassPathEntries(unit));
-
- // TODO: Notify the client launcher of other metadata stuff (injectors, lifecycle callbacks etc)
- // FIXME: For now I expose the entire metadata
- encCtx.bind("metaData", metaData);
-
- String mainClassName = getMainClassName(unit, true);
-
- Class<?> mainClass = loadClass(unit, mainClassName);
-
- ClientENCInjectionContainer container = new ClientENCInjectionContainer(unit, metaData, mainClass, appClientName, unit.getClassLoader(), encCtx);
-
- //di.deployedObject = container.getObjectName();
- unit.addAttachment(ClientENCInjectionContainer.class, container);
- getKernelAbstraction().install(container.getObjectName().getCanonicalName(), container.getDependencyPolicy(), container);
- }
- catch(Exception e)
- {
- log.error("Could not deploy " + unit.getName(), e);
- undeploy(unit, metaData);
- throw new DeploymentException("Could not deploy " + unit.getName(), e);
- }
- }
-
- /**
- * Get the class path entries which have been determined by the EARStructure.
- * Will return null if this unit is not part of an ear deployment.
- */
- private List<ClassPathEntry> getClassPathEntries(VFSDeploymentUnit unit)
- {
-// log.info("class path = " + unit.getTopLevel().getAttachment(StructureMetaData.class).getContext("").getClassPath());
- StructureMetaData smd = unit.getTopLevel().getAttachment(StructureMetaData.class);
- if(smd == null)
- return null;
- // A context without a path is the one we want (see AbstractStructureDeployer)
- return smd.getContext("").getClassPath();
- }
-
- /**
- * If there is no deployment descriptor, or it doesn't specify a JNDI name, then we make up one.
- * We use the basename from di.shortName.
- *
- * @param unit
- * @param dd
- * @return a good JNDI name
- */
- private String getJndiName(JBossClientMetaData dd)
- {
- String jndiName = dd.getJndiName();
- return jndiName;
- }
- private String getDeploymentJndiName(DeploymentUnit unit)
- {
- String jndiName;
- String shortName = unit.getSimpleName();
- if(shortName.endsWith(".jar/"))
- jndiName = shortName.substring(0, shortName.length() - 5);
- else if(shortName.endsWith(".jar"))
- jndiName = shortName.substring(0, shortName.length() - 4);
- else
- throw new IllegalStateException("Expected either '.jar' or '.jar/' at the end of " + shortName);
-
- return jndiName;
- }
-
-// public Kernel getKernel()
-// {
-// return kernel;
-// }
-
- private KernelAbstraction getKernelAbstraction()
- {
- return new MCKernelAbstraction(kernel, server);
- }
-
- // TODO: move this method either to a utility class or to the scanning deployer
- protected String getMainClassName(VFSDeploymentUnit unit, boolean fail) throws Exception
- {
- VirtualFile file = unit.getMetaDataFile("MANIFEST.MF");
- log.trace("parsing " + file);
- // Default to the jboss client main
- String mainClassName = "org.jboss.client.AppClientMain";
-
- if (file != null)
- {
- try
- {
- Manifest mf = VFSUtils.readManifest(file);
- Attributes attrs = mf.getMainAttributes();
- String className = attrs.getValue(Attributes.Name.MAIN_CLASS);
- if (className != null)
- {
- mainClassName = className;
- }
- }
- finally
- {
- file.close();
- }
- }
- return mainClassName;
- }
-
- private Class<?> loadClass(DeploymentUnit unit, String className) throws ClassNotFoundException
- {
- ClassLoader old = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(unit.getClassLoader());
- return Thread.currentThread().getContextClassLoader().loadClass(className);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(old);
- }
- }
-
- public void setKernel(Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- public void setMbeanServer(MBeanServer server)
- {
- this.server = server;
- }
-
- @Override
- public void undeploy(VFSDeploymentUnit unit, JBossClientMetaData metaData)
- {
- log.debug("undeploy " + unit.getName());
-
- ClientENCInjectionContainer container = unit.getAttachment(ClientENCInjectionContainer.class);
- if(container != null)
- getKernelAbstraction().uninstall(container.getObjectName().getCanonicalName());
-
- String appClientName = getJndiName(metaData);
- String deploymentClientName = null;
- if(appClientName == null)
- appClientName = getDeploymentJndiName(unit);
- else if(linkDeploymentJndiName)
- deploymentClientName = getDeploymentJndiName(unit);
-
- log.debug("Removing client ENC from: " + appClientName);
- try
- {
- InitialContext iniCtx = InitialContextFactory.getInitialContext();
- Util.unbind(iniCtx, appClientName);
- if(deploymentClientName != null && deploymentClientName.equals(appClientName) == false)
- Util.removeLinkRef(deploymentClientName);
- }
- catch(NameNotFoundException e)
- {
- // make sure stop doesn't fail for no reason
- log.debug("Could not find client ENC");
- }
- catch (NamingException e)
- {
- log.error("Failed to remove client ENC", e);
- }
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3Deployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3Deployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3Deployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,272 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.deployers;
-
-import java.util.Properties;
-import java.util.Set;
-
-import javax.management.MBeanServer;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.deployment.security.JaccPolicyUtil;
-import org.jboss.ejb3.DeploymentScope;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.cache.CacheFactoryRegistry;
-import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
-import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
-import org.jboss.ejb3.pool.PoolFactoryRegistry;
-import org.jboss.ejb3.remoting.RemoteProxyFactoryRegistry;
-import org.jboss.kernel.Kernel;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Deployes EJB 3 components based on meta data coming from JBossEjbParsingDeployer.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision$
- */
-public class Ejb3Deployer //extends AbstractSimpleVFSRealDeployer<JBossMetaData>
- extends AbstractVFSRealDeployer
-{
- private Set<String> allowedSuffixes;
-
- private Properties defaultPersistenceProperties;
-
- /** EJBTHREE-1040: mandate a deployment descriptor to actually deploy */
- private boolean deploymentDescriptorRequired;
-
- private Set<String> ignoredJarsSet;
-
- private Kernel kernel;
-
- private MBeanServer mbeanServer;
-
- private CacheFactoryRegistry cacheFactoryRegistry;
-
- private PoolFactoryRegistry poolFactoryRegistry;
-
- private RemoteProxyFactoryRegistry remoteProxyFactoryRegistry;
-
- private PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry;
-
- public Ejb3Deployer()
- {
- // TODO: when the annotation scanner deployer comes on, we will always have JBossMetaData
- //super(JBossMetaData.class);
- addInput(JBossMetaData.class);
- // TODO: PersistenceUnits will have it's own component deployer
- addInput(PersistenceUnitsMetaData.class);
- // TODO: should we really output this
- setOutput(Ejb3Deployment.class);
- }
-
- @Override
- public void deploy(VFSDeploymentUnit unit) throws DeploymentException
- {
- deploy(unit, unit.getAttachment(JBossMetaData.class), unit.getAttachment(PersistenceUnitsMetaData.class));
- }
-
- public void deploy(VFSDeploymentUnit unit, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData) throws DeploymentException
- {
- try
- {
- // Pickup any deployment which doesn't have metaData or metaData with ejbVersion unknown or 3
- if(metaData != null && (metaData.isEJB2x() || metaData.isEJB1x()))
- {
- assert persistenceUnitsMetaData == null : "Found persistence units in legacy deployment";
-
- log.debug("Ignoring legacy EJB deployment " + unit);
- return;
- }
-
- VirtualFile jar = unit.getRoot();
- if (jar.isLeaf() || ignoredJarsSet.contains(jar.getName()))
- {
- log.trace(this.getClass().getName() + " ignoring: " + jar.getName());
- return;
- }
- if(!hasAllowedSuffix(jar.getName()))
- {
- log.trace(this.getClass().getName() + " suffix not allowed: " + jar.getName());
- return;
- }
-
- // If DDs are required and none are present, skip deployment
- // EJBTHREE-1040
- if (this.isDeploymentDescriptorRequired() && (metaData == null) && persistenceUnitsMetaData == null)
- {
- log.trace(this.getClass().getSimpleName() + " skipping deployment \"" + unit.getSimpleName()
- + "\", jar: \"" + jar.getName()
- + "\" - either EJB3 Deployment Descriptor or \"jboss.xml\" is required and neither were found.");
- return;
- }
-
- log.debug("********* " + this.getClass().getSimpleName() + " Begin Unit: " + unit.getSimpleName() + " jar: "
- + jar.getName());
- DeploymentScope scope = null;
- VFSDeploymentUnit parent = unit.getParent();
- if (parent != null && parent.getSimpleName().endsWith(".ear")) // todo should look for metadata instead of ".ear"
- {
- scope = parent.getAttachment(DeploymentScope.class);
- if (scope == null)
- {
- scope = new JBoss5DeploymentScope(unit.getParent());
- parent.addAttachment(DeploymentScope.class, scope);
- }
- }
- JBoss5DeploymentUnit du = new JBoss5DeploymentUnit(unit);
- du.setDefaultPersistenceProperties(defaultPersistenceProperties);
- Ejb3JBoss5Deployment deployment = new Ejb3JBoss5Deployment(du, kernel, mbeanServer, unit, scope, metaData, persistenceUnitsMetaData,
- this);
- if (scope != null) scope.register(deployment);
- // create() creates initial EJB containers and initializes metadata.
- deployment.create();
- if (deployment.getEjbContainers().size() == 0 && deployment.getPersistenceUnitDeployments().size() == 0)
- {
- log.trace("Found no containers in scanned jar, consider adding it to the ignore list: " + jar.getName() + " url: " + jar.toURL() + " unit: " + unit.getSimpleName());
- deployment.destroy();
- return;
- }
- unit.addAttachment(Ejb3Deployment.class, deployment);
- // TODO: temporarily disable the security deployment
- unit.addAttachment(JaccPolicyUtil.IGNORE_ME_NAME, true, Boolean.class);
- }
- catch (Throwable t)
- {
- throw new DeploymentException("Error deploying " + unit.getSimpleName() + ": " + t.getMessage(), t);
- }
- }
-
- public Set<String> getAllowedSuffixes()
- {
- return allowedSuffixes;
- }
-
- public CacheFactoryRegistry getCacheFactoryRegistry()
- {
- return cacheFactoryRegistry;
- }
-
- public void setCacheFactoryRegistry(CacheFactoryRegistry cacheFactoryRegistry)
- {
- this.cacheFactoryRegistry = cacheFactoryRegistry;
- }
-
- public PoolFactoryRegistry getPoolFactoryRegistry()
- {
- return poolFactoryRegistry;
- }
-
- public void setPoolFactoryRegistry(PoolFactoryRegistry poolFactoryRegistry)
- {
- this.poolFactoryRegistry = poolFactoryRegistry;
- }
-
- public RemoteProxyFactoryRegistry getRemoteProxyFactoryRegistry()
- {
- return remoteProxyFactoryRegistry;
- }
-
- public void setRemoteProxyFactoryRegistry(RemoteProxyFactoryRegistry remoteProxyFactoryRegistry)
- {
- this.remoteProxyFactoryRegistry = remoteProxyFactoryRegistry;
- }
-
- public PersistenceManagerFactoryRegistry getPersistenceManagerFactoryRegistry()
- {
- return persistenceManagerFactoryRegistry;
- }
-
- public void setPersistenceManagerFactoryRegistry(PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry)
- {
- this.persistenceManagerFactoryRegistry = persistenceManagerFactoryRegistry;
- }
-
- private boolean hasAllowedSuffix(String name)
- {
- if(allowedSuffixes == null)
- return true;
-
- for (String suffix : allowedSuffixes)
- {
- if (name.endsWith(suffix))
- {
- return true;
- }
- }
- return false;
- }
-
- public boolean isDeploymentDescriptorRequired()
- {
- return deploymentDescriptorRequired;
- }
-
- public void setAllowedSuffixes(Set<String> s)
- {
- this.allowedSuffixes = s;
- }
-
- public void setDefaultPersistenceProperties(Properties p)
- {
- this.defaultPersistenceProperties = p;
- }
-
- public void setDeploymentDescriptorRequired(boolean b)
- {
- this.deploymentDescriptorRequired = b;
- }
-
- public void setIgnoredJarsSet(Set<String> s)
- {
- this.ignoredJarsSet = s;
- }
-
- public void setKernel(Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- public void setMbeanServer(MBeanServer server)
- {
- this.mbeanServer = server;
- }
-
- @Override
- public void undeploy(VFSDeploymentUnit unit)
- {
- Ejb3Deployment deployment = unit.getAttachment(Ejb3Deployment.class);
- if(deployment == null) return;
-
- try
- {
- deployment.destroy();
- }
- catch(Exception e)
- {
- log.warn("Failed to destroy deployment " + deployment, e);
- }
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,76 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, Red Hat Middleware LLC., 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.ejb3.deployers;
-
-import javax.management.MBeanServer;
-import javax.security.jacc.PolicyConfiguration;
-
-import org.jboss.ejb3.DependencyPolicy;
-import org.jboss.ejb3.DeploymentScope;
-import org.jboss.ejb3.DeploymentUnit;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.MCKernelAbstraction;
-import org.jboss.ejb3.javaee.JavaEEComponent;
-import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
-import org.jboss.kernel.Kernel;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-
-/**
- * JBoss 4.0 Microkernel specific implementation
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
- * @version $Revision: 56592 $
- */
-public class Ejb3JBoss5Deployment extends Ejb3Deployment
-{
- private static final Logger log = Logger.getLogger(Ejb3JBoss5Deployment.class);
-
- private org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit;
-
- public Ejb3JBoss5Deployment(DeploymentUnit ejb3Unit, Kernel kernel, MBeanServer mbeanServer, org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData, Ejb3Deployer deployer)
- {
- super(ejb3Unit, deploymentScope, metaData, persistenceUnitsMetaData, deployer);
-
- this.jbossUnit = jbossUnit;
- kernelAbstraction = new MCKernelAbstraction(kernel, mbeanServer);
-
- // todo maybe mbeanServer should be injected?
- this.mbeanServer = mbeanServer;
- }
-
- protected PolicyConfiguration createPolicyConfiguration() throws Exception
- {
- throw new IllegalStateException("This method should not be called");
- }
-
- protected void putJaccInService(PolicyConfiguration pc, DeploymentUnit ejb3Unit)
- {
- throw new IllegalStateException("This method should not be called");
- }
-
- public DependencyPolicy createDependencyPolicy(JavaEEComponent component)
- {
- return new JBoss5DependencyPolicy(component);
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/JBossClientParsingDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/JBossClientParsingDeployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/JBossClientParsingDeployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, Red Hat Middleware LLC, 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.ejb3.deployers;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
-import org.jboss.metadata.client.jboss.JBossClientMetaData;
-import org.jboss.metadata.client.spec.ApplicationClientMetaData;
-
-/**
- * The jboss-client.xml javaee client parsing deployer
- *
- * This deployer generates a merged JBossClientMetaData.
- * For application-client.xml ApplicationClientMetaData is retrieved from
- * the attachments. If there is a jboss-client.xml it will be parsed
- * by the SchemaResolverDeployer.
- * If either one is available a merged view will be created.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @author adrian at jboss.org
- * @author Scott.Stark at jboss.org
- * @version $Revision: $
- */
-public class JBossClientParsingDeployer extends SchemaResolverDeployer<JBossClientMetaData>
-{
- public JBossClientParsingDeployer()
- {
- super(JBossClientMetaData.class);
- // If an ApplicationClientMetaData is available use it
- setInputs(ApplicationClientMetaData.class);
- setName("jboss-client.xml");
- }
-
- /**
- * Override to create the merged JBossClientMetaData view
- */
- @Override
- protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException
- {
- super.createMetaData(unit, name, suffix);
- JBossClientMetaData jbossMetaData = getMetaData(unit, JBossClientMetaData.class.getName());
- ApplicationClientMetaData acmd = unit.getAttachment(ApplicationClientMetaData.class);
- // If either one is available generate a merged view
- if(jbossMetaData == null && acmd == null)
- return;
-
- // If there no JBossClientMetaData was created from a jboss-client.xml, create one
- if (jbossMetaData == null)
- {
- jbossMetaData = new JBossClientMetaData();
- }
- // Create a merged view
- JBossClientMetaData metaData = new JBossClientMetaData();
- metaData.merge(jbossMetaData, acmd, true);
- // Register the merged view as the output
- unit.getTransientManagedObjects().addAttachment(JBossClientMetaData.class.getName(), metaData, getOutput());
- // Keep the raw parsed as well
- // TODO: Wolf: Why? (ProfileService?)
- unit.getTransientManagedObjects().addAttachment("Raw"+JBossClientMetaData.class.getName(), jbossMetaData, getOutput());
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.deployers;
-
-import java.net.URL;
-import java.util.HashMap;
-
-import javax.persistence.spi.PersistenceUnitTransactionType;
-
-import org.hibernate.cfg.EJB3DTDEntityResolver;
-import org.hibernate.ejb.packaging.PersistenceXmlLoader;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
-import org.jboss.ejb3.protocol.jarjar.Handler;
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Find and parse persistence.xml.
- *
- * In a jar:
- * META-INF/persistence.xml
- *
- * In a war (JPA 6.2):
- * WEB-INF/classes/META-INF/persistence.xml
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class PersistenceUnitParsingDeployer extends AbstractVFSParsingDeployer<PersistenceUnitsMetaData>
-{
- private static final Logger log = Logger.getLogger(PersistenceUnitParsingDeployer.class);
-
- static
- {
- Handler.init();
- }
-
- public PersistenceUnitParsingDeployer()
- {
- super(PersistenceUnitsMetaData.class);
- setName("persistence.xml");
- }
-
- @Override
- protected PersistenceUnitsMetaData parse(DeploymentUnit unit, String name, PersistenceUnitsMetaData root) throws Exception
- {
- // Try to find the metadata
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
-
- VirtualFile file = vfsDeploymentUnit.getMetaDataFile(name);
- if (file == null)
- {
- // FIXME: hack to get a war persistence unit
- try
- {
- file = vfsDeploymentUnit.getFile("WEB-INF/classes/META-INF/persistence.xml");
- if(file == null)
- return null;
- }
- catch(IllegalStateException e)
- {
- return null;
- }
- // -- //
- }
-
- PersistenceUnitsMetaData result = parse(vfsDeploymentUnit, file, root);
- if (result != null)
- init(vfsDeploymentUnit, result, file);
- return result;
- }
-
- @Override
- protected PersistenceUnitsMetaData parse(VFSDeploymentUnit unit, VirtualFile file, PersistenceUnitsMetaData root)
- throws Exception
- {
- VirtualFile persistenceRoot = file.getParent().getParent();
-
- // We can't pass in a VFS url.
- //URL persistenceUnitRootUrl = persistenceRoot.toURL();
-
- // FIXME: is this a supported hack?
- // This introduces severe regression, will go the jar: url way (EJB-326)
- //URL persistenceUnitRootUrl = new URL("jarjar:" + persistenceRoot.getHandler().toURL());
-
- // http://opensource.atlassian.com/projects/hibernate/browse/EJB-326
- URL persistenceUnitRootUrl = persistenceRoot.getHandler().toURL();
- assert persistenceUnitRootUrl.getProtocol().equals("jar") || persistenceUnitRootUrl.getProtocol().equals("file") : "expected a jar or file url, but was " + persistenceUnitRootUrl;
-
- URL persistenceXmlUrl = file.toURL();
- PersistenceUnitsMetaData metaData = new PersistenceUnitsMetaData(persistenceUnitRootUrl, PersistenceXmlLoader.deploy(persistenceXmlUrl, new HashMap<String, String>(),
- new EJB3DTDEntityResolver(), PersistenceUnitTransactionType.JTA));
- log.info("Found persistence units " + metaData);
- // FIXME: if in EAR then unscoped else scoped
- return metaData;
- }
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/EJB3StandaloneDeployment.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/EJB3StandaloneDeployment.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/EJB3StandaloneDeployment.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -45,7 +45,7 @@
{
public EJB3StandaloneDeployment(DeploymentUnit di, Kernel kernel, MBeanServer mbeanServer)
{
- super(di, null, null, null, null);
+ super(di, null, null, null);
defaultSFSBDomain = "Embedded Stateful Bean";
kernelAbstraction = new MCKernelAbstraction(kernel, mbeanServer);
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/JavaCompInitializer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/JavaCompInitializer.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/JavaCompInitializer.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -22,8 +22,12 @@
package org.jboss.ejb3.embedded;
import java.util.Hashtable;
+
+import javax.naming.Context;
import javax.naming.InitialContext;
-import org.jboss.ejb3.EJB3Deployer;
+import javax.naming.LinkRef;
+import javax.naming.NamingException;
+
import org.jboss.ejb3.InitialContextFactory;
/**
@@ -36,6 +40,12 @@
{
private Hashtable jndiProperties;
+ public static void initializeJavaComp(InitialContext iniCtx)
+ throws NamingException
+ {
+ Context ctx = (Context) iniCtx.lookup("java:");
+ ctx.rebind("comp.ejb3", new LinkRef("java:comp"));
+ }
public Hashtable getJndiProperties()
{
@@ -50,6 +60,6 @@
public void start() throws Exception
{
InitialContext ctx = InitialContextFactory.getInitialContext(jndiProperties);
- EJB3Deployer.initializeJavaComp(ctx);
+ initializeJavaComp(ctx);
}
}
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java 2008-02-29 04:25:34 UTC (rev 70238)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java 2008-02-29 04:27:11 UTC (rev 70239)
@@ -34,7 +34,6 @@
import org.jboss.ejb3.cache.NoPassivationCacheFactory;
import org.jboss.ejb3.cache.simple.SimpleStatefulCacheFactory;
import org.jboss.ejb3.cache.tree.StatefulTreeCacheFactory;
-import org.jboss.ejb3.deployers.Ejb3Deployer;
import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
import org.jboss.ejb3.javaee.JavaEEComponent;
import org.jboss.ejb3.pool.PoolFactory;
@@ -52,20 +51,20 @@
{
public MockEjb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope)
{
- super(unit, deploymentScope, null, null, new Ejb3Deployer());
+ super(unit, deploymentScope, null, null);
PoolFactoryRegistry poolRegistry = new PoolFactoryRegistry();
HashMap<String, Class<? extends PoolFactory>> poolFactories = new HashMap<String, Class<? extends PoolFactory>>();
poolFactories.put("ThreadlocalPool", ThreadlocalPoolFactory.class);
poolFactories.put("StrictMaxPool", StrictMaxPoolFactory.class);
poolRegistry.setFactories(poolFactories);
- deployer.setPoolFactoryRegistry(poolRegistry);
+ setPoolFactoryRegistry(poolRegistry);
CacheFactoryRegistry cacheRegistry = new CacheFactoryRegistry();
HashMap<String, Class<? extends Ejb3CacheFactory>> cacheFactories = new HashMap<String, Class<? extends Ejb3CacheFactory>>();
cacheFactories.put("NoPassivationCache", NoPassivationCacheFactory.class);
cacheFactories.put("SimpleStatefulCache", SimpleStatefulCacheFactory.class);
cacheFactories.put("StatefulTreeCache", StatefulTreeCacheFactory.class);
cacheRegistry.setFactories(cacheFactories);
- deployer.setCacheFactoryRegistry(cacheRegistry);
+ setCacheFactoryRegistry(cacheRegistry);
}
@Override
More information about the jboss-cvs-commits
mailing list