You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/11/16 21:40:30 UTC

svn commit: r345111 - in /portals/pluto/trunk/pluto-util: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/pluto/ src/main/java/org/apache/pluto/util/ src/main/java/org/apache/pluto/util/assemble/ s...

Author: ddewolf
Date: Wed Nov 16 12:40:16 2005
New Revision: 345111

URL: http://svn.apache.org/viewcvs?rev=345111&view=rev
Log:
Refactoring guts of the maven plugin into util.  Preparing for cmd line install app and webbased deployer, etc. . .

Added:
    portals/pluto/trunk/pluto-util/src/
    portals/pluto/trunk/pluto-util/src/main/
    portals/pluto/trunk/pluto-util/src/main/java/
    portals/pluto/trunk/pluto-util/src/main/java/org/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/ManagementException.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/cli/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/InstallationConfig.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstaller.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstallerFactory.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/ServerConfig.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/FileSystemInstaller.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Jetty5FileSystemInstaller.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Tomcat5FileSystemInstaller.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Call.java
    portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Configure.java
    portals/pluto/trunk/pluto-util/src/resources/
    portals/pluto/trunk/pluto-util/src/resources/configure_1_3.dtd
Modified:
    portals/pluto/trunk/pluto-util/pom.xml

Modified: portals/pluto/trunk/pluto-util/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/pom.xml?rev=345111&r1=345110&r2=345111&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-util/pom.xml (original)
+++ portals/pluto/trunk/pluto-util/pom.xml Wed Nov 16 12:40:16 2005
@@ -16,51 +16,9 @@
   -->
   <dependencies>
    <dependency>
-      <groupId>portlet-api</groupId>
-	  <artifactId>portlet-api</artifactId>
-	  <version>1.0</version>
-	  <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.pluto</groupId>
-	  <artifactId>pluto-descriptor-api</artifactId>
-	  <version>${pom.version}</version>
-	  <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.pluto</groupId>
-	  <artifactId>pluto-descriptor-impl</artifactId>
-	  <version>${pom.version}</version>
-	  <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.pluto</groupId>
-	  <artifactId>pluto-container</artifactId>
-	  <version>${pom.version}</version>
-	  <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.pluto</groupId>
-	  <artifactId>pluto-taglib</artifactId>
-	  <version>${pom.version}</version>
-	  <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>castor</groupId>
-	  <artifactId>castor</artifactId>
-	  <version>0.9.6</version>
-	  <scope>compile</scope>
-    </dependency>
-	<dependency>
-      <groupId>xerces</groupId>
-	  <artifactId>xercesImpl</artifactId>
-	  <version>2.6.2</version>
-	  <scope>compile</scope>
-    </dependency>
-	<dependency>
-      <groupId>xerces</groupId>
-	  <artifactId>xmlParserAPIs</artifactId>
-	  <version>2.6.2</version>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.0.4</version>
 	  <scope>compile</scope>
     </dependency>
   </dependencies>
@@ -72,15 +30,6 @@
     </site>
   </distributionManagement>
   <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-pluto-plugin</artifactId>
-        <version>1.1-SNAPSHOT</version>
-        <configuration>
-        </configuration>
-      </plugin>
-    </plugins>
   </build>
   <reporting>
     <plugins>

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/ManagementException.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/ManagementException.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/ManagementException.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/ManagementException.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.util;
+
+import java.io.File;
+
+
+/**
+ * Exception thrown if an error occurs while managing
+ * a portal instance.
+ */
+public class ManagementException extends Exception {
+
+    private File installDir;
+
+    public ManagementException(String message, Throwable cause, File installDir) {
+        super(message, cause);
+        this.installDir = installDir;
+    }
+
+    public File getInstallDir() {
+        return installDir;
+    }
+
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/InstallationConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/InstallationConfig.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/InstallationConfig.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/InstallationConfig.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.util.install;
+
+import org.apache.pluto.util.install.ServerConfig;
+
+import java.util.List;
+import java.util.Map;
+import java.io.File;
+
+/**
+ *
+ */
+public class InstallationConfig {
+
+    /**
+     * A list of depdencies that are shared amoungst web applications.
+     */
+    private List sharedDependencies;
+
+    /**
+     * A list of dependencies are are shared amoungst web applications.
+     */
+    private List endorsedDependencies;
+
+    /**
+     * A list of war files which are to be considered portal dependencies.
+     */
+    private Map portletApplications;
+
+    /**
+     * The location of the portal application being installed.
+     */
+    private File portalApplication;
+
+    /**
+     * The installation directory.
+     */
+    private File installationDirectory;
+
+    private String portalContextPath;
+
+    private ServerConfig serverConfig;
+
+
+    public List getSharedDependencies() {
+        return sharedDependencies;
+    }
+
+    public void setSharedDependencies(List sharedDependencies) {
+        this.sharedDependencies = sharedDependencies;
+    }
+
+    public List getEndorsedDependencies() {
+        return endorsedDependencies;
+    }
+
+    public void setEndorsedDependencies(List endorsedDependencies) {
+        this.endorsedDependencies = endorsedDependencies;
+    }
+
+    public Map getPortletApplications() {
+        return portletApplications;
+    }
+
+    public void setPortletApplications(Map portletApplications) {
+        this.portletApplications = portletApplications;
+    }
+
+    public File getPortalApplication() {
+        return portalApplication;
+    }
+
+    public void setPortalApplication(File portalApplication) {
+        this.portalApplication = portalApplication;
+    }
+
+    public File getInstallationDirectory() {
+        return installationDirectory;
+    }
+
+    public void setInstallationDirectory(File installationDirectory) {
+        this.installationDirectory = installationDirectory;
+    }
+
+    public String getPortalContextPath() {
+        return portalContextPath;
+    }
+
+    public void setPortalContextPath(String portalContextPath) {
+        this.portalContextPath = portalContextPath;
+    }
+
+    public ServerConfig getServerConfig() {
+        return serverConfig;
+    }
+
+    public void setServerConfig(ServerConfig serverConfig) {
+        this.serverConfig = serverConfig;
+    }
+
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstaller.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstaller.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstaller.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstaller.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.util.install;
+
+import org.apache.pluto.util.ManagementException;
+
+import java.io.File;
+
+public interface PortalInstaller {
+
+    void install(InstallationConfig config) throws ManagementException, ManagementException;
+
+    void uninstall(InstallationConfig config) throws ManagementException;
+
+    boolean isValidInstallationDirectory(File installDir);
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstallerFactory.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstallerFactory.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstallerFactory.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/PortalInstallerFactory.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.util.install;
+
+import org.apache.pluto.util.install.impl.Tomcat5FileSystemInstaller;
+import org.apache.pluto.util.install.impl.Jetty5FileSystemInstaller;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ *
+ *
+ */
+public abstract class PortalInstallerFactory {
+
+    private static final ArrayList HANDLERS = new ArrayList();
+
+    static {
+        HANDLERS.add(new Tomcat5FileSystemInstaller());
+        HANDLERS.add(new Jetty5FileSystemInstaller());
+    }
+
+    public static PortalInstaller getAppServerHandler(File installDir) {
+        String className = System.getProperty(PortalInstallerFactory.class.getName());
+        PortalInstaller ash;
+        if(className != null)
+            return getHandler(className, installDir);
+        else
+            return findHandler(installDir);
+    }
+
+    private static PortalInstaller getHandler(String className, File installDir) {
+        PortalInstaller ash;
+        try {
+            Class cl = Class.forName(className);
+            ash = (PortalInstaller)cl.newInstance();
+            if(ash.isValidInstallationDirectory(installDir)) {
+                return ash;
+            }
+            else {
+                throw new Exception("Invalid installation directory for handler: "+className);
+            }
+       }
+        catch(Exception e) {
+            throw new RuntimeException("Unable to instantiate class: "+className, e);
+        }
+    }
+
+    private static PortalInstaller findHandler(File installDir) {
+        Iterator it = HANDLERS.iterator();
+        while(it.hasNext()) {
+            PortalInstaller ash = (PortalInstaller)it.next();
+            if(ash.isValidInstallationDirectory(installDir)) {
+                return ash;
+            }
+        }
+        throw new RuntimeException("Unable to locate appropriate app server handler for: "+installDir.getAbsolutePath());
+    }
+
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/ServerConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/ServerConfig.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/ServerConfig.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/ServerConfig.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.util.install;
+
+import java.util.List;
+import java.io.File;
+
+/**
+ *
+ */
+public class ServerConfig {
+
+    private String domain = "MyDomain";
+    private String server = "MyServer";
+    private String host = "localhost";
+    private int port = 8080;
+
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String domain) {
+        this.domain = domain;
+    }
+
+    public String getServer() {
+        return server;
+    }
+
+    public void setServer(String server) {
+        this.server = server;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/FileSystemInstaller.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/FileSystemInstaller.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/FileSystemInstaller.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/FileSystemInstaller.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.util.install.impl;
+
+import org.apache.pluto.util.install.InstallationConfig;
+import org.apache.pluto.util.install.PortalInstaller;
+import org.apache.pluto.util.ManagementException;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.List;
+import java.util.Collection;
+
+/**
+ * File System based installer.  Copies files to the appropriate
+ * locations.
+ *
+ */
+public abstract class FileSystemInstaller implements PortalInstaller {
+
+    protected void copyFilesToDirectory(Collection dependencies, File destination)
+    throws IOException {
+        Iterator it = dependencies.iterator();
+        while(it.hasNext()) {
+            File from = (File)it.next();
+            FileUtils.copyFileToDirectory(from, destination);
+        }
+    }
+
+    protected void copyFileToDirectory(File file, File destination)
+    throws IOException {
+        FileUtils.copyFileToDirectory(file, destination);
+    }
+
+    /**
+     * NOTE: Order is important.  If the server is running, we want to
+     *       make sure that the correct order is preserved
+     *
+     * 1) Install endorsed dependencies
+     * 2) Install shared dependencies
+     * 4) Prep Time
+     *    -- Create a domain directory for the portal
+     *    -- Init the configs holder
+     * 5) Install the Portlet Applications
+     * 6) Install the Portal Application
+     * 7) Finally, install the configs
+     * @param config
+     * @throws org.apache.pluto.util.ManagementException
+     */
+    public void install(InstallationConfig config) throws ManagementException {
+        File endorsedDir = getEndorsedDir(config);
+        File sharedDir = getSharedDir(config);
+        File domainDir = getWebAppDir(config);
+
+        endorsedDir.mkdirs();
+        sharedDir.mkdirs();
+        domainDir.mkdirs();
+
+        try {
+            copyFilesToDirectory(config.getEndorsedDependencies(), endorsedDir);
+            copyFilesToDirectory(config.getSharedDependencies(), sharedDir);
+
+            copyFilesToDirectory(config.getPortletApplications().values(),  domainDir);
+            copyFileToDirectory(config.getPortalApplication(), domainDir);
+
+            writeConfiguration(config);
+        }
+        catch(IOException io) {
+            throw new ManagementException(
+                "Unable to install portal to Tomcat",
+                io,
+                config.getInstallationDirectory()
+            );
+        }
+    }
+
+    public abstract void writeConfiguration(InstallationConfig config)
+    throws IOException;
+
+    protected abstract File getEndorsedDir(InstallationConfig config );
+
+    protected abstract File getSharedDir(InstallationConfig config);
+
+    protected abstract File getWebAppDir(InstallationConfig config);
+
+    public void uninstall(InstallationConfig config) {
+    }
+
+    public abstract boolean isValidInstallationDirectory(File installDir);
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Jetty5FileSystemInstaller.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Jetty5FileSystemInstaller.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Jetty5FileSystemInstaller.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Jetty5FileSystemInstaller.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.util.install.impl;
+
+import org.apache.pluto.util.install.InstallationConfig;
+import org.apache.pluto.util.install.impl.FileSystemInstaller;
+import org.apache.pluto.util.ManagementException;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.Iterator;
+import java.util.Map;
+
+public class Jetty5FileSystemInstaller extends FileSystemInstaller {
+
+    protected File getEndorsedDir(InstallationConfig config ) {
+        File installationDirectory = config.getInstallationDirectory();
+        return new File(installationDirectory, "ext");
+    }
+
+    protected File getSharedDir(InstallationConfig config) {
+        File installationDirectory = config.getInstallationDirectory();
+        return new File(installationDirectory, "ext");
+    }
+
+    protected File getWebAppDir(InstallationConfig config) {
+        File installationDirectory = config.getInstallationDirectory();
+        return new File(
+            installationDirectory, config.getServerConfig().getDomain()
+        );
+    }
+
+    protected File getConfigurationDir(InstallationConfig config) {
+        File installationDirectory = config.getInstallationDirectory();
+        String engine = "Catalina";
+        String host   = config.getServerConfig().getHost();
+        return new File(installationDirectory, "conf/"+engine+"/"+host);
+    }
+
+    public void uninstall(InstallationConfig config) {
+    }
+
+    public void deploy() {
+
+    }
+
+    public boolean isValidInstallationDirectory(File installDir) {
+        File serverConfig = new File(installDir, "etc/jetty.xml");
+        return serverConfig.exists();
+    }
+
+    /**
+     * NOTE: Order is important.  If the server is running, we want to
+     *       make sure that the correct order is preserved
+     *
+     * 1) Install endorsed dependencies
+     * 2) Install shared dependencies
+     * 4) Prep Time
+     *    -- Create a domain directory for the portal
+     *    -- Init the configs holder
+     * 5) Install the Portlet Applications
+     * 6) Install the Portal Application
+     * 7) Finally, install the configs
+     * @param config
+     * @throws org.apache.pluto.util.ManagementException
+     */
+    public void install(InstallationConfig config) throws ManagementException {
+        File endorsedDir = getEndorsedDir(config);
+        File sharedDir = getSharedDir(config);
+        File domainDir = getWebAppDir(config);
+        domainDir.mkdirs();
+        File contextConfigurationDirectory = getConfigurationDir(config);
+        /*
+        (config.getEndorsedDependencies(), endorsedDir);
+
+        copyFilesToDirectory(config.getSharedDependencies(), sharedDir);
+
+       Iterator it = config.getPortletApplications().values().iterator();
+        while(it.hasNext()) {
+            File portletApp = (File)it.next();
+            FileUtils.copyFileToDirectory(portletApp, domainDir);
+        }
+
+       FileUtils.copyFileToDirectory(config.getPortalApplication(), domainDir);
+
+
+        it = config.getPortletApplications().entrySet().iterator();
+        while(it.hasNext()) {
+            Map.Entry entry = (Map.Entry)it.next();
+            String context = entry.getKey().toString();
+            File portletApp = (File)entry.getValue();
+
+            File deployed = new File(domainDir, portletApp.getName());
+            String contents = getPortletApplicationConfig(context, deployed);
+            FileWriter out = new FileWriter(
+                new File(contextConfigurationDirectory, context+".xml"));
+            out.write(contents);
+            out.flush();
+            out.close();
+        }
+
+        File xmlFile =  new File(contextConfigurationDirectory, config.getPortalContextPath()+".xml");
+        FileWriter out = new FileWriter(xmlFile);
+        out.write(getPortalApplicationConfig(config));
+        out.flush();
+        out.close();
+        */
+    }
+
+    private String getPortalApplicationConfig(InstallationConfig config) {
+        File domainDir = this.getWebAppDir(config);
+        String war = domainDir.getAbsolutePath() + File.separatorChar +
+                config.getPortalApplication().getName();
+        String contextPath = config.getPortalContextPath();
+        return getConfigContents(war, contextPath);
+    }
+
+    private String getPortletApplicationConfig(String contextPath, File file) {
+        String war = file.getAbsolutePath();
+        return getConfigContents(war, contextPath);
+    }
+
+    public void writeConfiguration(InstallationConfig config) {
+
+    }
+
+    private String getConfigContents(String war, String contextPath) {
+        StringBuffer contents = new StringBuffer();
+        contents.append("<Context ")
+                .append("path=\"").append(contextPath).append("\" ")
+                .append("docBase=\"").append(war).append("\" ")
+                .append("crossContext=\"true\">").append("</Context>");
+       return contents.toString();
+    }
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Tomcat5FileSystemInstaller.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Tomcat5FileSystemInstaller.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Tomcat5FileSystemInstaller.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/Tomcat5FileSystemInstaller.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.util.install.impl;
+
+import org.apache.pluto.util.install.InstallationConfig;
+import org.apache.pluto.util.ManagementException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+public class Tomcat5FileSystemInstaller extends FileSystemInstaller {
+
+//
+// PortalInstaller Interface
+//
+
+    /**
+     * Determine whether or not this is a valid Tomcat 5.x installation.
+     * @param installDir the proposed TOMCAT BASE directory
+     * @return true if and only if <code>conf/server.xml</code> and
+     *         <code>conf/catalina.properties exist.</code>
+     */
+    public boolean isValidInstallationDirectory(File installDir) {
+        File serverConfig = new File(installDir, "conf/server.xml");
+        File catalinaProps = new File(installDir, "conf/catalina.properties");
+        return serverConfig.exists() && catalinaProps.exists();
+    }
+
+//
+// FileSystemInstaller Implementation
+//
+
+    public void writeConfiguration(InstallationConfig config)
+    throws IOException {
+
+        File domainDir = getWebAppDir(config);
+        File contextConfigurationDirectory = getConfigurationDir(config);
+
+        Iterator it = config.getPortletApplications().entrySet().iterator();
+        while(it.hasNext()) {
+            Map.Entry entry = (Map.Entry)it.next();
+            String context = entry.getKey().toString();
+            File portletApp = (File)entry.getValue();
+
+            File deployed = new File(domainDir, portletApp.getName());
+            String contents = getPortletApplicationConfig(context, deployed);
+            FileWriter out = new FileWriter(
+                    new File(contextConfigurationDirectory, context+".xml"));
+            out.write(contents);
+            out.flush();
+            out.close();
+        }
+
+        File xmlFile =  new File(
+                contextConfigurationDirectory,
+                config.getPortalContextPath()+".xml"
+        );
+
+        FileWriter out = new FileWriter(xmlFile);
+        out.write(getPortalApplicationConfig(config));
+        out.flush();
+        out.close();
+    }
+
+    protected File getEndorsedDir(InstallationConfig config ) {
+        File installationDirectory = config.getInstallationDirectory();
+        return new File(installationDirectory, "common/endorsed");
+    }
+
+    protected File getSharedDir(InstallationConfig config) {
+        File installationDirectory = config.getInstallationDirectory();
+        return new File(installationDirectory, "shared/lib");
+    }
+
+    protected File getWebAppDir(InstallationConfig config) {
+        File installationDirectory = config.getInstallationDirectory();
+        return new File(
+            installationDirectory, config.getServerConfig().getDomain()
+        );
+    }
+
+//
+// Helpers
+//
+
+    protected File getConfigurationDir(InstallationConfig config) {
+        File installationDirectory = config.getInstallationDirectory();
+        String engine = "Catalina";
+        String host   = config.getServerConfig().getHost();
+        return new File(installationDirectory, "conf/"+engine+"/"+host);
+    }
+
+    private String getPortalApplicationConfig(InstallationConfig config) {
+        File domainDir = this.getWebAppDir(config);
+        String war = domainDir.getAbsolutePath() + File.separatorChar +
+                config.getPortalApplication().getName();
+        String contextPath = config.getPortalContextPath();
+        return getConfigContents(war, contextPath);
+    }
+
+    private String getPortletApplicationConfig(String contextPath, File file) {
+        String war = file.getAbsolutePath();
+        return getConfigContents(war, contextPath);
+    }
+
+    private String getConfigContents(String war, String contextPath) {
+        StringBuffer contents = new StringBuffer();
+        contents.append("<Context ")
+                .append("path=\"").append(contextPath).append("\" ")
+                .append("docBase=\"").append(war).append("\" ")
+                .append("crossContext=\"true\">").append("</Context>");
+       return contents.toString();
+    }
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Call.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Call.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Call.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Call.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,21 @@
+package org.apache.pluto.util.install.impl.jetty;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: dxd0
+ * Date: Nov 11, 2005
+ * Time: 9:33:36 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class Call {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Configure.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Configure.java?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Configure.java (added)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/impl/jetty/Configure.java Wed Nov 16 12:40:16 2005
@@ -0,0 +1,21 @@
+package org.apache.pluto.util.install.impl.jetty;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: dxd0
+ * Date: Nov 11, 2005
+ * Time: 9:32:49 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class Configure {
+
+    private String klass;
+
+    public String getKlass() {
+        return klass;
+    }
+
+    public void setKlass(String klass) {
+        this.klass = klass;
+    }
+}

Added: portals/pluto/trunk/pluto-util/src/resources/configure_1_3.dtd
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/src/resources/configure_1_3.dtd?rev=345111&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-util/src/resources/configure_1_3.dtd (added)
+++ portals/pluto/trunk/pluto-util/src/resources/configure_1_3.dtd Wed Nov 16 12:40:16 2005
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+This is the document type descriptor for the
+org.mortbay.util.XmlConfiguration class.  It allows a java object to be
+configured by with a sequence of Set, Put and Call elements.  These tags are 
+mapped to methods on the object to be configured as follows:
+
+  <Set  name="Test">value</Set>              ==  obj.setTest("value");
+  <Put  name="Test">value</Put>              ==  obj.put("Test","value");
+  <Call name="test"><Arg>value</Arg></Call>  ==  obj.test("value");
+
+Values themselves may be configured objects that are created with the
+<New> tag or returned from a <Call> tag.
+
+Values are matched to arguments on a best effort approach, but types
+my be specified if a match is not achieved.
+
+$Id: configure_1_3.dtd,v 1.6 2005/03/29 12:02:50 gregwilkins Exp $
+-->
+
+<!ENTITY % CONFIG "Get|Set|Put|Call|New|Ref">
+<!ENTITY % VALUE "#PCDATA|Call|New|Get|SystemProperty|Array|Ref">
+
+<!ENTITY % TYPEATTR "type CDATA #IMPLIED " > <!-- String|Character|Short|Byte|Integer|Long|Boolean|Float|Double|char|short|byte|int|long|boolean|float|double|URL|InetAddress|InetAddrPort| #classname -->
+<!ENTITY % IMPLIEDCLASSATTR "class NMTOKEN #IMPLIED" >
+<!ENTITY % CLASSATTR "class NMTOKEN #REQUIRED" >
+<!ENTITY % NAMEATTR "name NMTOKEN #REQUIRED" >
+<!ENTITY % DEFAULTATTR "default CDATA #IMPLIED" >
+<!ENTITY % IDATTR "id NMTOKEN #IMPLIED" >
+<!ENTITY % REQUIREDIDATTR "id NMTOKEN #REQUIRED" >
+<!--
+Configure Element.
+This is the root element that specifies the class of object that
+can be configured:
+
+    <Configure class="com.acme.MyClass"> ... </Configure>
+
+A Configure element can contain Set, Put or Call elements.
+-->
+<!ELEMENT Configure (%CONFIG;)* >
+<!ATTLIST Configure %IMPLIEDCLASSATTR; %IDATTR; >
+
+
+<!--
+Set Element.
+This element maps to a call to a set method on the current object.
+The name and optional type attributes are used to select the set 
+method. If the name given is xxx, then a setXxx method is used, or
+the xxx field is used of setXxx cannot be found. 
+A Set element can contain value text and/or the value elements Call,
+New and SystemProperty. If no value type is specified, then white
+space is trimmed out of the value. If it contains multiple value
+elements they are added as strings before being converted to any
+specified type.
+
+A Set with a class attribute is treated as a static set method invocation.
+-->
+<!ELEMENT Set ( %VALUE; )* >
+<!ATTLIST Set %NAMEATTR; %TYPEATTR; %IMPLIEDCLASSATTR; >
+
+
+<!--
+Get Element.
+This element maps to a call to a get method or field on the current object.
+The name attribute is used to select the get method.
+If the name given is xxx, then a getXxx method is used, or
+the xxx field is used of setXxx cannot be found. 
+A Get element can contain Set, Put and/or Call elements which act on the object
+returned by the get call.
+
+A Get with a class attribute is treated as a static get method or field.
+-->
+<!ELEMENT Get (%CONFIG;)*>
+<!ATTLIST Get %NAMEATTR; %IMPLIEDCLASSATTR; %IDATTR; >
+
+<!--
+Put Element.
+This element maps to a call to a put method on the current object,
+which must implement the Map interface. The name attribute is used 
+as the put key and the optional type attribute can force the type 
+of the value.
+
+A Put element can contain value text and/or the value elements Call,
+New and SystemProperty. If no value type is specified, then white
+space is trimmed out of the value. If it contains multiple value
+elements they are added as strings before being converted to any
+specified type.
+-->
+<!ELEMENT Put ( %VALUE; )* >
+<!ATTLIST Put %NAMEATTR; %TYPEATTR; >
+
+
+<!--
+Call Element.
+This element maps to an arbitrary call to a method on the current object,
+The name attribute and Arg elements are used to select the method.
+
+A Call element can contain a sequence of Arg elements followed by
+a sequence of Set, Put and/or Call elements which act on any object
+returned by the original call:
+
+ <Call name="test"><Arg>value1</Arg><Set name="Test">Value2</Set></Call>
+
+This is equivalent to:
+
+ Object o2 = o1.test("value1");
+ o2.setTest("value2");
+
+A Call with a class attribute is treated as a static call.
+
+-->
+<!ELEMENT Call (Arg*,(%CONFIG;)*)>
+<!ATTLIST Call %NAMEATTR; %IMPLIEDCLASSATTR; %IDATTR;>
+
+
+<!--
+Arg Element.
+This element defines a positional argument for the Call element.
+The optional type attribute can force the type of the value.
+
+An Arg element can contain value text and/or the value elements Call,
+New and SystemProperty. If no value type is specified, then white
+space is trimmed out of the value. If it contains multiple value
+elements they are added as strings before being converted to any
+specified type.
+-->
+<!ELEMENT Arg ( %VALUE; )* >
+<!ATTLIST Arg %TYPEATTR; >
+
+
+
+<!--
+New Element.
+This element allows the creation of a new object as part of a 
+value of a Set, Put or Arg element. The class attribute determines
+the type of the new object and the contained Arg elements 
+are used to select the constructor for the new object.
+
+A New element can contain a sequence of Arg elements followed by
+a sequence of Set, Put and/or Call elements which act on the new object:
+
+ <New class="com.acme.MyClass">
+   <Arg>value1</Arg><Set name="Test">Value2</Set>
+ </New>
+
+This is equivalent to:
+
+ Object o = new com.acme.MyClass("value1");
+ o.setTest("value2");
+
+-->
+<!ELEMENT New (Arg*,(%CONFIG;)*)>
+<!ATTLIST New %CLASSATTR; %IDATTR;>
+
+<!--
+Ref Element.
+This element allows a previously created object to be reference by id.
+
+A Ref element can contain a sequence of Set, Put and/or Call elements 
+which act on the referenced object:
+
+ <Ref id="myobject">
+   <Set name="Test">Value2</Set>
+ </New>
+
+-->
+<!ELEMENT Ref ((%CONFIG;)*)>
+<!ATTLIST Ref %REQUIREDIDATTR;>
+
+<!--
+Array Element.
+This element allows the creation of a new array as part of a 
+value of a Set, Put or Arg element. The type attribute determines
+the type of the new array and the contained Item elements 
+are used for each element of the array
+
+ <Array type="java.lang.String">
+   <Item>value0</Arg>
+   <Item><New class="java.lang.String"><Arg>value1</Arg></New></Item>
+ </Array>
+
+This is equivalent to:
+ String[] a = new String[] { "value0", new String("value1") };
+
+-->
+<!ELEMENT Array (Item*)>
+<!ATTLIST Array %TYPEATTR; %IDATTR; >
+
+
+<!--
+Item Element.
+This element defines a positional argument for the Array element.
+The optional type attribute can force the type of the value.
+
+An Item element can contain value text and/or the value elements Call,
+New and SystemProperty. If no value type is specified, then white
+space is trimmed out of the value. If it contains multiple value
+elements they are added as strings before being converted to any
+specified type.
+-->
+<!ELEMENT Item ( %VALUE; )* >
+<!ATTLIST Item %TYPEATTR; %IDATTR; >
+
+
+<!--
+System Property Element.
+This element allows JVM System properties to be retrieved as
+part of the value of a Set, Put or Arg element.
+The name attribute specifies the property name and the optional
+default argument provides a default value.
+
+ <SystemProperty name="Test" default="value"/>
+
+This is equivalent to:
+
+ System.getProperty("Test","value");
+
+-->
+<!ELEMENT SystemProperty EMPTY>
+<!ATTLIST SystemProperty %NAMEATTR; %DEFAULTATTR; %IDATTR;>
+
+
+