[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: d_jencks Date: 02/02/21 23:02:53 Modified:src/main/org/jboss/deployment MainDeployer.java Log: Fixed compilation problems from previous refactoring. JNDIView list works, but JNDIView list and BeanCacheMonitor do not work: I will fix them shortly Revision ChangesPath 1.22 +2 -2 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- MainDeployer.java 22 Feb 2002 04:24:55 - 1.21 +++ MainDeployer.java 22 Feb 2002 07:02:53 - 1.22 @@ -46,7 +46,7 @@ * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark - * @version $Revision: 1.21 $ + * @version $Revision: 1.22 $ */ public class MainDeployer extends ServiceMBeanSupport @@ -506,7 +506,7 @@ } else { -log.info("No deployer for package: " + deployment.url); +log.debug("No deployer for package: " + deployment.url); } // end of else ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: starksm Date: 02/02/21 00:41:10 Modified:src/main/org/jboss/deployment MainDeployer.java Log: Simple fix for the current war deployment problems, don't do subdeployments of the contents of wars. Revision ChangesPath 1.20 +6 -5 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- MainDeployer.java 15 Feb 2002 06:18:30 - 1.19 +++ MainDeployer.java 21 Feb 2002 08:41:08 - 1.20 @@ -45,7 +45,8 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @version $Revision: 1.19 $ + * @author mailto:[EMAIL PROTECTED]";>Scott Stark + * @version $Revision: 1.20 $ */ public class MainDeployer extends ServiceMBeanSupport @@ -685,10 +686,11 @@ protected void deploySubPackages(DeploymentInfo di) throws DeploymentException { - // If XML only no subdeployment to speak of + // If XML only no subdeployment to speak of. We also do not + // break a war into subdeployments as this opens the door to + // servlet 2.3 classloading stuff we don't want to deal with here // FIXME do the sub deploy for directory and the move to - // if (di.isXML) return; - if (di.isXML || di.isDirectory) + if (di.isXML || di.isDirectory || di.shortName.endsWith(".war") ) { return ; } @@ -1020,4 +1022,3 @@ private synchronized int getNextID() { return id++;} } - ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: d_jencks Date: 02/02/12 23:19:24 Modified:src/main/org/jboss/deployment MainDeployer.java Log: added synchronization Revision ChangesPath 1.18 +93 -71jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- MainDeployer.java 13 Feb 2002 04:26:39 - 1.17 +++ MainDeployer.java 13 Feb 2002 07:19:24 - 1.18 @@ -45,7 +45,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @version $Revision: 1.17 $ + * @version $Revision: 1.18 $ */ public class MainDeployer extends ServiceMBeanSupport @@ -153,7 +153,10 @@ public Collection listDeployed() { - return new ArrayList(deploymentsList); + synchronized (deploymentsList) + { + return new ArrayList(deploymentsList); + } } public void addDeployer(DeployerMBean deployer) @@ -302,7 +305,7 @@ { try { - DeploymentInfo sdi = (DeploymentInfo) deployments.get(new URL(url)); + DeploymentInfo sdi = getDeployment(new URL(url)); if (sdi!= null) { @@ -352,12 +355,14 @@ try { // remove from local maps - deployments.remove(di.url); - if (deploymentsList.lastIndexOf(di) != -1) + synchronized (deploymentsList) { -deploymentsList.remove(deploymentsList.lastIndexOf(di)); +deployments.remove(di.url); +if (deploymentsList.lastIndexOf(di) != -1) +{ + deploymentsList.remove(deploymentsList.lastIndexOf(di)); +} } - // Nuke my stuff, this includes the class loader di.cleanup(log); @@ -397,7 +402,7 @@ public void deploy(URL url) { - DeploymentInfo sdi = (DeploymentInfo) deployments.get(url); + DeploymentInfo sdi = getDeployment(url); try { // if it does not exist create a new deployment @@ -421,7 +426,7 @@ try { // If we are already deployed return - if (deployments.containsKey(deployment.url)) + if (isDeployed(deployment.url)) { return; } @@ -468,16 +473,19 @@ // whether you do it or not, for the autodeployer deployment.lastDeployed = System.currentTimeMillis(); - //watch it, it will be picked up as modified below, deployments is a map duplicates are ok - deployments.put(deployment.url, deployment); - - // Do we watch it? Watch only urls outside our copy directory. - if (!deployment.url.toString().startsWith(tempDirString)) + synchronized (deploymentsList) { -deploymentsList.add(deployment); -if (debug) +//watch it, it will be picked up as modified below, deployments is a map duplicates are ok +deployments.put(deployment.url, deployment); + +// Do we watch it? Watch only urls outside our copy directory. +if (!deployment.url.toString().startsWith(tempDirString)) { - log.debug("Watching new file: " + deployment.url); + deploymentsList.add(deployment); + if (debug) + { + log.debug("Watching new file: " + deployment.url); + } } } } @@ -547,7 +555,7 @@ log.trace("Checking deployment file: "+files[i]); } // It is a new file - if (!deployments.containsKey(files[i].toURL())) + if (!isDeployed(files[i].toURL())) { newDeployments.add(files[i].toURL()); } @@ -576,28 +584,31 @@ log.trace("Scanning installed deployments"); } // People already deployed, scan for modifications - for (Iterator it = deploymentsList.listIterator(); it.hasNext(); ) + synchronized (deploymentsList) { - DeploymentInfo deployment = (DeploymentInfo) it.next(); - if (deployment.url.getProtocol().startsWith("file")) + for (Iterator it = deploymentsList.listIterator(); it.hasNext(); ) { -File theFile = new File(deployment.url.getFile()); -if (!theFile.exists()) +DeploymentInfo deployment = (DeploymentInfo) it.next(); +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java SARDeployer.java
User: user57 Date: 02/02/12 20:26:40 Modified:src/main/org/jboss/deployment MainDeployer.java SARDeployer.java Log: o These are all kinda related, so I am commiting them together o This is the second half of the migration to using ObjectName OBJECT_NAME o Not using jboss.system.* properties anywhere (one place in testsuite which I am ignoring for now) o StateManager will now read its config from a url (configURL), and only attempt to write it back out if that is a file URL. Need to fix this to not need to write back to a config file. o Still setting jboss.home & jboss.system.home, but use ServerConfigMBean to get the proper bits, will eventually abstract all file access out o Added a simple locator to find a mbean server. This is trivial code, but helps clean up client code and makes it obvious what it does. Revision ChangesPath 1.17 +2 -2 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- MainDeployer.java 13 Feb 2002 03:38:32 - 1.16 +++ MainDeployer.java 13 Feb 2002 04:26:39 - 1.17 @@ -45,7 +45,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @version $Revision: 1.16 $ + * @version $Revision: 1.17 $ */ public class MainDeployer extends ServiceMBeanSupport @@ -104,7 +104,7 @@ while (urls.hasMoreTokens()) { addDirectory(urls.nextToken().trim()) ; - } + } } public void addDirectory(String url) throws MalformedURLException 1.12 +29 -25jboss/src/main/org/jboss/deployment/SARDeployer.java Index: SARDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/SARDeployer.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- SARDeployer.java 12 Feb 2002 06:59:23 - 1.11 +++ SARDeployer.java 13 Feb 2002 04:26:40 - 1.12 @@ -67,7 +67,7 @@ * @author mailto:[EMAIL PROTECTED]";>David Maplesden * @author mailto:[EMAIL PROTECTED]";>David Jencks * @author mailto:[EMAIL PROTECTED]";>Jason Dillon - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ * * 20010830 marc fleury: * @@ -114,22 +114,18 @@ /** A proxy to the MainDeployer. */ private MainDeployerMBean mainDeployer; - /** The system state data directory. */ - private File stateDataDir; + /** The system data directory. */ + private File dataDir; + + /** The system install URL. */ + private URL installURL; + + /** The system library URL. */ + private URL libraryURL; // Public /** -* Gets the Name of the ServiceDeployer object -* -* @return returns "ServiceDeployer" -*/ - public String getName() - { - return "ServiceDeployer"; - } - - /** * Gets the FilenameFilter that the AutoDeployer uses to decide which files * will be deployed by the ServiceDeployer. Currently .jsr, .sar, and files * ending in service.xml are accepted. @@ -155,7 +151,6 @@ // We watch the top only, no directory support di.watch = di.url; } - else if(di.url.getProtocol().startsWith("file")) { File file = new File(di.url.getFile()); @@ -195,10 +190,10 @@ // Get the url of the local copy from the classloader. if (debug) { - log.debug("copying from " + di.localUrl + path + " -> " + stateDataDir); + log.debug("copying from " + di.localUrl + path + " -> " + dataDir); } -inflateJar(di.localUrl, stateDataDir, path); +inflateJar(di.localUrl, dataDir, path); } } catch (Exception e) @@ -282,7 +277,6 @@ log.debug("Found classpath element: " + classpathElement); } - //String codebase = System.getProperty("jboss.system.libraryDirectory"); String codebase = ""; String archives = ""; @@ -305,7 +299,12 @@ if (!(codebase.startsWith("http:") || codebase.startsWith("file:"))) { // put the jboss/system base in front of it - codebase = System.getProperty("jboss.system.installationURL")+codebase; + try { +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: d_jencks Date: 02/02/12 19:38:33 Modified:src/main/org/jboss/deployment MainDeployer.java Log: made redeploy work yet again Revision ChangesPath 1.16 +25 -45jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- MainDeployer.java 12 Feb 2002 06:59:22 - 1.15 +++ MainDeployer.java 13 Feb 2002 03:38:32 - 1.16 @@ -45,7 +45,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ public class MainDeployer extends ServiceMBeanSupport @@ -76,6 +76,9 @@ /** The temporary directory for deployments. */ private File tempDir; + /** The string naming the tempDir **/ + private String tempDirString; + /** The system home directory (for dealing with relative file names). */ private File homeDir; @@ -182,38 +185,34 @@ return name == null ? OBJECT_NAME : name; } - /** -* Get the local state data directory from the server configuration. -*/ - public ObjectName preRegister(MBeanServer server, ObjectName name) + protected void createService() throws Exception { - name = super.preRegister(server, name); - + // watch the deploy directory, it is a set so multiple adds + // (start/stop) only one entry is present // get the temporary directory to use - tempDir = (File) - server.getAttribute(ServerConfigMBean.OBJECT_NAME, "TempDir"); - tempDir = new File(tempDir, "deploy"); + tempDir = new File((File)server.getAttribute(ServerConfigMBean.OBJECT_NAME, "TempDir"), + "deploy"); + + //used in isWatched + tempDirString = tempDir.toURL().toString(); // get the system home directory - homeDir = (File) - server.getAttribute(ServerConfigMBean.OBJECT_NAME, "HomeDir"); - - return name; + homeDir = (File)server.getAttribute(ServerConfigMBean.OBJECT_NAME, "HomeDir"); + + //Watch in our standard directory. This should be derived from configuration info. + addDirectory("deploy"); } + /** +* Get the local state data directory from the server configuration. +*/ protected void startService() throws Exception { - // watch the deploy directory, it is a set so multiple adds - // (start/stop) only one entry is present - - // FIXME: Should pull this from ServerConfig - addDirectory("deploy"); - - // Do a first pass + //just so we can time startup... scan(); - + // Start auto deploy thread running = true; @@ -244,7 +243,6 @@ { do { - scan(); // Sleep try { @@ -254,6 +252,7 @@ { log.debug("interrupted"); } + scan(); } while (running); } @@ -472,8 +471,9 @@ //watch it, it will be picked up as modified below, deployments is a map duplicates are ok deployments.put(deployment.url, deployment); - // Do we watch it? - if (isWatched(deployment)) { + // Do we watch it? Watch only urls outside our copy directory. + if (!deployment.url.toString().startsWith(tempDirString)) + { deploymentsList.add(deployment); if (debug) { @@ -483,21 +483,6 @@ } } - private boolean isWatched(DeploymentInfo deployment) { - String tmp = null; - try { - tmp = tempDir.toURL().toString(); - } - catch (java.net.MalformedURLException e) { - // this will never happen, yet must make the compiler happy - throw new Error("Failed to convert File to URL: " + e); - } - - if (deployment.url.toString().startsWith(tmp)) { - return true; - } - return false; - } public void findDeployer(DeploymentInfo sdi) { @@ -529,11 +514,6 @@ } } - public void preDeregister() - throws Exception - { - running = false; - } /** * ScanNew scans the directories that are given to it and returns a ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java MainDeployerMBean.java SARDeployer.java
User: user57 Date: 02/02/11 22:59:23 Modified:src/main/org/jboss/deployment MainDeployer.java MainDeployerMBean.java SARDeployer.java Log: o MainDeployer & SARDeployer use ServerConfig getHomeDir() + getTempDir() and work off of them instead of jboss.system.home property. Revision ChangesPath 1.15 +106 -111 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- MainDeployer.java 12 Feb 2002 05:41:09 - 1.14 +++ MainDeployer.java 12 Feb 2002 06:59:22 - 1.15 @@ -7,10 +7,6 @@ package org.jboss.deployment; - - - - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -39,7 +35,9 @@ import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import org.jboss.system.ServiceMBeanSupport; -import org.jboss.util.DirectoryBuilder; +import org.jboss.system.ServerConfigMBean; + +import org.jboss.util.MBeanProxy; /** * MainDeployer @@ -47,13 +45,12 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ public class MainDeployer extends ServiceMBeanSupport implements MainDeployerMBean, Runnable { - /** Deployers **/ private final Set deployers = new HashSet(); @@ -74,11 +71,15 @@ private int id = 0; /** Given a flat set of files, this is the order of deployment **/ - private final String[] order = {"sar", "service.xml", "rar", "jar", "war", "ear", "zip"}; - - /** Get on period **/ - public void setPeriod(int period) - { + private String[] order = { "sar", "service.xml", "rar", "jar", "war", "ear", "zip" }; + + /** The temporary directory for deployments. */ + private File tempDir; + + /** The system home directory (for dealing with relative file names). */ + private File homeDir; + + public void setPeriod(int period) { this.period = period; } @@ -92,7 +93,7 @@ * Directory get set logic, these are "scanning" directories * on the local filesystem */ - public void setDirectories(String urlList) + public void setDirectories(String urlList) throws MalformedURLException { StringTokenizer urls = new StringTokenizer(urlList, ","); @@ -103,60 +104,47 @@ } } - public void addDirectory(String url) + public void addDirectory(String url) throws MalformedURLException { // We are dealing with a relative path URL - if (!( url.startsWith("file:") || url.startsWith("http:"))) - { - url = "file:"+System.getProperty("jboss.system.home")+File.separator+url; + if (!( url.startsWith("file:") || url.startsWith("http:"))) { + addDirectory(new URL(homeDir.toURL(), url)); } - // Only one entry - try - { - URL dir = new URL(url); + else { + addDirectory(new URL(url)); + } + } + + public void addDirectory(URL url) { + if (!directories.contains(url)) { + directories.add(url); - if (!directories.contains(dir)) - { -directories.add(dir); + if (log.isDebugEnabled()) { +log.debug("Added directory scan "+url); } } - catch (MalformedURLException bad) - { - log.warn("Failed to add directory scan " + url); - return; - } - - if (log.isDebugEnabled()) - { - log.debug("Added directory scan "+url); - } } - public void removeDirectory(String url) + public void removeDirectory(String url) throws MalformedURLException { // We are dealing with a relative path URL - if (!( url.startsWith("file:") || url.startsWith("http:"))) - { - url = System.getProperty("jboss.system.home") + url; + if (!(url.startsWith("file:") || url.startsWith("http:"))) { + removeDirectory(new URL(homeDir.toURL(), url)); } - - try - { - int index = directories.lastIndexOf(new URL(url)); - if (index != -1) - { -directories.remove(index); - } + else { + removeDirectory(new URL(url)); } - catch (MalformedURLException bad) - { - log.warn("Failed to remove directory scan " + url); - ret
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java MainDeployerMBean.java DeploymentInfo.java
User: d_jencks Date: 02/02/11 21:41:09 Modified:src/main/org/jboss/deployment MainDeployer.java MainDeployerMBean.java DeploymentInfo.java Log: cleanup of many deployment/undployment problems including bug 515537, deploy loops on failed deployment Revision ChangesPath 1.14 +299 -215 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- MainDeployer.java 12 Feb 2002 03:22:02 - 1.13 +++ MainDeployer.java 12 Feb 2002 05:41:09 - 1.14 @@ -7,65 +7,63 @@ package org.jboss.deployment; + + + + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.JarURLConnection; +import java.net.MalformedURLException; +import java.net.URL; import java.util.ArrayList; -import java.util.Set; +import java.util.Collection; import java.util.Enumeration; -import java.util.HashSet; -import java.util.Map; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.StringTokenizer; -import java.util.jar.JarFile; import java.util.jar.Attributes; import java.util.jar.JarEntry; +import java.util.jar.JarFile; import java.util.jar.Manifest; - -import java.net.JarURLConnection; -import java.net.URL; -import java.net.MalformedURLException; - -import java.io.InputStream; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; - import javax.management.MBeanServer; -import javax.management.ObjectName; import javax.management.MalformedObjectNameException; - +import javax.management.ObjectName; import org.jboss.system.ServiceMBeanSupport; - import org.jboss.util.DirectoryBuilder; -import org.jboss.util.MBeanProxy; - /** - * Takes a series of URL to watch, detects changes and calls the appropriate Deployers. - * + * MainDeployer + * + * Takes a series of URL to watch, detects changes and calls the appropriate Deployers + * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @author mailto:[EMAIL PROTECTED]";>Jason Dillon - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ */ public class MainDeployer extends ServiceMBeanSupport implements MainDeployerMBean, Runnable { - /** JMX Server **/ - private MBeanServer server; /** Deployers **/ - private Set deployers = new HashSet(); + private final Set deployers = new HashSet(); /** Scanned Directories **/ - private ArrayList directories = new ArrayList(); + private final ArrayList directories = new ArrayList(); /** I always feel like somebody is watching me, contains DeploymentInfo **/ - private Map deployments = new HashMap(); - private ArrayList deploymentsList = new ArrayList(); - + private final Map deployments = new HashMap(); + private final ArrayList deploymentsList = new ArrayList(); + /** Thread running **/ private boolean running = false; @@ -76,16 +74,20 @@ private int id = 0; /** Given a flat set of files, this is the order of deployment **/ - private String[] order = { "sar", "service.xml", "rar", "jar", "war", "ear", "zip" }; + private final String[] order = {"sar", "service.xml", "rar", "jar", "war", "ear", "zip"}; - public void setPeriod(int period) { + /** Get on period **/ + public void setPeriod(int period) + { this.period = period; } - public int getPeriod() { - return period; + public int getPeriod() + { + return period; } + /** * Directory get set logic, these are "scanning" directories * on the local filesystem @@ -106,16 +108,17 @@ // We are dealing with a relative path URL if (!( url.startsWith("file:") || url.startsWith("http:"))) { - url = "file:" + System.getProperty("jboss.system.home") + "/" + url; + url = "file:"+System.getProperty("jboss.system.home")+File.separator+url; } - // Only one entry try { URL dir = new URL(url); - if (!directories.contains(dir)) { - directories.add(dir); - } + + if (!directories.contains(dir)) + { +d
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java SARDeployer.java
User: starksm Date: 02/02/10 09:44:33 Modified:src/main/org/jboss/deployment MainDeployer.java SARDeployer.java Log: Fix problems with handling of file urls on win32 platforms. Revision ChangesPath 1.12 +172 -148 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- MainDeployer.java 9 Feb 2002 16:09:17 - 1.11 +++ MainDeployer.java 10 Feb 2002 17:44:32 - 1.12 @@ -45,7 +45,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ public class MainDeployer extends ServiceMBeanSupport @@ -110,17 +110,18 @@ if (!directories.contains(dir)) directories.add(dir); } - catch (MalformedURLException bad) { - log.warn("Failed to add directory scan "+url); - return; + catch (MalformedURLException bad) + { + log.warn("Failed to add directory scan "+url); + return; } - if (log.isDebugEnabled()) log.debug("Added directory scan "+url); + if (log.isDebugEnabled()) + log.debug("Added directory scan "+url); } public void removeDirectory(String url) { - // We are dealing with a relative path URL if (!( url.startsWith("file:") || url.startsWith("http:"))) { @@ -132,14 +133,16 @@ int index = directories.lastIndexOf(new URL(url)); if (index != -1) directories.remove(index); } - catch (MalformedURLException bad) { - log.warn("Failed to remove directory scan "+url); - return; + catch (MalformedURLException bad) + { + log.warn("Failed to remove directory scan "+url); + return; } - if (log.isDebugEnabled()) log.debug("Removed directory scan "+url); + if (log.isDebugEnabled()) + log.debug("Removed directory scan "+url); } - + public String[] getDeployed() { String[] urls = new String[deployments.size()]; @@ -219,13 +222,14 @@ do { // Sleep - try { - Thread.sleep(period); - } - catch (Exception e) { - log.debug("interrupted"); - } - + try + { +Thread.sleep(period); + } + catch (Exception e) + { +log.debug("interrupted"); + } scan(); } while (running); @@ -237,20 +241,19 @@ { // Scan diretories for new deployments Iterator newDeployments = scanNew().listIterator(); - while (newDeployments.hasNext()) { deploy((URL) newDeployments.next()); } - + // Undeploy and redeployto the modified ones Iterator modified = scanModified().listIterator(); while (modified.hasNext()) { DeploymentInfo di = (DeploymentInfo) modified.next(); - -try { +try +{ // if the url is a file that doesn't exist, it was removed -> undeploy // TODO: check connection on http protocol and see if it is removed. if (di.url.getProtocol().startsWith("file") && !new File(di.url.getFile()).exists()) @@ -263,27 +266,30 @@ undeploy(di); deploy(di); } } -catch (Exception e) { -log.warn("operation failed; ignoring", e); - } +catch (Exception e) +{ + log.warn("operation failed; ignoring", e); +} } } - catch (Exception e) { - log.warn("operation failed; ignoring", e); + catch (Exception e) + { + log.warn("operation failed; ignoring", e); } - } - + } + public void undeploy(String url) { try { DeploymentInfo sdi = (DeploymentInfo) deployments.get(new URL(url)); - if (sdi!= null) undeploy(sdi); - + if (sdi!= null) +undeploy(sdi); } - catch (Exception e) { - log.error("Couldn't undeploy url " + url, e); + catch (Exception e) + { + log.error("Couldn't undeploy url " + url, e); } } @@ -3
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: mnf999 Date: 02/02/06 22:00:16 Modified:src/main/org/jboss/deployment MainDeployer.java Log: Fix for the webinf deployment Revision ChangesPath 1.9 +68 -67jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- MainDeployer.java 2002/02/06 01:58:42 1.8 +++ MainDeployer.java 2002/02/07 06:00:15 1.9 @@ -42,7 +42,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @version $Revision: 1.8 $ +* @version $Revision: 1.9 $ * * */ @@ -310,7 +310,7 @@ // undeploy((DeploymentInfo) subs.next()); log.info("DEPLOYMENT OF SUB "+sub.url); undeploy(sub); - + } // Them remove the deployment itself @@ -554,7 +554,6 @@ // J2EE legacy goo in manifest parseManifestLibraries(di); - JarFile jarFile =null; // Then the packages inside the package being deployed @@ -571,11 +570,6 @@ JarEntry entry = (JarEntry)e.nextElement(); String name = entry.getName(); - // Make sure the name is flat no directory structure in subs name - // example war's WEBINF/lib/myjar.jar appears as myjar.jar in the tmp directory - if (name.lastIndexOf("/") != -1) -name = name.substring(name.lastIndexOf("/")+1); - // Everything that is not // a- an XML file // b- a class in a normal directory structure @@ -588,6 +582,11 @@ || name.endsWith(".zip")) { +// Make sure the name is flat no directory structure in subs name +// example war's WEBINF/lib/myjar.jar appears as myjar.jar in the tmp directory +if (name.lastIndexOf("/") != -1) + name = name.substring(name.lastIndexOf("/")+1); + try { File localCopyDir = new File(System.getProperty("jboss.system.home")+File.separator+"tmp"+File.separator+"deploy"); @@ -610,6 +609,7 @@ // And deploy it, this call is recursive subDeployments.add(sub); + } catch (Exception e2) { @@ -618,7 +618,7 @@ throw new DeploymentException("Could not deploy sub deployment "+name+" of deployment "+di.url); } } - + // WARNING: Do not close the jarFile let it hang until undeployment // The reason is that if you close the jarFile you cannot open streams // to files inside. The bug can be seen as follow @@ -639,23 +639,59 @@ { try{ deploy((DeploymentInfo) lt.next());} - + catch (DeploymentException de) { di.subDeployments.remove(di);} } } - - protected void copy(InputStream in, OutputStream out) - throws IOException + public void parseManifestLibraries(DeploymentInfo sdi) throws DeploymentException { + String classPath = null; - byte[] buffer = new byte[1024]; - int read; - while ((read = in.read(buffer)) > 0) + Manifest mf = sdi.getManifest(); + + if( mf != null ) { - out.write(buffer, 0, read); + Attributes mainAttributes = mf.getMainAttributes(); + classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH); } - } + + URL[] libs = {}; + if (classPath != null) + { + ArrayList tmp = new ArrayList(); + StringTokenizer st = new StringTokenizer(classPath); + log.debug("resolveLibraries: "+classPath); + while (st.hasMoreTokens()) + { +URL lib = null; + +String tk = st.nextToken(); + +DeploymentInfo sub = null; + +log.debug("new manifest entry for sdi at "+sdi.shortName+" entry is "+tk); + +try { + + lib = new URL(sdi.url, tk); + + if (!deployments.containsKey(lib)) + { + + // Try having it as a full subdeployment + sub = new DeploymentInfo(lib, sdi); + + deploy(sub); + } +} +catch (Exception ignore)
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: user57 Date: 02/02/05 17:58:42 Modified:src/main/org/jboss/deployment MainDeployer.java Log: o changed a few info's to debugs o added exitOnShutdown flag to Server, which when set to true will call System.exit and when false will only invoke the shutdown hook. o exposed exit() to compliment the halt() exposure o added exit(int) and halt(int) to expose a bit more control to the admin console. o By default exitOnShutdown will be false, but Main will always set it to true after creation of the Server object, since it is the controlling entity (Server is embeded inside of it). Revision ChangesPath 1.8 +10 -7 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- MainDeployer.java 2002/02/04 01:50:52 1.7 +++ MainDeployer.java 2002/02/06 01:58:42 1.8 @@ -42,7 +42,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @version $Revision: 1.7 $ +* @version $Revision: 1.8 $ * * */ @@ -365,6 +365,8 @@ public void deploy(DeploymentInfo deployment) throws DeploymentException { + boolean debug = log.isDebugEnabled(); + try { // If we are already deployed return if (deployments.containsKey(deployment.url)) return; @@ -389,18 +391,17 @@ if (deployment.deployer != null) deployment.deployer.deploy(deployment); deployment.status="Deployed"; - - log.info("Done deploying "+deployment.shortName); - + + if (debug) { + log.debug("Done deploying " + deployment.shortName); + } } catch (DeploymentException e) { - deployment.status="Deployment FAILED reason: "+e.getMessage(); throw e; } - finally { // whether you do it or not, for the autodeployer @@ -413,7 +414,9 @@ if (!deployment.url.toString().startsWith("file:"+System.getProperty("jboss.system.home")+File.separator+"tmp"+File.separator+"deploy")) { deploymentsList.add(deployment); -if (log.isDebugEnabled()) log.debug("Watching new file: " + deployment.url); +if (debug) { +log.debug("Watching new file: " + deployment.url); + } } } } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: mnf999 Date: 02/02/01 10:27:21 Modified:src/main/org/jboss/deployment MainDeployer.java Log: Fix for the sub directory deployments, if a jar in a sub then it gets deployed at flat level. This fixes a bug in the war deployment Revision ChangesPath 1.5 +8 -3 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MainDeployer.java 2002/02/01 16:32:20 1.4 +++ MainDeployer.java 2002/02/01 18:27:21 1.5 @@ -42,7 +42,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ * * */ @@ -386,7 +386,6 @@ } catch (DeploymentException e) { - log.error("Deployment failed: "+ deployment.url,e); deployment.status="Deployment FAILED reason: "+e.getMessage(); @@ -557,6 +556,11 @@ JarEntry entry = (JarEntry)e.nextElement(); String name = entry.getName(); + // Make sure the name is flat no directory structure in subs name + // example war's WEBINF/lib/myjar.jar appears as myjar.jar in the tmp directory + if (name.lastIndexOf("/") != -1) +name = name.substring(name.lastIndexOf("/")); + // Everything that is not // a- an XML file // b- a class in a normal directory structure @@ -573,6 +577,7 @@ { File localCopyDir = new File(System.getProperty("jboss.system.home")+File.separator+"tmp"+File.separator+"deploy"); + // We use the name of the entry as the name of the file under deploy // (marcf note: I don't think we need the getNextID, not important) File outFile = new File(localCopyDir, name); @@ -595,7 +600,7 @@ catch (DeploymentException e3) { throw e3;} //just throw catch (Exception e2) { - log.error("Error in subDeployment with name "+name); + log.error("Error in subDeployment with name "+name, e2); throw new DeploymentException("Could not deploy sub deployment "+name+" of deployment "+di.url); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: mnf999 Date: 02/01/29 18:32:29 Modified:src/main/org/jboss/deployment MainDeployer.java Log: Fixed the ordering of deployment so we get the nice little message at the end (first pass at deployment on the dependencies) Revision ChangesPath 1.3 +42 -50jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MainDeployer.java 2002/01/30 02:13:03 1.2 +++ MainDeployer.java 2002/01/30 02:32:29 1.3 @@ -42,7 +42,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @version $Revision: 1.2 $ +* @version $Revision: 1.3 $ * * */ @@ -144,22 +144,6 @@ if (log.isDebugEnabled()) log.debug("Removed directory scan "+url); } - /* - public String[] getDirectories() - { - - String[] urls= new String[directories.size()]; - - int i = 0; - Iterator dirs = directories.iterator(); - while (dirs.hasNext()) - urls[i++]= ((URL) dirs.next()).getFile(); - - return urls; - } - */ - - public String[] getDeployed() { String[] urls = new String[deployments.size()]; @@ -216,10 +200,13 @@ // watch the deploy directory, it is a set so multiple adds (start/stop) only one entry is present addDirectory("deploy"); + // Do a first pass + scan(); + // Start auto deploy thread running = true; - // Kick off the thread, since we wait at the end it makes a first run + // Kick off the thread new Thread(this, "MainDeployer").start(); } @@ -248,43 +235,48 @@ catch (Exception ignoredAgain) {log.info("interrupted exception");} - try - { -// Scan diretories for new deployments -Iterator newDeployments = scanNew().iterator(); - -while (newDeployments.hasNext()) -{ - deploy((URL) newDeployments.next()); -} - -// Undeploy and redeployto the modified ones -Iterator modified = scanModified().iterator(); - -while (modified.hasNext()) -{ - DeploymentInfo di = (DeploymentInfo) modified.next(); - - // if the url is a file that doesn't exist, it was removed -> undeploy - // TODO: check connection on http protocol and see if it is removed. - if (di.url.getProtocol().startsWith("file") && !new File(di.url.getFile()).exists()) - { - undeploy(di); - } - // it is a deployment - else - { - undeploy(di); deploy(di); - } -} - } - catch (Exception ignored) {log.info ("exception ", ignored);} + scan(); } while (running); } + public void scan() + { + try + { + // Scan diretories for new deployments + Iterator newDeployments = scanNew().iterator(); + + while (newDeployments.hasNext()) + { +deploy((URL) newDeployments.next()); + } + + // Undeploy and redeployto the modified ones + Iterator modified = scanModified().iterator(); + + while (modified.hasNext()) + { +DeploymentInfo di = (DeploymentInfo) modified.next(); + +// if the url is a file that doesn't exist, it was removed -> undeploy +// TODO: check connection on http protocol and see if it is removed. +if (di.url.getProtocol().startsWith("file") && !new File(di.url.getFile()).exists()) +{ + undeploy(di); +} +// it is a deployment +else +{ + undeploy(di); deploy(di); +} + } + } + catch (Exception ignored) {log.info ("exception ", ignored);} + } + public void undeploy(String url) { @@ -509,7 +501,7 @@ if ( ! theFile.exists()) modified.add(deployment); lastModified = theFile.lastModified(); - } +} // Use URL connection to get lastModified on http else lastModified = dep
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: mnf999 Date: 02/01/29 18:13:03 Modified:src/main/org/jboss/deployment MainDeployer.java Log: Fix for the removal of files Revision ChangesPath 1.2 +6 -6 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MainDeployer.java 2002/01/20 03:41:15 1.1 +++ MainDeployer.java 2002/01/30 02:13:03 1.2 @@ -42,7 +42,7 @@ * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ * * */ @@ -505,11 +505,11 @@ // Get lastModified of file from file system if (deployment.watch.getProtocol().startsWith("file")) { - lastModified = new File(deployment.watch.getFile()).lastModified(); - // File watched = new File(deployment.watch.getFile()); - //Only scan individual files - // if (!watched.isDirectory()) lastModified = watched.lastModified(); -} + File theFile = new File(deployment.watch.getFile()); + if ( ! theFile.exists()) modified.add(deployment); + + lastModified = theFile.lastModified(); + } // Use URL connection to get lastModified on http else lastModified = deployment.watch.openConnection().getLastModified(); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment MainDeployer.java
User: mnf999 Date: 02/01/19 19:41:15 Added: src/main/org/jboss/deployment MainDeployer.java Log: the main deployer. Thread and deploy operations. It copies over the classes and deploys anything to the server. does the unification of the class loaders and the deployer Revision ChangesPath 1.1 jboss/src/main/org/jboss/deployment/MainDeployer.java Index: MainDeployer.java === /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.deployment; import java.util.ArrayList; import java.util.Set; import java.util.Enumeration; import java.util.HashSet; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import java.util.StringTokenizer; import java.util.jar.JarFile; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.ConcurrentModificationException; import java.net.JarURLConnection; import java.util.jar.Manifest; import java.net.URL; import java.net.MalformedURLException; import java.io.InputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import javax.management.MBeanServer; import javax.management.ObjectName; import javax.management.MalformedObjectNameException; import org.jboss.system.ServiceMBeanSupport; /** * MainDeployer * * Takes a series of URL to watch, detects changes and calls the appropriate Deployers * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @version $Revision: 1.1 $ * * */ public class MainDeployer extends ServiceMBeanSupport implements MainDeployerMBean, Runnable { // Constants - // Attributes /** JMX Server **/ MBeanServer server; /** Deployers **/ Set deployers = new HashSet(); /** Scanned Directories **/ ArrayList directories = new ArrayList(); /** I always feel like somebody is watching me, contains DeploymentInfo **/ Map deployments = new HashMap(); ArrayList deploymentsList = new ArrayList(); /** Thread running **/ boolean running = false; /** period of scanning **/ int period = 5000; int id = 0; // Static // Constructors -- // Getters setters -- /** Get on period **/ public void setPeriod(int period) { this.period = period; } public int getPeriod() {return period;} /** Directory get set logic, these are "scanning" directories on the local filesystem **/ public void setDirectories(String urlList) { StringTokenizer urls = new StringTokenizer(urlList, ","); // Add URLs to list while (urls.hasMoreTokens()) { addDirectory(urls.nextToken().trim()) ; } } public void addDirectory(String url) { // We are dealing with a relative path URL if (!( url.startsWith("file:") || url.startsWith("http:"))) { url = "file:"+System.getProperty("jboss.system.home")+File.separator+url; } // Only one entry try { URL dir = new URL(url); if (!directories.contains(dir)) directories.add(dir); } catch (MalformedURLException bad) { log.warn("Failed to add directory scan "+url); return;} if (log.isDebugEnabled()) log.debug("Added directory scan "+url); } public void removeDirectory(String url) { // We are dealing with a relative path URL if (!( url.startsWith("file:") || url.startsWith("http:"))) { url = System.getProperty("jboss.system.home")+url; } try { int index = directories.lastIndexOf(new URL(url)); if (index != -1) directories.remove(index); } catch (MalformedURLException bad) { log.warn("Failed to remove directory scan "+url); return;} if (log.isDebugEnabled()) log.debug("Removed directory scan "+url); } /* public String[] getDirectories() { String[] urls= new String[directories.size()]; int i = 0; Iterator dirs = directories.iterator(); while (dirs.hasNext()) urls[i++]= ((URL) dirs.next()).getFile(); return urls; } */ public String[] ge