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/tools/pamanager/servletcontainer WeblogicManager.java TomcatManager.java JBossManager.java ApplicationServerManager.java
Date Wed, 23 Mar 2005 22:54:30 GMT
ate         2005/03/23 14:54:30

  Modified:    portal/src/java/org/apache/jetspeed/tools/pamanager
                        PortletApplicationManager.java
               portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer
                        WeblogicManager.java TomcatManager.java
                        JBossManager.java
  Removed:     portal/src/java/org/apache/jetspeed/tools/pamanager
                        RegistrationTool.java Deployment.java
                        FileSystemPAM.java Registration.java
                        ApplicationAlreadyDeployedException.java
                        DeploymentException.java WarInfusionPAM.java
                        ApplicationServerPAM.java DeployUtilities.java
                        PortletApplicationManagement.java Lifecycle.java
               portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer
                        ApplicationServerManager.java
  Log:
  Resolving http://issues.apache.org/jira/browse/JS2-210:
  New portlet container access and invokation implementation
  
  Revision  Changes    Path
  1.19      +311 -605  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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- PortletApplicationManager.java	29 Oct 2004 14:19:37 -0000	1.18
  +++ PortletApplicationManager.java	23 Mar 2005 22:54:30 -0000	1.19
  @@ -15,661 +15,367 @@
    */
   package org.apache.jetspeed.tools.pamanager;
   
  -import java.io.File;
  -import java.io.FileInputStream;
  -import java.io.IOException;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.Map;
  -import java.util.Properties;
  -import java.util.Map.Entry;
  -
  -import org.apache.commons.configuration.Configuration;
  -import org.apache.commons.configuration.PropertiesConfiguration;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.apache.jetspeed.Jetspeed;
  +
  +import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
  +import org.apache.jetspeed.components.portletentity.PortletEntityNotDeletedException;
   import org.apache.jetspeed.components.portletregistry.PortletRegistry;
  -import org.apache.jetspeed.deployment.impl.FileNotDeployableException;
  -import org.apache.jetspeed.deployment.impl.StandardDeploymentObject;
  -import org.apache.jetspeed.engine.Engine;
  -import org.apache.jetspeed.engine.JetspeedEngineConstants;
  -import org.apache.jetspeed.engine.SpringEngine;
  -import org.apache.jetspeed.exception.JetspeedException;
  -import org.apache.jetspeed.util.DirectoryHelper;
  +import org.apache.jetspeed.components.portletregistry.RegistryException;
  +import org.apache.jetspeed.container.window.PortletWindowAccessor;
  +import org.apache.jetspeed.factory.PortletFactory;
  +import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
  +import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
  +import org.apache.jetspeed.search.SearchEngine;
  +import org.apache.jetspeed.util.FileSystemHelper;
   import org.apache.jetspeed.util.descriptor.PortletApplicationWar;
   
  +import org.apache.pluto.om.entity.PortletEntity;
  +import org.apache.pluto.om.portlet.PortletDefinition;
  +
  +import java.io.IOException;
  +
  +import java.util.Iterator;
  +
   /**
    * PortletApplicationManager
    *
  - * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  + * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
    * @version $Id$
    */
  -/**
  - * 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>
  -  * @version $Id$
  - */
  -
  -public class PortletApplicationManager implements JetspeedEngineConstants
  +public class PortletApplicationManager implements PortletApplicationManagement
   {
  -    private static final Log log = LogFactory.getLog("deployment");
  -    
  -    /**
  -     * 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|register|undeploy|unregister|start|stop|reload}
  -     * -DPortletAppName= Name of the Portlet application
  -     * -DApplicationServer={Catalina}
  -     * -DApplicationType={webapp|local}
  -     *    (default webapp)
  -     * -DServer={host name of the target server}
  -     *   (optional: required for if deploying to Catalina)
  -     * -DServerPort={port of the target server. Default: localhost}
  -     *   (optional: required for if deploying to Catalina. Default: 8080)
  -     * -DUserName={User name to access the servers management system}
  -     *   (optional: required for if deploying to Catalina)
  -     * -DPassword={Password to access the servers management system}
  -     *   (optional: required for if deploying to Catalina)
  -     * -DImpl=(full class name i.e. org.apache.jetspeed.tools.pamanager.FileSystemPAM)
  -     *
  -     *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[])
  -    {
  -        String arg;
  -        Engine engine = null;
  -        int i = 0;        
  -
  -        // Read the command line
  -        String strWebAppDir = "";
  -        String strAction = "";
  -        String strWarFileName = "";
  -        String strPortletAppName = "";
  -        String strPortalName = "jetspeed";
  -        String applicationType = "webapp";
  -		String strUserName = "";
  -		String strPassword = "";
  -		String strServer = "localhost";
  -        String className = "org.apache.jetspeed.tools.pamanager.FileSystemPAM"; // default
  -        Deployment deployer = null;
  -        Registration registrator = null;
  -        Lifecycle lifecycle = null;
  -        
  -		int intServerPort = 8080;
  -        String jetspeedPropertiesFile = System.getProperty("pam.jetspeed.properties", "/WEB-INF/conf/jetspeed.properties");
  -        String appsDirectory = System.getProperty("pam.apps.directory", "/WEB-INF/apps/");
  -        
  -        while (i < args.length && args[i].startsWith("-"))
  -        {
  -            arg = args[i++];
  +    private static final Log    log = LogFactory.getLog("deployment");
  +    private static final String PORTLET_XML = "WEB-INF/portlet.xml";
   
  -            // use this type of check for arguments that require arguments
  -            if (arg.equalsIgnoreCase("-PortletAppName"))
  -            {
  -                if (i < args.length)
  -                    strPortletAppName = args[i++];
  -            }
  -            else if (arg.equalsIgnoreCase("-Impl"))
  -            {
  -                if (i < args.length)
  -                    className = args[i++];
  -            }            
  -            else if (arg.equalsIgnoreCase("-Action"))
  -            {
  -                if (i < args.length)
  -                    strAction = args[i++];
  -            }
  -            else if (arg.equalsIgnoreCase("-WebAppDir"))
  -            {
  -                if (i < args.length)
  -                    strWebAppDir = args[i++];
  -            }
  -            else if (arg.equalsIgnoreCase("-WarFileName"))
  -            {
  -                if (i < args.length)
  -                    strWarFileName = args[i++];
  -            }
  -            else if (arg.equalsIgnoreCase("-PortalName"))
  -            {
  -                if (i < args.length)
  -                    strPortalName = args[i++];
  -            }
  -            else if (arg.equalsIgnoreCase("-UserName"))
  -            {
  -                if (i < args.length)
  -                    strUserName = args[i++];
  -            }
  -			else if (arg.equalsIgnoreCase("-Password"))
  -			{
  -				if (i < args.length)
  -					strPassword = args[i++];
  -			}
  -			else if (arg.equalsIgnoreCase("-Server"))
  -			{
  -				if (i < args.length)
  -					strServer= args[i++];
  -			}
  -            else if (arg.equalsIgnoreCase("-ServerPort"))
  -            {
  -                if (i < args.length)
  -                    intServerPort = Integer.parseInt(args[i++]);
  -            }
  -            else if (arg.equalsIgnoreCase("-ApplicationType"))
  -            {
  -                if (i < args.length)
  -                {
  -                    applicationType = args[i++];
  -                }
  -            }
  -            else if (arg.equalsIgnoreCase("-h"))
  -            {
  -                helpScreen();
  -                return;
  -            }
  -            else if (arg.equalsIgnoreCase("-?"))
  -            {
  -                helpScreen();
  -                return;
  -            }
  -        }
  -        
  -        // 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)
  -        {
  -            System.out.println(
  -                "\nPortlet Application Name and/or action are not defined."
  -                    + "Please use '-PortletAppName appName' and/or '-Action deploy' from the command line\n");
  -            helpScreen();
  -            log.error("PAM Error: Invalid parameter(s) passed, cannot process PAM request.");
  -            if (!log.isInfoEnabled())
  -            {
  -                logRequest(args, true);
  -            }            
  -            return;
  -        }
  -
  -        String strAppRoot = strWebAppDir + strPortalName;
  +    protected PortletEntityAccessComponent entityAccess;
  +    protected PortletFactory        portletFactory;
  +    protected PortletRegistry       registry;
  +    protected PortletWindowAccessor windowAccess;
  +    protected SearchEngine searchEngine;
   
  +    /**
  +	 * Creates a new PortletApplicationManager object.
  +	 */
  +	public PortletApplicationManager(PortletFactory portletFactory, PortletRegistry registry,
  +		PortletEntityAccessComponent entityAccess, PortletWindowAccessor windowAccess)
  +	{
  +		this.portletFactory     = portletFactory;
  +		this.registry		    = registry;
  +		this.entityAccess	    = entityAccess;
  +		this.windowAccess	    = windowAccess;
  +	}
  +
  +	public void setSearchEngine(SearchEngine searchEngine)
  +	{
  +		this.searchEngine = searchEngine;
  +	}
  +
  +	public void startLocalPortletApplication(String contextName, FileSystemHelper warStruct,
  +		ClassLoader paClassLoader)
  +		throws RegistryException
  +	{
  +        checkValidContextName(contextName, true);
  +        startPA(contextName, warStruct, paClassLoader, true);
  +	}
  +
  +	public void startPortletApplication(String contextName, FileSystemHelper warStruct,
  +		ClassLoader paClassLoader)
  +		throws RegistryException
  +	{
  +        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
  +        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
           try
           {
  -            // Start the registry service -- it's needed by many actions
  -            Configuration properties =
  -                (Configuration) new PropertiesConfiguration(strAppRoot + jetspeedPropertiesFile);
  -
  -            properties.setProperty(APPLICATION_ROOT_KEY, strAppRoot);
  -
  -            // Override the properties with PAM specifice settings
  -            overrideProperties(strAppRoot, properties);
  -
  -            engine = Jetspeed.createEngine(properties, strAppRoot, null, SpringEngine.class);            
  +            checkValidContextName(contextName, false);
  +            startPA(contextName, warStruct, paClassLoader, false);
           }
  -        catch (Exception e)
  +        finally
           {
  -            String msg = "PAM Error: Failed to create the Jetspeed Engine. Error: ";
  -            System.out.println(msg + e.getMessage());
  -            log.error(msg, e);
  -            shutdownAndExit(engine);
  +            Thread.currentThread().setContextClassLoader(contextClassLoader);
           }
  +	}
   
  -        logRequest(args, false);
  -        
  +	public void stopLocalPortletApplication(String contextName)
  +		throws RegistryException
  +	{
  +		checkValidContextName(contextName, true);
  +		stopPA(contextName);
  +	}
  +
  +	public void stopPortletApplication(String contextName)
  +		throws RegistryException
  +	{
  +        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
  +        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
           try
           {
  -            System.out.println("Ready to run PAM implementation: " + className);
  -            System.out.print("Supporting interfaces: Deployment");
  -            // Class clas = Class.forName(className);
  -            PortletRegistry portletRegistry = (PortletRegistry) engine.getComponentManager()
  -                    .getComponent(PortletRegistry.class);
  -            deployer = (Deployment) engine.getComponentManager().getComponent("PAM");
  -            if (deployer instanceof Registration)
  -            {                
  -                System.out.print(", Registration");
  -                registrator = (Registration)deployer;
  -            }
  -            if (deployer instanceof Lifecycle)
  -            {
  -                System.out.print(", Lifecycle");
  -                lifecycle = (Lifecycle)deployer;
  -            }            
  -            System.out.println();
  +            checkValidContextName(contextName, false);
  +            stopPA(contextName);
           }
  -        catch (Exception e)
  +        finally
           {
  -            String msg = "PAM Error: Failed to create PAM implementation class object: " + className + " Error: ";
  -            System.out.println(msg  + e.getMessage());
  -            log.error(msg, e);
  -            shutdownAndExit(engine);                        
  +            Thread.currentThread().setContextClassLoader(contextClassLoader);
           }
  -        
  +	}
  +
  +	public void unregisterPortletApplication(String paName)
  +		throws RegistryException
  +	{
  +        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
  +        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
           try
           {
  -            // Invoke the functions
  -            if (strAction.compareToIgnoreCase("deploy") == 0)
  +            MutablePortletApplication pa = null;
  +            
  +            try
               {
  -                // Make sure that the WarFileName and the ApplicationServer are defined
  -                if (strWarFileName.length() == 0)
  -                {
  -                    System.out.println(
  -                        "\nDeploy action requires the war file name. Use '-WarFileName file.war' to specify the file name");
  -                    log.error("PAM Error: Web application (WAR) file name not specified.");
  -                    shutdownAndExit(engine);                
  -                }
  -                else
  -                {
  -                    if (applicationType.equals("local"))
  -                    {
  -                        String portletAppRoot = strAppRoot + appsDirectory;
  -                        deploy(deployer, portletAppRoot, strWarFileName, strPortletAppName); // [RUN]
  -                    }
  -                    else
  -                    {
  -                        // Requires WebAppDir
  -                        if (strWebAppDir.length() == 0)
  -                        {
  -                            System.out.println(
  -                                "\nDeploy action requires the definition of the ApplicationServer or the Web application directory.");
  -                            log.error("PAM Deploy Error: Web application (WAR) directory name not specified.");
  -                            shutdownAndExit(engine);                        
  -                        }
  -    
  -                        // File deploy uses Directory and warfile
  -                        deploy(deployer, strWebAppDir, strWarFileName, strPortletAppName); // [RUN]
  -                    }
  -                }
  -            }
  -            else if (strAction.compareToIgnoreCase("register") == 0)
  -            {
  -                // Requires WebAppDir
  -                if (strWebAppDir.length() == 0)
  -                {
  -                    System.out.println("\nRegister action requires the definition of the Web application directory.");
  -                    log.error("PAM Register Error: Web application (WAR) directory name not specified.");                        
  -                    shutdownAndExit(engine);
  -                }
  -                if (null == registrator)
  -                {
  -                    String msg = "PAM Register Error: Registration interface not supported by implementation: " + className;            
  -                    System.out.println("\n" + msg);
  -                    log.error(msg);
  -                    shutdownAndExit(engine);                                
  -                }
  -    
  -                register(registrator, strPortletAppName, strWarFileName); // [RUN]
  -            }
  -            else if (strAction.compareToIgnoreCase("unregister") == 0)
  -            {          
  -                if (null == registrator)
  -                {
  -                    String msg = "PAM Register Error: Registration interface not supported by implementation: " + className;            
  -                    System.out.println("\n" + msg);
  -                    log.error(msg);  
  -                    shutdownAndExit(engine);                
  -                }
  -                
  -                // Application server can be null -- using Catalina as default
  -                unregister(registrator, strPortletAppName); // [RUN]
  -            }
  -            else if (strAction.compareToIgnoreCase("undeploy") == 0)
  -            {
  -                
  -                undeploy(deployer, strWebAppDir, strPortletAppName, strServer, intServerPort, strUserName, strPassword); // [RUN]
  -            }
  -            else if (strAction.compareToIgnoreCase("start") == 0)
  -            {
  -                if (null == lifecycle)
  -                {
  -                    String msg = "PAM Lifecycle Error: Lifecycle interface not supported by implementation: " + className;            
  -                    System.out.println("\n" + msg);
  -                    log.error(msg);
  -                    shutdownAndExit(engine);                                
  -                }
  -    
  -                start(lifecycle, strPortletAppName, strServer, intServerPort, strUserName, strPassword); // [RUN]
  +                pa = (MutablePortletApplication) registry.getPortletApplication(paName);
               }
  -            else if (strAction.compareToIgnoreCase("stop") == 0)
  +            catch (Exception e)
               {
  -                stop(lifecycle, strPortletAppName, strServer, intServerPort, strUserName, strPassword); // [RUN]
  +                // ignore errors during portal shutdown
               }
  -            else if (strAction.compareToIgnoreCase("reload") == 0)
  +
  +            if (pa != null)
               {
  -                if (null == lifecycle)
  +                if (portletFactory.getPortletApplicationClassLoader(pa) != null)
                   {
  -                    String msg = "PAM Lifecycle Error: Lifecycle interface not supported by implementation: " + className;            
  -                    System.out.println("\n" + msg);
  -                    log.error(msg);
  -                    shutdownAndExit(engine);                                
  +                    throw new RegistryException("Portlet Application " + paName + " still running");
                   }
  -                // Application server can be null -- using Catalina as default
  -                reload(lifecycle, strPortletAppName, strServer, intServerPort, strUserName, strPassword); // [RUN]
  -            }
  -            else
  -            {
  -                System.out.println("\nAction: " + strAction + " not recognized by the PortletApplicationManager.");
  -                helpScreen();
  -            }
  -        }
  -        catch (Exception e)
  -        {
  -            String msg = "PAM Error: Failed during execution of " + strAction + ", error = " + e.getMessage();
  -            System.out.println(msg);
  -            log.error(msg);                        
  -            shutdownAndExit(engine);                    
  -        }
  -        
  -        try
  -        {
  -            if (engine != null)
  -            {
  -                engine.shutdown();
  -            }
  -        }
  -        catch (JetspeedException e1)
  -        {
  -            System.out.println("Failed shutting down the engine. Error: " + e1.getMessage());
  -            log.error("PAM Error: Failed shutting down the engine.", e1);                        
  -            System.exit(0);            
  -        }
  -        
  -        String msg = "PAM: completed operation " + strAction;
  -        System.out.println(msg);
  -        log.info(msg);
  -        System.exit(0);
  -    }
   
  -    public static void shutdownAndExit(Engine engine)
  -    {
  -        try
  -        {
  -            if (engine != null)
  -            {
  -                engine.shutdown();
  +                unregisterPortletApplication(pa, true);
               }
           }
  -        catch (JetspeedException e1)
  +        finally
           {
  -            System.out.println("Failed shutting down the engine. Error: " + e1.getMessage());
  -            log.error("PAM Error: Failed shutting down the engine.", e1);                        
  +            Thread.currentThread().setContextClassLoader(contextClassLoader);
           }
  -        
  -        System.exit(0);                    
  -    }
  -    
  -    public static void helpScreen()
  -    {
  -        System.out.println("\nPortletApplicationManager [options]\n");
  -        System.out.println("\t-action\t\t\t{deploy|undeploy|start|stop|reload}\n");
  -        System.out.println("\t-PortletAppName\t\t{AppName}\n");
  -        System.out.println("\t-WebAppDir\t\t{Path to target WebApp directory}\n");
  -        System.out.println("\t-WarFileName\t\t{Path to war file to deploy}\n");
  -        System.out.println("\t-Impl\t\t{class name of implementation}\n");
  -        System.out.println("\t-ApplicationType\t{webapp|local}\n");
  -
  -        System.out.println("\nNotes:");
  -        System.out.println("-Each command requires at least the action and the PortletAppName options.");
  -        System.out.println("-File system deploy requires the WebAppDir and War file option");
  -        System.out.println("-Deploy and undeploy actions require the WarFileName");
  +	}
   
  -        System.out.println(
  -            "\nExample: PortletApplicationManager -action deploy -PortletAppName DemoApp -ApplicationServer Catalina\n");
  +	protected void checkValidContextName(String contextName, boolean local)
  +		throws RegistryException
  +	{
  +		int prefixLength = LOCAL_PA_PREFIX.length();
   
  -    }
  +		if ((contextName.length() >= prefixLength)
  +			&& contextName.substring(0, prefixLength).equalsIgnoreCase(LOCAL_PA_PREFIX))
  +		{
  +			if (!local)
  +			{
  +				throw new RegistryException("Prefix \"" + LOCAL_PA_PREFIX
  +					+ "\" is reserved for Local Portlet Applications only.");
  +			}
  +		}
  +		else if (local)
  +		{
  +			throw new RegistryException("Prefix \"" + LOCAL_PA_PREFIX
  +				+ "\" is required for Local Portlet Applications.");
  +		}
  +	}
  +
  +	protected MutablePortletApplication registerPortletApplication(PortletApplicationWar paWar,
  +		MutablePortletApplication oldPA, boolean local)
  +		throws RegistryException
  +	{
  +		if (oldPA != null)
  +		{
  +			unregisterPortletApplication(oldPA, false);
  +			oldPA = null;
  +		}
  +
  +		MutablePortletApplication pa		 = null;
  +		boolean					  registered = false;
  +		String					  paName     = paWar.getPortletApplicationName();
  +
  +		try
  +		{
  +			log.info("Loading portlet.xml...." + paName);
  +			pa = paWar.createPortletApp();
   
  -    // Implementaion of the API's
  +			if (local)
  +			{
  +				pa.setApplicationType(MutablePortletApplication.LOCAL);
  +			}
  +			else
  +			{
  +				pa.setApplicationType(MutablePortletApplication.WEBAPP);
  +			}
   
  -    /**
  -     * Registers the already deployed WAR into the Portal registry
  -     *
  -     * @param registrator PAM implementation supporting Registration interface
  -     * @param webApplicationName The webapps directory or name inside the Application Server
  -     * @param portletApplicationName The Portlet Application name
  -     * @throws PortletApplicationException
  -     * @throws IOException
  -     * @throws FileNotDeployableException
  -     */
  -
  -    public static void register(Registration registrator,                                
  -                                String portletApplicationName,
  -                                String warFile)
  -    throws PortletApplicationException, FileNotDeployableException, IOException
  -    {
  -        System.out.println("Registering Portlet Application [" + portletApplicationName + "]...");  
  -              
  -        StandardDeploymentObject deploymentObject = new StandardDeploymentObject(new File(warFile));
  -        registrator.register(new PortletApplicationWar(deploymentObject.getFileObject(),  portletApplicationName, "/"+portletApplicationName ) );
  -        System.out.println("...PAM Register done");   
  -        deploymentObject.close();
  -    }
  +			// load the web.xml
  +			log.info("Loading web.xml...." + paName);
  +			MutableWebApplication wa = paWar.createWebApp();
  +			paWar.validate();
   
  -    /**
  -     * Unregisterd a deployed portlet application
  -     *
  -     * @param registrator PAM implementation supporting Registration interface
  -     * @param webApplicationName The webapps directory or name inside the Application Server
  -     * @param portletApplicationName The Portlet Application name
  -     */
  -
  -    public static void unregister(Registration registrator,
  -                                  
  -                                  String portletApplicationName)
  -    throws PortletApplicationException    
  -    {
  -        System.out.println("Unregistering Portlet Application [" + portletApplicationName + "...");
  -        registrator.unregister(portletApplicationName);
  -        System.out.println("...PAM Unregister done");        
  -    }
  +			if (local)
  +			{
  +				wa.setContextRoot("<portal>");
  +			}
   
  -    /**
  -     * Deploys the specified war file to the webapps dirctory specified.
  -     *
  -     * @param webAppsDir The webapps directory or name inside the Application Server
  -     * @param warFile The warFile containing the Portlet Application
  -     * @param portletApplicationName The Portlet Application name
  -     * @throws PortletApplicationException
  -     * @throws IOException
  -     * @throws FileNotDeployableException
  -     */
  -
  -    public static void deploy(Deployment deployer,
  -                              String webAppsDir, 
  -                              String warFile,
  -                              String portletApplicationName)
  -    throws PortletApplicationException, FileNotDeployableException, IOException        
  -    {
  -        System.out.println("Deploying Web Application [" + webAppsDir + "] to Portlet Application [" + portletApplicationName + "]...");
  -               
  -        StandardDeploymentObject deploymentObject = new StandardDeploymentObject(new File(warFile));
  -        deployer.deploy(new PortletApplicationWar(deploymentObject.getFileObject(), portletApplicationName, "/"+portletApplicationName));
  -        System.out.println("...PAM Deploy done");   
  -        deploymentObject.close();
  -    }
  +			pa.setWebApplicationDefinition(wa);
  +		}
  +		catch (Exception e)
  +		{
  +			String msg = "Failed to load portlet application for "
  +				+ paWar.getPortletApplicationName();
  +			log.error(msg);
  +			throw new RegistryException(msg);
  +		}
  +
  +		// register the portlet application
  +		try
  +		{
  +			registry.registerPortletApplication(pa);
  +			registered = true;
  +			log.info("Registered the portlet application " + paName);
   
  -    /**
  -     * Prepares the specified war file for deployment.
  -     *
  -     * @param paName The Portlet Application name
  -     * @throws PortletApplicationException
  -     * @throws IOException
  -     */    
  -    public static void undeploy(Deployment deployer,
  -                                String webApplicationName, 
  -                                String portletApplicationName, 
  -                                String host, 
  -                                int port, 
  -                                String user, 
  -                                String password)
  -    throws PortletApplicationException, IOException    
  -    {
  -        if (deployer instanceof ApplicationServerPAM)
  -        {
  -            ((ApplicationServerPAM)deployer).start();            
  -        }
  -        System.out.println("Un-deploying Web Application [" + webApplicationName + "], Portlet Application [" + portletApplicationName + "]...");
  -        
  -        String webAppPath = deployer.getDeploymentPath(webApplicationName);
  -        File warFile = new File(webAppPath);
  -        deployer.undeploy(new PortletApplicationWar(new DirectoryHelper(warFile), portletApplicationName, "/"+portletApplicationName));
  -        System.out.println("...PAM Undeploy done");                                
  -    }
  +			// add to search engine result
  +			if (searchEngine != null)
  +			{
  +				searchEngine.add(pa);
  +				searchEngine.add(pa.getPortletDefinitions());
  +				log.info("Registered the portlet application in the search engine... " + paName);
  +			}
   
  -    /**
  -     * Starts the specified Portlet Application on the Application Server
  -     * 
  -     * @param lifecycle
  -     * @param portletApplicationName
  -     * @param host
  -     * @param port
  -     * @param user
  -     * @param password
  -     * @throws PortletApplicationException
  -     */
  -    public static void start(Lifecycle lifecycle,
  -                             String portletApplicationName, 
  -                             String host, 
  -                             int port, 
  -                             String user,
  -                             String password)
  -    throws PortletApplicationException
  -    {
  -        if (lifecycle instanceof ApplicationServerPAM)
  -        {
  -            ((ApplicationServerPAM)lifecycle).start();            
  -        }
  -        System.out.println("Starting Portlet Application [" + portletApplicationName + "...");
  -     
  -        lifecycle.startPortletApplication(portletApplicationName);
  -        System.out.println("...PAM Start done");                        
  -    }
  +			return pa;
  +		}
  +		catch (Exception e)
  +		{
  +			String msg = "Failed to register portlet application, " + paName;
  +			log.error(msg, e);
   
  -    /**
  -     * Stops a portlet application from running on the Application Server
  -     *
  -     * @param lifecycle
  -     * @param portletApplicationName
  -     * @param appServer
  -     * @param host
  -     * @param port
  -     * @param user
  -     * @param password
  -     */    
  -    public static void stop(Lifecycle lifecycle, 
  -                            String portletApplicationName, 
  -                            String host, 
  -                            int port, 
  -                            String user, 
  -                            String password)
  -    throws PortletApplicationException        
  -    {
  -        Map map = new HashMap();        
  -        if (lifecycle instanceof ApplicationServerPAM)
  -        {
  -            ((ApplicationServerPAM)lifecycle).start();            
  -        }
  -        System.out.println("Stopping Portlet Application [" + portletApplicationName + "...");
  -      
  -        lifecycle.stopPortletApplication(portletApplicationName);
  -        System.out.println("...PAM Stop done");                
  -    }
  +			if (registered)
  +			{
  +				try
  +				{
  +					registry.removeApplication(pa);
  +				}
  +				catch (Exception re)
  +				{
  +					log.error("Failed to rollback registration of portlet application" + paName, re);
  +				}
  +			}
   
  -    /**
  -     * Reloads a portlet application.
  -     * 
  -     * @param lifecycle
  -     * @param portletApplicationName
  -     * @param appServer
  -     * @param host
  -     * @param port
  -     * @param user
  -     * @param password
  -     * @throws PortletApplicationException
  -     */    
  -    public static void reload(Lifecycle lifecycle, 
  -                              String portletApplicationName, 
  -                              String host, 
  -                              int port, 
  -                              String user, 
  -                              String password)
  -    throws PortletApplicationException    
  -    {        
  -        Map map = new HashMap();        
  -        if (lifecycle instanceof ApplicationServerPAM)
  -        {
  -            ((ApplicationServerPAM)lifecycle).start();            
  -        }
  -        System.out.println("Reloading Portlet Application [" + portletApplicationName + "...");
  -     
  -        lifecycle.reloadPortletApplication(portletApplicationName);
  -        System.out.println("...PSM Reload done");        
  -    }
  -
  -    /*
  -      * Method to override jetspeed properties.
  -      * @param properties The base configuration properties for the Jetspeed system.
  -      */
  -    public static void overrideProperties(String strApplicationRoot, Configuration properties) throws IOException
  -    {
  -        String pamPropertiesFile = System.getProperty("pam.properties", "/WEB-INF/conf/pam.properties");
  -        
  -        String testPropsPath = strApplicationRoot + pamPropertiesFile;
  -        File testFile = new File(testPropsPath);
  -        if (testFile.exists())
  -        {
  -            FileInputStream is = new FileInputStream(testPropsPath);
  -            Properties props = new Properties();
  -            props.load(is);
  +			throw new RegistryException(msg, e);
  +		}
  +	}
  +
  +	protected void startPA(String contextName, FileSystemHelper warStruct,
  +		ClassLoader paClassLoader, boolean local)
  +		throws RegistryException
  +	{
  +		PortletApplicationWar paWar = null;
  +
  +		try
  +		{
  +			try
  +			{
  +				paWar = new PortletApplicationWar(warStruct, contextName, "/" + contextName);
   
  -            Iterator it = props.entrySet().iterator();
  -            while (it.hasNext())
  -            {
  -                Entry entry = (Entry) it.next();
  -                //if (entry.getValue() != null && ((String)entry.getValue()).length() > 0)
  -                properties.setProperty((String) entry.getKey(), (String) entry.getValue());
  -            }
  -        }
  -    }
  -    
  -    public static void logRequest(String[] args, boolean logAsError)
  -    {
  -        String startMsg = "Starting a PAM request. Parameters: ";
  -        if (logAsError)
  -        {
  -            log.error(startMsg);
  -        }
  -        else
  +				if (paClassLoader == null)
  +				{
  +					paClassLoader = paWar.createClassloader(getClass().getClassLoader());
  +				}
  +			}
  +			catch (IOException e)
  +			{
  +				String msg = "Failed to create PA WAR for " + contextName;
  +				log.error(msg, e);
  +				throw new RegistryException(msg, e);
  +			}
  +
  +			MutablePortletApplication pa = (MutablePortletApplication) registry
  +				.getPortletApplication(contextName);
  +
  +			if ((pa != null) && (paWar.getPortletApplicationChecksum() == pa.getChecksum()))
  +			{
  +                portletFactory.unregisterPortletApplication(pa);
  +			}
  +			else
  +			{
  +				pa = registerPortletApplication(paWar, pa, local);
  +			}
  +            portletFactory.registerPortletApplication(pa, paClassLoader);
  +		}
  +		finally
  +		{
  +			if (paWar != null)
  +			{
  +				try
  +				{
  +					paWar.close();
  +				}
  +				catch (IOException e)
  +				{
  +					log.error("Failed to close PA WAR for " + contextName, e);
  +				}
  +			}
  +		}
  +	}
  +
  +	protected void stopPA(String contextName)
  +		throws RegistryException
  +	{
  +		MutablePortletApplication pa = null;
  +        
  +        try
           {
  -            log.info(startMsg);            
  +            pa = (MutablePortletApplication) registry.getPortletApplication(contextName);
           }
  -        
  -        int ix;
  -        
  -        for (ix = 0; ix < args.length; ix++)
  +        catch (Exception e)
           {
  -            String paramName = args[ix];            
  -            String paramValue = "--PARAMS OUT OF BALANCE--";
  -            if (ix <= args.length)
  -            {
  -                paramValue = args[++ix];
  -            }
  -            if (logAsError)
  -            {            
  -                log.error(paramName + " : " + paramValue);
  -            }
  -            else
  -            {
  -                log.info(paramName + " : " + paramValue);
  -            }
  +            // ignore errors during portal shutdown
           }
  -    }
  +		if (pa != null)
  +		{
  +			portletFactory.unregisterPortletApplication(pa);
  +		}
  +	}
  +
  +	protected void unregisterPortletApplication(MutablePortletApplication pa,
  +		boolean purgeEntityInfo)
  +		throws RegistryException
  +	{
  +		if (searchEngine != null)
  +		{
  +			searchEngine.remove(pa);
  +			searchEngine.remove(pa.getPortletDefinitions());
  +		}
  +
  +		log.info("Remove all registry entries defined for portlet application " + pa.getName());
  +
  +		Iterator portlets = pa.getPortletDefinitions().iterator();
  +
  +		while (portlets.hasNext())
  +		{
  +			PortletDefinition portletDefinition = (PortletDefinition) portlets.next();
  +			Iterator		  entities = entityAccess.getPortletEntities(portletDefinition)
  +													 .iterator();
  +
  +			while (entities.hasNext())
  +			{
  +				PortletEntity entity = (PortletEntity) entities.next();
  +
  +				if (purgeEntityInfo)
  +				{
  +					try
  +					{
  +						entityAccess.removePortletEntity(entity);
  +					}
  +					catch (PortletEntityNotDeletedException e)
  +					{
  +						String msg = "Failed to delete Portlet Entity " + entity.getId();
  +						log.error(msg, e);
  +						throw new RegistryException(msg, e);
  +					}
  +				}
  +
  +				entityAccess.removeFromCache(entity);
  +				windowAccess.removeWindows(entity);
  +			}
  +		}
  +
  +		// todo keep (User)Prefs?
  +		registry.removeApplication(pa);
  +	}
   }
  
  
  
  1.3       +8 -20     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/WeblogicManager.java
  
  Index: WeblogicManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/WeblogicManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WeblogicManager.java	13 Oct 2004 15:53:21 -0000	1.2
  +++ WeblogicManager.java	23 Mar 2005 22:54:30 -0000	1.3
  @@ -18,8 +18,6 @@
   import java.io.IOException;
   import java.io.InputStream;
   
  -import org.apache.commons.httpclient.HttpException;
  -
   /**
    * Weblogic application server management
    *
  @@ -32,7 +30,7 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#start(java.lang.String)
        */
  -    public String start(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult start(String appPath) throws IOException
       {
           // TODO Auto-generated method stub
           return null;
  @@ -41,7 +39,7 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#stop(java.lang.String)
        */
  -    public String stop(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult stop(String appPath) throws IOException
       {
           // TODO Auto-generated method stub
           return null;
  @@ -50,26 +48,16 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#reload(java.lang.String)
        */
  -    public String reload(String appPath) throws HttpException, IOException
  -    {
  -        // TODO Auto-generated method stub
  -        return null;
  -    }
  -
  -    /* (non-Javadoc)
  -     * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#remove(java.lang.String)
  -     */
  -    public String remove(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult reload(String appPath) throws IOException
       {
           // TODO Auto-generated method stub
           return null;
       }
   
       /* (non-Javadoc)
  -     * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#install(java.lang.String, java.lang.String)
  +     * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#undeploy(java.lang.String)
        */
  -    public String install(String warPath, String contexPath)
  -            throws HttpException, IOException
  +    public ApplicationServerManagerResult undeploy(String appPath) throws IOException
       {
           // TODO Auto-generated method stub
           return null;
  @@ -78,8 +66,8 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#deploy(java.lang.String, java.io.InputStream, int)
        */
  -    public String deploy(String appPath, InputStream is, int size)
  -            throws HttpException, IOException
  +    public ApplicationServerManagerResult deploy(String appPath, InputStream is, int size)
  +            throws IOException
       {
           // TODO Auto-generated method stub
           return null;
  
  
  
  1.10      +40 -126   jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/TomcatManager.java
  
  Index: TomcatManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/TomcatManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TomcatManager.java	13 Oct 2004 15:53:21 -0000	1.9
  +++ TomcatManager.java	23 Mar 2005 22:54:30 -0000	1.10
  @@ -16,8 +16,6 @@
   package org.apache.jetspeed.tools.pamanager.servletcontainer;
   
   import java.io.File;
  -import java.io.FileInputStream;
  -import java.io.FileOutputStream;
   import java.io.IOException;
   import java.io.InputStream;
   import java.net.MalformedURLException;
  @@ -26,7 +24,6 @@
   
   import org.apache.commons.httpclient.HostConfiguration;
   import org.apache.commons.httpclient.HttpClient;
  -import org.apache.commons.httpclient.HttpException;
   import org.apache.commons.httpclient.HttpMethod;
   import org.apache.commons.httpclient.NameValuePair;
   import org.apache.commons.httpclient.UsernamePasswordCredentials;
  @@ -34,11 +31,6 @@
   import org.apache.commons.httpclient.methods.PutMethod;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.jdom.Document;
  -import org.jdom.JDOMException;
  -import org.jdom.input.SAXBuilder;
  -import org.jdom.output.Format;
  -import org.jdom.output.XMLOutputter;
   
   /**
    * <p>
  @@ -51,27 +43,23 @@
    */
   public class TomcatManager implements ApplicationServerManager
   {
  -    private static final String DEFUALT_MANAGER_APP_PATH = "/manager";
  -    private static final String EMBEDDED_CONTEXT_FILE_PATH = "/META-INF/tomcat-context.xml";
  +    private static final String DEFAULT_MANAGER_APP_PATH = "/manager";
       protected static final Log log = LogFactory.getLog("deployment");
   
       private String catalinaBase;
       private String catalinaEngine;
  -    private int catalinaVersionMajor;
  +    private String catalinaContextPath;
       private String hostUrl;
       private int hostPort;
       private String userName;
       private String password;
       
  -    private String catalinaContextPath;
       
  -    private String managerAppPath = DEFUALT_MANAGER_APP_PATH;
  +    private String managerAppPath = DEFAULT_MANAGER_APP_PATH;
       private String stopPath = managerAppPath + "/stop";
       private String startPath = managerAppPath + "/start";
  -    private String removePath = managerAppPath + "/remove";
       private String deployPath = managerAppPath + "/deploy";
       private String undeployPath = managerAppPath + "/undeploy";
  -    private String installPath = managerAppPath + "/install";
       private String reloadPath = managerAppPath + "/reload";
       private String serverInfoPath = managerAppPath + "/serverinfo";
   
  @@ -83,13 +71,13 @@
   
       private HttpMethod reload;
   
  -    private HttpMethod remove;
  +    private HttpMethod undeploy;
   
       private PutMethod deploy;
   
       private HttpMethod install;
   
  -    public TomcatManager(String catalinaBase, String catalinaEngine, int catalinaVersionMajor, String hostName, int hostPort, String userName, String password) throws HttpException, IOException
  +    public TomcatManager(String catalinaBase, String catalinaEngine, String hostName, int hostPort, String userName, String password) throws IOException
       {
           super();
           
  @@ -102,15 +90,27 @@
               this.catalinaBase = catalinaBase;
           }    
           this.catalinaEngine = catalinaEngine;
  -        this.catalinaVersionMajor = catalinaVersionMajor;
           this.hostUrl = hostName;
           this.hostPort = hostPort;
           this.userName = userName;
           this.password = password;        
           
  -        if ( catalinaVersionMajor > 4 )
  +        this.catalinaContextPath = this.catalinaBase + "/conf/" + this.catalinaEngine + "/" + this.hostUrl + "/";
  +    }
  +    
  +    private ApplicationServerManagerResult parseResult(String responseBody)
  +    {
  +        if ( responseBody.startsWith("OK - "))
  +        {
  +            return new ApplicationServerManagerResult(true, responseBody.substring(5), responseBody);
  +        }
  +        else if ( responseBody.startsWith("FAIL - "))
  +        {
  +            return new ApplicationServerManagerResult(false, responseBody.substring(7), responseBody);
  +        }
  +        else
           {
  -            catalinaContextPath = this.catalinaBase + "/conf/" + this.catalinaEngine + "/" + this.hostUrl + "/";
  +            return new ApplicationServerManagerResult(false, responseBody, responseBody);
           }
       }
   
  @@ -126,28 +126,20 @@
           client.getState().setAuthenticationPreemptive(true);
           client.getState().setCredentials(null, hostUrl, new UsernamePasswordCredentials(userName, password));
   
  -        if ( catalinaVersionMajor > 4 )
  -        {
  -            // Tomcat 5 deprecated manager/install and manager/remove.
  -            // Those are now handled by manager/deploy and manager/undeploy respectively.
  -            installPath = deployPath;
  -            removePath = undeployPath;
  -        }
           start = new GetMethod(startPath);
           stop = new GetMethod(stopPath);
  -        remove = new GetMethod(removePath);
  -        install = new GetMethod(installPath);
           reload = new GetMethod(reloadPath);
  +        undeploy = new GetMethod(undeployPath);
           deploy = new PutMethod(deployPath);
       }
   
  -    public String start(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult start(String appPath) throws IOException
       {
           try
           {
               start.setQueryString(buildPathQueryArgs(appPath));
               client.executeMethod(start);
  -            return start.getResponseBodyAsString();
  +            return parseResult(start.getResponseBodyAsString());
           }
           finally
           {
  @@ -156,13 +148,13 @@
           }
       }
   
  -    public String stop(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult stop(String appPath) throws IOException
       {
           try
           {
               stop.setQueryString(buildPathQueryArgs(appPath));
               client.executeMethod(stop);
  -            return stop.getResponseBodyAsString();
  +            return parseResult(stop.getResponseBodyAsString());
           }
           finally
           {
  @@ -171,7 +163,7 @@
           }
       }
   
  -    public String reload(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult reload(String appPath) throws IOException
       {
           try
           {
  @@ -184,111 +176,33 @@
           }
           catch (InterruptedException e)
           {
  -            return "FAIL - "+e.toString();
  +            return parseResult("FAIL - "+e.toString());
           }
           finally
           {
               stop.recycle();
  -            stop.setPath(reloadPath);
  +            stop.setPath(stopPath);
               start.recycle();
  -            start.setPath(reloadPath);
  -        }
  -    }
  -
  -    public String remove(String appPath) throws HttpException, IOException
  -    {
  -        try
  -        {
  -            remove.setQueryString(buildPathQueryArgs(appPath));
  -            client.executeMethod(remove);
  -            return remove.getResponseBodyAsString();
  -        }
  -        finally
  -        {
  -            remove.recycle();
  -            remove.setPath(removePath);
  +            start.setPath(startPath);
           }
       }
   
  -    public String install(String warPath, String contextPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult undeploy(String appPath) throws IOException
       {
           try
           {
  -            File contextFile = new File(warPath+EMBEDDED_CONTEXT_FILE_PATH);
  -            File warPathFile = new File(warPath);
  -            String canonicalWarPath = warPathFile.getCanonicalPath();
  -
  -            if ( contextPath == null )
  -            {
  -                contextPath = "/"+ warPathFile.getName();
  -            }
  -            else if (!contextPath.startsWith("/"))
  -            {
  -                contextPath = "/" + contextPath;
  -            }
  -
  -            if ( contextFile.exists() )
  -            {
  -                FileInputStream fileInputStream = null;
  -                FileOutputStream fileOutputStream = null;
  -                
  -                try
  -                {
  -                    SAXBuilder saxBuilder = new SAXBuilder();
  -                    fileInputStream = new FileInputStream(contextFile);
  -                    Document document = saxBuilder.build(fileInputStream);
  -                    if (!document.getRootElement().getName().equals("Context"))
  -                    {
  -                        throw new IOException(EMBEDDED_CONTEXT_FILE_PATH+" invalid!!!");
  -                    }
  -                    document.getRootElement().setAttribute("path", contextPath);
  -                    document.getRootElement().setAttribute("docBase", canonicalWarPath);
  -                    XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
  -                    
  -                    File newContextFile = null;
  -                    if ( catalinaVersionMajor > 4 )
  -                    {
  -                        newContextFile = new File( catalinaContextPath+warPathFile.getName()+".xml");
  -                    }
  -                    else 
  -                    {
  -                        newContextFile = new File( warPathFile.getParentFile(), warPathFile.getName()+".xml");
  -                    }
  -                    fileOutputStream = new FileOutputStream(newContextFile);
  -                    output.output(document, fileOutputStream);
  -                    fileOutputStream.flush();
  -                    
  -                    install.setQueryString(buildConfigQueryArgs(newContextFile.getCanonicalPath(), contextPath));
  -                }
  -                catch (JDOMException e)
  -                {
  -                    IOException ioe = new IOException(EMBEDDED_CONTEXT_FILE_PATH+" invalid");
  -                    ioe.initCause(e);
  -                    throw ioe;
  -                }
  -                finally
  -                {
  -                    if ( fileInputStream != null )
  -                        fileInputStream.close();
  -                    if ( fileOutputStream != null )
  -                        fileOutputStream.close();
  -                }
  -            }
  -            else
  -                install.setQueryString(buildWarQueryArgs(canonicalWarPath, contextPath));
  -
  -            client.executeMethod(install);
  -            return install.getResponseBodyAsString();
  +            undeploy.setQueryString(buildPathQueryArgs(appPath));
  +            client.executeMethod(undeploy);
  +            return parseResult(undeploy.getResponseBodyAsString());
           }
           finally
           {
  -            install.recycle();
  -            install.setPath(installPath);
  +            undeploy.recycle();
  +            undeploy.setPath(undeployPath);
           }
  -
       }
   
  -    public String deploy(String appPath, InputStream is, int size) throws HttpException, IOException
  +    public ApplicationServerManagerResult deploy(String appPath, InputStream is, int size) throws IOException
       {
           try
           {
  @@ -303,7 +217,7 @@
               deploy.setRequestBody(is);
   
               client.executeMethod(deploy);
  -            return deploy.getResponseBodyAsString();
  +            return parseResult(deploy.getResponseBodyAsString());
           }
           finally
           {
  @@ -369,13 +283,13 @@
           }
           catch (UnknownHostException e1)
           {
  -            log.warn("Unknown server, CatalinaPAM will only function as FileSystemPAM: " + e1.toString());
  +            log.error("Unknown server: " + e1.toString());
   
               return false;
           }
           catch (IOException e1)
           {
  -            log.warn("IOException, CatalinaPAM will only function as FileSystemPAM: " + e1.toString());
  +            log.error("IOException: " + e1.toString());
   
               return false;
           }
  
  
  
  1.4       +8 -20     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/JBossManager.java
  
  Index: JBossManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/JBossManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JBossManager.java	13 Oct 2004 15:53:21 -0000	1.3
  +++ JBossManager.java	23 Mar 2005 22:54:30 -0000	1.4
  @@ -18,8 +18,6 @@
   import java.io.IOException;
   import java.io.InputStream;
   
  -import org.apache.commons.httpclient.HttpException;
  -
   /**
    * JBoss application server management
    *
  @@ -32,7 +30,7 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#start(java.lang.String)
        */
  -    public String start(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult start(String appPath) throws IOException
       {
           // TODO Auto-generated method stub
           return null;
  @@ -41,7 +39,7 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#stop(java.lang.String)
        */
  -    public String stop(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult stop(String appPath) throws IOException
       {
           // TODO Auto-generated method stub
           return null;
  @@ -50,26 +48,16 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#reload(java.lang.String)
        */
  -    public String reload(String appPath) throws HttpException, IOException
  -    {
  -        // TODO Auto-generated method stub
  -        return null;
  -    }
  -
  -    /* (non-Javadoc)
  -     * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#remove(java.lang.String)
  -     */
  -    public String remove(String appPath) throws HttpException, IOException
  +    public ApplicationServerManagerResult reload(String appPath) throws IOException
       {
           // TODO Auto-generated method stub
           return null;
       }
   
       /* (non-Javadoc)
  -     * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#install(java.lang.String, java.lang.String)
  +     * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#undeploy(java.lang.String)
        */
  -    public String install(String warPath, String contexPath)
  -            throws HttpException, IOException
  +    public ApplicationServerManagerResult undeploy(String appPath) throws IOException
       {
           // TODO Auto-generated method stub
           return null;
  @@ -78,8 +66,8 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#deploy(java.lang.String, java.io.InputStream, int)
        */
  -    public String deploy(String appPath, InputStream is, int size)
  -            throws HttpException, IOException
  +    public ApplicationServerManagerResult deploy(String appPath, InputStream is, int size)
  +            throws IOException
       {
           // TODO Auto-generated method stub
           return null;
  
  
  

---------------------------------------------------------------------
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