Author: reinhard Date: Fri Mar 11 07:28:54 2005 New Revision: 157093 URL: http://svn.apache.org/viewcvs?view=rev&rev=157093 Log: cleaning up; start moving mappings into resources; work on the cli-implementation; refactoring (better namings)
Added: cocoon/whiteboard/block-deployer/mapping/deploy.xml-mapping.xml cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10-mapping.xml cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10Resolver.java - copied, changed from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/BlockResolver.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Descriptor.java - copied, changed from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockDescriptor.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Property.java - copied, changed from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockProperty.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Requirement.java - copied, changed from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockRequirement.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServer22Locator.java - copied, changed from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationTestCase.java cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServer22LocatorTest.java - copied, changed from r126205, cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java Removed: cocoon/whiteboard/block-deployer/mapping/block.xml-mapping.xml cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/BlockResolver.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/RealRemoteBlock.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/SimpleBlock.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockDescriptor.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockProperty.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockRequirement.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServer21Locator.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/SingleBlockLocator.java cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServer21LocatorTest.java cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/SingeBlockLocatorTest.java Modified: cocoon/whiteboard/block-deployer/mapping/sample-deploy.xml cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/DeploymentService.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/RemoteBlockFactory.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationException.java cocoon/whiteboard/block-deployer/status.xml cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/LogEnabledTestCase.java Added: cocoon/whiteboard/block-deployer/mapping/deploy.xml-mapping.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/mapping/deploy.xml-mapping.xml?view=auto&rev=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/mapping/deploy.xml-mapping.xml (added) +++ cocoon/whiteboard/block-deployer/mapping/deploy.xml-mapping.xml Fri Mar 11 07:28:54 2005 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- + Copyright 1999-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. +--> +<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" + "http://castor.exolab.org/mapping.dtd"> +<mapping> + <class name="org.apache.cocoon.blockdeployer.configuration.DeploymentConfigurationDTO"> + <map-to xml="deploy" ns-uri="http://cocoon.apache.org/cob-deployment/1.0"/> + <field name="locators" type="org.apache.cocoon.blockdeployer.configuration.LocatorDTO" collection="collection" > + <bind-xml name="locator" node="element" location="locators"/> + </field> + <field name="servers" type="org.apache.cocoon.blockdeployer.configuration.ServerDTO" collection="collection" > + <bind-xml name="server" node="element" location="servers"/> + </field> + </class> + <class name="org.apache.cocoon.blockdeployer.configuration.LocatorDTO"> + <map-to ns-uri="http://cocoon.apache.org/cob-deployment/1.0"/> + <field name="uri" type="string"> + <bind-xml name="uri" node="element"/> + </field> + </class> + <class name="org.apache.cocoon.blockdeployer.configuration.ServerDTO"> + <map-to ns-uri="http://cocoon.apache.org/cob-deployment/1.0"/> + <field name="uri" type="string"> + <bind-xml name="uri" node="element"/> + </field> + </class> +</mapping> \ No newline at end of file Modified: cocoon/whiteboard/block-deployer/mapping/sample-deploy.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/mapping/sample-deploy.xml?view=diff&r1=157092&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/mapping/sample-deploy.xml (original) +++ cocoon/whiteboard/block-deployer/mapping/sample-deploy.xml Fri Mar 11 07:28:54 2005 @@ -14,16 +14,26 @@ See the License for the specific language governing permissions and limitations under the License. --> -<deploy> +<deploy xmlns="http://cocoon.apache.org/cob-deployment/1.0"> <locators> - <locator>C:\myDirectory</locator> - <locator>F:\anotherDirectory</locator> + <locator uri="C:/myDirectory" add-unavailable-blocks="true"/> + <locator uri="F:/anotherDirectory"/> + <locator uri="http://cocoon.apache.org/block-repository/"/> </locators> - <servers> - <server version="2.2">E:\blblb</server> - </servers> - <install> - <block id="http://mycompany.com/webmail/1.3.43" auto-resolve="true"/> - <block id="http://mycompany.com/myblock/1.3.43" auto-resolve="false"/> + <install default-system="localhost"> + <cocoon version="2.2"> + <system name="localhost" uri="D:/local"/> + <system name="production" uri="E:/myCocoonServer"/> + </cocoon> + <block id="http://mycompany.com/webmail/1.3.43" auto-resolve="true"> + <parameter name="mailserver"> + <system name="localhost" value="xyz"/> + <system name="production" value="abc"/> + </parameter> + </block> + <block id="http://mycompany.com/myblock/1.3.43" auto-resolve="false"> + <parameter name="driver" value="myDriver.class"/> + </block> + <block id="http://mycompany.com/myOtherBlock/1.3.43" auto-resolve="false" path="E:/myDevDir"/> </install> </deploy> Modified: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/DeploymentService.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/DeploymentService.java?view=diff&r1=157092&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/DeploymentService.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/DeploymentService.java Fri Mar 11 07:28:54 2005 @@ -15,7 +15,7 @@ */ package org.apache.cocoon.blockdeployer; -import org.apache.cocoon.blockdeployer.configuration.DeploymentConfiguration; +import org.apache.cocoon.blockdeployer.configuration.DeploymentConfigurationDTO; import org.apache.cocoon.blockdeployer.configuration.DeploymentConfigurationException; import org.apache.cocoon.blockdeployer.logging.LoggerFacade; @@ -25,18 +25,18 @@ public class DeploymentService { /** - * Deploy blocks using the information in the [EMAIL PROTECTED] DeploymentConfiguration}. + * Deploy blocks using the information in the [EMAIL PROTECTED] DeploymentConfigurationDTO}. * @param conf * @param logger */ - public static void deploy(DeploymentConfiguration conf, LoggerFacade logger) throws DeploymentConfigurationException { + public static void deploy(DeploymentConfigurationDTO conf, LoggerFacade logger) throws DeploymentConfigurationException { if(logger == null) { throw new NullPointerException("The logger mustn't be null."); } checkDeploymentConfiguration(conf, logger); } - protected static void checkDeploymentConfiguration(DeploymentConfiguration conf, LoggerFacade logger) + protected static void checkDeploymentConfiguration(DeploymentConfigurationDTO conf, LoggerFacade logger) throws DeploymentConfigurationException { } Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10-mapping.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10-mapping.xml?view=auto&rev=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10-mapping.xml (added) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10-mapping.xml Fri Mar 11 07:28:54 2005 @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- + Copyright 1999-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. +--> +<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" + "http://castor.exolab.org/mapping.dtd"> +<mapping> + <class name="org.apache.cocoon.blockdeployer.block.descriptor.Cob10Descriptor"> + <map-to xml="block" ns-uri="http://apache.org/cocoon/blocks/cob/1.0"/> + <field name="name" type="string" > + <bind-xml name="name" node="element" /> + </field> + <field name="blockId" type="string"> + <bind-xml name="id" node="attribute"/> + </field> + <field name="properties" type="org.apache.cocoon.blockdeployer.block.descriptor.Cob10Property" collection="collection" > + <bind-xml name="property" node="element" location="properties"/> + </field> + <field name="requirements" type="org.apache.cocoon.blockdeployer.block.descriptor.Cob10Requirement" collection="collection" > + <bind-xml name="requires" node="element" location="requirements"/> + </field> + </class> + <class name="org.apache.cocoon.blockdeployer.block.descriptor.Cob10Property"> + <map-to ns-uri="http://apache.org/cocoon/blocks/cob/1.0"/> + <field name="name" type="string"> + <bind-xml name="name" node="attribute"/> + </field> + <field name="description" type="string" > + <bind-xml name="description" node="element" /> + </field> + <field name="defaultValue" type="string" > + <bind-xml name="default" node="element" /> + </field> + </class> + <class name="org.apache.cocoon.blockdeployer.block.descriptor.Cob10Requirement"> + <map-to ns-uri="http://apache.org/cocoon/blocks/cob/1.0"/> + <field name="name" type="string"> + <bind-xml name="name" node="attribute"/> + </field> + <field name="blockId" type="string" > + <bind-xml name="block" node="element" /> + </field> + </class> +</mapping> \ No newline at end of file Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10.java?view=auto&rev=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10.java (added) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10.java Fri Mar 11 07:28:54 2005 @@ -0,0 +1,70 @@ +/* + * 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.cocoon.blockdeployer.block; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.cocoon.blockdeployer.block.RemoteBlock; +import org.apache.cocoon.blockdeployer.block.descriptor.BlockDescriptor; +import org.apache.cocoon.blockdeployer.repository.Locator; + +/** + * @since 0.1 + */ +public class Cob10 implements RemoteBlock { + + public final static String NAMESPACE = "http://apache.org/cocoon/blocks/cob/1.0"; + + private Locator locator; + private BlockDescriptor blockDescriptor; + private String blockId; + + public Locator getLocator() { + return this.locator; + } + + public void setLocator(Locator locator) { + this.locator = locator; + } + + public BlockDescriptor getBlockDescriptor() { + return this.blockDescriptor; + } + + public void setBlockDescriptor(BlockDescriptor blockDescriptor) { + this.blockDescriptor = blockDescriptor; + } + + public InputStream getStream() throws IOException { + return null; + } + + protected void setBlockId(String blockId) { + this.blockId = blockId; + } + + public String getBlockId() { + return this.blockId; + } + + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("id: " + this.blockId + ", locator: " + this.locator.toString()); + return sb.toString(); + } + +} Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10Resolver.java (from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/BlockResolver.java) URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10Resolver.java?view=diff&rev=157093&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/BlockResolver.java&r1=126205&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10Resolver.java&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/BlockResolver.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/Cob10Resolver.java Fri Mar 11 07:28:54 2005 @@ -22,7 +22,7 @@ * * @since 0.1 */ -public class BlockResolver { +public class Cob10Resolver { /** * Find all blocks, the passed blocks depend on. It checks Modified: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/RemoteBlockFactory.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/RemoteBlockFactory.java?view=diff&r1=157092&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/RemoteBlockFactory.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/RemoteBlockFactory.java Fri Mar 11 07:28:54 2005 @@ -18,7 +18,7 @@ import java.io.IOException; import java.io.InputStream; -import org.apache.cocoon.blockdeployer.block.descriptor.RealBlockDescriptor; +import org.apache.cocoon.blockdeployer.block.descriptor.Cob10Descriptor; import org.apache.cocoon.blockdeployer.repository.Locator; import org.apache.xerces.parsers.DOMParser; import org.exolab.castor.mapping.Mapping; @@ -49,8 +49,7 @@ * @return the RemoteBlock */ /* - * FIXME the factory should analyse the descriptor and decide based on the results which BlockDescriptor - * implementation is used + * FIXME the factory should analyse the doctype of the descriptor (not the namespace) * FIXME the descriptor should be analyzed whether it is correct - otherwise raise an exception */ public static RemoteBlock getRemoteBlock(InputStream descriptor, Locator locator) { @@ -81,9 +80,9 @@ } } - if(RealRemoteBlock.NAMESPACE.equals(namespace)) { - // it's a RealRemoteBlock ... - RealRemoteBlock realRemoteBlock = new RealRemoteBlock(); + if(Cob10.NAMESPACE.equals(namespace)) { + // it's a Cob10 ... + Cob10 realRemoteBlock = new Cob10(); realRemoteBlock.setBlockDescriptor(createCOB10Descriptor(descriptorDocument)); realRemoteBlock.setBlockId(realRemoteBlock.getBlockDescriptor().getBlockId()); if(locator == null) { @@ -96,18 +95,19 @@ return block; } - private static RealBlockDescriptor createCOB10Descriptor(Node descriptor) { - RealBlockDescriptor realBlockDescriptor = null; + private static Cob10Descriptor createCOB10Descriptor(Node descriptor) { + Cob10Descriptor realBlockDescriptor = null; try { Mapping mapping = new Mapping(); - mapping.loadMapping("mapping/block.xml-mapping.xml"); + mapping.loadMapping(Cob10Descriptor.class.getClassLoader(). + getResource("org/apache/cocoon/blockdeployer/block/Cob10-mapping.xml")); - Unmarshaller unmarshaller = new Unmarshaller(RealBlockDescriptor.class); + Unmarshaller unmarshaller = new Unmarshaller(Cob10Descriptor.class); unmarshaller.setMapping(mapping); unmarshaller.setIgnoreExtraAttributes(true); unmarshaller.setIgnoreExtraElements(true); // unmarshaller.setDebug(true); - realBlockDescriptor = (RealBlockDescriptor)unmarshaller.unmarshal(descriptor); + realBlockDescriptor = (Cob10Descriptor)unmarshaller.unmarshal(descriptor); } catch(Exception e) { throw new RuntimeException(e); } Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Descriptor.java (from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockDescriptor.java) URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Descriptor.java?view=diff&rev=157093&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockDescriptor.java&r1=126205&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Descriptor.java&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockDescriptor.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Descriptor.java Fri Mar 11 07:28:54 2005 @@ -29,7 +29,7 @@ /** * @since 0.1 */ -public class RealBlockDescriptor implements BlockDescriptor { +public class Cob10Descriptor implements BlockDescriptor { private String blockId; private String interfaceVersion; Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Property.java (from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockProperty.java) URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Property.java?view=diff&rev=157093&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockProperty.java&r1=126205&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Property.java&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockProperty.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Property.java Fri Mar 11 07:28:54 2005 @@ -20,7 +20,7 @@ /** * @since 0.1 */ -public class RealBlockProperty implements BlockProperty { +public class Cob10Property implements BlockProperty { protected String name; protected String description; Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Requirement.java (from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockRequirement.java) URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Requirement.java?view=diff&rev=157093&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockRequirement.java&r1=126205&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Requirement.java&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/RealBlockRequirement.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/block/descriptor/Cob10Requirement.java Fri Mar 11 07:28:54 2005 @@ -18,7 +18,7 @@ /** * @since 0.1 */ -public class RealBlockRequirement implements BlockRequirement { +public class Cob10Requirement implements BlockRequirement { private String name; private String blockId; Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO.java?view=auto&rev=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO.java (added) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO.java Fri Mar 11 07:28:54 2005 @@ -0,0 +1,33 @@ +/* + * Created on 26.02.2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.cocoon.blockdeployer.configuration; + + +public class BlockDTO { + String uri; + boolean autoResolve = true; + String path; + + public boolean isAutoResolve() { + return autoResolve; + } + public void setAutoResolve(boolean autoResolve) { + this.autoResolve = autoResolve; + } + public String getUri() { + return uri; + } + public void setUri(String uri) { + this.uri = uri; + } + public void setPath(String path) { + this.path = path; + } + public String getPath() { + return this.path; + } +} \ No newline at end of file Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO.java?view=auto&rev=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO.java (added) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO.java Fri Mar 11 07:28:54 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.cocoon.blockdeployer.configuration; + +import java.util.ArrayList; +import java.util.List; + +/** + * <p> + * This configuration contains all information that are collected by the client + * to deploy one ore more blocks, into one or more Cocoon servers by using + * one or more locators. + * </p> + * <p> + * It doesn't perform any validity checks on the data. This is done by the service this + * object is passed to. + * </p> + * @since 0.1 + */ +public class DeploymentConfigurationDTO { + + protected List servers = new ArrayList(); + protected List blocks = new ArrayList(); + protected List locators = new ArrayList(); + + public void addBlock(BlockDTO block) { + this.blocks.add(block); + } + + public void addServer(ServerDTO server) { + this.servers.add(server); + } + + public void addLocator(LocatorDTO locator) { + this.locators.add(locator); + } + + public List getLocators() { + return this.locators; + } + + public List getServers() { + return this.servers; + } + + public List getBlocks() { + return this.blocks; + } + +} Modified: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationException.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationException.java?view=diff&r1=157092&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationException.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationException.java Fri Mar 11 07:28:54 2005 @@ -16,7 +16,7 @@ package org.apache.cocoon.blockdeployer.configuration; /** - * A checked exception indicating that a [EMAIL PROTECTED] DeploymentConfiguration} is not valid. + * A checked exception indicating that a [EMAIL PROTECTED] DeploymentConfigurationDTO} is not valid. * * @since 0.1 */ Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO.java?view=auto&rev=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO.java (added) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO.java Fri Mar 11 07:28:54 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.cocoon.blockdeployer.configuration; + + +public class LocatorDTO { + private String uri; + private boolean addUnavailableBlocks = false; + + public void setUri(String uri) { + this.uri = uri; + } + + public String getUri() { + return this.uri; + } + + public void setAddUnistalledBlocks(boolean add) { + this.addUnavailableBlocks = add; + } + + public boolean isAddingUnavailableBlcoks() { + return this.addUnavailableBlocks; + } +} \ No newline at end of file Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO.java?view=auto&rev=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO.java (added) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO.java Fri Mar 11 07:28:54 2005 @@ -0,0 +1,18 @@ +/* + * Created on 26.02.2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.cocoon.blockdeployer.configuration; + + +public class ServerDTO { + String uri; + public void setUri(String uri) { + this.uri = uri; + } + public String getUri() { + return this.uri; + } +} \ No newline at end of file Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServer22Locator.java (from r126205, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java) URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServer22Locator.java?view=diff&rev=157093&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java&r1=126205&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServer22Locator.java&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServer22Locator.java Fri Mar 11 07:28:54 2005 @@ -42,12 +42,12 @@ import org.apache.commons.transaction.util.FileHelper; /** - * The <code>ApplicationServerLocator</code> points to a Cocoon server that + * The <code>ApplicationServer22Locator</code> points to a Cocoon server that * can manage <code>Block</code>s. * * @since 0.1 */ -public class ApplicationServerLocator implements Locator, Deployable, Lockable { +public class ApplicationServer22Locator implements Locator, Deployable, Lockable { private File basedir; private Wiring wiring; @@ -62,11 +62,11 @@ * @param wiring * is the [EMAIL PROTECTED] Wiring} (representing wiring.xml) of a Cocoon server */ - public ApplicationServerLocator(File basedir, Wiring wiring, LoggerFacade logger ) { + public ApplicationServer22Locator(File basedir, Wiring wiring, LoggerFacade logger ) { if(logger == null) { throw new NullPointerException("You have to set a logger!"); } - LocatorUtils.checkBasedir(basedir, logger, ApplicationServerLocator.class); + LocatorUtils.checkBasedir(basedir, logger, ApplicationServer22Locator.class); // FIXME shouldn't be the wiring encapsulated by this locator? currently its a mix ... :-/ if(wiring == null) { throw new NullPointerException("The wiring mustn't be null!"); Modified: cocoon/whiteboard/block-deployer/status.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/status.xml?view=diff&r1=157092&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/status.xml (original) +++ cocoon/whiteboard/block-deployer/status.xml Fri Mar 11 07:28:54 2005 @@ -30,14 +30,7 @@ </changes> <todo> - <actions priority="high"> - <action context="code" dev="RPO"> - Implement ApplicationServerLocator principally (the exact syntax of block.xml, - wiring.xml, ... are not so important ATM) - </action> - <action context="code" dev="RPO"> - Provide dynamic logger facade - every client can use the logger implementation it prefers - </action> + <actions priority="high"> <action context="code" dev="N.N."> Commandline deployer client </action> @@ -46,9 +39,6 @@ </action> </actions> <actions priority="low"> - <action context="code" dev="RPO"> - Refactoring: make it possible to use different Block implementations (via config files) - </action> <action context="code" dev="RPO"> Add support for different namespaces in block.xml files to add deployment adapters that can do additional (custom) stuff during deployment (e.g. database initialization) Modified: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/LogEnabledTestCase.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/LogEnabledTestCase.java?view=diff&r1=157092&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/LogEnabledTestCase.java (original) +++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/LogEnabledTestCase.java Fri Mar 11 07:28:54 2005 @@ -29,10 +29,16 @@ protected LoggerFacade logger; protected MockControl loggerControl; + public void setUp() { this.loggerControl = MockControl.createNiceControl(LoggerFacade.class); this.logger = (LoggerFacade) loggerControl.getMock(); this.logger = new ConsoleLogger(); + } + + public void testDummy() { + // Eclipse needs this, otherwise an JUnit error is thrown + } } Added: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationTestCase.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationTestCase.java?view=auto&rev=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationTestCase.java (added) +++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationTestCase.java Fri Mar 11 07:28:54 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.cocoon.blockdeployer.configuration; + +import java.io.File; +import java.io.FileInputStream; + +import org.exolab.castor.mapping.Mapping; +import org.exolab.castor.xml.Unmarshaller; +import org.xml.sax.InputSource; + +import junit.framework.TestCase; + +/** + * <p>Test Castor mapping file that is used to marshall and unmarshall + * DeploymentConfiguration objects. + * </p> + */ +public class DeploymentConfigurationTestCase extends TestCase { + + public void testObjectCreation() throws Exception { + Mapping mapping = new Mapping(); + mapping.loadMapping("mapping/deploy.xml-mapping.xml"); + + Unmarshaller unmarshaller = new Unmarshaller(); + unmarshaller.setMapping(mapping); + unmarshaller.setIgnoreExtraAttributes(true); + unmarshaller.setIgnoreExtraElements(true); + unmarshaller.setDebug(true); + FileInputStream fis = new FileInputStream(new File("mapping/sample-deploy.xml")); + DeploymentConfigurationDTO dc = (DeploymentConfigurationDTO)unmarshaller.unmarshal(new InputSource(fis)); + System.out.println("dc: " + dc.getLocators().size()); + + } + +} Copied: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServer22LocatorTest.java (from r126205, cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java) URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServer22LocatorTest.java?view=diff&rev=157093&p1=cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java&r1=126205&p2=cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServer22LocatorTest.java&r2=157093 ============================================================================== --- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java (original) +++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServer22LocatorTest.java Fri Mar 11 07:28:54 2005 @@ -30,7 +30,7 @@ /** * @since 0.1 */ -public class ApplicationServerLocatorTest extends LogEnabledTestCase { +public class ApplicationServer22LocatorTest extends LogEnabledTestCase { private void setupExamples() { FileUtil.mkdir(Constants.TMP_VALID_ASL_1); @@ -48,7 +48,7 @@ // copy examples into tmp location setupExamples(); // first hack to run the deploy method - ApplicationServerLocator asl = new ApplicationServerLocator(new File(Constants.TMP_VALID_ASL_1), wiring, this.logger); + ApplicationServer22Locator asl = new ApplicationServer22Locator(new File(Constants.TMP_VALID_ASL_1), wiring, this.logger); RemoteBlock b[] = new RemoteBlock[1]; b[0] = createBlockMock(null); asl.deploy(b);