portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl FileNotDeployableException.java DeployDecoratorEventListener.java StandardDeploymentManager.java StandardDeploymentObject.java DeployPortletAppEventListener.java
Date Wed, 16 Mar 2005 16:33:49 GMT
ate         2005/03/16 08:33:49

  Modified:    portal/src/java/org/apache/jetspeed/deployment/impl Tag:
                        deployment-refactoring
                        FileNotDeployableException.java
                        DeployDecoratorEventListener.java
                        StandardDeploymentManager.java
                        StandardDeploymentObject.java
                        DeployPortletAppEventListener.java
  Removed:     portal/src/java/org/apache/jetspeed/deployment Tag:
                        deployment-refactoring DeploymentManager.java
                        DeploymentException.java
                        DeploymentEventListener.java DeploymentEvent.java
                        DeploymentObject.java
  Log:
  Fixes and some refactoring to Deployment implementation
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.1   +3 -1      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/FileNotDeployableException.java
  
  Index: FileNotDeployableException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/FileNotDeployableException.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- FileNotDeployableException.java	9 Jul 2004 18:26:55 -0000	1.1
  +++ FileNotDeployableException.java	16 Mar 2005 16:33:49 -0000	1.1.2.1
  @@ -15,6 +15,8 @@
    */
   package org.apache.jetspeed.deployment.impl;
   
  +import org.apache.jetspeed.deployment.DeploymentException;
  +
   
   /**
    * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
  @@ -23,7 +25,7 @@
    * 
    * Thrown when attempting to deploy a file that cannot be deployed.
    */
  -public class FileNotDeployableException extends Exception
  +public class FileNotDeployableException extends DeploymentException
   {
   
       /**
  
  
  
  1.7.2.3   +3 -2      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/DeployDecoratorEventListener.java
  
  Index: DeployDecoratorEventListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/DeployDecoratorEventListener.java,v
  retrieving revision 1.7.2.2
  retrieving revision 1.7.2.3
  diff -u -r1.7.2.2 -r1.7.2.3
  --- DeployDecoratorEventListener.java	2 Mar 2005 13:51:41 -0000	1.7.2.2
  +++ DeployDecoratorEventListener.java	16 Mar 2005 16:33:49 -0000	1.7.2.3
  @@ -30,6 +30,7 @@
   import org.apache.jetspeed.deployment.DeploymentEvent;
   import org.apache.jetspeed.deployment.DeploymentEventListener;
   import org.apache.jetspeed.deployment.DeploymentException;
  +import org.apache.jetspeed.deployment.DeploymentStatus;
   import org.apache.jetspeed.util.DirectoryHelper;
   
   /**
  @@ -172,7 +173,7 @@
               }
   
               log.info("Decorator " + id + " deployed successfuly.");
  -            event.setStatus(DeploymentEvent.STATUS_OKAY);
  +            event.setStatus(DeploymentStatus.STATUS_OKAY);
           }
           catch (DeploymentException de)
           {
  
  
  
  1.5.2.3   +56 -63    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/StandardDeploymentManager.java
  
  Index: StandardDeploymentManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/StandardDeploymentManager.java,v
  retrieving revision 1.5.2.2
  retrieving revision 1.5.2.3
  diff -u -r1.5.2.2 -r1.5.2.3
  --- StandardDeploymentManager.java	2 Mar 2005 13:51:41 -0000	1.5.2.2
  +++ StandardDeploymentManager.java	16 Mar 2005 16:33:49 -0000	1.5.2.3
  @@ -33,6 +33,7 @@
   import org.apache.jetspeed.deployment.DeploymentException;
   import org.apache.jetspeed.deployment.DeploymentManager;
   import org.apache.jetspeed.deployment.DeploymentObject;
  +import org.apache.jetspeed.deployment.DeploymentStatus;
   
   /**
    * <p>
  @@ -156,6 +157,31 @@
               scanner.safeStop();
           }
       }
  +    
  +    public synchronized DeploymentStatus deploy(File aFile) throws DeploymentException
  +    {
  +        DeploymentObject deploymentObject = new StandardDeploymentObject(aFile);
  +        DeploymentEvent event = null;
  +        try
  +        {
  +            event = new DeploymentEventImpl(deploymentObject);
  +            dispatch(event);
  +        }
  +        finally
  +        {
  +            if ( deploymentObject != null )
  +            {
  +                try
  +                {
  +                    deploymentObject.close();
  +                }
  +                catch (IOException e)
  +                {                    
  +                }
  +            }
  +        }
  +        return event;
  +    }
   
       public void fireDeploymentEvent()
       {
  @@ -169,78 +195,45 @@
                   boolean failed = false;
                   boolean unknown = false;
   
  -                DeploymentObject deploymentObject = null;
  +                DeploymentStatus status = null;
  +                Exception de = null;
                   try
                   {
  -                    try
  +                    status = deploy(aFile);
  +                }
  +                catch (Exception e)
  +                {                    
  +                    de = e;
  +                }
  +                
  +                if ( status != null && status.getStatus() == DeploymentStatus.STATUS_OKAY
)
  +                {
  +                    if (aFile.exists())
                       {
  -                        deploymentObject = new StandardDeploymentObject(aFile);
  +                        log.info("File: " + aFile.getAbsolutePath() + " deployed");
  +                        boolean result = aFile.delete();
  +                        if (!result)
  +                        {
  +                           	log.error("Failed to remove: " + aFile);
  +                        }
                       }
  -                    catch (FileNotDeployableException e)
  +                }
  +                else
  +                {
  +                    if (status == null || status.getStatus() == DeploymentStatus.STATUS_EVAL)
                       {
  -                        unknown = true;
  +                        log.warn("Unrecognized file " + aFile.getAbsolutePath());
                       }
  -
  -                    if (deploymentObject != null)
  +                    else if ( de != null )
                       {
  -                        DeploymentEvent event = new DeploymentEventImpl(deploymentObject);
  -                        dispatch(event);
  -                        deploymentObject.close();
  -                        if (event.getStatus() == DeploymentEvent.STATUS_OKAY)
  -                        {
  -                            if (aFile.exists())
  -                            {
  -                                System.err.println("File: " + aFile.getAbsolutePath() +
" deployed");
  -                                boolean result = aFile.delete();
  -                                if (!result)
  -                                {
  -                                    System.err.println("Failed to remove: " + aFile);
  -                                }
  -                            }
  -                        }
  -                        else if (event.getStatus() == DeploymentEvent.STATUS_EVAL)
  -                        {
  -                            unknown = true;
  -                        }
  -                        else
  -                        {
  -                            failed = true;
  -                        }
  +                        log.error("Failure deploying " + aFile.getAbsolutePath(), de);
                       }
  -                    if (failed || unknown)
  +                    else
                       {
  -                        if (unknown)
  -                        {
  -                            log.warn("Unrecognized file " + aFile.getAbsolutePath());
  -                        }
  -                        else
  -                        {
  -                            log.error("Failure deploying " + aFile.getAbsolutePath());
  -                        }
  -                        ignoredFiles.put(aFile.getAbsolutePath(), new Long(aFile.lastModified()));
  +                        log.error("Failure deploying " + aFile.getAbsolutePath());
                       }
  -
  -                }
  -                catch (Exception e1)
  -                {
  -                    log.error("Failure deploying " + aFile.getAbsolutePath(), e1);
                       ignoredFiles.put(aFile.getAbsolutePath(), new Long(aFile.lastModified()));
                   }
  -                finally
  -                {
  -                    if (deploymentObject != null)
  -                    {
  -                        try
  -                        {
  -                            deploymentObject.close();
  -                        }
  -                        catch (IOException e)
  -                        {
  -
  -                        }
  -                    }
  -
  -                }
               }
           }
       }
  @@ -262,7 +255,7 @@
               {
                   DeploymentEventListener listener = (DeploymentEventListener) itr.next();
                   listener.invokeDeploy(event);
  -                if (event.getStatus() != DeploymentEvent.STATUS_EVAL)
  +                if (event.getStatus() != DeploymentStatus.STATUS_EVAL)
                   {
                       break;
                   }
  @@ -271,7 +264,7 @@
           catch (DeploymentException e)
           {
               log.error(e.getMessage(), e);
  -            event.setStatus(DeploymentEvent.STATUS_FAILED);
  +            event.setStatus(DeploymentStatus.STATUS_FAILED);
           }
       }
   
  
  
  
  1.1.2.3   +2 -2      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/StandardDeploymentObject.java
  
  Index: StandardDeploymentObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/StandardDeploymentObject.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- StandardDeploymentObject.java	2 Mar 2005 13:51:41 -0000	1.1.2.2
  +++ StandardDeploymentObject.java	16 Mar 2005 16:33:49 -0000	1.1.2.3
  @@ -39,7 +39,7 @@
       /**
        * @throws IOException
        */
  -    public StandardDeploymentObject(File deploymentObject) throws IOException, FileNotDeployableException
  +    public StandardDeploymentObject(File deploymentObject) throws FileNotDeployableException
       {
           if (verifyExtension(deploymentObject))
           {
  
  
  
  1.22.2.3  +5 -4      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java
  
  Index: DeployPortletAppEventListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java,v
  retrieving revision 1.22.2.2
  retrieving revision 1.22.2.3
  diff -u -r1.22.2.2 -r1.22.2.3
  --- DeployPortletAppEventListener.java	2 Mar 2005 13:51:41 -0000	1.22.2.2
  +++ DeployPortletAppEventListener.java	16 Mar 2005 16:33:49 -0000	1.22.2.3
  @@ -29,6 +29,7 @@
   import org.apache.jetspeed.deployment.DeploymentEvent;
   import org.apache.jetspeed.deployment.DeploymentEventListener;
   import org.apache.jetspeed.deployment.DeploymentException;
  +import org.apache.jetspeed.deployment.DeploymentStatus;
   import org.apache.jetspeed.tools.deploy.JetspeedDeploy;
   import org.apache.jetspeed.tools.pamanager.PortletApplicationManagement;
   import org.apache.jetspeed.util.DirectoryHelper;
  @@ -103,7 +104,7 @@
           {
               public boolean accept(File pathname)
               {
  -                return pathname.isDirectory() && registry.getPortletApplication(pathname.getName())
!= null;
  +                return pathname.isDirectory();
               }
           });
           for (int i = 0; i < localApps.length; i++)
  @@ -153,7 +154,7 @@
           {
               File toFile = new File(webAppDir, event.getName());
               new JetspeedDeploy(event.getPath(), toFile.getAbsolutePath());
  -            event.setStatus(DeploymentEvent.STATUS_OKAY);
  +            event.setStatus(DeploymentStatus.STATUS_OKAY);
           }
           catch (Exception e)
           {
  @@ -172,7 +173,7 @@
               JarExpander.expand(event.getDeploymentObject().getFile(), targetDir);
               DirectoryHelper paDirHelper = new DirectoryHelper(targetDir);
               pam.startLocalPortletApplication(appName, paDirHelper, createLocalPAClassLoader(targetDir));
  -            event.setStatus(DeploymentEvent.STATUS_OKAY);
  +            event.setStatus(DeploymentStatus.STATUS_OKAY);
           }
           catch (Exception e)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message