[jboss-cvs] JBossAS SVN: r72202 - in projects/ejb3/trunk/core/src: main/java/org/jboss/ejb3/embedded and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 15 02:17:22 EDT 2008
Author: scott.stark at jboss.org
Date: 2008-04-15 02:17:22 -0400 (Tue, 15 Apr 2008)
New Revision: 72202
Modified:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/DeploymentUnit.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxDeploymentScopeImpl.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxDeploymentUnit.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxKernelAbstraction.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/KernelAbstraction.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/MCKernelAbstraction.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/EJB3StandaloneDeployer.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java
Log:
EJBTHREE-1278, add attachments support to the DeploymentUnit and update the KernelAbstraction to accept a unit on install
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/DeploymentUnit.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/DeploymentUnit.java 2008-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/DeploymentUnit.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -38,12 +38,54 @@
*/
public interface DeploymentUnit
{
+ /**
+ * Add attachment
+ *
+ * @param name the name of the attachment
+ * @param attachment the attachment
+ * @return any previous attachment
+ * @throws IllegalArgumentException for a null name or attachment
+ * @throws UnsupportedOperationException when not supported by the implementation
+ */
+ Object addAttachment(String name, Object attachment);
+ /**
+ * Get attachment
+ *
+ * @param name the name of the attachment
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name
+ */
+ Object getAttachment(String name);
+ /**
+ * Remove attachment
+ *
+ * @param name the name of the attachment
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name
+ * @throws UnsupportedOperationException when not supported by the implementation
+ */
+ Object removeAttachment(String name);
+
ClassLoader getClassLoader();
ClassLoader getResourceLoader();
+ /**
+ * Get the file name of the deployment root (x.ejb).
+ *
+ * @return the file name of the deployment root
+ */
String getShortName();
+ /**
+ * Get the relative path of this deployment in the complete
+ * deployment structure. The root deployment relative path will
+ * have "". An ejb jar(x.jar) in an ear (z.ear) would have a
+ * relative path of "x.jar".
+ * @return
+ */
+ String getRelativePath();
+
List<VirtualFile> getResources(VirtualFileFilter filter);
URL getUrl();
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-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -402,7 +402,7 @@
String name = on.getCanonicalName();
DependencyPolicy dependsPolicy = container.getDependencyPolicy();
dependsPolicy.addDependency("jboss.ejb:service=EJBTimerService");
- kernelAbstraction.install(name, dependsPolicy, container);
+ kernelAbstraction.install(name, dependsPolicy, unit, container);
mbeanServer.registerMBean(container.getMBean(), on);
log.debug("Bound ejb3 container " + name);
}
@@ -686,7 +686,7 @@
{
DependencyPolicy policy = createDependencyPolicy(entityDeployment);
entityDeployment.addDependencies(policy);
- kernelAbstraction.install(entityDeployment.getKernelName(), policy, entityDeployment);
+ kernelAbstraction.install(entityDeployment.getKernelName(), policy, unit, entityDeployment);
}
}
}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxDeploymentScopeImpl.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxDeploymentScopeImpl.java 2008-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxDeploymentScopeImpl.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -64,6 +64,18 @@
return deployments.get(relativeShortName);
}
+ public EJBContainer getEjbContainer(Class businessIntf, String vfsContext)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public EJBContainer getEjbContainer(String ejbLink, Class businessIntf, String vfsContext)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
public String getName()
{
return shortName;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxDeploymentUnit.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxDeploymentUnit.java 2008-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxDeploymentUnit.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
@@ -55,6 +56,7 @@
private DeploymentInfo deploymentInfo;
InterceptorInfoRepository interceptorInfoRepository = new InterceptorInfoRepository(null);
private VirtualFile vfsRoot;
+ private Map<String, Object> attachments = new HashMap<String, Object>();
public JmxDeploymentUnit(DeploymentInfo deploymentInfo)
{
@@ -70,11 +72,30 @@
}
}
+ public Object addAttachment(String name, Object attachment)
+ {
+ return attachments.put(name, attachment);
+ }
+ public Object getAttachment(String name)
+ {
+ return attachments.get(name);
+ }
+ public Object removeAttachment(String name)
+ {
+ return attachments.remove(name);
+ }
+
public VirtualFile getRootFile()
{
return vfsRoot;
}
+ public String getRelativePath()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
public URL getRelativeURL(String jar)
{
URL url = null;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxKernelAbstraction.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxKernelAbstraction.java 2008-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JmxKernelAbstraction.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -68,7 +68,8 @@
}
- public void install(String name, DependencyPolicy dependencies, Object service)
+ public void install(String name, DependencyPolicy dependencies,
+ DeploymentUnit unit, Object service)
{
if (!(service instanceof ServiceMBeanSupport) && !(service instanceof DynamicMBean))
{
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/KernelAbstraction.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/KernelAbstraction.java 2008-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/KernelAbstraction.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -33,7 +33,7 @@
*/
public interface KernelAbstraction extends ClientKernelAbstraction
{
- public void install(String name, DependencyPolicy dependencies, Object service);
+ public void install(String name, DependencyPolicy dependencies, DeploymentUnit unit, Object service);
public void uninstall(String name);
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/MCKernelAbstraction.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/MCKernelAbstraction.java 2008-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/MCKernelAbstraction.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -112,7 +112,8 @@
return false;
}
- public void install(String name, DependencyPolicy dependencies, Object service)
+ public void install(String name, DependencyPolicy dependencies,
+ DeploymentUnit unit, Object service)
{
AbstractBeanMetaData bean = new AbstractBeanMetaData(name, service.getClass().getName());
bean.setConstructor(new AlreadyInstantiated(service));
@@ -162,7 +163,7 @@
try
{
server.registerMBean(service, on);
- install(on.getCanonicalName(), dependencies, service);
+ install(on.getCanonicalName(), dependencies, null, service);
// EJBTHREE-606: emulate the ServiceController calls
MBeanInfo info = server.getMBeanInfo(on); // redundant call for speed
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/EJB3StandaloneDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/EJB3StandaloneDeployer.java 2008-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/embedded/EJB3StandaloneDeployer.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -31,6 +31,7 @@
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
@@ -78,6 +79,7 @@
private Hashtable jndiProperties;
private InterceptorInfoRepository interceptorInfoRepository;
private VirtualFile vfsRoot;
+ private Map<String, Object> attachments = new HashMap<String, Object>();
public DeployerUnit(ClassLoader loader, URL url, Map defaultProps, Hashtable jndiProperties)
{
@@ -108,11 +110,30 @@
this.interceptorInfoRepository = new InterceptorInfoRepository(loader);
}
+ public Object addAttachment(String name, Object attachment)
+ {
+ return attachments.put(name, attachment);
+ }
+ public Object getAttachment(String name)
+ {
+ return attachments.get(name);
+ }
+ public Object removeAttachment(String name)
+ {
+ return attachments.remove(name);
+ }
+
public VirtualFile getRootFile()
{
return vfsRoot;
}
+ public String getRelativePath()
+ {
+ // There are only root deployments in standalone
+ return "";
+ }
+
public URL getRelativeURL(String jar)
{
URL url = null;
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java 2008-04-15 03:29:00 UTC (rev 72201)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java 2008-04-15 06:17:22 UTC (rev 72202)
@@ -40,6 +40,19 @@
public class MockDeploymentUnit implements DeploymentUnit
{
+ public Object addAttachment(String name, Object attachment)
+ {
+ return null;
+ }
+ public Object getAttachment(String name)
+ {
+ return null;
+ }
+ public Object removeAttachment(String name)
+ {
+ return null;
+ }
+
/* (non-Javadoc)
* @see org.jboss.ejb3.DeploymentUnit#getClassLoader()
*/
@@ -163,6 +176,12 @@
return null;
}
+ public String getRelativePath()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
/* (non-Javadoc)
* @see org.jboss.ejb3.DeploymentUnit#getUrl()
*/
More information about the jboss-cvs-commits
mailing list