Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2045 - in development/laboratory/plus: . api/meta api/meta/src api/meta/src/main api/meta/src/main/net api/meta/src/main/net/dpml api/meta/src/main/net/dpml/metro api/meta/src/main/net/dpml/metro/meta standard/meta standard/meta/src standard/meta/src/main standard/meta/src/main/net standard/meta/src/main/net/dpml standard/meta/src/main/net/dpml/metro standard/meta/src/main/net/dpml/metro/meta standard/meta/src/main/net/dpml/metro/meta/impl test/example/impl test/example/impl/src/main/net/dpml/test/hello/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: r2045 - in development/laboratory/plus: . api/meta api/meta/src api/meta/src/main api/meta/src/main/net api/meta/src/main/net/dpml api/meta/src/main/net/dpml/metro api/meta/src/main/net/dpml/metro/meta standard/meta standard/meta/src standard/meta/src/main standard/meta/src/main/net standard/meta/src/main/net/dpml standard/meta/src/main/net/dpml/metro standard/meta/src/main/net/dpml/metro/meta standard/meta/src/main/net/dpml/metro/meta/impl test/example/impl test/example/impl/src/main/net/dpml/test/hello/impl
  • Date: Fri, 11 Mar 2005 22:45:09 -0500

Author: mcconnell AT dpml.net
Date: Fri Mar 11 22:45:08 2005
New Revision: 2045

Added:
development/laboratory/plus/api/meta/
development/laboratory/plus/api/meta/build.xml
development/laboratory/plus/api/meta/src/
development/laboratory/plus/api/meta/src/main/
development/laboratory/plus/api/meta/src/main/net/
development/laboratory/plus/api/meta/src/main/net/dpml/
development/laboratory/plus/api/meta/src/main/net/dpml/metro/
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/

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/Descriptor.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/
development/laboratory/plus/standard/meta/build.xml
development/laboratory/plus/standard/meta/src/
development/laboratory/plus/standard/meta/src/main/
development/laboratory/plus/standard/meta/src/main/net/
development/laboratory/plus/standard/meta/src/main/net/dpml/
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/

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

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

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

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

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

development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/antlib.xml
Modified:
development/laboratory/plus/index.xml
development/laboratory/plus/test/example/impl/build.xml

development/laboratory/plus/test/example/impl/src/main/net/dpml/test/hello/impl/DefaultOutputHandler.java

development/laboratory/plus/test/example/impl/src/main/net/dpml/test/hello/impl/HelloComponent.java
Log:
Add the descriptors and initial integration of nested parts.

Added: development/laboratory/plus/api/meta/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/plus/api/meta/build.xml Fri Mar 11 22:45:08
2005
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="dpml-metro-meta-api" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="plugin:dpml/magic/dpml-magic-core">
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+
+</project>
+

Added:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ComponentDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ComponentDescriptor.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,170 @@
+/*
+ * 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.meta;
+
+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 ComponentDescriptor extends Descriptor
+{
+ private final InfoDescriptor m_info;
+ private final DependencyDescriptor[] m_dependencies;
+ private final ServiceDescriptor[] m_services;
+ private final PartDescriptor[] m_parts;
+
+ public ComponentDescriptor( final InfoDescriptor info,
ServiceDescriptor[] services,
+ DependencyDescriptor[] dependencies, PartDescriptor[] parts )
+ {
+ this( info, services, dependencies, parts, null );
+ }
+
+ public ComponentDescriptor( final InfoDescriptor info,
ServiceDescriptor[] services,
+ DependencyDescriptor[] dependencies, PartDescriptor[] parts,
Properties properties )
+ {
+ super( properties );
+ if( null == info )
+ {
+ throw new NullPointerException( "info" );
+ }
+ if( null == dependencies )
+ {
+ throw new NullPointerException( "dependencies" );
+ }
+ if( null == services )
+ {
+ throw new NullPointerException( "services" );
+ }
+ if( null == parts )
+ {
+ throw new NullPointerException( "parts" );
+ }
+ m_info = info;
+ m_services = services;
+ m_dependencies = dependencies;
+ m_parts = parts;
+ }
+
+ public InfoDescriptor getInfoDescriptor()
+ {
+ return m_info;
+ }
+
+ public DependencyDescriptor[] getDependencyDescriptors()
+ {
+ return m_dependencies;
+ }
+
+ public ServiceDescriptor[] getServiceDescriptors()
+ {
+ return m_services;
+ }
+
+ public PartDescriptor[] getPartDescriptors()
+ {
+ return m_parts;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_info.hashCode();
+ for( int i=0; i<m_dependencies.length; i++ )
+ {
+ hash ^= m_dependencies.hashCode();
+ }
+ for( int i=0; i<m_services.length; i++ )
+ {
+ hash ^= m_services.hashCode();
+ }
+ for( int i=0; i<m_parts.length; i++ )
+ {
+ hash ^= m_parts.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 ComponentDescriptor )
+ {
+ ComponentDescriptor component = (ComponentDescriptor) other;
+ if( false == getInfoDescriptor().equals(
component.getInfoDescriptor() ) )
+ {
+ return false;
+ }
+ else if( false == equals( getDependencyDescriptors(),
component.getDependencyDescriptors() ) )
+ {
+ return false;
+ }
+ else if( false == equals( getServiceDescriptors(),
component.getServiceDescriptors() ) )
+ {
+ return false;
+ }
+ else if( false == equals( getPartDescriptors(),
component.getPartDescriptors() ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ 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;
+ }
+
+ public String toString()
+ {
+ return "component#" + getInfoDescriptor().getClassname();
+ }
+}

Added:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/DependencyDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/DependencyDescriptor.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,103 @@
+/*
+ * 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.meta;
+
+import java.util.Properties;
+
+/**
+ * Description of a dependency.
+ *
+ * @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 DependencyDescriptor extends Descriptor
+{
+ private final String m_key;
+ private final String m_type;
+
+ public DependencyDescriptor( final String key, final String type )
+ {
+ this( key, type, null );
+ }
+
+ public DependencyDescriptor( final String key, final String type,
Properties properties )
+ {
+ super( properties );
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+ if( null == type )
+ {
+ throw new NullPointerException( "type" );
+ }
+ m_key = key;
+ m_type = type;
+ }
+
+ public String getKey()
+ {
+ return m_key;
+ }
+
+ public String getServiceClassname()
+ {
+ return m_type;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_key.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 DependencyDescriptor )
+ {
+ DependencyDescriptor dependency = (DependencyDescriptor) other;
+ if( false == getServiceClassname().equals(
dependency.getServiceClassname() ) )
+ {
+ return false;
+ }
+ else if( false == getKey().equals( dependency.getKey() ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+}

Added:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/Descriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/Descriptor.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,148 @@
+/*
+ * 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.meta;
+
+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;
+ }
+ }
+
+ /**
+ * 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/meta/src/main/net/dpml/metro/meta/InfoDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/InfoDescriptor.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,87 @@
+/*
+ * 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.meta;
+
+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 InfoDescriptor extends Descriptor
+{
+ private final String m_classname;
+
+ public InfoDescriptor( final String classname )
+ {
+ this( classname, null );
+ }
+
+ public InfoDescriptor( final String classname, Properties properties )
+ {
+ super( properties );
+ if( null == classname )
+ {
+ throw new NullPointerException( "classname" );
+ }
+ m_classname = classname;
+ }
+
+ public String getClassname()
+ {
+ return m_classname;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( super.equals( other ) == false )
+ {
+ return false;
+ }
+ else if( other instanceof InfoDescriptor )
+ {
+ InfoDescriptor info = (InfoDescriptor) other;
+ if( false == getClassname().equals( info.getClassname() ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_classname.hashCode();
+ return hash;
+ }
+}

Added:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/PartDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/PartDescriptor.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,104 @@
+/*
+ * 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.meta;
+
+import java.util.Properties;
+
+/**
+ * Description of a internal part dependency.
+ *
+ * @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 PartDescriptor extends Descriptor
+{
+ private final String m_key;
+ private final String m_type;
+
+ public PartDescriptor( final String key, final String type )
+ {
+ this( key, type, null );
+ }
+
+ public PartDescriptor( final String key, final String type, Properties
properties )
+ {
+ super( properties );
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+ if( null == type )
+ {
+ throw new NullPointerException( "type" );
+ }
+ m_key = key;
+ m_type = type;
+ }
+
+ public String getKey()
+ {
+ return m_key;
+ }
+
+ public String getPartClassname()
+ {
+ return m_type;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_key.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 PartDescriptor )
+ {
+ PartDescriptor part = (PartDescriptor) other;
+ if( false == getPartClassname().equals( part.getPartClassname()
) )
+ {
+ return false;
+ }
+ else if( false == getKey().equals( part.getKey() ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
+

Added:
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ServiceDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/meta/src/main/net/dpml/metro/meta/ServiceDescriptor.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.meta;
+
+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 ServiceDescriptor extends Descriptor
+{
+ private final String m_type;
+
+ public ServiceDescriptor( final String type )
+ {
+ this( type, null );
+ }
+
+ public ServiceDescriptor( final String type, Properties properties )
+ {
+ super( properties );
+ if( null == type )
+ {
+ throw new NullPointerException( "type" );
+ }
+ m_type = type;
+ }
+
+ public String getClassname()
+ {
+ return m_type;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.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 ServiceDescriptor)
+ {
+ ServiceDescriptor service = (ServiceDescriptor) other;
+ if( false == getClassname().equals( service.getClassname() ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}

Modified: development/laboratory/plus/index.xml
==============================================================================
--- development/laboratory/plus/index.xml (original)
+++ development/laboratory/plus/index.xml Fri Mar 11 22:45:08 2005
@@ -45,7 +45,22 @@
</types>
</info>
<dependencies>
- <include key="dpml-metro-part-api" tag="api"/>
+ <include key="dpml-metro-part-api"/>
+ </dependencies>
+ </project>
+
+ <project basedir="api/meta">
+ <info>
+ <group>dpml/metro</group>
+ <name>dpml-metro-meta-api</name>
+ <version>1.0.0</version>
+ <status>SNAPSHOT</status>
+ <types>
+ <type>jar</type>
+ </types>
+ </info>
+ <dependencies>
+ <include key="dpml-metro-part-api"/>
</dependencies>
</project>

@@ -75,7 +90,7 @@
</types>
</info>
<dependencies>
- <include key="dpml-metro-part-api" tag="api"/>
+ <include key="dpml-metro-part-api"/>
</dependencies>
</project>

@@ -111,6 +126,25 @@
</dependencies>
</project>

+ <project basedir="standard/meta">
+ <info>
+ <group>dpml/metro</group>
+ <name>dpml-metro-meta-impl</name>
+ <version>1.0.0</version>
+ <status>SNAPSHOT</status>
+ <types>
+ <type>jar</type>
+ <type>plugin</type>
+ </types>
+ </info>
+ <dependencies>
+ <include key="dpml-metro-meta-api"/>
+ <include key="dpml-metro-builder-api"/>
+ <include key="dpml-transit-tools"/>
+ <include key="dpml-magic-core"/>
+ </dependencies>
+ </project>
+
<project basedir="standard/builder">
<info>
<group>dpml/metro</group>
@@ -123,10 +157,9 @@
</types>
</info>
<dependencies>
- <include key="dpml-metro-model-api" tag="api"/>
<include key="dpml-metro-builder-api"/>
+ <include key="dpml-metro-model-api" tag="api"/>
<include key="dpml-magic-core"/>
- <!--<include key="ant"/>-->
</dependencies>
</project>

@@ -172,6 +205,9 @@
<dependencies>
<include key="dpml-test-hello-api" tag="api"/>
</dependencies>
+ <plugins>
+ <include key="dpml-metro-meta-impl"/>
+ </plugins>
</project>

<project basedir="test/execution">
@@ -189,9 +225,11 @@
<include key="dpml-test-hello-impl" tag="impl"/>
<include key="dpml-transit-main" test="true" runtime="false"/>
<include key="dpml-metro-kernel-impl" test="true" runtime="false"/>
- <include key="dpml-metro-builder-impl" test="true" runtime="false"/>
<include key="dpml-metro-control-impl" test="true" runtime="false"/>
</dependencies>
+ <plugins>
+ <include key="dpml-metro-builder-impl" test="true" runtime="false"/>
+ </plugins>
</project>

</index>

Added: development/laboratory/plus/standard/meta/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/plus/standard/meta/build.xml Fri Mar 11 22:45:08
2005
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="dpml-metro-meta-impl" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="plugin:dpml/magic/dpml-magic-core">
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+
+ <target name="package" depends="standard.package">
+ <x:export>
+ <antlib resource="net/dpml/metro/meta/impl/antlib.xml"
+ urn="plugin:dpml/metro/dpml-metro-meta-impl"/>
+ </x:export>
+ </target>
+
+</project>
+

Added:
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/ComponentDescriptorDataType.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/ComponentDescriptorDataType.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,352 @@
+/*
+ * 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.meta.impl;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.Properties;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.ArrayList;
+import java.lang.reflect.Method;
+
+import net.dpml.metro.meta.ComponentDescriptor;
+import net.dpml.metro.meta.ServiceDescriptor;
+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.builder.PartBuilder;
+
+import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * 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 ComponentDescriptorDataType extends DescriptorDataType
+{
+ private String m_classname;
+ private PartsDataType m_parts;
+ private Task m_task;
+
+ public ComponentDescriptorDataType( Task task )
+ {
+ m_task = task;
+ super.setProject( task.getProject() );
+ }
+
+ public void setClass( String classname )
+ {
+ m_classname = classname;
+ }
+
+ public PartsDataType createParts()
+ {
+ if( null == m_parts )
+ {
+System.out.println( "## creating parts element" );
+ m_parts = new PartsDataType( m_task );
+ }
+ return m_parts;
+ }
+
+ public Descriptor getDescriptor( ClassLoader classloader ) throws
IntrospectionException
+ {
+ return getComponentDescriptor( classloader );
+ }
+
+ public ComponentDescriptor getComponentDescriptor( ClassLoader
classloader ) throws IntrospectionException
+ {
+ Class subject = loadSubjectClass( classloader );
+ System.out.println( "## component: " + subject.getName() );
+ InfoDescriptor info = createInfoDescriptor( subject );
+ ServiceDescriptor[] services = createServiceDescriptors( subject );
+ DependencyDescriptor[] dependencies = createDependencyDescriptors(
subject );
+ PartDescriptor[] parts = createPartDescriptors( subject );
+ return new ComponentDescriptor( info, services, dependencies, parts
);
+ }
+
+ private Class loadSubjectClass( ClassLoader classloader )
+ {
+ if( null == m_classname )
+ {
+ final String error =
+ "Missing component descriptor class attribute.";
+ throw new IllegalStateException( error );
+ }
+ try
+ {
+ return classloader.loadClass( m_classname );
+ }
+ catch( ClassNotFoundException e )
+ {
+ final String error =
+ "Component class reference ["
+ + m_classname
+ + "] is not present in the project path.";
+ throw new BuildException( error );
+ }
+ }
+
+ private InfoDescriptor createInfoDescriptor( Class subject )
+ {
+ String classname = subject.getName();
+ return new InfoDescriptor( classname );
+ }
+
+ /**
+ * If the class contains an inner class named "Dependencies" then
+ * resolve the key/inteterface clasname pairs based on the inner class
+ * method names.
+ * @param subject the component implmentation class
+ * @return an array of dependency descriptors
+ */
+ private DependencyDescriptor[] createDependencyDescriptors( Class
subject ) throws IntrospectionException
+ {
+ String classname = subject.getName();
+ Class[] classes = subject.getClasses();
+ Class dependencies = locateClass( "$Dependencies", classes );
+ if( null == dependencies )
+ {
+ return new DependencyDescriptor[0];
+ }
+ else
+ {
+ ArrayList list = new ArrayList();
+ Method[] methods = dependencies.getMethods();
+ for( int i=0; i<methods.length; i++ )
+ {
+ Method method = methods[i];
+ DependencyDescriptor dep = createDependencyDescriptor(
method );
+ list.add( dep );
+ }
+ return (DependencyDescriptor[]) list.toArray( new
DependencyDescriptor[0] );
+ }
+ }
+
+ private DependencyDescriptor createDependencyDescriptor( Method method )
throws IntrospectionException
+ {
+ validateMethodName( method );
+ Class returnType = method.getReturnType();
+ validateNonNullReturnType( method, returnType );
+ validateNonArrayReturnType( method, returnType );
+ validateInterfaceReturnType( method, returnType );
+ validateNoExceptions( method );
+ validateNoParameters( method );
+
+ String key = method.getName().substring( 3 );
+ String type = returnType.getName();
+ System.out.println( "### dep: " + key + ", " + type );
+ return new DependencyDescriptor( key, type );
+ }
+
+ private ServiceDescriptor[] createServiceDescriptors( Class subject )
+ {
+ ArrayList list = new ArrayList();
+ Class[] interfaces = subject.getInterfaces();
+ for( int i=0; i<interfaces.length; i++ )
+ {
+ Class service = interfaces[i];
+ ServiceDescriptor descriptor = createServiceDescriptor( service
);
+ if( null != descriptor )
+ {
+ list.add( descriptor );
+ }
+ }
+ return new ServiceDescriptor[0];
+ }
+
+ public ServiceDescriptor createServiceDescriptor( Class subject )
+ {
+ String type = subject.getName();
+ if( type.startsWith( "java." ) )
+ {
+ return null; // ignore java.* interfaces
+ }
+ else
+ {
+ System.out.println( "### service: " + type );
+ return new ServiceDescriptor( type );
+ }
+ }
+
+ private PartDescriptor[] createPartDescriptors( Class subject ) throws
IntrospectionException
+ {
+ String classname = subject.getName();
+ Class[] classes = subject.getClasses();
+ Class parts = locateClass( "$Parts", classes );
+ if( null == parts )
+ {
+ return new PartDescriptor[0];
+ }
+ else
+ {
+ PartBuilder[] builders = createParts().getPartBuilders();
+
+ ArrayList list = new ArrayList();
+ Method[] methods = parts.getMethods();
+ if( builders.length != methods.length )
+ {
+ final String error =
+ "The number of builders declared in the build file ["
+ + builders.length
+ + "] does not match the number of method entries in the
Parts interface ["
+ + methods.length
+ + "].";
+ throw new BuildException( error );
+ }
+ for( int i=0; i<methods.length; i++ )
+ {
+ Method method = methods[i];
+ PartBuilder builder = builders[i];
+ PartDescriptor part = createPartDescriptor( method, builder
);
+ list.add( part );
+ }
+ return (PartDescriptor[]) list.toArray( new PartDescriptor[0] );
+ }
+ }
+
+ private PartDescriptor createPartDescriptor( Method method, PartBuilder
builder )
+ throws IntrospectionException
+ {
+ validateMethodName( method );
+ validateNoExceptions( method );
+ validateNoParameters( method );
+
+ Class returnType = method.getReturnType();
+ validateNonNullReturnType( method, returnType );
+ validateNonArrayReturnType( method, returnType );
+
+ String key = method.getName().substring( 3 );
+ String type = returnType.getName();
+ System.out.println( "### part descriptor: " + key + ", " + type );
+ try
+ {
+ Part part = builder.build();
+ System.out.println( "### part directive: " + part );
+
+ // ###
+ // write out the part directive as a resource colocated with the
+ // class using the naming convention [classname]#key.part
+ //
+
+ return new PartDescriptor( key, type );
+ }
+ catch( Exception e )
+ {
+ throw new BuildException( e );
+ }
+ }
+
+ private Class locateClass( String postfix, Class[] classes )
+ {
+ for( int i=0; i<classes.length; i++ )
+ {
+ Class inner = classes[i];
+ String name = inner.getName();
+ if( name.endsWith( postfix ) )
+ {
+ return inner;
+ }
+ }
+ return null;
+ }
+
+ private void validateNonNullReturnType( Method method, Class returnType
) throws IntrospectionException
+ {
+ if( null == returnType )
+ {
+ final String error =
+ "Method ["
+ + method.getName()
+ + "] does not declare a return type.";
+ throw new IntrospectionException( error );
+ }
+ }
+
+ private void validateNonArrayReturnType( Method method, Class returnType
) throws IntrospectionException
+ {
+ if( null != returnType.getComponentType() )
+ {
+ final String error =
+ "Method ["
+ + method.getName()
+ + "] declares an array return type.";
+ throw new IntrospectionException( error );
+ }
+ }
+
+ private void validateInterfaceReturnType( Method method, Class
returnType ) throws IntrospectionException
+ {
+ if( returnType.isInterface() == false )
+ {
+ final String error =
+ "Method ["
+ + method.getName()
+ + "] declares a return type ["
+ + returnType.getName()
+ + "] that is not an interface.";
+ throw new IntrospectionException( error );
+ }
+ }
+
+ private void validateMethodName( Method method ) throws
IntrospectionException
+ {
+ if( method.getName().startsWith( "get" ) == false )
+ {
+ final String error =
+ "Method ["
+ + method.getName()
+ + "] does not start with 'get'.";
+ throw new IntrospectionException( error );
+ }
+ }
+
+ private void validateNoExceptions( Method method ) throws
IntrospectionException
+ {
+ Class[] exceptionTypes = method.getExceptionTypes();
+ if( exceptionTypes.length > 0 )
+ {
+ final String error =
+ "Method ["
+ + method.getName()
+ + "] declares one or more exceptions.";
+ throw new IntrospectionException( error );
+ }
+ }
+
+ private void validateNoParameters( Method method ) throws
IntrospectionException
+ {
+ Class[] parameterTypes = method.getParameterTypes();
+ if( parameterTypes.length > 0 )
+ {
+ final String error =
+ "Method ["
+ + method.getName()
+ + "] declares one or more parameters.";
+ throw new IntrospectionException( error );
+ }
+ }
+}

Added:
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/DescriptorDataType.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/DescriptorDataType.java
Fri Mar 11 22:45:08 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.meta.impl;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.Properties;
+import java.util.List;
+import java.util.LinkedList;
+
+import net.dpml.metro.meta.Descriptor;
+
+import org.apache.tools.ant.ProjectComponent;
+
+/**
+ * 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 abstract class DescriptorDataType extends ProjectComponent
+{
+ public abstract Descriptor getDescriptor( ClassLoader classloader )
throws IntrospectionException;
+}

Added:
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/IntrospectionException.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/IntrospectionException.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,35 @@
+/*
+ * 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.meta.impl;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * 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/standard/meta/src/main/net/dpml/metro/meta/impl/MetaDescriptorBuilderTask.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/MetaDescriptorBuilderTask.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,97 @@
+/*
+ * 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.meta.impl;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.Properties;
+import java.util.List;
+import java.util.LinkedList;
+
+import net.dpml.metro.meta.Descriptor;
+import net.dpml.magic.tasks.ProjectTask;
+import net.dpml.magic.model.Policy;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+
+/**
+ * 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 MetaDescriptorBuilderTask extends ProjectTask
+{
+ private List m_types = new LinkedList();
+
+ public ComponentDescriptorDataType createComponent()
+ {
+ System.out.println( "# new component" );
+ ComponentDescriptorDataType data = new ComponentDescriptorDataType(
this );
+ m_types.add( data );
+ return data;
+ }
+
+ public void execute()
+ {
+ System.out.println( "# execution" );
+ Project project = getProject();
+ Path path = getDefinition().getPath( project, Policy.RUNTIME );
+ File classes = getContext().getClassesDirectory();
+ path.createPathElement().setLocation( classes );
+ ClassLoader classloader = new AntClassLoader( project, path );
+
+ Descriptor[] descriptors = getDescriptors( classloader );
+ for( int i=0; i<descriptors.length; i++ )
+ {
+ Descriptor descriptor = descriptors[i];
+ System.out.println( "# descriptor: " + descriptor.toString() );
+ }
+ }
+
+ private Descriptor[] getDescriptors( 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++ )
+ {
+ DescriptorDataType type = types[i];
+ try
+ {
+ descriptors[i] = type.getDescriptor( classloader );
+ }
+ catch( IntrospectionException e )
+ {
+ final String error = "Introspection error: " +
e.getMessage();
+ throw new BuildException( error, e, getLocation() );
+ }
+ catch( BuildException e )
+ {
+ e.setLocation( getLocation() );
+ throw e;
+ }
+ }
+ return descriptors;
+ }
+}

Added:
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/PartsDataType.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/PartsDataType.java
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,169 @@
+/*
+ * 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.meta.impl;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.net.URI;
+
+import net.dpml.metro.part.Part;
+import net.dpml.metro.builder.PartBuilder;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.DynamicElementNS;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Location;
+
+/**
+ * A datatype that enables custom part builders.
+ *
+ * @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 PartsDataType extends ProjectComponent implements
DynamicElementNS
+{
+ private List m_builders = new LinkedList();
+ private Task m_owner;
+
+ public PartsDataType( Task owner )
+ {
+ Project project = owner.getProject();
+ setProject( project );
+ m_owner = owner;
+ }
+
+ /**
+ * 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 part builder: " + path );
+ PartBuilder builder = loadPartHandler( path, name );
+ if( null == builder )
+ {
+ System.out.println( "## null builder" );
+ }
+ else
+ {
+ System.out.println( "## adding part builder: " + builder );
+ m_builders.add( builder );
+ }
+ return builder;
+ }
+
+ private PartBuilder loadPartHandler( String uri, String name ) throws
BuildException
+ {
+ String urn = uri + ":" + name;
+ Object builder = null;
+ PartBuilder partBuilder = null;
+ String target = m_owner.getOwningTarget().getName();
+ Location location = m_owner.getLocation();
+ ClassLoader context = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(
getClass().getClassLoader() );
+ Project project = getProject();
+ builder = project.createDataType( urn );
+ partBuilder = (PartBuilder) builder;
+ return partBuilder ;
+ }
+ catch( ClassCastException e )
+ {
+ final String error =
+ "The custom part builder ["
+ + builder.getClass().getName()
+ + "] established by the uri ["
+ + urn
+ + "] declared by the element <"
+ + name
+ + "> under the task <"
+ + m_owner.getTaskName()
+ + "><parts> within the target <"
+ + target
+ + "> does not implement the net.dpml.metro.tools.PartBuilder
interface.";
+ throw new BuildException( error, e );
+ }
+ catch( BuildException e )
+ {
+ final String error =
+ "Unable to load the plugin from the uri ["
+ + urn
+ + "] to handle the custom part type declared by the element <"
+ + name
+ + "> within <"
+ + m_owner.getTaskName()
+ + "><parts> under the target <"
+ + target
+ + ">.";
+ throw new BuildException( error, e );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected exception while attempting to load the custom part
handler with the uri ["
+ + urn
+ + "] declared by the element <"
+ + name
+ + "> within <"
+ + m_owner.getTaskName()
+ + "><parts> under the target <"
+ + target
+ + ">.";
+ throw new BuildException( error, e );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( context );
+ }
+ }
+
+ /**
+ * Return the set of parts contained within this container.
+ * @return the contained parts
+ */
+ public PartBuilder[] getPartBuilders()
+ {
+ return (PartBuilder[]) m_builders.toArray( new PartBuilder[0] );
+ }
+
+ /**
+ * Return the set of parts contained within this container.
+ * @return the contained parts
+ */
+ public Part[] getParts( URI[] uris ) throws Exception
+ {
+ PartBuilder[] builders = (PartBuilder[]) m_builders.toArray( new
PartBuilder[0] );
+ Part[] parts = new Part[ builders.length ];
+ for( int i=0; i<builders.length; i++ )
+ {
+ PartBuilder builder = builders[i];
+ parts[i] = builder.build( uris );
+ }
+ return parts;
+ }
+}

Added:
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/antlib.xml
==============================================================================
--- (empty file)
+++
development/laboratory/plus/standard/meta/src/main/net/dpml/metro/meta/impl/antlib.xml
Fri Mar 11 22:45:08 2005
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+
+<antlib>
+ <taskdef name="meta"
classname="net.dpml.metro.meta.impl.MetaDescriptorBuilderTask"/>
+</antlib>

Modified: development/laboratory/plus/test/example/impl/build.xml
==============================================================================
--- development/laboratory/plus/test/example/impl/build.xml (original)
+++ development/laboratory/plus/test/example/impl/build.xml Fri Mar 11
22:45:08 2005
@@ -2,9 +2,22 @@

<project name="dpml-test-hello-impl" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit"
- xmlns:x="plugin:dpml/magic/dpml-magic-core" >
+ xmlns:x="plugin:dpml/magic/dpml-magic-core">

<transit:import uri="artifact:template:dpml/magic/standard"/>

+ <target name="package" depends="standard.package">
+ <x:property name="builder.uri" feature="plugin"
key="dpml-metro-builder-impl"/>
+ <meta xmlns="plugin:dpml/metro/dpml-metro-meta-impl">
+ <component class="net.dpml.test.hello.impl.DefaultOutputHandler"/>
+ <component class="net.dpml.test.hello.impl.HelloComponent">
+ <parts>
+ <component xmlns="${builder.uri}"
+ class="net.dpml.test.hello.impl.DefaultOutputHandler"
name="outputHandler"/>
+ </parts>
+ </component>
+ </meta>
+ </target>
+
</project>


Modified:
development/laboratory/plus/test/example/impl/src/main/net/dpml/test/hello/impl/DefaultOutputHandler.java
==============================================================================
---
development/laboratory/plus/test/example/impl/src/main/net/dpml/test/hello/impl/DefaultOutputHandler.java
(original)
+++
development/laboratory/plus/test/example/impl/src/main/net/dpml/test/hello/impl/DefaultOutputHandler.java
Fri Mar 11 22:45:08 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.test.hello;
+package net.dpml.test.hello.impl;

import net.dpml.test.hello.OutputHandler;


Modified:
development/laboratory/plus/test/example/impl/src/main/net/dpml/test/hello/impl/HelloComponent.java
==============================================================================
---
development/laboratory/plus/test/example/impl/src/main/net/dpml/test/hello/impl/HelloComponent.java
(original)
+++
development/laboratory/plus/test/example/impl/src/main/net/dpml/test/hello/impl/HelloComponent.java
Fri Mar 11 22:45:08 2005
@@ -34,15 +34,23 @@
OutputHandler getPublisher();
}

+ public interface Parts
+ {
+ OutputHandler getOutputHandler();
+ }
+
private Dependencies m_dependencies;
+ private Parts m_parts;

- public HelloComponent( Dependencies dependencies )
+ public HelloComponent( Dependencies dependencies, Parts parts )
{
m_dependencies = dependencies;
+ m_parts = parts;
}

public void sayHello()
{
- m_dependencies.getPublisher().publish( "hello" );
+ m_dependencies.getPublisher().publish( "hello via publisher" );
+ m_parts.getOutputHandler().publish( "hello via part" );
}
}



  • svn commit: r2045 - in development/laboratory/plus: . api/meta api/meta/src api/meta/src/main api/meta/src/main/net api/meta/src/main/net/dpml api/meta/src/main/net/dpml/metro api/meta/src/main/net/dpml/metro/meta standard/meta standard/meta/src standard/meta/src/main standard/meta/src/main/net standard/meta/src/main/net/dpml standard/meta/src/main/net/dpml/metro standard/meta/src/main/net/dpml/metro/meta standard/meta/src/main/net/dpml/metro/meta/impl test/example/impl test/example/impl/src/main/net/dpml/test/hello/impl, mcconnell, 03/11/2005

Archive powered by MHonArc 2.6.24.

Top of Page