weaver      2004/06/09 09:39:06

  Modified:    portal/src/test/org/apache/jetspeed/deployment
                        TestSimpleDeployment.java
               portal/src/java/org/apache/jetspeed/deployment/impl
                        DeployPortletAppEventListener.java
  Added:       portal/test/deployment/deploy jetspeed-layouts.war
  Log:
  see issue: <http://nagoya.apache.org/jira/browse/JS2-75>
  
  Revision  Changes    Path
  1.7       +6 -1      
jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/deployment/TestSimpleDeployment.java
  
  Index: TestSimpleDeployment.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/deployment/TestSimpleDeployment.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestSimpleDeployment.java 9 Mar 2004 19:35:46 -0000       1.6
  +++ TestSimpleDeployment.java 9 Jun 2004 16:39:05 -0000       1.7
  @@ -116,6 +116,10 @@
           assertTrue(decoratorVm.getCanonicalPath() + " was not created!", 
decoratorVm.exists());
                PortletRegistryComponent portletRegistry = (PortletRegistryComponent) 
Jetspeed.getComponentManager().getComponent(PortletRegistryComponent.class);
           assertNotNull(TEST_PORTLET_APP_NAME+" was not registered into the portlet 
registery.", portletRegistry.getPortletApplicationByIdentifier(TEST_PORTLET_APP_NAME));
  +        assertTrue(TEST_PORTLET_APP_NAME+" directory was not created, app not 
deployed.", new File(webAppsDir+"/"+TEST_PORTLET_APP_NAME).exists());
  +        assertNotNull("jetspeed was not registered into the portlet registery.", 
portletRegistry.getPortletApplicationByIdentifier("jetspeed"));
  +        assertFalse("local app, jetspeed, got deployed when it should have only 
been registered.", new File(webAppsDir+"/jetspeed").exists());
  +        
   
       }
   
  @@ -161,6 +165,7 @@
                try
           {
               pam.undeploy(webAppsDir, TEST_PORTLET_APP_NAME);
  +            pam.unregister(webAppsDir, "jetspeed");
           }
           catch (PortletApplicationException e)
           {            
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/test/deployment/deploy/jetspeed-layouts.war
  
        <<Binary file>>
  
  
  1.9       +29 -9     
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DeployPortletAppEventListener.java        4 Jun 2004 02:37:15 -0000       1.8
  +++ DeployPortletAppEventListener.java        9 Jun 2004 16:39:06 -0000       1.9
  @@ -20,8 +20,8 @@
   import org.apache.jetspeed.deployment.DeploymentEventListener;
   import org.apache.jetspeed.deployment.DeploymentException;
   import org.apache.jetspeed.deployment.fs.FSObjectHandler;
  -import org.apache.jetspeed.tools.pamanager.Deployment;
   import org.apache.jetspeed.tools.pamanager.PortletApplicationException;
  +import org.apache.jetspeed.tools.pamanager.PortletApplicationManagement;
   import org.apache.pluto.om.portlet.PortletApplicationDefinition;
   import org.jdom.Document;
   import org.jdom.Element;
  @@ -41,11 +41,11 @@
   
       protected static final Log log = LogFactory.getLog("deployment");
       private String webAppDir;
  -    private Deployment pam;
  +    private  PortletApplicationManagement pam;
       private Map appNameToFile;
   
   
  -    public DeployPortletAppEventListener(String webAppDir, Deployment pam)
  +    public DeployPortletAppEventListener(String webAppDir, 
PortletApplicationManagement pam)
       {
           this.webAppDir = webAppDir;
           this.pam = pam;
  @@ -60,9 +60,9 @@
           if (event.getEventType().equals(DeploymentEvent.EVENT_TYPE_DEPLOY))
           {
               try
  -            {
  -
  +            {                
                   FSObjectHandler handler = (FSObjectHandler) event.getHandler();
  +                boolean isLocal = 
handler.getFile().getName().startsWith("jetspeed-");
                   InputStream portletXmlStream = 
handler.getConfiguration("WEB-INF/portlet.xml");
                   if (portletXmlStream == null)
                   {
  @@ -90,7 +90,16 @@
   
                       log.info("Preparing to deploy portlet app \"" + id + "\"");
                  
  -                    pam.deploy(webAppDir, handler.getPath(), id);
  +                    if(isLocal)
  +                    {
  +                         log.info(handler.getFile().getName()+" will be registered 
as a local portlet applicaiton.");
  +                         pam.register(id, id, handler.getPath());
  +                    }
  +                    else
  +                    {
  +                         log.info("Deploying portlet applicaion WAR 
"+handler.getFile().getName());
  +                         pam.deploy(webAppDir, handler.getPath(), id);
  +                    }
                  
                                        
                                        appNameToFile.put(handler.getFile().getName(), 
id);
  @@ -112,6 +121,7 @@
               try
               {
                   FSObjectHandler handler = (FSObjectHandler) event.getHandler();
  +                boolean isLocal = 
handler.getFile().getName().startsWith("jetspeed-");
                   File fileThatWasRemoved = handler.getFile();
                   String fileName = fileThatWasRemoved.getName();
                   paName = (String) appNameToFile.get(fileName);
  @@ -130,8 +140,18 @@
                       PortletCache.removeAll(pa);
                   }
                   
  -                log.info("Preparing to undeploy portlet application 
\""+paName+"\"");
  -                pam.undeploy(webAppDir, paName);
  +                
  +                if(isLocal)
  +                {
  +                    log.info("Preparing to unregister portlet application 
\""+paName+"\"");
  +                    pam.unregister(paName, paName);                    
  +                }
  +                else
  +                {
  +                    log.info("Preparing to undeploy portlet application 
\""+paName+"\"");
  +                    pam.undeploy(webAppDir, paName);
  +                }
  +                
                   log.info("Portlet application \""+paName+"\""+" was successfuly 
undeployed.");
               }
               catch (Exception e)
  
  
  

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

Reply via email to