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/07/30 08:58:47 UTC
svn commit: r226478 - in /portals/pluto/branches/pluto-1.1: ./
maven-pluto-plugin/ maven-pluto-plugin/src/main/java/org/apache/pluto/maven/
pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/
pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/
Author: ddewolf
Date: Fri Jul 29 23:58:38 2005
New Revision: 226478
URL: http://svn.apache.org/viewcvs?rev=226478&view=rev
Log: (empty)
Added:
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPlutoMojo.java
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPortletMojo.java
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AssembleMojo.java
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/DeployMojo.java
Modified:
portals/pluto/branches/pluto-1.1/README
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java
portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java
portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java
Modified: portals/pluto/branches/pluto-1.1/README
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/README?rev=226478&r1=226477&r2=226478&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/README (original)
+++ portals/pluto/branches/pluto-1.1/README Fri Jul 29 23:58:38 2005
@@ -1,3 +1,17 @@
+Table of Contents
+=====================================
+ - Introduction
+
+ - Instalation
+ * Automated Maven Installation
+ * Manual Installation
+ * Windows Installer
+
+ - Portlet Deployment
+ * Portlet Assembly with Maven
+ * Portlet Deployment with Maven
+
+
1) Introduction
- You are looking at the source distribution of Pluto 1.1.x.
@@ -48,3 +62,19 @@
- The NSIS Installer is not yet complete
+======================================
+3) Portlet Deployment
+
+3a) Assembly:
+---------------------------------------
+ All portlet applications must be run through
+ the pluto assembler before being deployed.
+ To do so:
+
+ Step 1: 'cd pluto-install'
+ Step 2: 'maven pluto:assemble -Dmaven.deploy.deployment=<path to war>
+
+3b) Deployment:
+
+ Step 1: 'cd pluto-install'
+ Step 2: 'maven pluto:deploy -Dmaven.deploy.deployment=<path to war>
Modified: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml?rev=226478&r1=226477&r2=226478&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml (original)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml Fri Jul 29 23:58:38 2005
@@ -4,13 +4,23 @@
<artifactId>maven-pluto-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
-
+ <parent>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
<name>Maven Pluto Installer Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0-alpha-3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto-deploy</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Modified: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java?rev=226478&r1=226477&r2=226478&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java (original)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java Fri Jul 29 23:58:38 2005
@@ -15,13 +15,11 @@
*/
package org.apache.pluto.maven;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
-import java.util.List;
-import java.util.ArrayList;
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
/**
* Abstract Mojo for installation tasks.
@@ -29,7 +27,7 @@
* @since 07/29/2005
* @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
*/
-public abstract class AbstractInstallationMojo extends AbstractMojo {
+public abstract class AbstractInstallationMojo extends org.apache.pluto.maven.AbstractPlutoMojo {
protected AbstractInstallationMojo() {
@@ -47,11 +45,6 @@
}
/**
- * @parameter expression="${pluto.installation.dir}"
- * @required
- */
- protected File installationDirectory;
- /**
* @parameter expression="${pluto.installation.tomcat.host}"
*/
protected String host = "localhost";
@@ -62,38 +55,9 @@
protected String engine = "Catalina";
/**
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- protected MavenProject project;
-
- /**
* @parameter expression="${project.basedir}/.."
*/
protected File basedir;
-
- public void execute() throws MojoExecutionException {
- if(!installationDirectory.exists() || !installationDirectory.isDirectory()) {
- throw new MojoExecutionException("Installation Directory "+installationDirectory.getAbsolutePath()+" does not exist.");
- }
-
- try {
- doExecute();
- }
- catch(MojoExecutionException mee) {
- throw mee;
- }
- catch(Exception e) {
- throw new MojoExecutionException("Error Installing Pluto", e);
- }
- }
-
- /**
- * Process the actual execution.
- * @throws Exception
- */
- protected abstract void doExecute() throws Exception;
protected List getSharedDependencies() {
List list = new ArrayList();
Added: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPlutoMojo.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPlutoMojo.java?rev=226478&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPlutoMojo.java (added)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPlutoMojo.java Fri Jul 29 23:58:38 2005
@@ -0,0 +1,63 @@
+/*
+ * 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.maven;
+
+import org.apache.maven.plugin.*;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @todo Document
+ * @since Jul 30, 2005
+ */
+public abstract class AbstractPlutoMojo extends org.apache.maven.plugin.AbstractMojo {
+ /**
+ * @parameter expression="${pluto.installation.dir}"
+ * @required
+ */
+ protected File installationDirectory;
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ public void execute() throws MojoExecutionException {
+ if(!installationDirectory.exists() || !installationDirectory.isDirectory()) {
+ throw new MojoExecutionException("Installation Directory "+installationDirectory.getAbsolutePath()+" does not exist.");
+ }
+
+ try {
+ doExecute();
+ }
+ catch(MojoExecutionException mee) {
+ throw mee;
+ }
+ catch(Exception e) {
+ throw new MojoExecutionException("Error Installing Pluto", e);
+ }
+ }
+
+ /**
+ * Process the actual execution.
+ * @throws Exception
+ */
+ protected abstract void doExecute() throws Exception;
+}
Added: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPortletMojo.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPortletMojo.java?rev=226478&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPortletMojo.java (added)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractPortletMojo.java Fri Jul 29 23:58:38 2005
@@ -0,0 +1,39 @@
+/*
+ * 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.maven;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @todo Document
+ * @since Jul 30, 2005
+ */
+public abstract class AbstractPortletMojo extends AbstractPlutoMojo {
+ /**
+ * @parameter expression="${pluto.deploy.deployment}"
+ * @required
+ */
+ protected File deployment;
+
+ protected InputStream createInputStream() throws IOException {
+ return new FileInputStream(deployment);
+ }
+}
Added: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AssembleMojo.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AssembleMojo.java?rev=226478&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AssembleMojo.java (added)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AssembleMojo.java Fri Jul 29 23:58:38 2005
@@ -0,0 +1,49 @@
+/*
+ * 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.maven;
+
+import org.apache.pluto.deploy.Assembler;
+import org.apache.pluto.deploy.impl.ArchivedFileAssembler;
+
+import java.io.IOException;
+import java.io.File;
+import java.util.jar.JarFile;
+
+/**
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @todo Document
+ * @todo Refactor this and the assembler to model deployer and allow no arg constructor
+ * @since Jul 30, 2005
+ *
+ * @goal assemble
+ */
+public class AssembleMojo extends AbstractPortletMojo {
+
+ protected void doExecute() throws Exception {
+
+ Assembler assembler = createAssembler();
+ assembler.assemble();
+
+ }
+
+ private Assembler createAssembler() throws IOException {
+ JarFile jar = new JarFile(deployment);
+ File destination = deployment;
+ Assembler assembler = new ArchivedFileAssembler(jar, destination);
+ return assembler;
+ }
+}
Added: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/DeployMojo.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/DeployMojo.java?rev=226478&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/DeployMojo.java (added)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/DeployMojo.java Fri Jul 29 23:58:38 2005
@@ -0,0 +1,89 @@
+/*
+ * 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.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.pluto.deploy.Deployer;
+import org.apache.pluto.deploy.DeploymentConfig;
+import org.apache.pluto.deploy.impl.Tomcat5FileSystemDeployer;
+
+import java.util.Properties;
+
+
+/**
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @todo Document
+ * @since Jul 30, 2005
+ *
+ * @goal deploy
+ */
+public class DeployMojo extends AbstractPortletMojo {
+
+ /**
+ * @parameter expression="${pluto.deploy.impl}"
+ */
+ private String deployerClass = Tomcat5FileSystemDeployer.class.getName();
+
+ /**
+ * @parameter expression="${pluto.deploy.tomcat.service}"
+ */
+ private String tomcatService = "Catalina";
+
+ /**
+ * @parameter expression="${pluto.deploy.tomcat.host}"
+ */
+ private String tomcatHost = "localhost";
+
+ protected void doExecute() throws Exception {
+ if(!deployment.getName().endsWith(".war")) {
+ throw new MojoExecutionException(deployment.getName()+" is an invalid deployment. Please specify a war.");
+ }
+
+ Deployer deployer = createDeployer();
+ deployer.deploy(createConfig(), createInputStream());
+
+ }
+
+ private DeploymentConfig createConfig() {
+ return new DeploymentConfigImpl();
+ }
+
+
+ private Deployer createDeployer() throws Exception {
+ Class cl = Class.forName(deployerClass);
+ return (Deployer)cl.newInstance();
+ }
+
+ private class DeploymentConfigImpl extends DeploymentConfig {
+ private Properties props;
+
+ public DeploymentConfigImpl() {
+ super(deployment.getName().substring(0, deployment.getName().lastIndexOf(".")));
+ props = new Properties(project.getProfileProperties());
+ props.putAll(System.getProperties());
+ props.setProperty("tomcat.home", installationDirectory.getAbsolutePath());
+ props.setProperty("tomcat.service", tomcatService);
+ props.setProperty("tomcat.host", tomcatHost);
+ }
+
+ public String getDeploymentProperty(String key) {
+ String property = props.getProperty(key);
+ return property;
+ }
+ }
+
+}
Modified: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java?rev=226478&r1=226477&r2=226478&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java (original)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java Fri Jul 29 23:58:38 2005
@@ -27,6 +27,7 @@
import java.util.Set;
/**
+ * @todo Enhancement. Support installing release from repo
* @goal install
* @requiresDependencyResolution runtime
*/
Modified: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java?rev=226478&r1=226477&r2=226478&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java Fri Jul 29 23:58:38 2005
@@ -26,6 +26,7 @@
/**
* Used to assemble a web application into a portlet application.
*
+ * @todo Refactor to have a default constructor and act as a service
* @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
* @author <a href="mailto:heavyzheng@gmail.com">Zhong ZHENG</a>
* @version 1.0
Modified: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java?rev=226478&r1=226477&r2=226478&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java Fri Jul 29 23:58:38 2005
@@ -15,15 +15,15 @@
*/
package org.apache.pluto.deploy.maven;
-import java.io.File;
-import java.io.IOException;
-
+import org.apache.commons.jelly.JellyTagException;
+import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
-import org.apache.commons.jelly.MissingAttributeException;
-import org.apache.commons.jelly.JellyTagException;
import org.apache.pluto.deploy.Assembler;
import org.apache.pluto.deploy.AssemblerFactory;
+
+import java.io.File;
+import java.io.IOException;
/**
* Tag which is used to assemble portlet applications.