Browse Source

Moved DataType engine components to tasklet hierarchy as it can not exist independenct of tasklets.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268603 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
2ca4d55559
2 changed files with 114 additions and 0 deletions
  1. +43
    -0
      proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DataTypeEngine.java
  2. +71
    -0
      proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultDataTypeEngine.java

+ 43
- 0
proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DataTypeEngine.java View File

@@ -0,0 +1,43 @@
/*
* 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.tasklet.engine;

import org.apache.ant.tasklet.DataType;
import org.apache.avalon.Component;
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;
}

+ 71
- 0
proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultDataTypeEngine.java View File

@@ -0,0 +1,71 @@
/*
* 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.tasklet.engine;

import org.apache.ant.tasklet.DataType;
import org.apache.avalon.ComponentManager;
import org.apache.avalon.ComponentManagerException;
import org.apache.avalon.Composer;
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 );
}
}

Loading…
Cancel
Save