You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2001/06/03 07:14:48 UTC
cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer DefaultTskDeployer.java
donaldp 01/06/02 22:14:48
Modified: proposal/myrmidon/src/java/org/apache/ant/modules/core
RegisterConverter.java
proposal/myrmidon/src/java/org/apache/myrmidon/components/converter
ConverterRegistry.java
DefaultConverterRegistry.java
DefaultMasterConverter.java
proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer
DefaultTskDeployer.java
Removed: proposal/myrmidon/src/java/org/apache/myrmidon/components/converter
ConverterInfo.java
Log:
Removed ConverterInfo and simplified ConverterRegistry
Revision Changes Path
1.12 +3 -6 jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterConverter.java
Index: RegisterConverter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterConverter.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- RegisterConverter.java 2001/06/03 05:03:14 1.11
+++ RegisterConverter.java 2001/06/03 05:14:47 1.12
@@ -15,7 +15,6 @@
import org.apache.avalon.framework.component.Composable;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.components.converter.ConverterInfo;
import org.apache.myrmidon.components.converter.ConverterRegistry;
import org.apache.myrmidon.components.deployer.DeploymentException;
import org.apache.myrmidon.components.deployer.TskDeployer;
@@ -110,13 +109,11 @@
}
else
{
- final ConverterInfo info = new ConverterInfo( m_sourceType, m_destinationType );
- m_converterRegistry.registerConverterInfo( m_classname, info );
+ m_converterRegistry.registerConverter( m_classname, m_sourceType, m_destinationType );
- final DefaultComponentFactory factory =
- new DefaultComponentFactory( new URL[] { url } );
-
+ final DefaultComponentFactory factory = new DefaultComponentFactory( new URL[] { url } );
factory.addNameClassMapping( m_classname, m_classname );
+
try { m_typeManager.registerType( Converter.ROLE, m_classname, factory ); }
catch( final Exception e )
{
1.2 +5 -4 jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/ConverterRegistry.java
Index: ConverterRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/ConverterRegistry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConverterRegistry.java 2001/06/02 14:28:42 1.1
+++ ConverterRegistry.java 2001/06/03 05:14:47 1.2
@@ -27,13 +27,14 @@
* @param destination the destination classname
* @return the className of converter or null if none available
*/
- String getConverterInfoName( String source, String destination );
+ String getConverterName( String source, String destination );
/**
- * Register a converter-info
+ * Register a converter
*
* @param className the className of converter
- * @param info the ConverterInfo
+ * @param source the source classname
+ * @param destination the destination classname
*/
- void registerConverterInfo( String className, ConverterInfo info );
+ void registerConverter( String className, String source, String destination );
}
1.2 +5 -6 jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultConverterRegistry.java
Index: DefaultConverterRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultConverterRegistry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultConverterRegistry.java 2001/06/02 14:28:42 1.1
+++ DefaultConverterRegistry.java 2001/06/03 05:14:47 1.2
@@ -10,7 +10,7 @@
import java.util.HashMap;
/**
- * Default implementation of ConverterInfo registry.
+ * Default implementation of Converter registry.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
@@ -19,18 +19,17 @@
{
private final HashMap m_mapping = new HashMap();
- public String getConverterInfoName( final String source, final String destination )
+ public String getConverterName( final String source, final String destination )
{
final HashMap map = (HashMap)m_mapping.get( source );
if( null == map ) return null;
return (String)map.get( destination );
}
- public void registerConverterInfo( final String className, final ConverterInfo info )
+ public void registerConverter( final String className,
+ final String source,
+ final String destination )
{
- final String source = info.getSource();
- final String destination = info.getDestination();
-
HashMap map = (HashMap)m_mapping.get( source );
if( null == map )
{
1.2 +4 -5 jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java
Index: DefaultMasterConverter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultMasterConverter.java 2001/06/02 14:28:42 1.1
+++ DefaultMasterConverter.java 2001/06/03 05:14:47 1.2
@@ -29,7 +29,7 @@
{
private final static boolean DEBUG = false;
- private ConverterRegistry m_infoRegistry;
+ private ConverterRegistry m_registry;
private ComponentSelector m_selector;
/**
@@ -41,7 +41,7 @@
public void compose( final ComponentManager componentManager )
throws ComponentException
{
- m_infoRegistry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE );
+ m_registry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE );
final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
m_selector = (ComponentSelector)typeManager.lookup( Converter.ROLE + "Selector" );
@@ -73,9 +73,8 @@
}
//TODO: Start searching inheritance hierarchy for converter
- final String name =
- m_infoRegistry.getConverterInfoName( originalClass.getName(),
- destination.getName() );
+ final String name = m_registry.getConverterName( originalClass.getName(),
+ destination.getName() );
if( null == name )
{
1.9 +5 -17 jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultTskDeployer.java
Index: DefaultTskDeployer.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultTskDeployer.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultTskDeployer.java 2001/06/03 05:03:15 1.8
+++ DefaultTskDeployer.java 2001/06/03 05:14:48 1.9
@@ -26,7 +26,6 @@
import org.apache.avalon.framework.logger.AbstractLoggable;
import org.apache.myrmidon.api.Task;
import org.apache.myrmidon.api.DataType;
-import org.apache.myrmidon.components.converter.ConverterInfo;
import org.apache.myrmidon.components.converter.ConverterRegistry;
import org.apache.myrmidon.components.executor.Executor;
import org.apache.myrmidon.components.type.ComponentFactory;
@@ -46,8 +45,8 @@
{
private final static String TSKDEF_FILE = "TASK-LIB/taskdefs.xml";
- private DefaultConfigurationBuilder m_configurationBuilder;
- private ConverterRegistry m_converterInfoRegistry;
+ private DefaultConfigurationBuilder m_configurationBuilder = new DefaultConfigurationBuilder();
+ private ConverterRegistry m_converterRegistry;
private TypeManager m_typeManager;
/**
@@ -68,7 +67,7 @@
public void compose( final ComponentManager componentManager )
throws ComponentException
{
- m_converterInfoRegistry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE );
+ m_converterRegistry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE );
m_typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
}
@@ -245,16 +244,6 @@
}
}
- private DefaultConfigurationBuilder getBuilder()
- {
- if( null == m_configurationBuilder )
- {
- m_configurationBuilder = new DefaultConfigurationBuilder();
- }
-
- return m_configurationBuilder;
- }
-
/**
* Retrieve zip file for file.
*
@@ -298,7 +287,7 @@
private Configuration buildConfiguration( final InputStream input )
throws DeploymentException
{
- try { return getBuilder().build( input ); }
+ try { return m_configurationBuilder.build( input ); }
catch( final SAXException se )
{
throw new DeploymentException( "Malformed configuration data", se );
@@ -354,8 +343,7 @@
final String source = converter.getAttribute( "source" );
final String destination = converter.getAttribute( "destination" );
- final ConverterInfo info = new ConverterInfo( source, destination );
- m_converterInfoRegistry.registerConverterInfo( name, info );
+ m_converterRegistry.registerConverter( name, source, destination );
factory.addNameClassMapping( name, name );
m_typeManager.registerType( Converter.ROLE, name, factory );