Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2048 - in development/laboratory/plus: api/builder/src/main/net/dpml/metro/builder api/meta/src/main/net/dpml/metro/meta api/part/src/main/net/dpml/metro/part standard/meta/src/main/net/dpml/metro/meta/impl

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2048 - in development/laboratory/plus: api/builder/src/main/net/dpml/metro/builder api/meta/src/main/net/dpml/metro/meta api/part/src/main/net/dpml/metro/part standard/meta/src/main/net/dpml/metro/meta/impl
  • Date: Sat, 12 Mar 2005 16:54:36 -0500

Author: mcconnell AT dpml.net
Date: Sat Mar 12 16:54:36 2005
New Revision: 2048

Added:

development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/IntrospectionException.java

development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/TypeBuilder.java

development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Catalog.java

development/laboratory/plus/api/part/src/main/net/dpml/metro/part/CatalogEntry.java

development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Descriptor.java
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Type.java
Removed:

development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/Catalog.java

development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/CatalogEntry.java

development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/Descriptor.java

development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/IntrospectionException.java
Modified:

development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ComponentDescriptor.java

development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/DependencyDescriptor.java

development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/InfoDescriptor.java

development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/PartDescriptor.java

development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ServiceDescriptor.java

development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/CatalogTask.java

development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/ComponentDescriptorDataType.java

development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/DescriptorDataType.java
Log:
Define a type builder and enable dynamic plugin of component type builders to
the build process.

Added:
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/IntrospectionException.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/IntrospectionException.java
Sat Mar 12 16:54:36 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.metro.builder;
+
+/**
+ * An exception throws if an error occurs while introspecting a method.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class IntrospectionException extends Exception
+{
+ public IntrospectionException( String message )
+ {
+ super( message );
+ }
+}

Added:
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/TypeBuilder.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/TypeBuilder.java
Sat Mar 12 16:54:36 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.metro.builder;
+
+import java.net.URI;
+
+import net.dpml.metro.part.Type;
+
+/**
+ * The contract for builders that create component part.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public interface TypeBuilder
+{
+ /**
+ * Build a part type.
+ * @return the serializable part type.
+ * @exception IntrospectionException if a introspection occurs during
type construction
+ */
+ Type buildType( ClassLoader classloader ) throws IntrospectionException;
+
+}

Modified:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ComponentDescriptor.java
==============================================================================
---
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ComponentDescriptor.java
(original)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ComponentDescriptor.java
Sat Mar 12 16:54:36 2005
@@ -21,13 +21,16 @@
import java.io.Serializable;
import java.util.Properties;

+import net.dpml.metro.part.Type;
+import net.dpml.metro.part.Descriptor;
+
/**
* Base class for all descriptors.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class ComponentDescriptor extends Descriptor
+public class ComponentDescriptor extends Descriptor implements Type
{
private final InfoDescriptor m_info;
private final DependencyDescriptor[] m_dependencies;

Modified:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/DependencyDescriptor.java
==============================================================================
---
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/DependencyDescriptor.java
(original)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/DependencyDescriptor.java
Sat Mar 12 16:54:36 2005
@@ -20,6 +20,8 @@

import java.util.Properties;

+import net.dpml.metro.part.Descriptor;
+
/**
* Description of a dependency.
*

Modified:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/InfoDescriptor.java
==============================================================================
---
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/InfoDescriptor.java
(original)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/InfoDescriptor.java
Sat Mar 12 16:54:36 2005
@@ -20,6 +20,8 @@

import java.util.Properties;

+import net.dpml.metro.part.Descriptor;
+
/**
* Base class for all descriptors.
*

Modified:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/PartDescriptor.java
==============================================================================
---
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/PartDescriptor.java
(original)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/PartDescriptor.java
Sat Mar 12 16:54:36 2005
@@ -20,6 +20,8 @@

import java.util.Properties;

+import net.dpml.metro.part.Descriptor;
+
/**
* Description of a internal part dependency.
*

Modified:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ServiceDescriptor.java
==============================================================================
---
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ServiceDescriptor.java
(original)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ServiceDescriptor.java
Sat Mar 12 16:54:36 2005
@@ -20,6 +20,8 @@

import java.util.Properties;

+import net.dpml.metro.part.Descriptor;
+
/**
* Base class for all descriptors.
*

Added:
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Catalog.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Catalog.java
Sat Mar 12 16:54:36 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.metro.part;
+
+import java.util.Properties;
+
+/**
+ * A catalog is an index of component descriptors packaged within a jar file.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class Catalog extends Descriptor
+{
+ private final CatalogEntry[] m_entries;
+
+ public Catalog( CatalogEntry[] entries )
+ {
+ this( entries, null );
+ }
+
+ public Catalog( CatalogEntry[] entries, Properties properties )
+ {
+ super( properties );
+ if( null == entries )
+ {
+ throw new NullPointerException( "entries" );
+ }
+ m_entries = entries;
+ }
+
+ public CatalogEntry[] getEntries()
+ {
+ return m_entries;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ for( int i=0; i<m_entries.length; i++ )
+ {
+ hash ^= m_entries[i].hashCode();
+ }
+ return hash;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( super.equals( other ) == false )
+ {
+ return false;
+ }
+ else if( other instanceof Catalog )
+ {
+ Catalog catalog = (Catalog) other;
+ if( false == equals( getEntries(), catalog.getEntries() ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}
+

Added:
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/CatalogEntry.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/CatalogEntry.java
Sat Mar 12 16:54:36 2005
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.metro.part;
+
+import java.util.Properties;
+
+/**
+ * A catalog entry is an immutable datatype describing an entry within a
catalog. Each
+ * entry references a path to a descriptor and the associated descriptor
type. The
+ * path corresponds to the package path and classname (e.g.
acme.wiget.StandardWidget).
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class CatalogEntry extends Descriptor
+{
+ private final String m_path;
+ private final String m_type;
+
+ public CatalogEntry( String path, String type )
+ {
+ this( path, type, null );
+ }
+
+ public CatalogEntry( String path, String type, Properties properties )
+ {
+ super( properties );
+ m_path = path;
+ m_type = type;
+ }
+
+ public String getPath()
+ {
+ return m_path;
+ }
+
+ public String getType()
+ {
+ return m_type;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_path.hashCode();
+ hash ^= m_type.hashCode();
+ return hash;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( super.equals( other ) == false )
+ {
+ return false;
+ }
+ else if( other instanceof CatalogEntry )
+ {
+ CatalogEntry entry = (CatalogEntry) other;
+ if( getPath().equals( entry.getPath() ) == false )
+ {
+ return false;
+ }
+ else if( getType().equals( entry.getType() ) == false )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}
+

Added:
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Descriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Descriptor.java
Sat Mar 12 16:54:36 2005
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.metro.part;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+/**
+ * Base class for all descriptors.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class Descriptor implements Serializable
+{
+ private static final String[] EMPTY_PROPERTY_NAMES = new String[0];
+
+ /**
+ * Descriptor properties.
+ */
+ private final Properties m_properties;
+
+ /**
+ * Creation of a new descriptor.
+ * @param properties a set of properties to be associated with the
descriptor
+ */
+ protected Descriptor( final Properties properties )
+ {
+ m_properties = properties;
+ }
+
+ /**
+ * Return the property value using a supplied key.
+ *
+ * @param key the property key
+ * @return the property value relative to the supplied key
+ */
+ public String getProperty( final String key )
+ {
+ if ( null == m_properties )
+ {
+ return null;
+ }
+ else
+ {
+ return m_properties.getProperty( key );
+ }
+ }
+
+ /**
+ * Return the property value using a supplied key and default.
+ * If the property value associated with the key is null then
+ * return the default value.
+ *
+ * @param key the property key
+ * @param def the default value
+ * @return the resolved value
+ */
+ public String getProperty( final String key, final String def )
+ {
+ if ( null == m_properties )
+ {
+ return def;
+ }
+ else
+ {
+ return m_properties.getProperty( key, def );
+ }
+ }
+
+ /**
+ * Returns the set of property names available under this descriptor.
+ *
+ * @return an array of property names
+ */
+ public String[] getPropertyNames()
+ {
+ if ( null == m_properties )
+ {
+ return EMPTY_PROPERTY_NAMES;
+ }
+ else
+ {
+ return (String[]) m_properties.keySet().toArray(
EMPTY_PROPERTY_NAMES );
+ }
+ }
+
+ /**
+ * Compare this object with another for equality.
+ * @param other the object to compare this object with
+ * @return TRUE if the supplied object is equivalent
+ */
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ if( other instanceof Descriptor )
+ {
+ Descriptor descriptor = (Descriptor) other;
+ if( null == m_properties )
+ {
+ return null == descriptor.m_properties;
+ }
+ else
+ {
+ return m_properties.equals( descriptor.m_properties );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public boolean equals( Object[] primary, Object[] secondary )
+ {
+ if( primary.length != secondary.length )
+ {
+ return false;
+ }
+ for( int i=0; i<primary.length; i++ )
+ {
+ Object prime = primary[i];
+ Object second = secondary[i];
+ if( prime.equals( second ) == false )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Return the hashcode for the object.
+ * @return the hashcode value
+ */
+ public int hashCode()
+ {
+ if( null == m_properties )
+ {
+ return 42;
+ }
+ else
+ {
+ return m_properties.hashCode();
+ }
+ }
+}

Added:
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Type.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/Type.java
Sat Mar 12 16:54:36 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.metro.part;
+
+import java.io.Serializable;
+import java.net.URI;
+
+/**
+ * The common interface implemented by all component parts.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public interface Type extends Serializable
+{
+}

Modified:
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/CatalogTask.java
==============================================================================
---
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/CatalogTask.java
(original)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/CatalogTask.java
Sat Mar 12 16:54:36 2005
@@ -24,7 +24,10 @@
import java.util.List;
import java.util.LinkedList;

-import net.dpml.metro.meta.Descriptor;
+import net.dpml.metro.part.Type;
+import net.dpml.metro.builder.IntrospectionException;
+import net.dpml.metro.builder.TypeBuilder;
+
import net.dpml.magic.tasks.ProjectTask;
import net.dpml.magic.model.Policy;

@@ -33,25 +36,101 @@
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DynamicElementNS;

/**
- * Task that handles the construction of a catalog of parts.
+ * Task that handles the construction of a catalog entries.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class CatalogTask extends ProjectTask
+public class CatalogTask extends ProjectTask implements DynamicElementNS
{
- private List m_types = new LinkedList();
+ private List m_builders = new LinkedList();

public ComponentDescriptorDataType createEntry()
{
System.out.println( "# new catalog entry" );
ComponentDescriptorDataType data = new ComponentDescriptorDataType(
this );
- m_types.add( data );
+ m_builders.add( data );
return data;
}

+ /**
+ * Operation used to construct a custom part type directive.
+ * @param uri the part handler uri
+ * @param name the element name
+ * @param qualified the qualified name
+ */
+ public Object createDynamicElement( String uri, String name, String
qualified )
+ {
+ String path = getProject().replaceProperties( uri );
+ System.out.println( "## creating type builder: " + path );
+ TypeBuilder builder = loadTypeHandler( path, name );
+ if( null == builder )
+ {
+ System.out.println( "## null builder" );
+ }
+ else
+ {
+ System.out.println( "## adding type builder: " + builder );
+ m_builders.add( builder );
+ }
+ return builder;
+ }
+
+ private TypeBuilder loadTypeHandler( String uri, String name ) throws
BuildException
+ {
+ String urn = uri + ":" + name;
+ Object builder = null;
+ TypeBuilder typeBuilder = null;
+ ClassLoader context = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(
getClass().getClassLoader() );
+ Project project = getProject();
+ builder = project.createDataType( urn );
+ typeBuilder = (TypeBuilder) builder;
+ return typeBuilder ;
+ }
+ catch( ClassCastException e )
+ {
+ final String error =
+ "The custom type builder ["
+ + builder.getClass().getName()
+ + "] established by the uri ["
+ + urn
+ + "] declared by the element <"
+ + name
+ + "' does not implement the net.dpml.metro.builder.TypeBuilder
interface.";
+ throw new BuildException( error, e, getLocation() );
+ }
+ catch( BuildException e )
+ {
+ final String error =
+ "Unable to load the plugin from the uri ["
+ + urn
+ + "] to handle the custom type declared by the element <"
+ + name
+ + ">.";
+ throw new BuildException( error, e, getLocation() );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected exception while attempting to load the custom type
handler with the uri ["
+ + urn
+ + "] declared by the element <"
+ + name
+ + ">.";
+ throw new BuildException( error, e, getLocation() );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( context );
+ }
+ }
+
public void execute()
{
System.out.println( "# execution" );
@@ -61,25 +140,25 @@
path.createPathElement().setLocation( classes );
ClassLoader classloader = new AntClassLoader( project, path );

- Descriptor[] descriptors = getDescriptors( classloader );
- for( int i=0; i<descriptors.length; i++ )
+ Type[] types = getTypes( classloader );
+ for( int i=0; i<types.length; i++ )
{
- Descriptor descriptor = descriptors[i];
- System.out.println( "# descriptor: " + descriptor.toString() );
+ Type type = types[i];
+ System.out.println( "# type: " + type.toString() );
}
}

- private Descriptor[] getDescriptors( ClassLoader classloader )
+ private Type[] getTypes( ClassLoader classloader )
{
- Descriptor[] descriptors = new Descriptor[ m_types.size() ];
- DescriptorDataType[] types =
- (DescriptorDataType[]) m_types.toArray( new DescriptorDataType[0]
);
- for( int i=0; i<types.length; i++ )
+ TypeBuilder[] builders = (TypeBuilder[]) m_builders.toArray( new
TypeBuilder[0] );
+ Type[] types = new Type[ builders.length ];
+ for( int i=0; i<builders.length; i++ )
{
- DescriptorDataType type = types[i];
+ TypeBuilder builder = builders[i];
try
{
- descriptors[i] = type.getDescriptor( classloader );
+ Type type = builder.buildType( classloader );
+ types[i] = type;
}
catch( IntrospectionException e )
{
@@ -92,6 +171,6 @@
throw e;
}
}
- return descriptors;
+ return types;
}
}

Modified:
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/ComponentDescriptorDataType.java
==============================================================================
---
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/ComponentDescriptorDataType.java
(original)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/ComponentDescriptorDataType.java
Sat Mar 12 16:54:36 2005
@@ -31,9 +31,11 @@
import net.dpml.metro.meta.DependencyDescriptor;
import net.dpml.metro.meta.PartDescriptor;
import net.dpml.metro.meta.InfoDescriptor;
-import net.dpml.metro.meta.Descriptor;
import net.dpml.metro.part.Part;
+import net.dpml.metro.part.Type;
+import net.dpml.metro.part.Descriptor;
import net.dpml.metro.builder.PartBuilder;
+import net.dpml.metro.builder.IntrospectionException;

import org.apache.tools.ant.ProjectComponent;
import org.apache.tools.ant.BuildException;
@@ -72,12 +74,12 @@
return m_parts;
}

- public Descriptor getDescriptor( ClassLoader classloader ) throws
IntrospectionException
+ public Type buildType( ClassLoader classloader ) throws
IntrospectionException
{
- return getComponentDescriptor( classloader );
+ return buildComponentDescriptor( classloader );
}

- public ComponentDescriptor getComponentDescriptor( ClassLoader
classloader ) throws IntrospectionException
+ public ComponentDescriptor buildComponentDescriptor( ClassLoader
classloader ) throws IntrospectionException
{
Class subject = loadSubjectClass( classloader );
System.out.println( "## component: " + subject.getName() );

Modified:
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/DescriptorDataType.java
==============================================================================
---
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/DescriptorDataType.java
(original)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/DescriptorDataType.java
Sat Mar 12 16:54:36 2005
@@ -24,7 +24,9 @@
import java.util.List;
import java.util.LinkedList;

-import net.dpml.metro.meta.Descriptor;
+import net.dpml.metro.builder.TypeBuilder;
+import net.dpml.metro.builder.IntrospectionException;
+import net.dpml.metro.part.Type;

import org.apache.tools.ant.ProjectComponent;

@@ -34,7 +36,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public abstract class DescriptorDataType extends ProjectComponent
+public abstract class DescriptorDataType extends ProjectComponent implements
TypeBuilder
{
- public abstract Descriptor getDescriptor( ClassLoader classloader )
throws IntrospectionException;
+ public abstract Type buildType( ClassLoader classloader ) throws
IntrospectionException;
}



  • svn commit: r2048 - in development/laboratory/plus: api/builder/src/main/net/dpml/metro/builder api/meta/src/main/net/dpml/metro/meta api/part/src/main/net/dpml/metro/part standard/meta/src/main/net/dpml/metro/meta/impl, mcconnell, 03/12/2005

Archive powered by MHonArc 2.6.24.

Top of Page