Author: reinhard Date: Fri Mar 11 08:24:07 2005 New Revision: 157101 URL: http://svn.apache.org/viewcvs?view=rev&rev=157101 Log: more consisten naming; moving mapping files into resources
Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO10.java - copied, changed from r157093, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10-mapping.xml cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10.java - copied, changed from r157093, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO10.java - copied, changed from r157093, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO10.java - copied, changed from r157093, cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/RealBlockWiring10-mapping.xml cocoon/whiteboard/block-deployer/test/mapping/ - copied from r157098, cocoon/whiteboard/block-deployer/mapping/ Removed: cocoon/whiteboard/block-deployer/mapping/ 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/test/mapping/deploy.xml-mapping.xml cocoon/whiteboard/block-deployer/test/mapping/sample-block.xml cocoon/whiteboard/block-deployer/test/mapping/sample-deploy.xml cocoon/whiteboard/block-deployer/test/mapping/sample-wiring.xml cocoon/whiteboard/block-deployer/test/mapping/wiring.xml-mapping.xml Modified: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/DeploymentService.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationException.java cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationTestCase.java 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=157100&r2=157101 ============================================================================== --- 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 08:24:07 2005 @@ -15,7 +15,7 @@ */ package org.apache.cocoon.blockdeployer; -import org.apache.cocoon.blockdeployer.configuration.DeploymentConfigurationDTO; +import org.apache.cocoon.blockdeployer.configuration.DeploymentConfigurationDTO10; 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] DeploymentConfigurationDTO}. + * Deploy blocks using the information in the [EMAIL PROTECTED] DeploymentConfigurationDTO10}. * @param conf * @param logger */ - public static void deploy(DeploymentConfigurationDTO conf, LoggerFacade logger) throws DeploymentConfigurationException { + public static void deploy(DeploymentConfigurationDTO10 conf, LoggerFacade logger) throws DeploymentConfigurationException { if(logger == null) { throw new NullPointerException("The logger mustn't be null."); } checkDeploymentConfiguration(conf, logger); } - protected static void checkDeploymentConfiguration(DeploymentConfigurationDTO conf, LoggerFacade logger) + protected static void checkDeploymentConfiguration(DeploymentConfigurationDTO10 conf, LoggerFacade logger) throws DeploymentConfigurationException { } Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO10.java (from r157093, 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/BlockDTO10.java?view=diff&rev=157101&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO.java&r1=157093&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO10.java&r2=157101 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/BlockDTO10.java Fri Mar 11 08:24:07 2005 @@ -1,13 +1,22 @@ /* - * Created on 26.02.2005 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates + * 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 BlockDTO { +public class BlockDTO10 { String uri; boolean autoResolve = true; String path; Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10-mapping.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10-mapping.xml?view=auto&rev=157101 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10-mapping.xml (added) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10-mapping.xml Fri Mar 11 08:24:07 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.DeploymentConfigurationDTO10"> + <map-to xml="deploy" ns-uri="http://cocoon.apache.org/cob-deployment/1.0"/> + <field name="locators" type="org.apache.cocoon.blockdeployer.configuration.LocatorDTO10" collection="collection" > + <bind-xml name="locator" node="element" location="locators"/> + </field> + <field name="servers" type="org.apache.cocoon.blockdeployer.configuration.ServerDTO10" collection="collection" > + <bind-xml name="server" node="element" location="servers"/> + </field> + </class> + <class name="org.apache.cocoon.blockdeployer.configuration.LocatorDTO10"> + <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.ServerDTO10"> + <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 Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10.java (from r157093, 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/DeploymentConfigurationDTO10.java?view=diff&rev=157101&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO.java&r1=157093&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10.java&r2=157101 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10.java Fri Mar 11 08:24:07 2005 @@ -30,21 +30,21 @@ * </p> * @since 0.1 */ -public class DeploymentConfigurationDTO { +public class DeploymentConfigurationDTO10 { protected List servers = new ArrayList(); protected List blocks = new ArrayList(); protected List locators = new ArrayList(); - public void addBlock(BlockDTO block) { + public void addBlock(BlockDTO10 block) { this.blocks.add(block); } - public void addServer(ServerDTO server) { + public void addServer(ServerDTO10 server) { this.servers.add(server); } - public void addLocator(LocatorDTO locator) { + public void addLocator(LocatorDTO10 locator) { this.locators.add(locator); } 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=157100&r2=157101 ============================================================================== --- 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 08:24:07 2005 @@ -16,7 +16,7 @@ package org.apache.cocoon.blockdeployer.configuration; /** - * A checked exception indicating that a [EMAIL PROTECTED] DeploymentConfigurationDTO} is not valid. + * A checked exception indicating that a [EMAIL PROTECTED] DeploymentConfigurationDTO10} is not valid. * * @since 0.1 */ Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO10.java (from r157093, 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/LocatorDTO10.java?view=diff&rev=157101&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO.java&r1=157093&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO10.java&r2=157101 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/LocatorDTO10.java Fri Mar 11 08:24:07 2005 @@ -16,7 +16,7 @@ package org.apache.cocoon.blockdeployer.configuration; -public class LocatorDTO { +public class LocatorDTO10 { private String uri; private boolean addUnavailableBlocks = false; Copied: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO10.java (from r157093, 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/ServerDTO10.java?view=diff&rev=157101&p1=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO.java&r1=157093&p2=cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO10.java&r2=157101 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/configuration/ServerDTO10.java Fri Mar 11 08:24:07 2005 @@ -1,13 +1,21 @@ /* - * Created on 26.02.2005 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates + * 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 ServerDTO { +public class ServerDTO10 { String uri; public void setUri(String uri) { this.uri = uri; Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/RealBlockWiring10-mapping.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/RealBlockWiring10-mapping.xml?view=auto&rev=157101 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/RealBlockWiring10-mapping.xml (added) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/RealBlockWiring10-mapping.xml Fri Mar 11 08:24:07 2005 @@ -0,0 +1,65 @@ +<?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.wiring.RealBlockWiring"> + <map-to xml="wiring" ns-uri="http://apache.org/cocoon/blocks/wiring/1.0"/> + <field name="blockDescriptors" + type="org.apache.cocoon.blockdeployer.wiring.WiredRealBlockDescriptor" collection="collection"> + <bind-xml name="block" node="element"/> + </field> + </class> + <class name="org.apache.cocoon.blockdeployer.wiring.WiredRealBlockDescriptor"> + <map-to ns-uri="http://apache.org/cocoon/blocks/wiring/1.0"/> + <field name="id" type="string"> + <bind-xml name="id" node="attribute"/> + </field> + <field name="location" type="string"> + <bind-xml name="location" node="attribute"/> + </field> + <field name="mountPath" type="string"> + <bind-xml name="mount" node="element"/> + </field> + <field name="properties" + type="org.apache.cocoon.blockdeployer.wiring.WiredRealBlockProperty" collection="collection"> + <bind-xml name="property" node="element" location="properties" /> + </field> + <field name="connections" + type="org.apache.cocoon.blockdeployer.wiring.WiredRealBlockConnection" collection="collection"> + <bind-xml name="connection" node="element" location="connections"/> + </field> + </class> + <class name="org.apache.cocoon.blockdeployer.wiring.WiredRealBlockProperty"> + <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="value" type="string"> + <bind-xml node="text"/> + </field> + </class> + <class name="org.apache.cocoon.blockdeployer.wiring.WiredRealBlockConnection"> + <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="connectedBlockId" type="string"> + <bind-xml node="text"/> + </field> + </class> +</mapping> Modified: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java?view=diff&r1=157100&r2=157101 ============================================================================== --- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java (original) +++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java Fri Mar 11 08:24:07 2005 @@ -20,6 +20,7 @@ import java.io.InputStream; import java.io.InputStreamReader; +import org.apache.cocoon.blockdeployer.block.descriptor.Cob10Descriptor; import org.exolab.castor.mapping.Mapping; import org.exolab.castor.xml.Unmarshaller; @@ -31,8 +32,9 @@ public static Wiring build(File descriptorFile) throws Exception { // create an object out of the descriptor file Mapping mapping = new Mapping(); - // FIXME read the mapping by using the classloader - mapping.loadMapping("mapping/wiring.xml-mapping.xml"); + mapping.loadMapping(Cob10Descriptor.class.getClassLoader(). + getResource("org/apache/cocoon/blockdeployer/wiring/RealBlockWiring10-mapping.xml")); + Unmarshaller unmarshaller = new Unmarshaller(RealBlockWiring.class); unmarshaller.setMapping(mapping); Modified: 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=diff&r1=157100&r2=157101 ============================================================================== --- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationTestCase.java (original) +++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationTestCase.java Fri Mar 11 08:24:07 2005 @@ -18,6 +18,7 @@ import java.io.File; import java.io.FileInputStream; +import org.apache.cocoon.blockdeployer.block.descriptor.Cob10Descriptor; import org.exolab.castor.mapping.Mapping; import org.exolab.castor.xml.Unmarshaller; import org.xml.sax.InputSource; @@ -33,15 +34,16 @@ public void testObjectCreation() throws Exception { Mapping mapping = new Mapping(); - mapping.loadMapping("mapping/deploy.xml-mapping.xml"); + mapping.loadMapping(Cob10Descriptor.class.getClassLoader(). + getResource("org/apache/cocoon/blockdeployer/configuration/DeploymentConfigurationDTO10-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)); + FileInputStream fis = new FileInputStream(new File("mapping/sample-deploy.xml")); + DeploymentConfigurationDTO10 dc = (DeploymentConfigurationDTO10)unmarshaller.unmarshal(new InputSource(fis)); System.out.println("dc: " + dc.getLocators().size()); }