Hi there,
I just wanted to throw in that after clearing up a few things here at infor
and reading the ejb-ref part of the EJB2.0 spec, I�m at it and would like to
synchronize work with Toby (and Sebastian and Daniel, maybe) on the issue.
If you would not mind, I�ll leave this "automatic registering of subordinate
deployment services at the J2EEDeployer" out, for the moment, because I
think that after a bit of refactoring, this can be easily put in.
So the first thing that is fairly easy to do, is to have that general
DeployerMBean interface and a general DeploymentException (first proposal
attached: main extension is that the deployers now also expose an
un/is/deploy(URL) method, a deploy(URL,ClassLoader) method that explicitely
takes the parent ClassLoader as an argument, and a whereDeployed(URL) method
that returns the actual ClassLoader into which this part of the application
has been put.)
/*
* JBoss, the OpenSource EJB server
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.deployment;
import java.net.MalformedURLException;
import java.io.IOException;
import org.jboss.util.ServiceMBean;
import java.net.URL;
/**
* Generic JMX interface of a deployment service.
* @author Christoph.Jung ([EMAIL PROTECTED])
* @version $Revision: 1.3 $
*/
public interface DeployerMBean extends ServiceMBean {
// Constants -----------------------------------------------------
// Public --------------------------------------------------------
/**
* the "usual" (re-)deploy method that is used from external JMX clients
* url should indeed have proper URL syntax, else a @throws
MalformedURLException is thrown
*/
public void deploy(String url) throws MalformedURLException,
IOException, J2eeDeploymentException;
/**
* the "usual" undeploy method that is used from external JMX clients
* url should indeed have proper URL syntax, else a @throws
MalformedURLException is thrown
*/
public void undeploy(String url) throws MalformedURLException,
IOException, DeploymentException;
/**
* the "usual" method to find out whether an application is actually
running
* url should indeed have proper URL syntax, else a @throws
MalformedURLException is thrown
*/
public boolean isDeployed(String url) throws MalformedURLException,
DeploymentException;
/** the url-based deploy method that is used internally */
public void deploy(URL url) throws IOException, DeploymentException;
/** the url-based undeploy method that is used internally */
public void undeploy(URL url) throws IOException, DeploymentException;
/** the url-based, internal method to find out whether an application is
actually running */
public boolean isDeployed(URL url) throws DeploymentException;
/**
* extended url-based deploy method that is used internally and accepts
an already given
* @arg parentClassLoader as its basis. This is used for chaining
deployment services under the same "roof".
*/
public void deploy(URL url, ClassLoader parentClassLoader) throws
IOException, DeploymentException;
/**
* extended method to find out whether and in which classloader
* an application is actually running
*/
public ClassLoader whereDeployed(URL url) throws DeploymentException;
}
/*
* JBoss, the OpenSource EJB server
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.deployment;
/**
* General exception to indicate that some deployment process failed.
*
* @author Christoph G. Jung ([EMAIL PROTECTED])
* @version $Revision: 1.2 $
*/
public class DeploymentException
extends Exception
{
// carries a nested exception
Exception exception;
// Constructors --------------------------------------------------
public DeploymentException (String message)
{
super (message);
}
public DeploymentException (String message, Exception e)
{
super (message);
this.exception = e;
}
public Exception getException()
{
return exception;
}
}
They should next be implemented/subclassed by the
J2EEDeployer/J2EEDeploymentException, the
ContainerFactory/DeploymentException, the
EmbeddedTomcatService/ETDeploymentException, (whereelse should I look ?),
and maybe that abstract DeploymentMBeanSupport that Toby and Marc were
talking about ...
Third step should be the discussed chaining behaviour: I would like
application.xml/J2EEApplicationMetaData being able to point to one/several
"parent ears" and implement the non-cyclic recursive deployment there.
For the ejb-ref thing, because it�s not part of the application.xml, we need
AFAIS a recursive (un)deploy call from ContainerFactory to J2EEDeployer in
order to get the discussed (maybe cyclic) ejb-ref thing working.
That�s not fully resolved now, but I think that for this purpose,
J2EEDeployer must keep a hashtable of URL-->ClassLoader associations and
ContainerFactory needs a map from URL to Set(URL) which is the clique of
interdependent ears that is teared down together.
Best,
CGJ