You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ra...@apache.org on 2003/12/05 00:06:20 UTC

cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager DeployUtilities.java FileSystemPAM.java PortletApplicationManager.java

raphael     2003/12/04 15:06:20

  Modified:    portal/src/java/org/apache/jetspeed/tools/pamanager Tag:
                        aggregation_1-branch DeployUtilities.java
                        FileSystemPAM.java PortletApplicationManager.java
  Log:
  - add register/unregister operations to PAM tool to update portlet registry for an
  already deployed WAR (like jetspeed itself)
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.1.1.2.1 +44 -44    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/DeployUtilities.java
  
  Index: DeployUtilities.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/DeployUtilities.java,v
  retrieving revision 1.1.1.1
  retrieving revision 1.1.1.1.2.1
  diff -u -r1.1.1.1 -r1.1.1.1.2.1
  --- DeployUtilities.java	28 Jul 2003 23:47:52 -0000	1.1.1.1
  +++ DeployUtilities.java	4 Dec 2003 23:06:20 -0000	1.1.1.1.2.1
  @@ -78,7 +78,7 @@
   /**
    * This class implements methods that are called during the deployment of the application.
    *
  - * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a> 
  + * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a>
     * @version $Id$
    */
   
  @@ -88,10 +88,10 @@
       /**
        * Deploys archives from a war file to the WebApps directory
        * @param webAppsDir The application server directory
  -     * @param warFile The war file to deploy 
  +     * @param warFile The war file to deploy
        * @throws PortletApplicationException
        */
  -    
  +
       public void deployArchive(String webAppsDir, String warFile, String appName) throws PortletApplicationException
       {
           String warFileName = warFile;
  @@ -107,13 +107,13 @@
           try
           {
               String destination = webAppsDir + appName;
  -    
  +
               JarFile jarFile = new JarFile(warFile);
               Enumeration files = jarFile.entries();
               while (files.hasMoreElements())
               {
                   JarEntry entry = (JarEntry)files.nextElement();
  -    
  +
                   File file = new File(destination, entry.getName());
                   File dirF = new File(file.getParent());
                   dirF.mkdirs();
  @@ -133,26 +133,26 @@
                       }
                       fos.close();
                   }
  -    
  +
               }
  -    
  +
               System.out.println("Libraries and classes deployment finished!");
           }
           catch( Exception e )
           {
               e.printStackTrace();
  -            PortletApplicationException pe = 
  -                new PortletApplicationException("Exception while copying jar files to web apps directory '" + 
  -                                                 webAppsDir +"'" + e.getMessage());            
  +            PortletApplicationException pe =
  +                new PortletApplicationException("Exception while copying jar files to web apps directory '" +
  +                                                 webAppsDir +"'" + e.getMessage());
               throw pe;
           }
       }
   
       /**
        * getWebXMLPath()
  -     * Creates the full path to the web.xml. 
  +     * Creates the full path to the web.xml.
        * @param webAppsDir The application server directory
  -     * @param warFile The war file to deploy 
  +     * @param warFile The war file to deploy
        * @throws PortletApplicationException
        */
   
  @@ -160,7 +160,7 @@
       {
           if (webAppsDir.length() == 0 || warFile.length() == 0 )
           {
  -            PortletApplicationException pe = 
  +            PortletApplicationException pe =
                   new PortletApplicationException("WebAppDir(" + webAppsDir + ") or WarFile ("+ warFile + ") not defined! ");
               throw pe;
           }
  @@ -190,54 +190,54 @@
       private final static String CONFIG_JAX_FACTORY_DOM = "jax.factory.dom";
       private String jaxDomFactoryProp = "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";
       private static final String JAX_DOM_PARSER_PROPERTY = "javax.xml.parsers.DocumentBuilderFactory";
  -    
  +
       public void processWebXML(String webXml, String paName) throws PortletApplicationException
  -    {     
  +    {
           System.out.println("prepare web archive '"+webXml+"' ...");
   
           try
           {
               // Read the WEB.XML and add application specific nodes.
  -            System.setProperty( JAX_DOM_PARSER_PROPERTY, jaxDomFactoryProp);            
  +            System.setProperty( JAX_DOM_PARSER_PROPERTY, jaxDomFactoryProp);
               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
               dbf.setNamespaceAware(true);
  -            
  +
               DocumentBuilder db = dbf.newDocumentBuilder();
               if (db== null)
               {
                 PortletApplicationException e = new PortletApplicationException( "Failed to create an XML DOM!");
                 throw e;
               }
  -           
  +
               Document doc = db.parse(new File(webXml));
               if ( doc == null)
               {
  -                PortletApplicationException e = 
  -                    new PortletApplicationException( "Failed to load " + webXml + 
  +                PortletApplicationException e =
  +                    new PortletApplicationException( "Failed to load " + webXml +
                           "\nMake sure that the file exists in the war file and it's valid XML syntax.");
                   throw e;
  -    
  +
               }
  -   
  +
               // web.xml loadded -- check if all elements are in the document
               boolean bServletMappingExists  = false;
               boolean bWelcomeFileExists     = false;
               boolean bDocUpdated            = false;    // Only save DOM document when it was updated
  -    
  +
               NodeList nodes_i   = doc.getDocumentElement().getChildNodes();
   
               for (int i = 0; i < nodes_i.getLength(); i++)
               {
                   Node node_i = nodes_i.item(i);
  -    
  +
                   if (   node_i.getNodeType() == Node.ELEMENT_NODE
  -                    && ((Element) node_i).getTagName().equals("servlet-mapping")) 
  +                    && ((Element) node_i).getTagName().equals("servlet-mapping"))
                   {
                       bServletMappingExists = true;
  -    
  +
                       Element eServletMapping = (Element) node_i;
                       NodeList nodes_j = eServletMapping.getChildNodes();
  -                    for (int j = 0; j < nodes_j.getLength(); j++) 
  +                    for (int j = 0; j < nodes_j.getLength(); j++)
                       {
                           // TBD: Not yet clear what element we try to add. Use <servlet-name>
                           //      for testing.
  @@ -264,12 +264,12 @@
                   else if (   node_i.getNodeType() == Node.ELEMENT_NODE
                            && ((Element) node_i).getTagName().equals("welcome-file-list"))
                   {
  -                  bWelcomeFileExists = true;  
  +                  bWelcomeFileExists = true;
                   }
               }
  - 
  +
               // Add the <welcome-file-list> node to the document
  -    
  +
               if ( bWelcomeFileExists == false)
               {
                   System.out.println("Adding <welcome-file-list> element to web.xml...");
  @@ -279,16 +279,16 @@
                   Element eWelcomeFile = doc.createElement("welcome-file");
                   Text txt = doc.createTextNode("Index.jsp");
                   eWelcomeFile.appendChild(txt);
  -    
  +
                   // Create welcome-file-list node
                   Element eWelcomeList = doc.createElement("welcome-file-list");
  -                
  +
                   // Add welcome-file node to welcome-file-list node
                   eWelcomeList.appendChild(eWelcomeFile);
  -    
  +
                   // Add the welcome-file-list to the document
                   doc.getDocumentElement().appendChild(eWelcomeList);
  -    
  +
               }
   
               // Persit DOM Docuemnt to disk
  @@ -302,7 +302,7 @@
                     ("-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN", "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd");
   
                   FileWriter fw = new FileWriter(webXml);
  -                
  +
                   XMLSerializer serial = new XMLSerializer(fw, format);
   
                   serial.asDOMSerializer();
  @@ -310,23 +310,23 @@
                   fw.close();
   
                   System.out.println("Updated " + webXml + " saved.....");
  -                                                                                
  +
               }
           }
           catch(SAXException se)
           {
  -            PortletApplicationException e = 
  +            PortletApplicationException e =
                   new PortletApplicationException("SAX Exception while ading elements to the web.xml file.\n" + se.getMessage());
               throw e;
           }
           catch(Exception ex)
           {
  -            PortletApplicationException e = 
  -                new PortletApplicationException("Unhandled exception while ading elements to the web.xml file.\n" 
  +            PortletApplicationException e =
  +                new PortletApplicationException("Unhandled exception while ading elements to the web.xml file.\n"
                               + ex.getMessage());
               throw e;
           }
  -            
  +
   
       }
   
  @@ -341,16 +341,16 @@
           if (dir.isDirectory())
           {
               String[] children = dir.list();
  -            for (int i=0; i<children.length; i++) 
  +            for (int i=0; i<children.length; i++)
               {
                   boolean success = deleteDir(new File(dir, children[i]));
  -                if (!success) 
  +                if (!success)
                   {
                       return false;
                   }
               }
           }
  -        
  +
           // The directory is now empty so delete it
           return dir.delete();
       }
  
  
  
  1.6.2.1   +141 -74   jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/FileSystemPAM.java
  
  Index: FileSystemPAM.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/FileSystemPAM.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- FileSystemPAM.java	26 Nov 2003 20:55:35 -0000	1.6
  +++ FileSystemPAM.java	4 Dec 2003 23:06:20 -0000	1.6.2.1
  @@ -72,7 +72,7 @@
    * This is the catalina specific implemenation for deplyment of Portlet Applications.
    *
    *
  - * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a> 
  + * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a>
    * @version $Id$
    */
   
  @@ -83,15 +83,55 @@
       private static final String DEPLOYMENT_SYSTEM = "jetspeed-deploy";
   
       private String deploymentDbAlias;
  +
  +    /**
  +     * <p>
  +     * deploy
  +     * </p>
  +     *
  +     * @see org.apache.jetspeed.tools.pamanager.Deployment#deploy(java.lang.String, java.lang.String, java.lang.String)
  +     * @param webAppsDir
  +     * @param warFile
  +     * @param paName
  +     * @throws PortletApplicationException
  +     */
  +    public void deploy(String webAppsDir, String warFile, String paName) throws PortletApplicationException
  +    {
  +        deploy(webAppsDir, warFile, paName, null, 0);
  +
  +    }
  +
  +    /**
  +     * <p>
  +     * deploy
  +     * </p>
  +     *
  +     * @see org.apache.jetspeed.tools.pamanager.Deployment#deploy(java.lang.String, java.lang.String, java.lang.String)
  +     * @param webAppsDir
  +     * @param warFile
  +     * @param paName
  +     * @param startState The deployment state where deployment should start:
  +     * 0 deploy war - 1 Update Web XML - 2 Update Regsitry
  +     * @throws PortletApplicationException
  +     */
  +    public void deploy(String webAppsDir, String warFile, String paName, int startState) throws PortletApplicationException
  +    {
  +        deploy(webAppsDir, warFile, paName, null, startState);
  +
  +    }
  +
       /**
        * Deploys the specified war file to the webapps dirctory specified.
  -     * 
  +     *
        * @param webAppsDir The webapps directory inside the Application Server
        * @param warFile The warFile containing the Portlet Application
        * @param paName The Portlet Application name
  +     * @param startState The deployment state where deployment should start:
  +     * 0 deploy war - 1 Update Web XML - 2 Update Regsitry
        * @throws PortletApplicationException
        */
  -    public void deploy(String webAppsDir, String warFile, String paName, String deploymentDbAlias)
  +    public void deploy(String webAppsDir, String warFile, String paName,
  +                       String deploymentDbAlias, int startState)
           throws PortletApplicationException
       {
           this.deploymentDbAlias = deploymentDbAlias;
  @@ -110,56 +150,68 @@
   
           try
           {
  -            util.deployArchive(webAppsDir, warFile, paName);
  +            if (startState <= nState)
  +            {
  +                util.deployArchive(webAppsDir, warFile, paName);
  +            }
  +
               nState = 1;
   
  -            util.processWebXML(util.getWebXMLPath(webAppsDir, warFile, paName), paName);
  +            if (startState <= nState)
  +            {
  +                util.processWebXML(util.getWebXMLPath(webAppsDir, warFile, paName), paName);
  +            }
  +
               nState = 2;
   
  -            // Application is deployed -- populate the registry with the portlet.xml
  -            String portletXMLPath = webAppsDir + paName + "/WEB-INF/portlet.xml";
  +            if (startState <= nState)
  +            {
  +                // Application is deployed -- populate the registry with the portlet.xml
  +                String portletXMLPath = webAppsDir + paName + "/WEB-INF/portlet.xml";
   
  -            // load the portlet.xml
  -            System.out.println("Loading " + portletXMLPath + " into memory....");
  -            app = (MutablePortletApplication) PortletDescriptorUtilities.loadPortletDescriptor(portletXMLPath, paName);
  +                // load the portlet.xml
  +                System.out.println("Loading " + portletXMLPath + " into memory....");
  +                app = (MutablePortletApplication) PortletDescriptorUtilities.loadPortletDescriptor(portletXMLPath, paName);
   
  -            if (app == null)
  -            {
  -                System.out.println("Error loading: " + portletXMLPath);
  -                rollback(nState, webAppsDir, paName, app);
  -                return;
  -            }
  +                if (app == null)
  +                {
  +                    System.out.println("Error loading: " + portletXMLPath);
  +                    rollback(nState, webAppsDir, paName, app);
  +                    return;
  +                }
   
  -            // create the web application 
  -            MutableWebApplication webapp = new WebApplicationDefinitionImpl();
  -            if (paName.startsWith("/"))
  -            {
  -                webapp.setContextRoot(paName);
  -            }
  -            else
  -            {
  -                webapp.setContextRoot("/" + paName);
  -            }
  -            webapp.addDisplayName(Jetspeed.getDefaultLocale(), paName);
  -            app.setWebApplicationDefinition(webapp);
  -
  -            //Test if application exists in registry
  -            //Uneeded as the registry service will do this for us.
  -            //            if ( JetspeedPortletRegistry.getPortletApplication(app.getName()) != null)
  -            //            {
  -            //                System.out.println("Application already exists in the database. Please undeploy the application : "
  -            //                      + app.getName());
  -            //                rollback(nState, webAppsDir, paName, app );
  -            //                return;
  -            //                   
  -            //            }
  +                // create the web application
  +                MutableWebApplication webapp = new WebApplicationDefinitionImpl();
  +                if (paName.startsWith("/"))
  +                {
  +                    webapp.setContextRoot(paName);
  +                }
  +                else
  +                {
  +                    webapp.setContextRoot("/" + paName);
  +                }
  +                webapp.addDisplayName(Jetspeed.getDefaultLocale(), paName);
  +                app.setWebApplicationDefinition(webapp);
   
  -            // save it to the registry
  -            System.out.println("Saving the portlet.xml in the registry...");
  -            // locate the deployment home
  -            identifyDeploymentSystem();
  +                //Test if application exists in registry
  +                //Uneeded as the registry service will do this for us.
  +                //            if ( JetspeedPortletRegistry.getPortletApplication(app.getName()) != null)
  +                //            {
  +                //                System.out.println("Application already exists in the database. Please undeploy the application : "
  +                //                      + app.getName());
  +                //                rollback(nState, webAppsDir, paName, app );
  +                //                return;
  +                //
  +                //            }
  +
  +                // save it to the registry
  +                System.out.println("Saving the portlet.xml in the registry...");
  +                // locate the deployment home
  +                identifyDeploymentSystem();
  +
  +                JetspeedPortletRegistry.registerPortletApplication(app, DEPLOYMENT_SYSTEM);
  +            }
   
  -            JetspeedPortletRegistry.registerPortletApplication(app, DEPLOYMENT_SYSTEM);
               nState = 3;
   
               // DONE
  @@ -192,14 +244,14 @@
       }
   
       /**
  -     * Undeploys application.
  -     * 
  +     * Unregisters application.
  +     *
        * @param webAppsDir The webapps directory inside the Application Server
  -     * @param paName The Portlet Application name 
  +     * @param paName The Portlet Application name
        * @throws PortletApplicationException
        */
   
  -    public void undeploy(String webAppsDir, String paName) throws PortletApplicationException
  +    public void unregister(String webAppsDir, String paName) throws PortletApplicationException
       {
           String portletXMLPath = webAppsDir + paName + "/WEB-INF/portlet.xml";
           try
  @@ -222,12 +274,44 @@
   
               // JetspeedPortletRegistry.processPortletApplicationTree(app, "remove");
               // locate the deployment home
  -			JetspeedPortletRegistry.beginTransaction();
  +            JetspeedPortletRegistry.beginTransaction();
               JetspeedPortletRegistry.removeApplication(app);
  -			JetspeedPortletRegistry.commitTransaction();
  +            JetspeedPortletRegistry.commitTransaction();
               // Remove the webapps directory
               System.out.println("Remove " + webAppsDir + paName + " and all sub-directories.");
   
  +        }
  +        catch (Exception re)
  +        {
  +            try
  +            {
  +                JetspeedPortletRegistry.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e)
  +            {
  +                // TODO Auto-generated catch block
  +                e.printStackTrace();
  +            }
  +            throw new PortletApplicationException(re.getMessage());
  +        }
  +
  +    }
  +
  +    /**
  +     * Undeploys application.
  +     *
  +     * @param webAppsDir The webapps directory inside the Application Server
  +     * @param paName The Portlet Application name
  +     * @throws PortletApplicationException
  +     */
  +
  +    public void undeploy(String webAppsDir, String paName) throws PortletApplicationException
  +    {
  +        try
  +        {
  +            // First unergister the application from Registry
  +            unregister(webAppsDir, paName);
  +
               // Call into DeplyUtilities class
               DeployUtilities util = new DeployUtilities();
               if (util.deleteDir(new File(webAppsDir + paName)) == false)
  @@ -242,7 +326,7 @@
           }
           catch (Exception re)
           {
  -			try
  +            try
               {
                   JetspeedPortletRegistry.rollbackTransaction();
               }
  @@ -286,8 +370,8 @@
   
       /**
        * Undeploys application.
  -     * 
  -     * @param paName The Portlet Application name 
  +     *
  +     * @param paName The Portlet Application name
        * @throws PortletApplicationException
        */
       public void undeploy(String paName) throws PortletApplicationException
  @@ -309,15 +393,15 @@
                   System.out.println("Saving the portlet.xml in the registry...");
                   // locate the deployment home
                   identifyDeploymentSystem();
  -				JetspeedPortletRegistry.beginTransaction();
  +                JetspeedPortletRegistry.beginTransaction();
                   JetspeedPortletRegistry.removeApplication(app);
  -				JetspeedPortletRegistry.commitTransaction();
  +                JetspeedPortletRegistry.commitTransaction();
               }
   
           }
           catch (Exception e1)
           {
  -			try
  +            try
               {
                   JetspeedPortletRegistry.rollbackTransaction();
               }
  @@ -353,21 +437,4 @@
               return;
           }
       }
  -    /** 
  -     * <p>
  -     * deploy
  -     * </p>
  -     * 
  -     * @see org.apache.jetspeed.tools.pamanager.Deployment#deploy(java.lang.String, java.lang.String, java.lang.String)
  -     * @param webAppsDir
  -     * @param warFile
  -     * @param paName
  -     * @throws PortletApplicationException
  -     */
  -    public void deploy(String webAppsDir, String warFile, String paName) throws PortletApplicationException
  -    {
  -        deploy(webAppsDir, warFile, paName, null);
  -
  -    }
  -
   }
  
  
  
  1.1.1.1.2.1 +110 -45   jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java
  
  Index: PortletApplicationManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java,v
  retrieving revision 1.1.1.1
  retrieving revision 1.1.1.1.2.1
  diff -u -r1.1.1.1 -r1.1.1.1.2.1
  --- PortletApplicationManager.java	28 Jul 2003 23:47:53 -0000	1.1.1.1
  +++ PortletApplicationManager.java	4 Dec 2003 23:06:20 -0000	1.1.1.1.2.1
  @@ -71,7 +71,7 @@
    * This is the interface that defines the Lifecycle-related methods to control
    * Portlet Applications.
    *
  - * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a> 
  + * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a>
     * @version $Id$
    */
   
  @@ -80,19 +80,19 @@
       /**
        * Command line utility to deploy a portlet application to an application server.
        * The command line has the following options:
  -     * 
  +     *
        * PortletApplicationManager
        * -DWebappDir={Webapps directory of application server}
        * -DWarFileName={Name of the WAR file to deploy}
  -     * -Daction={deploy|undeploy|start|stop|reload}
  +     * -Daction={deploy|register|undeploy|unregister|start|stop|reload}
        * -DPortletAppName= Name of the Portlet application
        * -DApplicationServer={Catalina}
        *
  -     *Notes: The deploy action requires the WarFileName. If no ApplicationServer 
  +     *Notes: The deploy action requires the WarFileName. If no ApplicationServer
        *       is defined it requires in additionthe WebappDir.
        *       All other actions require the PortletAppName. If the ApplicationServer
        *       is not defined it will use catalina as default.
  -                                
  +
        */
   
       public static void main(String args[])
  @@ -101,7 +101,7 @@
           Engine engine = null;
           int i = 0;
   
  -        // Read the command line 
  +        // Read the command line
           String strWebAppDir = "";
           String strAction = "";
           String strWarFileName = "";
  @@ -164,7 +164,7 @@
   
           }
   
  -        // Portlet Application Name and action are required by all functions. 
  +        // Portlet Application Name and action are required by all functions.
           // Make sure that the values were defined from the command line.
           if (strPortletAppName.length() == 0 || strAction.length() == 0)
           {
  @@ -228,35 +228,49 @@
                   }
               }
           }
  -        else
  -            if (strAction.compareToIgnoreCase("undeploy") == 0)
  +        else if (strAction.compareToIgnoreCase("register") == 0)
  +        {
  +            // Requires WebAppDir
  +            if (strWebAppDir.length() == 0)
               {
  -                // Application server can be null -- using Catalina as default
  -                undeploy(strWebAppDir, strPortletAppName, strAppServer);
  +                System.out.println(
  +                    "\nRegister action requires the definition of the Web application directory.");
  +                return;
               }
  -            else
  -                if (strAction.compareToIgnoreCase("start") == 0)
  -                {
  -                    // Application server can be null -- using Catalina as default
  -                    start(strAppServer, strPortletAppName);
  -                }
  -                else
  -                    if (strAction.compareToIgnoreCase("stop") == 0)
  -                    {
  -                        // Application server can be null -- using Catalina as default
  -                        stop(strAppServer, strPortletAppName);
  -                    }
  -                    else
  -                        if (strAction.compareToIgnoreCase("reload") == 0)
  -                        {
  -                            // Application server can be null -- using Catalina as default
  -                            reload(strAppServer, strPortletAppName);
  -                        }
  -                        else
  -                        {
  -                            System.out.println("\nAction: " + strAction + " not recognized by the PortletApplicationManager.");
  -                            helpScreen();
  -                        }
  +
  +            register(strWebAppDir, strWarFileName, strPortletAppName);
  +        }
  +        else if (strAction.compareToIgnoreCase("unregister") == 0)
  +        {
  +            // Application server can be null -- using Catalina as default
  +            unregister(strWebAppDir, strPortletAppName, strAppServer);
  +        }
  +        else if (strAction.compareToIgnoreCase("undeploy") == 0)
  +        {
  +            // Application server can be null -- using Catalina as default
  +            undeploy(strWebAppDir, strPortletAppName, strAppServer);
  +        }
  +        else if (strAction.compareToIgnoreCase("start") == 0)
  +        {
  +            // Application server can be null -- using Catalina as default
  +            start(strAppServer, strPortletAppName);
  +        }
  +        else if (strAction.compareToIgnoreCase("stop") == 0)
  +        {
  +            // Application server can be null -- using Catalina as default
  +            stop(strAppServer, strPortletAppName);
  +        }
  +        else if (strAction.compareToIgnoreCase("reload") == 0)
  +        {
  +            // Application server can be null -- using Catalina as default
  +            reload(strAppServer, strPortletAppName);
  +        }
  +        else
  +        {
  +            System.out.println("\nAction: " + strAction + " not recognized by the PortletApplicationManager.");
  +            helpScreen();
  +        }
  +
           try
           {
               if (engine != null)
  @@ -294,8 +308,59 @@
       // Implementaion of the API's
   
       /**
  +     * Registers the already deployed WAR into the Portal registry
  +     *
  +     * @param webAppsDir The webapps directory inside the Application Server
  +     * @param warFile The warFile containing the Portlet Application
  +     * @param paName The Portlet Application name
  +     * @throws PortletApplicationException
  +     */
  +
  +    public static void register(String webAppsDir, String warFile, String strPortletAppName)
  +    {
  +        // Invoke FileSystemPAM
  +        FileSystemPAM fs = new FileSystemPAM();
  +        try
  +        {
  +            System.out.println("Calling FileSystemPAM...");
  +
  +            fs.deploy(webAppsDir, warFile, strPortletAppName, 1);
  +        }
  +        catch (PortletApplicationException e)
  +        {
  +            //e.printStackTrace(System.out);
  +            System.out.println(e.getMessage());
  +        }
  +    }
  +
  +    /**
  +     * Unregisterd a deployed portlet application
  +     *
  +     * @param paName The Portlet Application name
  +     * @throws PortletApplicationException
  +     */
  +
  +    public static void unregister(String strWebAppDir, String paName, String appServer)
  +    {
  +        if (strWebAppDir.length() != 0)
  +        {
  +            // FileSystem undeploy
  +            FileSystemPAM dc = new FileSystemPAM();
  +            try
  +            {
  +                dc.unregister(strWebAppDir, paName);
  +            }
  +            catch (PortletApplicationException e)
  +            {
  +                e.printStackTrace(System.out);
  +            }
  +        }
  +
  +    }
  +
  +    /**
        * Deploys the specified war file to the webapps dirctory specified.
  -     * 
  +     *
        * @param webAppsDir The webapps directory inside the Application Server
        * @param warFile The warFile containing the Portlet Application
        * @param paName The Portlet Application name
  @@ -322,7 +387,7 @@
       /**
        * Deploys the specified war file to the webapps directory on the Application Server.
        * The appServer parameter specifies a specific Application Server.
  -     * 
  +     *
        * @param warFile The warFile containing the Portlet Application
        * @param appServer The Application Server name receiving the Portlet Application.
        * @param paName The Portlet Application name
  @@ -353,8 +418,8 @@
   
       /**
        * Prepares the specified war file for deployment.
  -     * 
  -     * @param paName The Portlet Application name 
  +     *
  +     * @param paName The Portlet Application name
        * @throws PortletApplicationException
        */
   
  @@ -399,8 +464,8 @@
   
       /**
       * Starts the specified Portlet Application on the Application Server
  -    * 
  -    * @param paName The Portlet Application name 
  +    *
  +    * @param paName The Portlet Application name
       * @throws PortletApplicationException
       */
   
  @@ -429,8 +494,8 @@
   
       /**
        * Stops a portlet application from running on the Application Server
  -     * 
  -     * @param paName The Portlet Application name 
  +     *
  +     * @param paName The Portlet Application name
        * @throws PortletApplicationException
        */
   
  @@ -459,8 +524,8 @@
   
       /**
        * Reloads a portlet application.
  -     * 
  -     * @param paName The Portlet Application name 
  +     *
  +     * @param paName The Portlet Application name
        * @throws PortletApplicationException
        */
   
  
  
  

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