Here are the diff for you to look at, without beeing ment as the final
versions:
First for mx loading:
Common subdirectories:
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/jmx/src/main/org/jboss/mx/loading/CVS
and ./CVS
diff -u -N
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/jmx/src/main/org/jboss/mx/loading/DelegatingLoaderRepository.java
./DelegatingLoaderRepository.java
---
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/jmx/src/main/org/jboss/mx/loading/DelegatingLoaderRepository.java
Thu Jan 1 01:00:00 1970
+++ ./DelegatingLoaderRepository.java Mon Feb 17 13:17:01 2003
@@ -0,0 +1,241 @@
+/*
+* JBoss, the OpenSource EJB server
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
+package org.jboss.mx.loading;
+
+import java.net.URL;
+import java.util.List;
+import java.util.HashSet;
+import java.util.Iterator;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.management.MBeanRegistration;
+
+import org.jboss.mx.logging.Logger;
+import org.jboss.mx.loading.LoadMgr.PkgClassLoader;
+import org.jboss.mx.server.ServerConstants;
+/**
+ * DelegatingLoaderRepository.java
+ *
+ *
+ * Created: Thu Feb 13 17:05:56 2003
+ *
+ * @author Peter Antman
+ * @version $Revision$ $Date$
+ */
+
+public class DelegatingLoaderRepository extends
HeirarchicalLoaderRepository3 implements
DelegatingLoaderRepositoryMBean,MBeanRegistration {
+ // Attributes ----------------------------------------------------
+ private static final Logger log =
Logger.getLogger(DelegatingLoaderRepository.class);
+ private static ObjectName DEFAULT_LOADER_NAME;
+ static
+ {
+ try
+ {
+ DEFAULT_LOADER_NAME = new
ObjectName(ServerConstants.DEFAULT_LOADER_NAME);
+ }
+ catch(Exception e)
+ {
+ log.error("Failed to initialize default loader name", e);
+ }
+ }
+ MBeanServer server;
+ List dependantReps;
+
+ /*
+ public DelegatingLoaderRepository() {
+
+ }
+ */
+ public DelegatingLoaderRepository(MBeanServer server)
+ throws AttributeNotFoundException, InstanceNotFoundException,
MBeanException, ReflectionException
+ {
+ this(server, DEFAULT_LOADER_NAME);
+ }
+ public DelegatingLoaderRepository(MBeanServer server, ObjectName
parentName)
+ throws AttributeNotFoundException, InstanceNotFoundException,
MBeanException, ReflectionException
+ {
+ super(server,parentName);
+ this.server = server;
+ }
+
+ // MBean registration - to get at the MBean server!
+ public ObjectName preRegister(MBeanServer server,
+ ObjectName name)
+ throws java.lang.Exception {
+ this.server = server;
+ return name;
+ }
+
+ public void postRegister(java.lang.Boolean registrationDone) {}
+
+ public void preDeregister()
+ throws java.lang.Exception {}
+
+ public void postDeregister() {}
+
+ public void setDependantRepositories(List repositories) {
+ this.dependantReps = repositories;
+ }
+
+ public List getDependantRepositories() {
+ return dependantReps;
+ }
+
+
+ /** Load a class using the repository class loaders.
+ *
+ * @param name The name of the class
+ * @param resolve If <code>true</code>, the class will be resolved
+ * @param scl The asking class loader
+ * @return The loaded class
+ * @throws ClassNotFoundException If the class could not be found.
+ */
+ public Class loadClass(String name, boolean resolve, ClassLoader
scl)
+ throws ClassNotFoundException
+ {
+ Class foundClass = null;
+ try {
+ foundClass = super.loadClass(name, resolve, scl);
+ } catch (ClassNotFoundException e) {} // end of try-catch
+
+ if ( foundClass == null && dependantReps != null) {
+ if (log.isTraceEnabled())
+ log.trace("Looking up class in delegating repositories");
+ Iterator repNames = dependantReps.iterator();
+ while ( repNames.hasNext()) {
+ try {
+ UnifiedLoaderRepository3 repository =
getRepository((ObjectName)repNames.next());
+ foundClass = repository.loadClass(name, resolve, scl);
+ if( foundClass != null )
+ return foundClass;
+ } catch (Exception e) {
+ log.warn("Could not lookup delegating repository:"+e);
+ } // end of try-catch
+
+ } // end of while ()
+
+
+ } // end of if ()
+
+ /* If we reach here, all of the classloaders currently in the VM
don't
+ know about the class
+ */
+ throw new ClassNotFoundException(name);
+ }
+
+
+ /** Find a resource from this repository. This first looks to this
+ * repository and then the parent repository.
+ * @param name The name of the resource
+ * @param scl The asking class loader
+ * @return An URL for reading the resource, or <code>null</code> if
the
+ * resource could not be found.
+ */
+ public URL getResource(String name, ClassLoader scl)
+ {
+ URL resource = super.getResource(name, scl);
+ // Try this repository
+ if ( resource == null && dependantReps != null) {
+ if (log.isTraceEnabled())
+ log.trace("Looking up resource in delegating
repositories");
+ Iterator repNames = dependantReps.iterator();
+ while ( repNames.hasNext()) {
+ try {
+ UnifiedLoaderRepository3 repository =
getRepository((ObjectName)repNames.next());
+ resource= repository.getResource(name, scl);
+ } catch (Exception e) {
+ log.warn("Could not lookup delegating repository:"+e);
+ } // end of try-catch
+
+ } // end of while ()
+
+
+ } // end of if ()
+ return resource;
+ }
+
+
+ /** Called by LoadMgr to locate a previously loaded class. This
looks
+ * first to this repository and then the parent repository.
+ *@return the cached class if found, null otherwise
+ */
+ Class loadClassFromCache(String name)
+ {
+ // Try this repository
+ Class foundClass = super.loadClassFromCache(name);
+
+ if ( foundClass == null && dependantReps != null) {
+ if (log.isTraceEnabled())
+ log.trace("Looking up class in delegating repositories
cache");
+ Iterator repNames = dependantReps.iterator();
+ while ( repNames.hasNext()) {
+ try {
+ UnifiedLoaderRepository3 repository =
getRepository((ObjectName)repNames.next());
+ foundClass = repository.loadClassFromCache(name);;
+ } catch (Exception e) {
+ log.warn("Could not lookup delegating repository:"+e);
+ } // end of try-catch
+
+ }
+ }
+ return foundClass;
+ }
+
+
+ /** Called by LoadMgr to obtain all class loaders. This returns a
set of
+ * PkgClassLoader with the HeirarchicalLoaderRepository3 ordered
ahead of
+ * the parent repository pkg class loaders
+ *@return HashSet<PkgClassLoader>
+ */
+ public HashSet getPackageClassLoaders(String name)
+ {
+ HashSet pkgSet = super.getPackageClassLoaders(name);
+
+ // Place delegating classloader at the tail
+ if ( dependantReps != null) {
+ if (log.isTraceEnabled())
+ log.trace("Adding pkgSet");
+ Iterator repNames = dependantReps.iterator();
+ while ( repNames.hasNext()) {
+ try {
+ UnifiedLoaderRepository3 repository =
getRepository((ObjectName)repNames.next());
+ HashSet repSet =
repository.getPackageClassLoaders(name);
+ if( repSet != null )
+ {
+ Iterator iter = repSet.iterator();
+ while( iter.hasNext() )
+ {
+ Object o = iter.next();
+ PkgClassLoader pkgUcl = null;
+ if ( o instanceof UnifiedClassLoader3 ) {
+ pkgUcl = new
PkgClassLoader((UnifiedClassLoader3)o, 2);//We pu them after 0 and 1 as
used in Heir
+ } else {
+ pkgUcl = (PkgClassLoader)o;
+ pkgUcl.order = 2;
+ } // end of else
+ pkgSet.add(pkgUcl);
+ }
+ }
+ } catch (Exception e) {
+ log.warn("Could not lookup delegating repository:"+e,e);
+ } // end of try-catch
+
+
+ }
+ }
+
+ return pkgSet;
+ }
+
+ protected UnifiedLoaderRepository3 getRepository(ObjectName repName)
throws Exception {
+ return (UnifiedLoaderRepository3)
server.getAttribute((ObjectName)repName,"Instance");
+ }
+}
diff -u -N
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/jmx/src/main/org/jboss/mx/loading/DelegatingLoaderRepositoryMBean.java
./DelegatingLoaderRepositoryMBean.java
---
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/jmx/src/main/org/jboss/mx/loading/DelegatingLoaderRepositoryMBean.java
Thu Jan 1 01:00:00 1970
+++ ./DelegatingLoaderRepositoryMBean.java Thu Feb 13 18:36:44 2003
@@ -0,0 +1,23 @@
+/*
+* JBoss, the OpenSource EJB server
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
+package org.jboss.mx.loading;
+import java.util.List;
+/**
+ * DelegatingLoaderRepositoryMBean.java
+ *
+ *
+ * Created: Thu Feb 13 17:47:56 2003
+ *
+ * @author Peter Antman
+ * @version $Revision$ $Date$
+ */
+
+public interface DelegatingLoaderRepositoryMBean extends
UnifiedLoaderRepository3MBean {
+ public void setDependantRepositories(List repositories);
+
+ public List getDependantRepositories();
+}
And then for server deploy:
Common subdirectories:
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/CVS
and ./CVS
diff -uN
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/DependantEARDeployer.java
./DependantEARDeployer.java
---
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/DependantEARDeployer.java
Thu Jan 1 01:00:00 1970
+++ ./DependantEARDeployer.java Mon Feb 17 14:31:10 2003
@@ -0,0 +1,206 @@
+/*
+* JBoss, the OpenSource EJB server
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
+package org.jboss.deployment;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.w3c.dom.Element;
+import javax.management.ObjectName;
+import javax.management.Attribute;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.DeploymentState;
+import org.jboss.system.ServiceControllerMBean;
+import org.jboss.util.jmx.MBeanProxy;
+import org.jboss.metadata.MetaData;
+import org.jboss.management.j2ee.J2EEApplication;
+/**
+ * DependantEARDeployer.java
+ *
+ *
+ * Created: Fri Feb 14 15:37:19 2003
+ *
+ * @author Peter Antman
+ * @version $Revision$ $Date$
+ */
+
+public class DependantEARDeployer extends EARDeployer {
+ /**
+ * Class name of repository handing dependant reps.
+ */
+ public static final String DEPENDS_REPOSITORY
="org.jboss.mx.loading.DelegatingLoaderRepository";
+ /** A proxy to the ServiceController. */
+ private ServiceControllerMBean serviceController;
+
+
+ public DependantEARDeployer() {
+ super();
+ }
+ /**
+ * The startService method gets the mbeanProxies for MainDeployer
+ * and ServiceController, used elsewhere.
+ *
+ * @exception Exception if an error occurs
+ */
+ protected void startService() throws Exception
+ {
+ super.startService();
+
+ // get the controller proxy
+ serviceController = (ServiceControllerMBean)
MBeanProxy.create(ServiceControllerMBean.class,
+
ServiceControllerMBean.OBJECT_NAME,
+
server);
+
+ }
+
+
+ /**
+ * Handles dependant repositories.
+ * <p>A redeploy of a dependant repository will lead to a redeploy
of this
+ * component.An important aspect of this is
+ * that it is only possible to depend on scoped repositories
+ * created through this deployer!
+ *
+ */
+ protected void initLoaderRepository(DeploymentInfo di, Element
loader) throws Exception {
+ if ( loader==null)
+ return;
+
+ // First check new attr objectName
+ String repositoryName = loader.getAttribute("objectName");
+
+ if (repositoryName == null || repositoryName.length() == 0 ){
+ log.warn("Reading repository name from element content: may
clash with depends definitions " +loader);
+ repositoryName = MetaData.getElementContent(loader);
+ }
+
+ if( repositoryName != null )
+ {
+ log.info("Using loader repository: " + repositoryName);
+ // Check for an implementation class
+ String repositoryClassName =
loader.getAttribute("loaderRepositoryClass");
+ if( repositoryClassName.length() == 0 )
+ repositoryClassName = null;
+ // Get the required object name of the repository
+ ObjectName objectName = new ObjectName(repositoryName);
+ di.setRepositoryInfo(repositoryClassName, objectName);
+
+ // Check for dependant repositories
+ Iterator deps =
MetaData.getChildrenByTagName(loader,"depends");
+ List depends = new ArrayList();
+ while ( deps.hasNext() ) {
+ ObjectName rep = new
ObjectName(MetaData.getElementContent((Element)deps.next()));
+ depends.add(rep);
+
+ } // end of while ()
+ // Create a depends proxy which will redeploy this di when
+ // handled through service controller
+ ObjectName proxy = new ObjectName(
objectName.toString()+"Proxy" );
+ // This is not so funny: if proxy exists and is in started
state
+ // this deployment in really done through it because of a
dependnant
+ // redeploy!
+ if (!isProxyActive(proxy, DeploymentState.STARTED)) {
+ // It might still be there, for example if repository
(component)
+ // it depends on was just removed or because an error
during
+ // deployment
+ serviceController.remove(proxy);
+
+ server.createMBean(
"org.jboss.deployment.RepositoryProxy", proxy);
+ // FIXME: does depends still work when a dependant rep was
recreated?
+ serviceController.create(proxy,depends);
+ serviceController.start(proxy);
+ server.setAttribute( proxy, new
Attribute("DeploymentInfo",di));
+ }
+ // for another rep to be able to depend on this rep, register
it
+ // see start():
+ //serviceController.create(objectName);
+ //serviceController.start(objectName);
+
+ // Add deps
+ if ( DEPENDS_REPOSITORY.equals(repositoryClassName)) {
+ server.setAttribute(objectName, new
Attribute("DependantRepositories",depends) );
+ }
+ }
+ }
+
+ public void start(DeploymentInfo di) throws DeploymentException {
+ super.start(di);
+
+ // Now we "start" the repository when this module is fully loaded
+ try {
+ serviceController.create(di.repositoryName);
+ serviceController.start(di.repositoryName);
+ } catch (Exception e) {
+ throw new DeploymentException("Could not start repository: "
+e,e);
+ } // end of try-catch
+
+ }
+
+ /**
+ * Describe <code>destroy</code> method here.
+ *
+ * @param di a <code>DeploymentInfo</code> value
+ * @exception DeploymentException if an error occurs
+ */
+ public void destroy(DeploymentInfo di) throws DeploymentException
+ {
+ log.info("Undeploying J2EE application, destroy step: " +
di.url);
+ // Remove any deployment specific repository
+ if(
di.repositoryName.equals(DeploymentInfo.DEFAULT_LOADER_REPOSITORY) ==
false )
+ {
+ log.debug("Destroying ear loader
repository:"+di.repositoryName);
+ try
+ {
+ // We let the controller do this so that dependant reps get
to
+ // know it!
+ //this.server.unregisterMBean(di.repositoryName);
+ serviceController.stop(di.repositoryName);
+ serviceController.destroy(di.repositoryName);
+ serviceController.remove(di.repositoryName);
+
+ // Here we have an unsolved problem: if we had an rep proxy
+ // how do we take it down
+ // Take down proxy
+ ObjectName proxy = new ObjectName(
di.repositoryName.toString()+"Proxy" );
+ // Hopfully we can skip service steps
+ if (!isProxyActive(proxy,DeploymentState.STOPPED)) {
+ // remove seems to invoke stop anyhow! if we are not
stopped
+ // here we where not dependant on anyone. Remove DI.
+ server.setAttribute( proxy, new
Attribute("DeploymentInfo",null));
+ serviceController.remove(proxy);
+ }
+ }
+ catch(Exception e)
+ {
+ log.warn("Failed to unregister ear loader repository", e);
+ }
+ }
+
+ // Destroy the appropriate JSR-77 instance
+ J2EEApplication.destroy(server, di.shortName);
+ }
+
+ /**
+ * Check if the proxy is active; i.e the current cycle is actually
+ * an effect of the proxy doing its work.
+ */
+ boolean isProxyActive(ObjectName proxyName, DeploymentState state)
throws DeploymentException{
+ if (proxyName == null || state == null)
+ throw new IllegalArgumentException("Argument null
proxyName="+proxyName+" state="+state);
+ try {
+ // Is there a proxy at al
+ if (server.isRegistered(proxyName)) {
+ if (state ==
server.getAttribute(proxyName,"DeploymentState") )
+ return true;
+
+ }
+ }catch(javax.management.JMException e) {
+ throw new DeploymentException("Could not check if repository
proxy was active: " + e,e);
+ }
+
+ return false;
+ }
+}
diff -uN
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/EARDeployer.java
./EARDeployer.java
---
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/EARDeployer.java
Sun Jan 12 21:04:16 2003
+++ ./EARDeployer.java Fri Feb 14 15:47:11 2003
@@ -115,17 +115,8 @@
metaData.importXml(jbossApp, true);
// Check for a loader-repository for scoping
Element loader = MetaData.getOptionalChild(jbossApp,
"loader-repository");
- String repositoryName =
MetaData.getOptionalChildContent(jbossApp, "loader-repository");
- if( repositoryName != null )
- {
- // Check for an implementation class
- String repositoryClassName =
loader.getAttribute("loaderRepositoryClass");
- if( repositoryClassName.length() == 0 )
- repositoryClassName = null;
- // Get the required object name of the repository
- ObjectName objectName = new ObjectName(repositoryName);
- di.setRepositoryInfo(repositoryClassName, objectName);
- }
+ initLoaderRepository(di,loader);
+
}
// resolve the watch
@@ -236,6 +227,23 @@
di.localUrl
);
}
+
+ protected void initLoaderRepository(DeploymentInfo di, Element
loader) throws Exception {
+ if ( loader==null)
+ return;
+
+ String repositoryName = MetaData.getElementContent(loader);
+ if( repositoryName != null )
+ {
+ // Check for an implementation class
+ String repositoryClassName =
loader.getAttribute("loaderRepositoryClass");
+ if( repositoryClassName.length() == 0 )
+ repositoryClassName = null;
+ // Get the required object name of the repository
+ ObjectName objectName = new ObjectName(repositoryName);
+ di.setRepositoryInfo(repositoryClassName, objectName);
+ }
+ }
/**
* Describe <code>destroy</code> method here.
diff -uN
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/RepositoryProxy.java
./RepositoryProxy.java
---
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/RepositoryProxy.java
Thu Jan 1 01:00:00 1970
+++ ./RepositoryProxy.java Mon Feb 17 09:12:04 2003
@@ -0,0 +1,72 @@
+/*
+* JBoss, the OpenSource EJB server
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
+package org.jboss.deployment;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.DeploymentState;
+import org.jboss.system.ServiceMBeanSupport;
+/**
+ * RepositoryProxy.java
+ *
+ *
+ * Created: Fri Feb 14 17:29:29 2003
+ *
+ * @author Peter Antman
+ * @version $Revision$ $Date$
+ */
+
+public class RepositoryProxy extends ServiceMBeanSupport
+ implements RepositoryProxyMBean {
+ DeploymentInfo di;
+ DeploymentState state;
+ public void setDeploymentInfo(DeploymentInfo di) {
+ this.di = di;
+ }
+
+ public DeploymentInfo getDeploymentInfo() {
+ return di;
+ }
+
+ public DeploymentState getDeploymentState() {
+ return state;
+ }
+
+ /**
+ * Performs SubDeployer registration.
+ */
+ protected void startService() throws Exception
+ {
+ if ( di != null) {
+ state = DeploymentState.STARTED;
+ log.info("Deploying " + di);
+ // This is a dependant redeploy!
+
server.invoke(org.jboss.deployment.MainDeployerMBean.OBJECT_NAME,
+ "deploy",
+ new Object[] {di},
+ new String[]
{"org.jboss.deployment.DeploymentInfo"});
+ } // end of if ()
+
+ }
+
+ /**
+ * Performs SubDeployer registration.
+ */
+ protected void stopService() throws Exception
+ {
+ if ( di != null) {
+ state = DeploymentState.STOPPED;
+ log.info("Undeploying " + di);
+ // This is a dependant undeploy!
+
server.invoke(org.jboss.deployment.MainDeployerMBean.OBJECT_NAME,
+ "undeploy",
+ new Object[] {di},
+ new String[]
{"org.jboss.deployment.DeploymentInfo"});
+ } // end of if ()
+
+ }
+
+
+}
diff -uN
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/RepositoryProxyMBean.java
./RepositoryProxyMBean.java
---
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/RepositoryProxyMBean.java
Thu Jan 1 01:00:00 1970
+++ ./RepositoryProxyMBean.java Mon Feb 17 09:11:56 2003
@@ -0,0 +1,23 @@
+/*
+* JBoss, the OpenSource EJB server
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
+package org.jboss.deployment;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.DeploymentState;
+import org.jboss.system.ServiceMBean;
+/**
+ *
+ * @author Peter Antman
+ * @version $Revision$ $Date$
+ */
+
+public interface RepositoryProxyMBean extends ServiceMBean {
+ public void setDeploymentInfo(DeploymentInfo di);
+
+ public DeploymentInfo getDeploymentInfo();
+
+ public DeploymentState getDeploymentState();
+}
Common subdirectories:
/home/pra/src/rw/jboss-versions/3.0.x/ro/jboss-3.0/server/src/main/org/jboss/deployment/scope
and ./scope
//Peter
On Tue, 2003-02-18 at 20:23, Scott M Stark wrote:
> Submit it as a patch so I can take a look at it. Alternate class loading
> strategies should certainly be available. Basically you want to deploy
> components that are dependent on each other based on type without
> having to aggregate them into the same deployment unit which is what
> is required now.
>
> xxxxxxxxxxxxxxxxxxxxxxxx
> Scott Stark
> Chief Technology Officer
> JBoss Group, LLC
> xxxxxxxxxxxxxxxxxxxxxxxx
>
> ----- Original Message -----
> From: "Peter Antman" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 18, 2003 10:51 AM
> Subject: [JBoss-dev] Dependant classloader repository
>
>
> >
> >
> > Hi,
> > I would like to share some ideas about extensions to the current
> > classloader to see if I am totally on the wrong track and if it
> > perhaps would be a welcome addition to JBoss.
> >
> > First I have to say that I still find the "new" classloader
> > architecture somewhat limiting. If you have the following two
> > conditions:
> >
> > 1. You do not want components/classes globally available in the
> > repository because this stops from implementation/interface
> > versioning.
> > 2. You want to be able to partition your stuff in several deployable
> > components (locally/remote), but which uses each other (EJB:s
> > calling EJB:s, MBeans calling MBeans (locally and through RMI),
> > MBeans calling EJB:s and EJB:s calling MBeans).
> >
> > The you basically have to do a couple of things:
> >
> > 1. Be very paranoid about what classes get stuffed into your
> > components.
> > 2. Up to the last classloader change stuff almost every class at the
> > global
> > level anyhow, through lib or a dynamic classloader deployer, and
> > after
> > the latest changes at least place all interfaces statically
> > available in the global classloader repository.
> >
> > To me this hinders one of the aspects that has always was dear to
> > me: hot redeploy.
> >
> > Here is an idea (with a working test implementation) to make these
> > obstacles possible to overcome:
> >
> > Create a repository which may delegate to other repositories (not just
> > a parent repository) and make this configurable in jboss-app.xml
> >
> > Create dependency checks so that lifecykling a component with a
> > repository which have dependent repositories will make also these
> > components "lifecyking".
> >
> > Here is the basic steps I took to create this:
> >
> > 1. Create a DelegatingLoaderRepository which extends
> > HeirarchicalLoaderRepository3. The delegating repository takes a
> > list of repositories to delegate to if the normal loading fails.
> >
> > 2. Factor out repository handling in EARDeployer, extends EARDeployer
> > with a DependantEARDeployer.
> >
> > EAR:s deployed through this new deployer may set up dependencies
> > between its own repository and the repositories of other
> > components. These other repositories must however also have been
> > created through the dependent deployer; because the repository must
> > be installed in the ServiceController.
> >
> > For a repository created through the DependantEARDeployer a
> > RepositoryProxy is created which will work as a proxy to track
> > dependency events from the ServiceController. The proxy also takes
> > the DeploymentInfo of the components; which makes it possible for
> > the proxy to redeploy its component!
> >
> > server.createMBean( "org.jboss.deployment.RepositoryProxy",
> > proxy);
> > serviceController.create(proxy,depends);
> > serviceController.start(proxy);
> > server.setAttribute( proxy, new
> > Attribute("DeploymentInfo",di));
> >
> > The repository is then added to ServiceController in the start face
> > of the deployment (so that all its subcomponents is available and
> > added to the repository).
> >
> >
> > So, how can this be used?
> >
> > Say we have component A and B. B needs to call A.
> >
> > jboss-app of A:
> > <jboss-app>
> > <loader-repository>:loader=compA</loader-repository>
> >
> >
> > jboss-app of B:
> > <jboss-app>
> > <loader-repository
> >
> > loaderRepositoryClass="org.jboss.mx.loading.DelegatingLoaderRepository"
> > objectName=":loader=compB"
> > ><depends><depends>:loader=compA</depends></loader-repository>
> >
> >
> > When both components are deployed it is possible to:
> > - redeploy B as ordinary
> > - redeploy A with new classes -> B will be redeployed automatically
> >
> > Extended example: component C is dependent of B:
> > <jboss-app>
> > <loader-repository
> >
> > loaderRepositoryClass="org.jboss.mx.loading.DelegatingLoaderRepository"
> > objectName=":loader=compC"
> > ><depends><depends>:loader=compB</depends></loader-repository>
> >
> >
> > - Redeploying B will lead to C being redeployed:
> > - Redeploying A will leas to B and C being redeployed.
> >
> >
> > Circular example:
> > B depends on A, C depends on B and A:
> >
> > <loader-repository
> >
> > loaderRepositoryClass="org.jboss.mx.loading.DelegatingLoaderRepository"
> > objectName=":loader=compC"
> >
> >
>><depends><depends>:loader=compA</depends><depends>:loader=compB</depends></loader-repository>
> >
> > This works nice to (but is actually not needed since C will see A
> > through B).
> >
> > What do you say: is there any hidden pitfalls you immediately see with
> > this approach? Would it perhaps be something that should be integrated
> > into JBoss?
> >
> > //Peter
> > --
> > ------------------------------------------------------------
> > Peter Antman Chief Technology Officer, Development
> > Technology in Media, Box 34105 100 26 Stockholm
> > WWW: http://www.tim.se WWW: http://www.backsource.org
> > Email: [EMAIL PROTECTED]
> > Phone: +46-(0)8-506 381 11 Mobile: +46-(0)704 20 58 11
> > ------------------------------------------------------------
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
--
------------------------------------------------------------
Peter Antman Chief Technology Officer, Development
Technology in Media, Box 34105 100 26 Stockholm
WWW: http://www.tim.se WWW: http://www.backsource.org
Email: [EMAIL PROTECTED]
Phone: +46-(0)8-506 381 11 Mobile: +46-(0)704 20 58 11
------------------------------------------------------------
-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development