weaver      2004/01/15 08:10:52

  Modified:    portal/src/java/org/apache/jetspeed/deployment/fs
                        FileObjectHandler.java JARObjectHandlerImpl.java
               portal/src/java/org/apache/jetspeed/deployment
                        DeploymentHandler.java
  Log:
  getConfiguration() now returns a more generic inputStream object
  instead of a o.a.commons.configuration.Configruration object.  This was done
  so we can support extracting and reading the portlet.xml from a WAR file.
  
  Revision  Changes    Path
  1.2       +2 -2      
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/fs/FileObjectHandler.java
  
  Index: FileObjectHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/fs/FileObjectHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileObjectHandler.java    14 Jan 2004 19:32:57 -0000      1.1
  +++ FileObjectHandler.java    15 Jan 2004 16:10:52 -0000      1.2
  @@ -91,7 +91,7 @@
       /**
        * @see org.apache.jetspeed.deployment.fs.FSObjectHandler#getConfiguration()
        */
  -    public Configuration getConfiguration(String configPath)
  +    public InputStream getConfiguration(String configPath)
       {
           // TODO Auto-generated method stub
           return null;
  
  
  
  1.2       +14 -6     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/fs/JARObjectHandlerImpl.java
  
  Index: JARObjectHandlerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/fs/JARObjectHandlerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JARObjectHandlerImpl.java 14 Jan 2004 19:32:57 -0000      1.1
  +++ JARObjectHandlerImpl.java 15 Jan 2004 16:10:52 -0000      1.2
  @@ -65,6 +65,8 @@
   
   import org.apache.commons.configuration.Configuration;
   import org.apache.commons.configuration.PropertiesConfiguration;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   
   /**
    * <p>
  @@ -81,6 +83,8 @@
        private JarInputStream content;
        
       private JarFile jarFile;
  +    
  +    private static final Log log = LogFactory.getLog("deployment"); 
       /**
        * @see org.apache.jetspeed.deployment.fs.FSObjectHandler#getPath()
        */
  @@ -142,13 +146,17 @@
       /**
        * @see org.apache.jetspeed.deployment.fs.FSObjectHandler#getConfiguration()
        */
  -    public Configuration getConfiguration(String configPath) throws IOException
  +    public InputStream getConfiguration(String configPath) throws IOException
       {
        JarEntry jarEntry = jarFile.getJarEntry(configPath);
  -     InputStream configStream = jarFile.getInputStream(jarEntry);
  -             PropertiesConfiguration conf = new PropertiesConfiguration();
  -     conf.load(configStream);
  -     return conf;       
  +     // null indicates this is probably not a deployment
  +     // we need to be concerned about 
  +     if(jarEntry == null)
  +     {
  +             return null;
  +     }
  +     return jarFile.getInputStream(jarEntry);
  +             
       }
   
   }
  
  
  
  1.2       +24 -3     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/DeploymentHandler.java
  
  Index: DeploymentHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/DeploymentHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeploymentHandler.java    14 Jan 2004 19:32:57 -0000      1.1
  +++ DeploymentHandler.java    15 Jan 2004 16:10:52 -0000      1.2
  @@ -16,6 +16,9 @@
    * <p>
    * DeploymentHandler
    * </p>
  + * <p> 
  + *   Object representation of a deployment artifact of some type.
  + * </p>
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
    * @version $Id$
  @@ -24,14 +27,32 @@
   public interface DeploymentHandler
   {
   
  -     
  +     /**
  +      * Gets the deployment artifacts content as a Stream
  +      * @return
  +      * @throws IOException
  +      */
        InputStream getAsStream() throws IOException;
        
        Reader getAsReader() throws IOException;
        
  +     /**
  +      * Closes any resources that may have been opend during the use
  +      * of this ObjectHandler.
  +      * @throws IOException
  +      */
        void close() throws IOException;
        
  -     Configuration getConfiguration(String configPath) throws IOException;
  +     /**
  +      * retreives the the configuration for this deployment artifact
  +      * based on the artifact-relative <code>configPath</code>
  +      * provided.
  +      * @param configPath artifcat-relative path to the confiuration file
  +      * @return Configuration of this artificat or <code>null</code> if the 
  +      * configuration is not present in the artifcat.
  +      * @throws IOException error opening the configuration
  +      */
  +     InputStream getConfiguration(String configPath) throws IOException;
                
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to