cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r372256 - in /cocoon/trunk: cocoon-deployer/src/main/java/org/apache/cocoon/deployer/ cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/ cocoon-deployer/src/main/java/org/apache/cocoon/deployer/block/ cocoon-deploye...
Date Wed, 25 Jan 2006 16:16:43 GMT
Author: reinhard
Date: Wed Jan 25 08:16:15 2006
New Revision: 372256

URL: http://svn.apache.org/viewcvs?rev=372256&view=rev
Log:
work on deployment dependency management and provide a working example: cocoon-deployer-plugin-demo
should work

Modified:
    cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/ArtifactProvider.java
    cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/BlockDeployer.java
    cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer.java
    cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22.java
    cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServerFactory.java
    cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/block/BlockFactory.java
    cocoon/trunk/cocoon-deployer/src/main/resources/xsd/deploy-schema-1.0.xsd
    cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/BlockDeployerTest.java
    cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22Test.java
    cocoon/trunk/cocoon-deployer/src/test/mocks/validBlock-03/blockRoot/META-INF/block.xml
    cocoon/trunk/cocoon-deployer/src/test/mocks/validBlock-03/valid-block-1.0.jar
    cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-01/deploy.xml
    cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-02/deploy.xml
    cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-03/deploy.xml
    cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-04/deploy.xml
    cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-05/deploy.xml
    cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin-demo/pom.xml
    cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployMojo.java
    cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/MavenArtifactProvider.java
    cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/SingleBlockDeployMojo.java
    cocoon/trunk/cocoon-plugins/cocoon-minimal-webapp/pom.xml

Modified: cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/ArtifactProvider.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/ArtifactProvider.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/ArtifactProvider.java
(original)
+++ cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/ArtifactProvider.java
Wed Jan 25 08:16:15 2006
@@ -29,6 +29,6 @@
 	 * This method is used to resolve all dependencies of the passed artifact ids. It supports
 	 * transitive dependencies and makes sure that only one version of an artifact is returned.
 	 */
-	public File[] getArtifact(String mainArtifactId, String[] artifactIds);
+	public File[] getArtifact(String[] artifactIds);
 	
 }

Modified: cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/BlockDeployer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/BlockDeployer.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/BlockDeployer.java
(original)
+++ cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/BlockDeployer.java
Wed Jan 25 08:16:15 2006
@@ -20,6 +20,7 @@
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import org.apache.cocoon.deployer.applicationserver.CocoonServer;
@@ -92,24 +93,36 @@
 		// validate deployment descriptor (correct dependencies, mount path only used once in exclusive
mode, 
 		// set only available properties)
 		
-		
-		// check if this version of the deployer supports the requested Cocoon version
-		String version = deploymentDescriptor.getCocoon().getVersion();
-		if(!version.equals("2.2") && !version.equals("2.2-SNAPSHOT")) {
-			throw new DeploymentException("This version of the block deployer only supports Cocoon
2.2.");
-		}
+		// get the Cocoon urn
+		String cocoonWebappUrn = deploymentDescriptor.getCocoon().getWebappUrn();
+		String cocoonBlockFwWebappUrn = deploymentDescriptor.getCocoon().getBlockFwUrn();		
 		
 		// get all dependant libraries transitivly
-		// TBD artifactProvider.getArtifact()
+		File[] libraries = artifactProvider.getArtifact( 
+				this.getAllBlockUrns(this.blockList, cocoonBlockFwWebappUrn));
 		
 		// deploy the blocks
 		CocoonServer cocoonServer = CocoonServerFactory.createServer(
 				deploymentDescriptor.getCocoon(), this.variableResolver, this.artifactProvider);
-		cocoonServer.deploy((Block[]) blockList.toArray(new Block[blockList.size()]), new File[0],
this.log);
+		cocoonServer.deploy((Block[]) blockList.toArray(new Block[blockList.size()]), 
+				cocoonWebappUrn, libraries, this.log);
 		
 		stopWatch.stop();
 		this.log.info("SUCESSFULLY deployed in " + stopWatch);
 		
+	}
+	
+	/**
+	 * @return a list of all urns to be installed
+	 */
+	private String[] getAllBlockUrns(List blocks, String urn) {
+		List urnList = new ArrayList();
+		urnList.add(urn);
+		for(Iterator it = blocks.iterator(); it.hasNext();) {
+			String blockUrn = ((Block) it.next()).getId();
+			urnList.add(blockUrn);
+		}
+		return (String[]) urnList.toArray(new String[urnList.size()]);
 	}
 
 	

Modified: cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer.java
(original)
+++ cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer.java
Wed Jan 25 08:16:15 2006
@@ -28,7 +28,7 @@
 
 public interface CocoonServer {
 
-	public boolean deploy(Block[] blocks, File[] libraries, Logger log);
+	public boolean deploy(Block[] blocks, String serverArtifact, File[] libraries, Logger log);
 	
 	public boolean isExclusive();
 	

Modified: cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22.java
(original)
+++ cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22.java
Wed Jan 25 08:16:15 2006
@@ -49,7 +49,6 @@
 
 public class CocoonServer22 implements CocoonServer {
 
-	public static final String DEFAULT_COCOON_22_SERVER_ARTIFACT = "org.apache.cocoon:cocoon-minimal-webapp:1.0-SNAPSHOT:war";
 	public static final String WIRING_10_NAMESPACE = "http://apache.org/cocoon/blocks/wiring/1.0";
 	public static final String WIRING_FILE = "WEB-INF/wiring.xml";
 	public static final String WEB_INF_BLOCKS_DIR = "WEB-INF/blocks";
@@ -71,7 +70,7 @@
 	 * TODO exclusive mode not implemented yet
 	 * TODO variable resolver not used yet
 	 */
-	public synchronized boolean deploy(Block[] blocks, File[] libraries, Logger log) {
+	public synchronized boolean deploy(Block[] blocks, String serverArtifact, File[] libraries,
Logger log) {
 		Validate.notNull(blocks, "A blocks object (Block[]) has to be passed to this method!");
 		Validate.notNull(libraries, "A libraries object (File[]) has to passed to this method!");
 		
@@ -88,7 +87,7 @@
 	    	
 			// install the Cocoon server if necessary
 			if(baseDirectoryFile.list().length == 0) {
-				deployCocoonServer(frm, txId, "");
+				deployCocoonServer(frm, txId, "", serverArtifact);
 			} else {
 				// TODO logging
 			}
@@ -147,9 +146,11 @@
 			}
 			
 			// install all libraries
+			// TODO What happens if two libraries have the same filename by chance ...?
 			for(int i = 0; i < libraries.length; i++) {
 				File lib = libraries[i];
 				String libName = lib.getName();
+				log.info("Installing library " + WEB_INF_LIBS_DIR + "/" + libName);		
 				OutputStream out = frm.writeResource(txId, WEB_INF_LIBS_DIR + "/" + libName);
 				FileInputStream fis = new FileInputStream(lib);
 				int b;
@@ -167,7 +168,6 @@
             
             // committ transaction
 			frm.commitTransaction(txId); 
-			log.info("All block successfully deployed.");
 			
 	    } catch(Exception ex) {
 	    	try {
@@ -297,8 +297,8 @@
 	/**
 	 * Extract the Cocoon server to the filesystem using the FileResourceManager
 	 */
-	protected void deployCocoonServer(FileResourceManager frm, String txId, String relativeOutputDir)
{
-		File zip = this.artifactProvider.getArtifact(DEFAULT_COCOON_22_SERVER_ARTIFACT);
+	protected void deployCocoonServer(FileResourceManager frm, String txId, String relativeOutputDir,
String serverArtifact) {
+		File zip = this.artifactProvider.getArtifact(serverArtifact);
 		try {
 			ZipUtils.extractZip(new ZipInputStream(new FileInputStream(zip)), frm, txId, relativeOutputDir);
 		} catch (FileNotFoundException e) {

Modified: cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServerFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServerFactory.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServerFactory.java
(original)
+++ cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/applicationserver/CocoonServerFactory.java
Wed Jan 25 08:16:15 2006
@@ -32,7 +32,7 @@
 		cocoonServer.setArtifactProvider(artifactProvider);
 		
 		try {
-			cocoonServer.setBaseDirectory(new URI(cocoon.getUrl()));
+			cocoonServer.setBaseDirectory(new URI(cocoon.getTargetUrl()));
 		} catch (URISyntaxException e) {
 			throw new DeploymentException("Invalid Cocoon server URL");
 		}

Modified: cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/block/BlockFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/block/BlockFactory.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/block/BlockFactory.java
(original)
+++ cocoon/trunk/cocoon-deployer/src/main/java/org/apache/cocoon/deployer/block/BlockFactory.java
Wed Jan 25 08:16:15 2006
@@ -76,7 +76,7 @@
 		deployBlock.setId(deployBlockId);
 		
 		BinaryBlock block = BlockFactory.createBinaryBlock(artifact, deployBlock);
-		deployBlock.setUrn("mvn:" + block.getBlockDescriptor().getId());
+		deployBlock.setUrn(block.getBlockDescriptor().getId());
 		
 		return block;
 	}

Modified: cocoon/trunk/cocoon-deployer/src/main/resources/xsd/deploy-schema-1.0.xsd
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/main/resources/xsd/deploy-schema-1.0.xsd?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/main/resources/xsd/deploy-schema-1.0.xsd (original)
+++ cocoon/trunk/cocoon-deployer/src/main/resources/xsd/deploy-schema-1.0.xsd Wed Jan 25 08:16:15
2006
@@ -31,10 +31,10 @@
   </xs:element>
   
   <xs:complexType name="cocoon">
-  	<xs:attribute name="url" type="xs:anyURI" use="required"/>
-    <xs:attribute name="exclusive" type="xs:boolean" use="required"/>
-  	<xs:attribute name="version" type="xs:string" use="required"/>	
-  	<xs:attribute name="webapp" type="xs:anyURI" use="optional"/>
+  	<xs:attribute name="target-url" type="xs:anyURI" use="required"/>
+    <xs:attribute name="exclusive" type="xs:boolean" use="required"/>
+  	<xs:attribute name="webapp-urn" type="xs:anyURI" use="optional"/>
+  	<xs:attribute name="block-fw-urn" type="xs:anyURI" use="optional"/>
   </xs:complexType>
   
   <xs:complexType name="block">

Modified: cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/BlockDeployerTest.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/BlockDeployerTest.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/BlockDeployerTest.java
(original)
+++ cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/BlockDeployerTest.java
Wed Jan 25 08:16:15 2006
@@ -18,7 +18,6 @@
 import java.io.File;
 import java.io.FileReader;
 
-import org.apache.cocoon.deployer.applicationserver.CocoonServer22;
 import org.apache.cocoon.deployer.generated.deploy.x10.Deploy;
 import org.apache.cocoon.deployer.logger.ConsoleLogger;
 import org.apache.cocoon.deployer.resolver.NullVariableResolver;
@@ -43,7 +42,7 @@
 		ArtifactProvider aProvider = (ArtifactProvider) aProviderCtrl.getMock();
 		
 		// server
-		aProvider.getArtifact(CocoonServer22.DEFAULT_COCOON_22_SERVER_ARTIFACT);
+		aProvider.getArtifact("org.apache.cocoon:cocoon-minimal-webapp:2.0-SNAPSHOT:war");
 		File vanillaCocoonServerArtifact = this.getMockArtefact("validVanillaCocoon22App/appRoot.zip");
 		assertTrue(vanillaCocoonServerArtifact.exists());		
 		aProviderCtrl.setReturnValue(vanillaCocoonServerArtifact);
@@ -62,6 +61,9 @@
 		
 		aProvider.getArtifact("mvn:anyblock:anyblock-07:1.0");
 		aProviderCtrl.setReturnValue(this.getMockArtefact("validBlock-07/valid-block-1.0.jar"));
		
+		
+		aProvider.getArtifact((String[]) null);
+		aProviderCtrl.setDefaultReturnValue(new File[0]);
 		
 		aProviderCtrl.replay();
 		return aProvider;

Modified: cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22Test.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22Test.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22Test.java
(original)
+++ cocoon/trunk/cocoon-deployer/src/test/java/org/apache/cocoon/deployer/applicationserver/CocoonServer22Test.java
Wed Jan 25 08:16:15 2006
@@ -35,6 +35,7 @@
 public class CocoonServer22Test extends AbstractDeployerTestCase {
 	
 	private static final String deployPath = "target/test/deployServer22";
+	private static final String DEFAULT_WEBAPP_ARTIFACT = "org.apache.cocoon:cocoon-minimal-webapp:1.0-SNAPSHOT:war";
 	
 	/**
 	 * Test method for 'org.apache.cocoon.deployer.applicationserver.CocoonServer22.deploy(Block[])'
@@ -50,7 +51,7 @@
 		BinaryBlock[] blocks = new Block10[1];
 		blocks[0] = createBlock10Instance("validBlock-02/valid-block-1.0.jar", "validDeploy-02/deploy.xml",
0);	
 		
-		cocoonServer.deploy(blocks, createLibraries(), this.getLogger());
+		cocoonServer.deploy(blocks, DEFAULT_WEBAPP_ARTIFACT, createLibraries(), this.getLogger());
 		
 	    // assertions: check if setting the properties works correctly
 		Wiring wiring = (Wiring) Wiring.unmarshal(new FileReader(new File(deployPath + "/WEB-INF/wiring.xml")));
@@ -73,7 +74,7 @@
 		blocks[1] = createBlock10Instance("validBlock-03/valid-block-1.0.jar", "validDeploy-03/deploy.xml",
1);
 		blocks[2] = createBlock10Instance("validBlock-03/valid-block-1.0.jar", "validDeploy-03/deploy.xml",
2);
 		
-		cocoonServer.deploy(blocks, createLibraries(), this.getLogger());
+		cocoonServer.deploy(blocks, DEFAULT_WEBAPP_ARTIFACT, createLibraries(), this.getLogger());
 		
 	    // assertions: names, location, connections
 		Wiring wiring = (Wiring) Wiring.unmarshal(new FileReader(new File(deployPath + "/WEB-INF/wiring.xml")));
@@ -125,7 +126,7 @@
 	    frm.start();
 	    frm.startTransaction(txId);
 	    
-	    cocoonServer.deployCocoonServer(frm, txId, relativeOutputDir);
+	    cocoonServer.deployCocoonServer(frm, txId, relativeOutputDir, DEFAULT_WEBAPP_ARTIFACT);
 	    frm.commitTransaction(txId);
 	    
 	    // ASSERTIONS!!!
@@ -140,7 +141,7 @@
 		MockControl aProviderCtrl = MockControl.createControl(ArtifactProvider.class);
 		ArtifactProvider aProvider = (ArtifactProvider) aProviderCtrl.getMock();
 		
-		aProvider.getArtifact(CocoonServer22.DEFAULT_COCOON_22_SERVER_ARTIFACT);
+		aProvider.getArtifact("org.apache.cocoon:cocoon-minimal-webapp:1.0-SNAPSHOT:war");
 		File vanillaCocoonServerArtifact = this.getMockArtefact("validVanillaCocoon22App/appRoot.zip");
 		assertTrue(vanillaCocoonServerArtifact.exists());		
 		aProviderCtrl.setReturnValue(vanillaCocoonServerArtifact);

Modified: cocoon/trunk/cocoon-deployer/src/test/mocks/validBlock-03/blockRoot/META-INF/block.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/mocks/validBlock-03/blockRoot/META-INF/block.xml?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/test/mocks/validBlock-03/blockRoot/META-INF/block.xml
(original)
+++ cocoon/trunk/cocoon-deployer/src/test/mocks/validBlock-03/blockRoot/META-INF/block.xml
Wed Jan 25 08:16:15 2006
@@ -15,8 +15,8 @@
   limitations under the License. 
 -->
 <block xmlns="http://apache.org/cocoon/blocks/cob/1.0"
-       id="http://cocoon.apache.org/blocks/anyblock-03/1.0">
-  <name>anyblock02</name>
+  id="anyblock:anyblock-03:1.0">
+  <name>anyblock03</name>
   <description href="http://cocoon.apache.org/blocks/anyblock/1.0">
     A test block
   </description>

Modified: cocoon/trunk/cocoon-deployer/src/test/mocks/validBlock-03/valid-block-1.0.jar
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/mocks/validBlock-03/valid-block-1.0.jar?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
Binary files - no diff available.

Modified: cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-01/deploy.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-01/deploy.xml?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-01/deploy.xml (original)
+++ cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-01/deploy.xml Wed Jan 25 08:16:15
2006
@@ -16,7 +16,8 @@
 -->
 <deploy xmlns="http://apache.org/cocoon/blocks/deploy/1.0">
   
-  <cocoon version="2.2" url="file://d:/my-cocoon/" exclusive="true"/>
+  <cocoon target-url="file://d:/my-cocoon/" 
+    webapp-urn="org.apache.cocoon:cocoon-minimal-webapp:1.0-SNAPSHOT:war" exclusive="true"/>
   
   <block id="webmail" location="00001" urn="webmail:webmail:3.27">
     <connections>

Modified: cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-02/deploy.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-02/deploy.xml?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-02/deploy.xml (original)
+++ cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-02/deploy.xml Wed Jan 25 08:16:15
2006
@@ -16,7 +16,8 @@
 -->
 <deploy xmlns="http://apache.org/cocoon/blocks/deploy/1.0">
   
-  <cocoon version="2.2" url="./validDeploy-02/myServer" exclusive="true"/>
+  <cocoon target-url="./validDeploy-02/myServer" 
+    urn="org.apache.cocoon:cocoon-minimal-webapp:1.0-SNAPSHOT:war" exclusive="true"/>
 
   
   <block id="block02" urn="validBlock-02:validBlock-02:1.0">
     <properties>

Modified: cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-03/deploy.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-03/deploy.xml?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-03/deploy.xml (original)
+++ cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-03/deploy.xml Wed Jan 25 08:16:15
2006
@@ -16,7 +16,8 @@
 -->
 <deploy xmlns="http://apache.org/cocoon/blocks/deploy/1.0">
   
-  <cocoon version="2.2" url="./validDeploy-02/myServer" exclusive="true"/>
+  <cocoon target-url="./validDeploy-02/myServer" 
+    urn="org.apache.cocoon:cocoon-minimal-webapp:1.0-SNAPSHOT:war" exclusive="true"/>
 
   
   <block id="block02" urn="validBlock-02:validBlock-02:1.0">
     <connections>

Modified: cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-04/deploy.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-04/deploy.xml?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-04/deploy.xml (original)
+++ cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-04/deploy.xml Wed Jan 25 08:16:15
2006
@@ -16,7 +16,8 @@
 -->
 <deploy xmlns="http://apache.org/cocoon/blocks/deploy/1.0">
   
-  <cocoon version="2.2" url="target/test/validDeploy-02/myServer" exclusive="true"/>
+  <cocoon target-url="target/test/validDeploy-02/myServer" 
+    webapp-urn="org.apache.cocoon:cocoon-minimal-webapp:2.0-SNAPSHOT:war" exclusive="true"/>
 
   
   <block id="b03" urn="mvn:validBlock-03:validBlock-03:1.0">
     <connections>

Modified: cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-05/deploy.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-05/deploy.xml?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-05/deploy.xml (original)
+++ cocoon/trunk/cocoon-deployer/src/test/mocks/validDeploy-05/deploy.xml Wed Jan 25 08:16:15
2006
@@ -16,7 +16,8 @@
 -->
 <deploy xmlns="http://apache.org/cocoon/blocks/deploy/1.0">
   
-  <cocoon version="2.2" url="target/test/validDeploy-02/myServer" exclusive="true"/>
+  <cocoon target-url=".target/test/validDeploy-02/myServer" 
+    urn="org.apache.cocoon:cocoon-minimal-webapp:1.0-SNAPSHOT:war" exclusive="true"/>
   
   
   <block id="db" urn="mvn:validBlock-04:validBlock-04:1.0"/>  
   

Modified: cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin-demo/pom.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin-demo/pom.xml?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin-demo/pom.xml (original)
+++ cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin-demo/pom.xml Wed Jan 25 08:16:15 2006
@@ -50,4 +50,13 @@
     </plugins>
   </build>  
   
+  <dependencies>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.1</version>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+  
 </project>

Modified: cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployMojo.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployMojo.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployMojo.java
(original)
+++ cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployMojo.java
Wed Jan 25 08:16:15 2006
@@ -15,30 +15,19 @@
  */
 package org.apache.cocoon.maven.deployer;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
 import org.apache.maven.project.artifact.MavenMetadataSource;
 
 /**
  * @goal deploy
  * @requiresProject false
+ * @description
  */
 public class DeployMojo extends AbstractMojo {
 
@@ -97,60 +86,8 @@
 	
     public void execute() throws MojoExecutionException 
     {
-        getLog().info("Cocoon block deployer");
-        getLog().info("factory: " + artifactFactory.toString());
-         
-        Set artifacts = null;
-        ArtifactResolutionResult result = null;  
-        try {
-			
-			// see org.apache.maven.artifact.ant.DependenciesTask
-			Dependency dependency = new Dependency();
-			dependency.setArtifactId("easymock");
-			dependency.setGroupId("easymock");
-			dependency.setVersion("1.1");
-			Dependency dependency1 = new Dependency();
-			dependency1.setArtifactId("commons-dbcp");
-			dependency1.setGroupId("commons-dbcp");
-			dependency1.setVersion("1.2");
-			Dependency dependency2 = new Dependency();
-			dependency2.setArtifactId("log4j");
-			dependency2.setGroupId("log4j");
-			dependency2.setVersion("1.2.8");			
-			List dependencies = new ArrayList();
-			dependencies.add(dependency);
-			dependencies.add(dependency1);
-			dependencies.add(dependency2);			
-
-            Artifact pomArtifact = artifactFactory.createBuildArtifact( "log4j", "log4j",
"1.2.9", "jar");			
-            Map managedDependencies = Collections.EMPTY_MAP;			
-            artifacts = MavenMetadataSource.createArtifacts( artifactFactory, dependencies,
null, null, null );			
-            result = artifactResolver.resolveTransitively( artifacts, pomArtifact, managedDependencies,
localRepository,
-                    remoteArtifactRepositories, metadataSource);
-
-            
-		} catch (ArtifactResolutionException e) {
-			e.printStackTrace();
-		} catch (ArtifactNotFoundException e) {
-			e.printStackTrace();
-		} catch (InvalidDependencyVersionException e) {
-			e.printStackTrace();
-		}
-
-        for ( Iterator i = artifacts.iterator(); i.hasNext(); )
-        {
-            Artifact artifact = (Artifact) i.next();
-            System.out.println("art: " + artifact.getId());
-        }		
-		
-	    for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
-        {
-            Artifact artifact = (Artifact) i.next();
-            System.out.println("res " + artifact.getId());
-        }		
-	    
-		getLog().info("deployDescriptor: " + new File(deployDescriptor).getAbsolutePath());   
 
+         
     }	
 	
 }

Modified: cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/MavenArtifactProvider.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/MavenArtifactProvider.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/MavenArtifactProvider.java
(original)
+++ cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/MavenArtifactProvider.java
Wed Jan 25 08:16:15 2006
@@ -119,9 +119,7 @@
     /**
 	 * @see org.apache.cocoon.deployer.ArtifactProvider#getArtifact(java.lang.String[])
 	 */
-    public final File[] getArtifact(String mainArtifactId, String[] artifactIds) {
-    	
-    	// !!! this method has never been testet !!!
+    public final File[] getArtifact(String[] artifactIds) {
     	
     	Validate.notNull(artifactIds, "artifactIds mustn't be null");
     	Validate.noNullElements(artifactIds, "Quering a 'null'-artifact is not possible");
@@ -132,14 +130,7 @@
     	try {
 			List dependencies = new ArrayList();
 	        Set artifacts = null;		
-	        
-	        ArtifactBean mainArtifactBean = getArtifactBeanFor(mainArtifactId);
-            Artifact mainArtifact = artifactFactory.createBuildArtifact(
-                mainArtifactBean.getGroupId(),
-                mainArtifactBean.getArtifactId(),
-                mainArtifactBean.getVersion(),
-                mainArtifactBean.getType());		        
-	        
+
     		for(int i = 0; i < artifactIds.length; i++) {
 	    		ArtifactBean artifactBean = getArtifactBeanFor(artifactIds[i]);
 				Dependency dependency = new Dependency();
@@ -147,20 +138,24 @@
 				dependency.setArtifactId(artifactBean.getArtifactId());
 				dependency.setVersion(artifactBean.getVersion());    	
 				dependency.setType(artifactBean.getType());
-				dependencies.add(dependencies);
+				dependencies.add(dependency);		
 	    	}
-    		
+
+    		Artifact mainArtifact = artifactFactory.createBuildArtifact( "unspecified", "unspecified",
"0.0", "jar");
+            
             artifacts = MavenMetadataSource.createArtifacts( this.artifactFactory, dependencies,
null, null, null );		   		
 		
-            Map managedDependencies = Collections.EMPTY_MAP;			
-            artifacts = MavenMetadataSource.createArtifacts( artifactFactory, dependencies,
null, null, null );			
+            Map managedDependencies = Collections.EMPTY_MAP;	
+            
+            artifacts = MavenMetadataSource.createArtifacts( artifactFactory, dependencies,
null, null, null );		
+            
             ArtifactResolutionResult result = artifactResolver.resolveTransitively( 
             		artifacts, mainArtifact, managedDependencies, localRepository,
                     remoteArtifactRepositories, metadataSource);   
             
 
     	    for(Iterator i = result.getArtifacts().iterator(); i.hasNext();) {
-                Artifact artifact = (Artifact) i.next();
+                Artifact artifact = (Artifact) i.next();       
                 returnFilesList.add(artifact.getFile());
             }		            
 
@@ -168,6 +163,7 @@
     	    
     	} catch (Exception ex) {
 			this.log.error(ex);
+			// TBD: catch specific exceptions and throw new MojoExecutionException(...) with explanations
what went wrong
 		}
     	
     	return returnFiles;
@@ -185,7 +181,6 @@
      */
     private ArtifactBean getArtifactBeanFor(final String artifactSpec)
         throws ArtifactResolutionException, ArtifactNotFoundException {
-        this.log.debug("[MavenArtifactProvider.getArtifactFor: artifactSpec=" + artifactSpec);
   	
     	
         final int p1 = artifactSpec.indexOf(':');
         Validate.isTrue(p1 > 0, "invalid artifact specifier: " + artifactSpec);
@@ -196,7 +191,6 @@
 
         final String artifactId = artifactSpec.substring(p1 + 1, p2);
         final int p3 = artifactSpec.indexOf(':', p2 + 1);
-        System.out.println("p3: " + p3);
         final String version =
             (p3 > 0) ? artifactSpec.substring(p2 + 1, p3) : artifactSpec.substring(p2
+ 1);
         final String type = (p3 > 0) ? artifactSpec.substring(p3 + 1) : "jar";

Modified: cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/SingleBlockDeployMojo.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/SingleBlockDeployMojo.java?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/SingleBlockDeployMojo.java
(original)
+++ cocoon/trunk/cocoon-plugins/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/SingleBlockDeployMojo.java
Wed Jan 25 08:16:15 2006
@@ -107,9 +107,9 @@
     //~ Methods -----------------------------------------------------------------------------------------
 
     /**
-     * DOCUMENT ME!
+     * Create a minimal web application based on the current block
      *
-     * @throws MojoExecutionException DOCUMENT ME!
+     * @throws MojoExecutionException if any problem occurs while executing this Mojo
      */
     public void execute()
         throws MojoExecutionException {
@@ -129,9 +129,10 @@
         // create the Cocoon object
         Cocoon cocoon = new Cocoon();
         cocoon.setExclusive(true);
-        cocoon.setUrl("target/cocoon-webapp");
-        cocoon.setVersion("2.2");
-
+        cocoon.setTargetUrl("target/cocoon-webapp");
+        cocoon.setWebappUrn("org.apache.cocoon:cocoon-minimal-webapp:1.0-SNAPSHOT:war");
+        cocoon.setBlockFwUrn("org.apache.cocoon:cocoon-blocks-fw-impl:1.0-SNAPSHOT");
+        
         Block block = new Block();
         block.setId(artifactId);
         block.setAutoWire(true);

Modified: cocoon/trunk/cocoon-plugins/cocoon-minimal-webapp/pom.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-plugins/cocoon-minimal-webapp/pom.xml?rev=372256&r1=372255&r2=372256&view=diff
==============================================================================
--- cocoon/trunk/cocoon-plugins/cocoon-minimal-webapp/pom.xml (original)
+++ cocoon/trunk/cocoon-plugins/cocoon-minimal-webapp/pom.xml Wed Jan 25 08:16:15 2006
@@ -34,5 +34,5 @@
   <name>Minimal Cocoon web application</name>
   
   <url>http://cocoon.apache.org</url>
-  
+
 </project>



Mime
View raw message