[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment SARDeployer.java

2002-02-09 Thread Scott M Stark

  User: starksm 
  Date: 02/02/09 15:36:52

  Modified:src/main/org/jboss/deployment SARDeployer.java
  Log:
  Validate that the stream for the META-INF/jboss-service.xml is not null
  to prevent an NPE from the xml parser
  
  Revision  ChangesPath
  1.6   +46 -52jboss/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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SARDeployer.java  9 Feb 2002 16:09:17 -   1.5
  +++ SARDeployer.java  9 Feb 2002 23:36:52 -   1.6
  @@ -6,7 +6,6 @@
   */
   package org.jboss.deployment;
   
  -
   import java.io.File;
   import java.io.FilenameFilter;
   import java.io.IOException;
  @@ -58,7 +57,7 @@
   * @author mailto:[EMAIL PROTECTED]";>Marc Fleury
   * @author mailto:[EMAIL PROTECTED]";>David Maplesden
   * @author mailto:[EMAIL PROTECTED]";>David Jencks
  -* @version   $Revision: 1.5 $ 
  +* @version   $Revision: 1.6 $ 
   *
   *  20010830 marc fleury:
   *  initial import
  @@ -95,8 +94,8 @@
   *  
   */
   public class SARDeployer
  -extends ServiceMBeanSupport
  -implements SARDeployerMBean
  +   extends ServiceMBeanSupport
  +   implements SARDeployerMBean
   {
  // Attributes 
  private ObjectName objectName;
  @@ -132,11 +131,10 @@
  {
 return (di.url.toString().endsWith(".sar")
|| di.url.toString().endsWith("service.xml"));
  -   }
  -   
  -   
  +   }   
  +
  public void init(DeploymentInfo di)
  -   throws DeploymentException
  +  throws DeploymentException
  {
 try 
 {
  @@ -149,7 +147,6 @@

else if(di.url.getProtocol().startsWith("file"))
{
  -
   File file = new File (di.url.getFile());
   
   // If not directory we watch the package
  @@ -191,13 +188,12 @@
throw new DeploymentException(e.getMessage());
 }
  }
  -   
  -   
  +
  public void deploy(DeploymentInfo di)
  -   throws DeploymentException
  +  throws DeploymentException
  {
  -  
  -  try {
  +  try
  +  {
// install the MBeans in this descriptor
if (log.isInfoEnabled())
   log.info("Deploying SAR: url " + di.url);
  @@ -209,7 +205,6 @@

for (int i = 0; i < nl.getLength(); i++)
{
  -
   Element mbean = (Element)nl.item(i);
   
   log.debug("deploying with ServiceController mbean " + mbean);
  @@ -259,7 +254,7 @@
  }
  
  protected void parseXMLClasspath(DeploymentInfo di) 
  -   throws DeploymentException
  +  throws DeploymentException
  {
 Set classpath = new HashSet();
 
  @@ -276,7 +271,6 @@
//Does it specify a codebase?
if (classpathElement != null)
{
  -
   log.debug("setting up classpath " + classpath);
   // Load the codebase
   codebase = classpathElement.getAttribute("codebase").trim();
  @@ -349,9 +343,9 @@
// We have an archive whatever the codebase go ahead and load the libraries
else if (!archives.equals(""))
{
  -
   // Still no codebase? safeguard
  -if (codebase.equals("")) codebase = 
System.getProperty("jboss.system.libraryDirectory");
  +if (codebase.equals(""))
  +   codebase = System.getProperty("jboss.system.libraryDirectory");
  
   if (archives.equals("*") || archives.equals("")) 
   {
  @@ -390,8 +384,7 @@
 throw new DeploymentException(e.getMessage());
  }
   }
  -
  -
  +
   else // A real archive listing (as opposed to wildcard)
   {
  StringTokenizer jars = new StringTokenizer(archives, ",");
  @@ -405,8 +398,8 @@
  }
   }
}
  - 
  - else //codebase is empty and archives is empty but we did have a classpath 
entry
  + //codebase is empty and archives is empty but we did have a classpath entry
  + else
{
   throw new DeploymentException("A classpath entry was declared but no 
codebase and no jars specified. Please fix jboss-service.xml in your configuration");
}
  @@ -421,8 +414,8 @@
neededUrl = (URL)jars.next();

// Call the main deployer with it
  - try {
  -
  + try
  + {   
   // Create a new Deployment not as a subdeployment,
   // An external package is not a "subdeployment" it is a s

[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment SARDeployer.java

2002-01-29 Thread marc fleury

  User: mnf999  
  Date: 02/01/29 17:50:16

  Modified:src/main/org/jboss/deployment SARDeployer.java
  Log:
  Patch from David is ok, functionality lost is the capacity to deploy a flat jar with 
just the classes and referencing the codebase (rare case)
  
  Revision  ChangesPath
  1.3   +1 -19 jboss/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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SARDeployer.java  2002/01/30 00:36:53 1.2
  +++ SARDeployer.java  2002/01/30 01:50:16 1.3
  @@ -58,7 +58,7 @@
   * @author mailto:[EMAIL PROTECTED]";>Marc Fleury
   * @author mailto:[EMAIL PROTECTED]";>David Maplesden
   * @author mailto:[EMAIL PROTECTED]";>David Jencks
  -* @version   $Revision: 1.2 $ 
  +* @version   $Revision: 1.3 $ 
   *
   *  20010830 marc fleury:
   *  initial import
  @@ -348,24 +348,6 @@
// We have an archive whatever the codebase go ahead and load the libraries
else if (!archives.equals(""))
{
  -
  -// We have a real codebase specified in xml
  -// We add it to the classpath so we load files from it (http/file will 
work)
  -if (!codebase.equals(""))
  -{  
  -   try 
  -   {
  -   //XTEMP EXPERIMENT david j
  -  // Add the codebase to the classpath
  -  //classpath.add( new URL(codebase));
  -   }
  -   catch (Exception e2) 
  -   {
  -  log.error("Couldn't create URL for codebase "+codebase, e2);
  -  throw new DeploymentException(e2.getMessage());
  -   
  -   }
  -}
   
   // Still no codebase? safeguard
   if (codebase.equals("")) codebase = 
System.getProperty("jboss.system.libraryDirectory");
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment SARDeployer.java

2002-01-29 Thread David Jencks

  User: d_jencks
  Date: 02/01/29 16:36:53

  Modified:src/main/org/jboss/deployment SARDeployer.java
  Log:
  hack to  get copy-activated deployments working without removing the deploy dir
  
  Revision  ChangesPath
  1.2   +3 -2  jboss/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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SARDeployer.java  2002/01/20 03:38:23 1.1
  +++ SARDeployer.java  2002/01/30 00:36:53 1.2
  @@ -58,7 +58,7 @@
   * @author mailto:[EMAIL PROTECTED]";>Marc Fleury
   * @author mailto:[EMAIL PROTECTED]";>David Maplesden
   * @author mailto:[EMAIL PROTECTED]";>David Jencks
  -* @version   $Revision: 1.1 $ 
  +* @version   $Revision: 1.2 $ 
   *
   *  20010830 marc fleury:
   *  initial import
  @@ -355,8 +355,9 @@
   {  
  try 
  {
  +   //XTEMP EXPERIMENT david j
 // Add the codebase to the classpath
  -  classpath.add( new URL(codebase));
  +  //classpath.add( new URL(codebase));
  }
  catch (Exception e2) 
  {
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



Re: [JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment SARDeployer.java

2002-01-28 Thread David Jencks

On 2002.01.20 03:11:47 -0500 Adam Heath wrote:
> On Sat, 19 Jan 2002, marc fleury wrote:
> 
> >  /**
> >  * 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.
> >  *
> >  * @return   The FileNameFilter for use by the AutoDeployer.
> >  */
> >  public boolean accepts(DeploymentInfo di)
> >  {
> > return (di.url.toString().endsWith(".sar")
> >|| di.url.toString().endsWith("service.xml"));
> >  }
> 
> Should this also test for '.jsr' like the documentation says, or should
> the
> docs be updated?
> 

The docs should be updated. Lets stick with one extension, .sar.   jsr
looks too much like java specification request.

davidjencks
> 
> ___
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> 
> 

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment SARDeployer.java

2002-01-19 Thread marc fleury

  User: mnf999  
  Date: 02/01/19 19:38:23

  Added:   src/main/org/jboss/deployment SARDeployer.java
  Log:
  The new SARDeployer
  
  Revision  ChangesPath
  1.1  jboss/src/main/org/jboss/deployment/SARDeployer.java
  
  Index: SARDeployer.java
  ===
  /*
  * JBoss, the OpenSource J2EE webOS
  *
  * Distributable under LGPL license.
  * See terms of license at gnu.org.
  */
  package org.jboss.deployment;
  
  
  import java.io.File;
  import java.io.FilenameFilter;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.io.FileOutputStream;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.LinkedList;
  import java.util.List;
  import java.util.ListIterator;
  import java.util.Map;
  import java.util.Set;
  import java.util.HashSet;
  import java.util.StringTokenizer;
  import java.util.jar.JarFile;
  import java.util.Enumeration;
  import java.util.jar.JarEntry;
  import javax.management.InstanceNotFoundException;
  import javax.management.MBeanException;
  import javax.management.MBeanServer;
  import javax.management.MalformedObjectNameException;
  import javax.management.ObjectName;
  import javax.management.ReflectionException;
  import javax.management.RuntimeErrorException;
  import javax.management.RuntimeMBeanException;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.parsers.ParserConfigurationException;
  import org.jboss.deployment.DeploymentInfo;
  import org.jboss.system.Service;
  import org.jboss.system.ServiceControllerMBean;
  import org.jboss.system.ServiceLibraries;
  import org.jboss.system.ServiceMBeanSupport;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  import org.w3c.dom.NodeList;
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  
  /**
  * This is the main Service Deployer API.
  *
  * @see   org.jboss.system.Service
  * @author mailto:[EMAIL PROTECTED]";>Marc Fleury
  * @author mailto:[EMAIL PROTECTED]";>David Maplesden
  * @author mailto:[EMAIL PROTECTED]";>David Jencks
  * @version   $Revision: 1.1 $ 
  *
  *  20010830 marc fleury:
  *  initial import
  *
  *  
  *
  *  20010905 david maplesden:
  *  
  *  Changed deployment procedure to deploy all listed mbeans, then
  *  initialise them all before finally starting them all.  Changed services
  *  sets to lists to maintain ordering.
  *  
  *
  *  20010908 david jencks
  *  
  * fixed tabs to spaces and log4j logging. Made the urlToServiceSet
  *map actually use the url supplied to deploy. Made postRegister use
  *deploy. Made undeploy work, and implemented sar dependency management
  *and recursive deploy/undeploy.
  *  
  *
  *  20010907 david maplesden:
  *  
  *  Added support for "depends" tag
  *  
  *
  *  20011210 marc fleury:
  *  
  *  Removing the classpath dependency to explicit jars
  *  
  *  20011211 marc fleury:
  *  
  *  rewrite
  *  
  */
  public class SARDeployer
  extends ServiceMBeanSupport
  implements SARDeployerMBean
  {
 // Attributes 
 private ObjectName objectName;
 
 //Find all the deployment info for a url
 private final Map urlToDeploymentInfoMap = new HashMap();
 
 //Find what package an mbean came from.
 private final Map objectNameToSupplyingPackageMap = new HashMap();
 
 
 
 // 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.
 *
 * @return   The FileNameFilter for use by the AutoDeployer.
 */
 public boolean accepts(DeploymentInfo di) 
 {
return (di.url.toString().endsWith(".sar")
   || di.url.toString().endsWith("service.xml"));
 }
 
 
 public void init(DeploymentInfo di)
 throws DeploymentException
 {
try 
{
   // resolve the watch
   if (di.url.getProtocol().startsWith("http"))
   {
  // 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())