weaver      2003/12/24 10:01:55

  Added:       content-server/src/java/org/apache/jetspeed/deployment/fs
                        JARObjectHandlerImpl.java FileSystemScanner.java
                        FSObjectHandler.java
               content-server/src/java/org/apache/jetspeed/deployment
                        DeploymentException.java
                        DeploymentEventListener.java
                        DeploymentEventImpl.java DeploymentEvent.java
                        DeploymentEventDispatcher.java
               content-server/src/java/org/apache/jetspeed/contentserver
                        ContentServlet.java
               content-server project.xml
  Log:
  The beginnings of the contnet server.  The servlet is basically nothing right now.
  
  However, the automated deployment system is 85% complete and is generic enough to 
  be used with other types of deployment besides themes content.  For example
  it will be very easy to write a DeploymentEventListener that wraps the PAM
  for automating portlet application deployment.
  
  The javadocs also need to be fleshed out.
  
  
  Revision  Changes    Path
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/deployment/fs/JARObjectHandlerImpl.java
  
  Index: JARObjectHandlerImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.deployment.fs;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.Reader;
  import java.util.jar.JarInputStream;
  
  /**
   * <p>
   * JARObjectHandlerImpl
   * </p>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: JARObjectHandlerImpl.java,v 1.1 2003/12/24 18:01:54 weaver Exp $
   *
   */
  public class JARObjectHandlerImpl implements FSObjectHandler
  {
        private File jar;
        private InputStream content;
        
      /**
       * @see org.apache.jetspeed.deployment.fs.FSObjectHandler#getPath()
       */
      public String getPath()
      {        
          return jar.getAbsolutePath();
      }
  
      /**
       * @see 
org.apache.jetspeed.deployment.fs.FSObjectHandler#setPath(java.lang.String)
       */
      public void setPath(String path)
      {
          this.jar = new File(path); 
  
      }
  
      /**
       * @see org.apache.jetspeed.deployment.fs.FSObjectHandler#setFile(java.io.File)
       */
      public void setFile(File file)
      {        
          jar = file;
      }
  
      /**
       * @see org.apache.jetspeed.deployment.fs.FSObjectHandler#getAsStream()
       */
      public InputStream getAsStream() throws IOException
      {        
        if(content == null)
        {
                        content = new JarInputStream(new FileInputStream(jar));
        }
          return content;
      }
  
      /**
       * @see org.apache.jetspeed.deployment.fs.FSObjectHandler#getAsReader()
       */
      public Reader getAsReader() throws IOException
      {        
          return new InputStreamReader(getAsStream());
      }  
      /**
       * @see org.apache.jetspeed.deployment.fs.FSObjectHandler#close()
       */
      public void close() throws IOException
      {
          if(content != null)
          {
                content.close();
          }
  
      }
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/deployment/fs/FileSystemScanner.java
  
  Index: FileSystemScanner.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.deployment.fs;
  
  import java.io.File;
  import java.io.FilenameFilter;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.jetspeed.deployment.DeploymentEvent;
  import org.apache.jetspeed.deployment.DeploymentEventDispatcher;
  import org.apache.jetspeed.deployment.DeploymentEventImpl;
  
  /**
   * <p>
   * FileSystemWatcher
   * </p>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: FileSystemScanner.java,v 1.1 2003/12/24 18:01:54 weaver Exp $
   *
   */
  public class FileSystemScanner extends Thread
  {
      private String directoryToWatch;
      private File directoryToWatchFile;
      private FilenameFilter filter;
      private Map fileTypeHandlers;
      private long delay;
      private DeploymentEventDispatcher dispatcher;
      private Map fileDates;
      private boolean started = true;
      private List deployedFiles;
      
      private static final Log log = LogFactory.getLog(FileSystemScanner.class);
  
      public FileSystemScanner(String directoryToWatch, Map fileTypeHandlers, 
DeploymentEventDispatcher dispatcher, long delay)
      {
          this.directoryToWatch = directoryToWatch;
                this.directoryToWatchFile = new File(directoryToWatch);
          this.fileTypeHandlers = fileTypeHandlers;
          this.delay = delay;
          this.dispatcher = dispatcher;
          this.deployedFiles = new ArrayList();
          
          Set fileExtensions = fileTypeHandlers.keySet();               
          this.filter = new AllowedFileTypeFilter((String[])fileExtensions.toArray(new 
String[1]));
      }
  
      /**
       * @see java.lang.Runnable#run()
       */
      public void run()
      {
          while (started)
          {
                File[] stagedFiles = getStagedFiles();
                        undeployRemovedArtifacts(stagedFiles);
                redeployChangedArtifacts(stagedFiles);
              deployNewArtifacts(stagedFiles);
              
  
              try
              {
                  sleep(delay);
              }
              catch (InterruptedException e)
              {
  
              }
          }
      }
      
        /**
         * notifies a switch variable that exits the watcher's montior loop started in 
the <code>run()</code>
         * method.      
         *
         */
        public void safeStop()
        {
                started = false;
        }
  
      private void deployNewArtifacts(File[] stagedFiles)
      {
          for(int i = 0; i < stagedFiles.length; i++)
          {
                // check for new deployment
                if(!deployedFiles.contains(stagedFiles[i]))
                {                               
                        FSObjectHandler objHandler = 
getFSObjectHandler(stagedFiles[i]);
                        objHandler.setFile(stagedFiles[i]);
                  try
                  {
                      DeploymentEvent event = new 
DeploymentEventImpl(DeploymentEvent.EVENT_TYPE_DEPLOY, objHandler.getAsStream());
                      dispatcher.dispatch(event);
                      // we are responsible for reclaiming the FSObject's resource
                      objHandler.close();
                      deployedFiles.add(stagedFiles[i]);
                      // record the lastModified so we can watch for re-deployment
                      fileDates.put(stagedFiles[i], new 
Long(stagedFiles[i].lastModified()));
                      
                  }
                  catch (Exception e1)
                  {
                      log.error("Error deploying "+stagedFiles[i].getAbsolutePath(), 
e1);
                  }
                }
          }
      }
      
        private void redeployChangedArtifacts(File[] stagedFiles)
        {
                
        }
        
        private void undeployRemovedArtifacts(File[] stagedFiles)
        {
                
        }
  
  
      
      protected File[] getStagedFiles()
      {         
        return this.directoryToWatchFile.listFiles(this.filter);
      }
      
      protected FSObjectHandler getFSObjectHandler(File file)
      {
        String name = file.getName();
                int extIndex = name.lastIndexOf('.');
                if(extIndex != -1 && (extIndex+1) < name.length())
                {
                        String extension = name.substring(extIndex+1);
                        return (FSObjectHandler) fileTypeHandlers.get(extension);
                }
                else
                {
                        return null;
                }
                
        
      }
      
      class AllowedFileTypeFilter implements FilenameFilter
      {
        private String[] fileTypes;
        
                public AllowedFileTypeFilter(String[] fileTypes)
                {
                        if(fileTypes == null || fileTypes.length < 1)
                        {
                                throw new IllegalArgumentException("String[] fileTypes 
cannot be null and must have at least one entry.");
                        }
                        this.fileTypes = fileTypes;
                }
                
          /**
           * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
           */
          public boolean accept(File dir, String name)
          {
              int extIndex = name.lastIndexOf('.');
              if(extIndex != -1 && (extIndex+1) < name.length())
              {
                String extension = name.substring(extIndex+1);
                for(int i = 0; i < fileTypes.length; i++ )
                {
                        if(fileTypes[i].equalsIgnoreCase(extension))
                        {
                                return true;
                        }
                }
              }
              return false;
          }
  
      }
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/deployment/fs/FSObjectHandler.java
  
  Index: FSObjectHandler.java
  ===================================================================
  /**
   * Created on Dec 24, 2003
   *
   * 
   * @author
   */
  package org.apache.jetspeed.deployment.fs;
  
  import java.io.File;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.Reader;
  
  /**
   * <p>
   * FSObjectHandler
   * </p>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: FSObjectHandler.java,v 1.1 2003/12/24 18:01:54 weaver Exp $
   *
   */
  public interface FSObjectHandler
  {
        String getPath();
        
        void setPath(String path);
        
        void setFile(File file);
        
        InputStream getAsStream() throws IOException;
        
        Reader getAsReader() throws IOException;
        
        void close() throws IOException;
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/deployment/DeploymentException.java
  
  Index: DeploymentException.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.deployment;
  
  import org.apache.commons.lang.exception.NestableException;
  
  /**
   * <p>
   * DeploymentException
   * </p>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: DeploymentException.java,v 1.1 2003/12/24 18:01:55 weaver Exp $
   *
   */
  public class DeploymentException extends NestableException
  {
  
      /**
       * 
       */
      public DeploymentException()
      {
          super();
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @param arg0
       */
      public DeploymentException(String arg0)
      {
          super(arg0);
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @param arg0
       */
      public DeploymentException(Throwable arg0)
      {
          super(arg0);
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @param arg0
       * @param arg1
       */
      public DeploymentException(String arg0, Throwable arg1)
      {
          super(arg0, arg1);
          // TODO Auto-generated constructor stub
      }
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/deployment/DeploymentEventListener.java
  
  Index: DeploymentEventListener.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.deployment;
  
  /**
   * <p>
   * DeploymentEventListener
   * </p>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: DeploymentEventListener.java,v 1.1 2003/12/24 18:01:55 weaver Exp $
   *
   */
  public interface DeploymentEventListener
  {
        public void invoke(DeploymentEvent event) throws DeploymentException;
        
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/deployment/DeploymentEventImpl.java
  
  Index: DeploymentEventImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.deployment;
  
  import java.io.InputStream;
  
  /**
   * <p>
   * DeploymentEventImpl
   * </p>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: DeploymentEventImpl.java,v 1.1 2003/12/24 18:01:55 weaver Exp $
   *
   */
  public class DeploymentEventImpl implements DeploymentEvent
  {
        
        private String type;
        private InputStream content;
        private String deploymentRoot;
  
      /**
       * 
       */
      public DeploymentEventImpl(String type, InputStream content, String depRoot)
      {
          super();
          this.type = type;
          this.content = content;
          this.deploymentRoot = depRoot;
          
      }
      
        public DeploymentEventImpl(String type, InputStream content)
        {
                super();
                this.type = type;
                this.content = content;
                
          
        }
  
      /**
       * @see org.apache.jetspeed.deployment.DeploymentEvent#getEventType()
       */
      public String getEventType()
      {        
          return this.type;
      }
  
      /**
       * @see org.apache.jetspeed.deployment.DeploymentEvent#getDeploymentRoot()
       */
      public String getDeploymentRoot()
      {        
          return this.deploymentRoot;
      }
  
      /**
       * @see org.apache.jetspeed.deployment.DeploymentEvent#getContent()
       */
      public InputStream getContent()
      {        
          return this.content;
      }
  
      /**
       * @param string
       */
      public void setDeploymentRoot(String string)
      {
          deploymentRoot = string;
      }
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/deployment/DeploymentEvent.java
  
  Index: DeploymentEvent.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.deployment;
  
  import java.io.InputStream;
  
  /**
   * <p>
   * DeploymentEvent
   * </p>
   * <p>
   * A <code>DeploymentEvent</code> is fired when a DeploymentEventDispatcher is 
notified that
   * a deployment event has occurred, for example, a JAR file being drop into a 
specific directory.
   * </p>
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: DeploymentEvent.java,v 1.1 2003/12/24 18:01:55 weaver Exp $
   *
   */
  public interface DeploymentEvent
  {
        /** Standard deployment event */
        String EVENT_TYPE_DEPLOY = "deploy";
        
        /** Standard re-deployment event */
        String EVENT_TYPE_REDEPLOY = "redeploy";
        
        /** Standard un-deployment event */
        String EVENT_TYPE_UNDEPLOY = "undeploy";                
        
        /**
         * Returns the type of event this is.  You can use one of the three 
pre-defined types
         * or use a custom one as event types are freeform.
         * @return String this event's type.
         */
        String getEventType();
        
        /**
         * This is the absolute path where content for this event should be deployed 
to.
         * @return String absolute path to the final home of the deployed content.
         */
        String getDeploymentRoot();
        
        void setDeploymentRoot(String deploymentRoot);
        
  
        /**
         * Returns an <code>java.io.InputStream</code> containing the deployed 
content.  Most often
         * this will be a <code>java.utiljar.JARInputStream</code>.
         * @return InputStream containing the information to be deployed.
         */     
        InputStream getContent();       
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/deployment/DeploymentEventDispatcher.java
  
  Index: DeploymentEventDispatcher.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.deployment;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /**
   * <p>
   * DeploymentEventDispatcher
   * </p>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: DeploymentEventDispatcher.java,v 1.1 2003/12/24 18:01:55 weaver Exp 
$
   *
   */
  public class DeploymentEventDispatcher
  {
      private List deploymentListeners;
      private String deploymentRoot;
      
      private static final Log log = 
LogFactory.getLog(DeploymentEventDispatcher.class);
      
  
      public DeploymentEventDispatcher(String deploymentRoot)
      {
                deploymentListeners = new ArrayList();        
                this.deploymentRoot = deploymentRoot;
      }
      
      public void addDeploymentListener(DeploymentEventListener listener)
      {
                deploymentListeners.add(listener);
      }
      
      public void dispatch(DeploymentEvent event)
      {
        Iterator itr = deploymentListeners.iterator();
        event.setDeploymentRoot(deploymentRoot);
        while(itr.hasNext())
        {
                DeploymentEventListener listener = (DeploymentEventListener) 
itr.next();
                try
              {
                  listener.invoke(event);
              }
              catch (DeploymentException e)
              {   
                // log and continue
                             
                  
              }
        }
      }
  
      
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/content-server/src/java/org/apache/jetspeed/contentserver/ContentServlet.java
  
  Index: ContentServlet.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.contentserver;
  
  import java.io.IOException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  /**
   * <p>
   * ContentServlet
   * </p>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
   * @version $Id: ContentServlet.java,v 1.1 2003/12/24 18:01:55 weaver Exp $
   *
   */
  public class ContentServlet extends HttpServlet
  {
  
   
      /**
       * @see 
javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, 
javax.servlet.http.HttpServletResponse)
       */
      protected void service(HttpServletRequest arg0, HttpServletResponse arg1) throws 
ServletException, IOException
      {
          
          
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed-2/content-server/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
    <pomVersion>3</pomVersion>
    <id>jetspeed2-content-server</id>
    <name>Jetspeed 2 Enterprise Portal Content Server</name>
    <groupId>jetspeed2</groupId>
    <currentVersion>2.0-a1-dev</currentVersion>
    <organization>
      <name>Apache Software Foundation</name>
      <url>http://jakarta.apache.org/</url>
      <logo>/images/jakarta-logo.gif</logo>
    </organization>
    <inceptionYear>1999</inceptionYear>
    <package>org.apache.jetspeed</package>
    <logo>/images/blue-logo.gif</logo>
  
    <!-- Gump integration -->
    <gumpRepositoryId></gumpRepositoryId>
  
    <description>Jetspeed is an Open Source implementation of an Enterprise 
Information Portal, using Java and XML.</description>
    <shortDescription>Enterprise Information Portal</shortDescription>
    <url>http://www.sporteportal.com/jetspeed-2/</url>
    <issueTrackingUrl>http://www.sporteportal.com/scarab</issueTrackingUrl>
    <siteAddress>www.sporteportal.com</siteAddress>
    <siteDirectory></siteDirectory>
    <distributionDirectory></distributionDirectory>
  
    <repository>
      <connection>scm:cvs:pserver:[EMAIL PROTECTED]:/cvs:jetspeed-2</connection>
      <url>http://cvs.sporteportal.com/viewcvs/jetspeed-2/</url>
    </repository>
  
    <mailingLists>
      <mailingList>
        <name>Jetspeed 2 Developer List</name>
        <subscribe>[EMAIL PROTECTED]</subscribe>
        <unsubscribe>[EMAIL PROTECTED]</unsubscribe>
      </mailingList>
    </mailingLists>
  
    <developers>
      <developer>
        <name>David Sean Taylor</name>
        <id>taylor</id>
        <email>[EMAIL PROTECTED]</email>
        <roles>
          <role>Java Developer</role>
        </roles>
      </developer>
  
      <developer>
        <name>Raphael Luta</name>
        <id>raphael</id>
        <email>[EMAIL PROTECTED]</email>
        <roles>
          <role>Java Developer</role>
        </roles>
      </developer>
  
      <developer>
        <name>Mark Orciuch</name>
        <id>mark</id>
        <email>[EMAIL PROTECTED]</email>
        <roles>
          <role>Java Developer</role>
        </roles>
      </developer>
  
      <developer>
        <name>Paul Spencer</name>
        <id>paul</id>
        <email>[EMAIL PROTECTED]</email>
        <roles>
          <role>Java Developer</role>
        </roles>
      </developer>
  
      <developer>
        <name>Scott Weaver</name>
        <id>scott</id>
        <email>[EMAIL PROTECTED]</email>
        <roles>
          <role>Java Developer</role>
        </roles>
      </developer>
  
     <developer>
        <name>Roger Ruttimann</name>
        <id>roger</id>
        <email>[EMAIL PROTECTED]</email>
        <roles>
          <role>Java Developer</role>
        </roles>
      </developer>
  
      </developers>
     <dependencies>
       <dependency>
        <id>commons-logging</id>
        <version>1.0.2</version>
        <properties>
          <war.bundle.jar>false</war.bundle.jar>
        </properties>
      </dependency>
        <dependency>
        <id>servletapi</id>
        <version>2.3</version>
        <properties>
          <war.bundle.jar>false</war.bundle.jar>
        </properties> 
      </dependency>
    <dependencies/>
  
    <build>
      <nagEmailAddress>[EMAIL PROTECTED]</nagEmailAddress>
      <!--
      <sourceDirectory>src/java</sourceDirectory>
      <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
      <aspectSourceDirectory></aspectSourceDirectory>
      -->
      <unitTest>
        <includes>
          <include>**/*Test*.java</include>
        </includes>
        <excludes>
          <exclude>**/BaseTestCase.java</exclude>
        </excludes>
      </unitTest>
    </build>
  </project>
  
  
  

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

Reply via email to