Moved Pattern to modules hierarchy while others moved to tasklet hierarchy git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268598 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,22 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.ant.datatypes; | |||
| import org.apache.avalon.Component; | |||
| /** | |||
| * Base class for those classes that can appear inside the build file | |||
| * as stand alone data types. | |||
| * | |||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public interface DataType | |||
| extends Component | |||
| { | |||
| } | |||
| @@ -1,43 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.ant.datatypes; | |||
| import org.apache.avalon.Component; | |||
| import org.apache.avalon.Loggable; | |||
| import org.apache.avalon.camelot.FactoryException; | |||
| import org.apache.avalon.camelot.LocatorRegistry; | |||
| import org.apache.avalon.camelot.RegistryException; | |||
| /** | |||
| * This is basically a engine that can be used to access data-types. | |||
| * The engine acts as a repository and factory for these types. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public interface DataTypeEngine | |||
| extends Component | |||
| { | |||
| /** | |||
| * Retrieve registry of data-types. | |||
| * This is used by deployer to add types into engine. | |||
| * | |||
| * @return the registry | |||
| */ | |||
| LocatorRegistry getRegistry(); | |||
| /** | |||
| * Create a data-type of type registered under name. | |||
| * | |||
| * @param name the name of data type | |||
| * @return the DataType | |||
| * @exception RegistryException if an error occurs | |||
| * @exception FactoryException if an error occurs | |||
| */ | |||
| DataType createDataType( String name ) | |||
| throws RegistryException, FactoryException; | |||
| } | |||
| @@ -1,70 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.ant.datatypes; | |||
| import org.apache.avalon.Composer; | |||
| import org.apache.avalon.ComponentManager; | |||
| import org.apache.avalon.ComponentManagerException; | |||
| import org.apache.avalon.Composer; | |||
| import org.apache.avalon.camelot.DefaultLocatorRegistry; | |||
| import org.apache.avalon.camelot.Factory; | |||
| import org.apache.avalon.camelot.FactoryException; | |||
| import org.apache.avalon.camelot.Locator; | |||
| import org.apache.avalon.camelot.LocatorRegistry; | |||
| import org.apache.avalon.camelot.RegistryException; | |||
| /** | |||
| * This is basically a engine that can be used to access data-types. | |||
| * The engine acts as a repository and factory for these types. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class DefaultDataTypeEngine | |||
| implements DataTypeEngine, Composer | |||
| { | |||
| protected Factory m_factory; | |||
| protected LocatorRegistry m_registry = new DefaultLocatorRegistry(); | |||
| /** | |||
| * Retrieve registry of data-types. | |||
| * This is used by deployer to add types into engine. | |||
| * | |||
| * @return the registry | |||
| */ | |||
| public LocatorRegistry getRegistry() | |||
| { | |||
| return m_registry; | |||
| } | |||
| /** | |||
| * Retrieve relevent services needed to deploy. | |||
| * | |||
| * @param componentManager the ComponentManager | |||
| * @exception ComponentManagerException if an error occurs | |||
| */ | |||
| public void compose( final ComponentManager componentManager ) | |||
| throws ComponentManagerException | |||
| { | |||
| m_factory = (Factory)componentManager.lookup( "org.apache.avalon.camelot.Factory" ); | |||
| } | |||
| /** | |||
| * Create a data-type of type registered under name. | |||
| * | |||
| * @param name the name of data type | |||
| * @return the DataType | |||
| * @exception RegistryException if an error occurs | |||
| * @exception FactoryException if an error occurs | |||
| */ | |||
| public DataType createDataType( final String name ) | |||
| throws RegistryException, FactoryException | |||
| { | |||
| final Locator locator = m_registry.getLocator( name ); | |||
| return (DataType)m_factory.create( locator, DataType.class ); | |||
| } | |||
| } | |||
| @@ -1,95 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.ant.datatypes; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.ant.util.Condition; | |||
| /** | |||
| * Basic data type for holding patterns. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class Pattern | |||
| implements DataType | |||
| { | |||
| protected String m_name; | |||
| protected Condition m_condition; | |||
| /** | |||
| * Retrieve name (aka value) of pattern. | |||
| * | |||
| * @return the name/value of pattern | |||
| */ | |||
| public String getName() | |||
| { | |||
| return m_name; | |||
| } | |||
| /** | |||
| * Get condition associated with pattern if any. | |||
| * | |||
| * @return the Condition | |||
| */ | |||
| public Condition getCondition() | |||
| { | |||
| return m_condition; | |||
| } | |||
| /** | |||
| * Setter method for name/value of pattern. | |||
| * Conforms to ant setter patterns | |||
| * | |||
| * @param name the value | |||
| */ | |||
| public void setName( final String name ) | |||
| { | |||
| m_name = name; | |||
| } | |||
| /** | |||
| * Set if clause on pattern. | |||
| * | |||
| * @param condition the condition | |||
| * @exception AntException if an error occurs | |||
| */ | |||
| public void setIf( final String condition ) | |||
| throws AntException | |||
| { | |||
| verifyConditionNull(); | |||
| m_condition = new Condition( true, condition ); | |||
| } | |||
| /** | |||
| * Set unless clause of pattern. | |||
| * | |||
| * @param condition the unless clause | |||
| * @exception AntException if an error occurs | |||
| */ | |||
| public void setUnless( final String condition ) | |||
| throws AntException | |||
| { | |||
| verifyConditionNull(); | |||
| m_condition = new Condition( false, condition ); | |||
| } | |||
| /** | |||
| * Utility method to make sure condition unset. | |||
| * Made so that it is not possible for both if and unless to be set. | |||
| * | |||
| * @exception AntException if an error occurs | |||
| */ | |||
| protected void verifyConditionNull() | |||
| throws AntException | |||
| { | |||
| if( null != m_condition ) | |||
| { | |||
| throw new AntException( "Can only set one of if/else for pattern data type" ); | |||
| } | |||
| } | |||
| } | |||