rwatler     2005/02/03 01:39:13

  Modified:    portal/src/java/org/apache/jetspeed/deployment/impl
                        DeployPortletAppEventListener.java
  Log:
  handle various deployment/registration states that might appear when 
container and deployer are out of sync
  
  Revision  Changes    Path
  1.22      +29 -31    
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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DeployPortletAppEventListener.java        2 Feb 2005 03:22:05 -0000       
1.21
  +++ DeployPortletAppEventListener.java        3 Feb 2005 09:39:13 -0000       
1.22
  @@ -195,42 +195,40 @@
               }
   
               PortletApplicationWar paWar = new 
PortletApplicationWar(deploymentObj.getFileObject(), id, "/" + id );
  +            PortletApplicationDefinition pa = 
registry.getPortletApplicationByIdentifier(id);
  +            boolean registered = (pa != null); 
  +            File deploymentPath = (isLocal ? 
deploymentObj.getFileObject().getRootDirectory() : new 
File(pam.getDeploymentPath(id)));
  +            boolean deployed = deploymentPath.exists();
  +            log.info("Portlet application \"" + id + "\"" + ": registered=" 
+ registered + ", deployed=" + deployed);
   
  -            if ((registry.getPortletApplicationByIdentifier(id) != null) &&
  -                
event.getEventType().equals(DeploymentEvent.EVENT_TYPE_DEPLOY))
  +            if (registered && deployed && 
event.getEventType().equals(DeploymentEvent.EVENT_TYPE_DEPLOY))
               {
  -                log.info("Portlet application \"" + id + "\""
  -                         + " already been registered.  Skipping initial 
deployment.");
  +                log.info("Portlet application \"" + id + "\"" + " already 
registered.  Skipping initial deployment.");
                   pam.register(paWar);
               }
  -            else
  +            else if (!registered || 
event.getEventType().equals(DeploymentEvent.EVENT_TYPE_DEPLOY))
               {
  -                log.info("Preparing to (re) deploy portlet app \"" + id + 
"\"");
  -                
  -                if 
(event.getEventType().equals(DeploymentEvent.EVENT_TYPE_DEPLOY))
  -                {
  -                    if (isLocal)
  -                    {
  -                        log.info(fileName + " will be registered as a local 
portlet application.");                    
  -                        pam.register(paWar);
  -                    }
  -                    else
  -                    {
  -                        log.info("Deploying portlet application WAR " + 
fileName);
  -                        pam.deploy(paWar);
  -                    }
  -                }
  -                else if 
(event.getEventType().equals(DeploymentEvent.EVENT_TYPE_REDEPLOY))
  -                {
  -                    if (isLocal)
  -                    {
  -                        //TODO: get this working                    
  -                    }
  -                    else
  -                    {
  -                        log.info("Re-deploying portlet application WAR " + 
fileName);
  -                        pam.redeploy(paWar);
  -                    }
  +                if (isLocal)
  +                {
  +                    log.info("Deploying portlet app \"" + id + "\": " + 
fileName + " will be registered as a local portlet application.");
  +                    pam.register(paWar);
  +                }
  +                else
  +                {
  +                    log.info("Deploying portlet app \"" + id + "\": " + 
"portlet application WAR " + fileName);
  +                    pam.deploy(paWar);
  +                }
  +            }
  +            else if (deployed || 
event.getEventType().equals(DeploymentEvent.EVENT_TYPE_REDEPLOY))
  +            {
  +                if (isLocal)
  +                {
  +                    log.error("Redeploying portlet app \"" + id + "\" from " 
+ fileName + " as a local portlet application is not implemented.");
  +                }
  +                else
  +                {
  +                    log.info("Redeploying portlet app \"" + id + "\": " + 
"portlet application WAR " + fileName);
  +                    pam.redeploy(paWar);
                   }
               }
               appNameToFile.put(deploymentObj.getPath(), id);
  
  
  

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

Reply via email to