User: cgjung Date: 01/05/18 08:04:56 Modified: src/main/org/jboss/deployment J2eeDeployer.java Installer.java Deployment.java Log: A very few modifiers opened up to allow subclassing of J2eeDeployer. Some public accessors to Deployment. Maintain deployment.sourceUrl in Installer. Revision Changes Path 1.24 +31 -17 jboss/src/main/org/jboss/deployment/J2eeDeployer.java Index: J2eeDeployer.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/J2eeDeployer.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- J2eeDeployer.java 2001/05/16 16:54:16 1.23 +++ J2eeDeployer.java 2001/05/18 15:04:56 1.24 @@ -70,7 +70,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a> * @author Toby Allsopp ([EMAIL PROTECTED]) -* @version $Revision: 1.23 $ +* @version $Revision: 1.24 $ */ public class J2eeDeployer extends ServiceMBeanSupport @@ -85,20 +85,24 @@ // Attributes ---------------------------------------------------- // my server to lookup for the special deployers - MBeanServer server; + // <comment author="cgjung">better be protected for subclassing </comment> + protected MBeanServer server; - String name; + // <comment author="cgjung">better be protected for subclassing </comment> + protected String name; // names of the specials deployers - ObjectName jarDeployer; - ObjectName warDeployer; + // <comment author="cgjung">better be protected for subclassing </comment> + protected ObjectName jarDeployer; + protected ObjectName warDeployer; String jarDeployerName; String warDeployerName; int classpathPolicy = EASY; - InstallerFactory installer; + // <comment author="cgjung"> better be protected for subclassing </comment> + protected InstallerFactory installer; // Static -------------------------------------------------------- /** only for testing...*/ @@ -401,21 +405,23 @@ * by the given deployment of the given deployment. <br> * This means download the needed packages do some validation... * <i> Validation and do some other things is not yet implemented </i> + * <comment author="cgjung"> better be protected for subclassing </comment> * @param _downloadUrl the url that points to the app to install * @throws IOException if the download fails * @throws J2eeDeploymentException if the given package is somehow inconsistent */ - Deployment installApplication (URL _downloadUrl) throws IOException, J2eeDeploymentException + protected Deployment installApplication (URL _downloadUrl) throws IOException, J2eeDeploymentException { return installer.install(_downloadUrl); } /** Deletes the file tree of the specified application. <br> - * @param _name the directory (DEPLOYMENT_DIR/<_name> to remove recursivly + * <comment author="cgjung">better be protected for subclassing</comment> + * @param _name the directory (DEPLOYMENT_DIR/<_name> to remove recursivly * @throws IOException if something goes wrong */ - void uninstallApplication (String _pattern) throws IOException + protected void uninstallApplication (String _pattern) throws IOException { Deployment d = installer.findDeployment (_pattern); @@ -423,7 +429,7 @@ uninstallApplication (d); } - void uninstallApplication (Deployment _d) throws IOException + protected void uninstallApplication (Deployment _d) throws IOException { log.log ("Destroying application " + _d.name); installer.uninstall(_d); @@ -433,11 +439,12 @@ /** Starts the successful downloaded deployment. <br> * Means the modules are deployed by the responsible container deployer + * <comment author="cgjung">better be protected for subclassing </comment> * @param _d the deployment to start * @throws J2eeDeploymentException if an error occures for one of these * modules */ - private void startApplication (Deployment _d) throws J2eeDeploymentException + protected void startApplication (Deployment _d) throws J2eeDeploymentException { // save the old classloader ClassLoader oldCl = Thread.currentThread().getContextClassLoader (); @@ -519,11 +526,12 @@ /** Stops a running deployment. <br> * Means the modules are undeployed by the responsible container deployer + * <comment author="cgjung">better protected for subclassing</comment> * @param _d the deployment to stop * @throws J2eeDeploymentException if an error occures for one of these - * modules + * modules */ - private void stopApplication (Deployment _d) throws J2eeDeploymentException + protected void stopApplication (Deployment _d) throws J2eeDeploymentException { // save the old classloader, tomcat replaces my classloader somehow?! ClassLoader oldCl = Thread.currentThread().getContextClassLoader (); @@ -660,8 +668,10 @@ - /** tests if the web container deployer is available */ - private boolean warDeployerAvailable () + /** tests if the web container deployer is available + * <comment author="cgjung"> better be protected for subclassing </comment> + */ + protected boolean warDeployerAvailable () { return server.isRegistered (warDeployer); } @@ -669,9 +679,13 @@ /** * creates an application class loader for this deployment - * this class loader will be shared between jboss and tomcat via the contextclassloader + * this class loader will be shared between jboss and tomcat via the contextclassloader. May throw + * a J2eeDeploymentException to indicate problems stting up the classloader. + * <comment author="cgjung"> should be protected in order to allow reasonable subclassing. Needs an + * exception in case that you do more sophisticated meta-data installations. + * </comment> */ - private void createContextClassLoader(Deployment deployment) { + protected void createContextClassLoader(Deployment deployment) throws J2eeDeploymentException { // get urls we want all classloaders of this application to share URL[] urls = new URL[deployment.commonUrls.size ()]; 1.6 +5 -1 jboss/src/main/org/jboss/deployment/Installer.java Index: Installer.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/Installer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Installer.java 2001/02/23 06:24:16 1.5 +++ Installer.java 2001/05/18 15:04:56 1.6 @@ -58,7 +58,7 @@ * * @see <related> * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a> - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ public class Installer { @@ -128,6 +128,10 @@ d = new Deployment(); Deployment.Module m = null; d.name = getName (src.toString()); + + // <code author="cgjung"> is needed for redeployment purposes + d.sourceUrl=src; + // </code> baseDir = new File (factory.baseDir, d.name); 1.7 +72 -4 jboss/src/main/org/jboss/deployment/Deployment.java Index: Deployment.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/Deployment.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Deployment.java 2000/12/07 15:44:06 1.6 +++ Deployment.java 2001/05/18 15:04:56 1.7 @@ -16,7 +16,7 @@ /** Represents a J2EE application or module (EJB.jar, Web.war or App.ear). <br> * * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a> -* @version $Revision: 1.6 $ +* @version $Revision: 1.7 $ */ public class Deployment implements java.io.Serializable @@ -43,7 +43,7 @@ /** the WEB Modules */ protected Vector webModules; - /** Creates a new Deployment object. */ + /** Creates a new Deployment object. */ Deployment () { date = new Date(); @@ -59,8 +59,51 @@ { return new Module (); } + + /** returns the name of this deployment + */ + public String getName() { + return name; + } + + /** returns the source url that points to from where this deployment has been + * downloaded + * @author cgjung + */ + public URL getSourceUrl() { + return sourceUrl; + } + + /** returns the local url that points to the place where this deployment + * has been downloaded + * @author cgjung + */ + public URL getLocalUrl() { + return localUrl; + } + + /** returns the common urls + * @author cgjung + */ + public Vector getCommonUrls() { + return commonUrls; + } - /** returns all files (URLs) that are needed to run this deployment properly */ + /** returns the ejbModules + * @author cgjung + */ + public Vector getEjbModules() { + return ejbModules; + } + + /** returns the webModules + * @author cgjung + */ + public Vector getWebModules() { + return webModules; + } + + /** returns all files (URLs) that are needed to run this deployment properly */ public Vector getAllFiles() { // the common libs @@ -102,7 +145,7 @@ /** Represents a J2ee module. */ - class Module + public class Module implements java.io.Serializable { /** a short name for the module */ @@ -123,5 +166,30 @@ { localUrls = new Vector (); } + + /** + * returns the local urls + * @author cgjung + */ + public Vector getLocalUrls() { + return localUrls; + } + + /** + * returns the name + * @author cgjung + */ + public String getName() { + return name; + } + + /** + * returns the web context + * @author cgjung + */ + public String getWebContext() { + return webContext; + } + } } _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development