Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2050 - in development/laboratory/plus: . api/builder/src/main/net/dpml/metro/builder api/meta api/model/src/main/net/dpml/metro/meta api/part/src/main/net/dpml/metro/part standard/builder standard/builder/src/main/net/dpml/metro/builder/impl standard/meta test/example/impl test/execution

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: r2050 - in development/laboratory/plus: . api/builder/src/main/net/dpml/metro/builder api/meta api/model/src/main/net/dpml/metro/meta api/part/src/main/net/dpml/metro/part standard/builder standard/builder/src/main/net/dpml/metro/builder/impl standard/meta test/example/impl test/execution
  • Date: Sun, 13 Mar 2005 05:20:33 -0500

Author: mcconnell AT dpml.net
Date: Sun Mar 13 05:20:31 2005
New Revision: 2050

Added:
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/

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

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

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

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

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

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

development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/PartBuilder.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/CatalogEntry.java
development/laboratory/plus/index.xml
development/laboratory/plus/standard/builder/build.xml

development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilder.java

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

development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/antlib.xml
development/laboratory/plus/test/example/impl/build.xml
development/laboratory/plus/test/execution/build.xml
Log:
shaking and baking

Modified:
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/PartBuilder.java
==============================================================================
---
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/PartBuilder.java
(original)
+++
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/PartBuilder.java
Sun Mar 13 05:20:31 2005
@@ -28,20 +28,20 @@
* @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 PartBuilder
+public interface PartBuilder extends Builder
{
/**
* Build the part.
* @return the serializable part
- * @exception ConstructionException if a construction error occurs
+ * @exception Exception if a construction error occurs
*/
- Part build() throws Exception;
+ Part buildPart() throws Exception;

/**
* Build the part.
* @return the serializable part
- * @exception ConstructionException if a construction error occurs
+ * @exception Exception if a construction error occurs
*/
- Part build( URI[] uris ) throws Exception;
+ Part buildPart( URI[] uris ) throws Exception;

}

Modified:
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/TypeBuilder.java
==============================================================================
---
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/TypeBuilder.java
(original)
+++
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/TypeBuilder.java
Sun Mar 13 05:20:31 2005
@@ -28,13 +28,26 @@
* @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
+public interface TypeBuilder extends Builder
{
/**
+ * Return a urn identitifying the strategy.
+ *
+ * @return a strategy uri
+ */
+ URI getStrategyURI();
+
+ /**
* Build a part type.
* @return the serializable part type.
* @exception IntrospectionException if a introspection occurs during
type construction
*/
Type buildType( ClassLoader classloader ) throws IntrospectionException;

+ /**
+ * Return the path to the resource containing the defintion of the type.
+ * @return the resource path
+ */
+ String getResourcePath();
+
}

Added:
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/ComponentDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/ComponentDescriptor.java
Sun Mar 13 05:20:31 2005
@@ -0,0 +1,155 @@
+/*
+ * 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;
+
+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 implements Type
+{
+ 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[i].hashCode();
+ }
+ for( int i=0; i<m_services.length; i++ )
+ {
+ hash ^= m_services[i].hashCode();
+ }
+ for( int i=0; i<m_parts.length; i++ )
+ {
+ hash ^= m_parts[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 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 String toString()
+ {
+ return "component#" + getInfoDescriptor().getClassname();
+ }
+}

Added:
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/DependencyDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/DependencyDescriptor.java
Sun Mar 13 05:20:31 2005
@@ -0,0 +1,105 @@
+/*
+ * 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;
+
+import net.dpml.metro.part.Descriptor;
+
+/**
+ * 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/model/src/main/net/dpml/metro/meta/InfoDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/InfoDescriptor.java
Sun Mar 13 05:20:31 2005
@@ -0,0 +1,89 @@
+/*
+ * 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;
+
+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 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/model/src/main/net/dpml/metro/meta/PartDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/PartDescriptor.java
Sun Mar 13 05:20:31 2005
@@ -0,0 +1,123 @@
+/*
+ * 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.net.URI;
+import java.util.Properties;
+
+import net.dpml.metro.part.Descriptor;
+
+/**
+ * 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;
+ private final URI m_part;
+
+ public PartDescriptor( final String key, final String type, URI part )
+ {
+ this( key, type, part, null );
+ }
+
+ public PartDescriptor( final String key, final String type, URI part,
Properties properties )
+ {
+ super( properties );
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+ if( null == type )
+ {
+ throw new NullPointerException( "type" );
+ }
+ if( null == part )
+ {
+ throw new NullPointerException( "part" );
+ }
+ m_key = key;
+ m_type = type;
+ m_part = part;
+ }
+
+ public String getKey()
+ {
+ return m_key;
+ }
+
+ public String getType()
+ {
+ return m_type;
+ }
+
+ public URI getPart()
+ {
+ return m_part;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_key.hashCode();
+ hash ^= m_type.hashCode();
+ hash ^= m_part.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 == getType().equals( part.getType() ) )
+ {
+ return false;
+ }
+ else if( false == getKey().equals( part.getKey() ) )
+ {
+ return false;
+ }
+ else if( false == getPart().equals( part.getPart() ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
+

Added:
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/ServiceDescriptor.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/api/model/src/main/net/dpml/metro/meta/ServiceDescriptor.java
Sun Mar 13 05:20:31 2005
@@ -0,0 +1,90 @@
+/*
+ * 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;
+
+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 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/api/part/src/main/net/dpml/metro/part/CatalogEntry.java
==============================================================================
---
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/CatalogEntry.java
(original)
+++
development/laboratory/plus/api/part/src/main/net/dpml/metro/part/CatalogEntry.java
Sun Mar 13 05:20:31 2005
@@ -18,6 +18,7 @@

package net.dpml.metro.part;

+import java.net.URI;
import java.util.Properties;

/**
@@ -31,35 +32,35 @@
public class CatalogEntry extends Descriptor
{
private final String m_path;
- private final String m_type;
+ private final URI m_strategy;

- public CatalogEntry( String path, String type )
+ public CatalogEntry( URI strategy, String path )
{
- this( path, type, null );
+ this( strategy, path, null );
}

- public CatalogEntry( String path, String type, Properties properties )
+ public CatalogEntry( URI strategy, String path, Properties properties )
{
super( properties );
+ m_strategy = strategy;
m_path = path;
- m_type = type;
}

- public String getPath()
+ public String getResourcePath()
{
return m_path;
}

- public String getType()
+ public URI getStrategyURI()
{
- return m_type;
+ return m_strategy;
}

public int hashCode()
{
int hash = super.hashCode();
hash ^= m_path.hashCode();
- hash ^= m_type.hashCode();
+ hash ^= m_strategy.hashCode();
return hash;
}

@@ -76,11 +77,11 @@
else if( other instanceof CatalogEntry )
{
CatalogEntry entry = (CatalogEntry) other;
- if( getPath().equals( entry.getPath() ) == false )
+ if( getResourcePath().equals( entry.getResourcePath() ) == false
)
{
return false;
}
- else if( getType().equals( entry.getType() ) == false )
+ else if( getStrategyURI().equals( entry.getStrategyURI() ) ==
false )
{
return false;
}
@@ -95,5 +96,10 @@
}
}

+ public String toString()
+ {
+ return "[entry type:" + m_strategy + " resource:" + m_path + "]";
+ }
+
}


Modified: development/laboratory/plus/index.xml
==============================================================================
--- development/laboratory/plus/index.xml (original)
+++ development/laboratory/plus/index.xml Sun Mar 13 05:20:31 2005
@@ -64,21 +64,6 @@
</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>
-
<project basedir="api/model">
<info>
<group>dpml/metro</group>
@@ -141,25 +126,6 @@
</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>
@@ -172,8 +138,10 @@
</types>
</info>
<dependencies>
- <include key="dpml-metro-builder-api"/>
+ <include key="dpml-metro-part-api" tag="api"/>
<include key="dpml-metro-model-api" tag="api"/>
+ <include key="dpml-metro-builder-api"/>
+ <include key="dpml-transit-tools"/>
<include key="dpml-magic-core"/>
</dependencies>
</project>
@@ -221,7 +189,7 @@
<include key="dpml-test-hello-api" tag="api"/>
</dependencies>
<plugins>
- <include key="dpml-metro-meta-impl"/>
+ <include key="dpml-metro-builder-impl"/>
</plugins>
</project>

@@ -232,7 +200,7 @@
<version>1.0.0</version>
<status>SNAPSHOT</status>
<types>
- <type>xpart</type>
+ <type>part</type>
</types>
</info>
<dependencies>
@@ -243,7 +211,7 @@
<include key="dpml-metro-control-impl" test="true" runtime="false"/>
</dependencies>
<plugins>
- <include key="dpml-metro-builder-impl" test="true" runtime="false"/>
+ <include key="dpml-metro-builder-impl"/>
</plugins>
</project>


Modified: development/laboratory/plus/standard/builder/build.xml
==============================================================================
--- development/laboratory/plus/standard/builder/build.xml (original)
+++ development/laboratory/plus/standard/builder/build.xml Sun Mar 13
05:20:31 2005
@@ -7,7 +7,8 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="init" depends="standard.init">
- <x:filter key="dpml-metro-control-impl" feature="plugin"
token="CONTROLLER-URI"/>
+ <x:filter key="dpml-metro-control-impl" feature="plugin"
token="STRATEGY-URI"/>
+ <x:filter feature="plugin" token="BUILDER-URI"/>
</target>

<target name="package" depends="standard.package">

Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilder.java
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilder.java
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilder.java
Sun Mar 13 05:20:31 2005
@@ -26,6 +26,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.URI;
+import java.net.URISyntaxException;
import java.rmi.MarshalledObject;
import java.util.Arrays;
import java.util.List;
@@ -74,8 +75,8 @@
//--------------------------------------------------------------------

/**
- * Set the name of the identifiable to the supplied value.
- * @param name the identifying name
+ * Set the name of the component.
+ * @param name component name
*/
public void setName( final String name )
{
@@ -84,8 +85,8 @@
}

/**
- * Set the name of the identifiable to the supplied value.
- * @param name the identifying name
+ * Set the classname identifying the part type.
+ * @param name the classname
*/
public void setClass( final String classname )
{
@@ -107,13 +108,34 @@
// PartBuilder
//--------------------------------------------------------------------

- public Part build() throws Exception
+ /**
+ * Return a urn identitifying the component type strategy that this
+ * builder is supporting.
+ *
+ * @return a uri identifiying the type strategy
+ */
+ public URI getStrategyURI()
+ {
+ return STRATEGY_URI;
+ }
+
+ /**
+ * Return a uri identitifying the builder.
+ *
+ * @return a uri identifiying the type builder
+ */
+ public URI getBuilderURI()
+ {
+ return BUILDER_URI;
+ }
+
+ public Part buildPart() throws Exception
{
URI[] uris = new URI[0];
- return build( uris );
+ return buildPart( uris );
}

- public Part build( URI[] uris ) throws Exception
+ public Part buildPart( URI[] uris ) throws Exception
{
System.out.println( "building part: " + m_name );
return buildComponentModel( uris );
@@ -205,11 +227,12 @@

public void execute()
{
-System.out.println( "executing" );
+System.out.println( "executing component part" );
try
{
- Part part = build();
- marshall( part );
+ Part part = buildPart();
+ File output = getOutputFile();
+ MarshalledObjectHelper.write( part, output );
}
catch( BuildException e )
{
@@ -223,37 +246,10 @@
}
}

- private void marshall( Object object )
- {
- ObjectOutputStream output = null;
- FileOutputStream stream = null;
- File file = getOutputFile();
- try
- {
- MarshalledObject marshalled = new MarshalledObject( object );
- stream = new FileOutputStream( file );
- output = new ObjectOutputStream( stream );
- output.writeObject( marshalled );
- }
- catch( Throwable e )
- {
- final String error =
- "Unexpected error while attempting to marshall an object."
- + "\ndestination: " + file
- + "\nclass: " + object.getClass().getName()
- + "\nreason: " + e.toString();
- throw new ConstructionException( error, e, getLocation() );
- }
- finally
- {
- closeStream( output );
- }
- }
-
private File getOutputFile()
{
- File dir = getContext().getDeliverablesDirectory( "xpart" );
- String filename = getDefinition().getFilename( "xpart" );
+ File dir = getContext().getDeliverablesDirectory( "part" );
+ String filename = getDefinition().getFilename( "part" );
File file = new File( dir, filename );
File parent = file.getParentFile();
if( !parent.exists() )
@@ -263,18 +259,18 @@
return file;
}

- private void closeStream( OutputStream out )
+ private static URI STRATEGY_URI = setupURI( "@STRATEGY-URI@" );
+ private static URI BUILDER_URI = setupURI( "@BUILDER-URI@" );
+
+ private static URI setupURI( String spec )
{
- if( null != out )
+ try
{
- try
- {
- out.close();
- }
- catch( IOException ioe )
- {
- boolean ignoreMe = true;
- }
+ return new URI( spec );
+ }
+ catch( URISyntaxException ioe )
+ {
+ return null;
}
}


Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/PartsDataType.java
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/PartsDataType.java
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/PartsDataType.java
Sun Mar 13 05:20:31 2005
@@ -36,7 +36,7 @@
import org.apache.tools.ant.Location;

/**
- * The task is a container of parts.
+ * 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 $
@@ -48,10 +48,19 @@

public PartsDataType( Task owner )
{
- setProject( owner.getProject() );
+ Project project = owner.getProject();
+ setProject( project );
m_owner = owner;
}

+ public ComponentModelBuilder createComponent()
+ {
+ System.out.println( "# new component" );
+ ComponentModelBuilder builder = new ComponentModelBuilder();
+ m_builders.add( builder );
+ return builder;
+ }
+
/**
* Operation used to construct a custom part type directive.
* @param uri the part handler uri
@@ -61,15 +70,24 @@
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 );
- m_builders.add( builder );
+ 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();
@@ -77,13 +95,16 @@
try
{
Thread.currentThread().setContextClassLoader(
getClass().getClassLoader() );
- return (PartBuilder) getProject().createDataType( urn );
+ Project project = getProject();
+ builder = project.createDataType( urn );
+ partBuilder = (PartBuilder) builder;
+ return partBuilder ;
}
catch( ClassCastException e )
{
final String error =
"The custom part builder ["
- + partBuilder.getClass().getName()
+ + builder.getClass().getName()
+ "] established by the uri ["
+ urn
+ "] declared by the element <"
@@ -93,7 +114,7 @@
+ "><parts> within the target <"
+ target
+ "> does not implement the net.dpml.metro.tools.PartBuilder
interface.";
- throw new BuildException( error, e, location );
+ throw new BuildException( error, e );
}
catch( BuildException e )
{
@@ -107,7 +128,7 @@
+ "><parts> under the target <"
+ target
+ ">.";
- throw new BuildException( error, e, location );
+ throw new BuildException( error, e );
}
catch( Throwable e )
{
@@ -121,7 +142,7 @@
+ "><parts> under the target <"
+ target
+ ">.";
- throw new BuildException( error, e, location );
+ throw new BuildException( error, e );
}
finally
{
@@ -133,6 +154,15 @@
* 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] );
@@ -140,7 +170,7 @@
for( int i=0; i<builders.length; i++ )
{
PartBuilder builder = builders[i];
- parts[i] = builder.build( uris );
+ parts[i] = builder.buildPart( uris );
}
return parts;
}

Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/antlib.xml
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/antlib.xml
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/antlib.xml
Sun Mar 13 05:20:31 2005
@@ -1,5 +1,6 @@
<?xml version="1.0"?>

<antlib>
+ <taskdef name="catalog"
classname="net.dpml.metro.builder.impl.CatalogTask"/>
<taskdef name="component"
classname="net.dpml.metro.builder.impl.ComponentModelBuilder"/>
</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 Sun Mar 13
05:20:31 2005
@@ -7,13 +7,11 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

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

Modified: development/laboratory/plus/test/execution/build.xml
==============================================================================
--- development/laboratory/plus/test/execution/build.xml (original)
+++ development/laboratory/plus/test/execution/build.xml Sun Mar 13
05:20:31 2005
@@ -2,23 +2,21 @@

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

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

<target name="init" depends="standard.init">
- <filter token="XPATH"
value="target/deliverables/xparts/${project.filename}"/>
- <x:property name="builder.uri" feature="plugin"
key="dpml-metro-builder-impl"/>
- <transit:plugin uri="${builder.uri}"/>
+ <filter token="XPATH"
value="target/deliverables/parts/${project.filename}"/>
</target>

<target name="package" depends="standard.package">
- <m:component class="net.dpml.test.hello.impl.HelloComponent"
name="hello">
+ <component xmlns="plugin:dpml/metro/dpml-metro-builder-impl"
+ class="net.dpml.test.hello.impl.HelloComponent" name="hello">
<parts>
- <m:component class="net.dpml.test.hello.impl.DefaultOutputHandler"
name="output"/>
+ <component class="net.dpml.test.hello.impl.DefaultOutputHandler"
name="output"/>
</parts>
- </m:component>
+ </component>
</target>

</project>



  • svn commit: r2050 - in development/laboratory/plus: . api/builder/src/main/net/dpml/metro/builder api/meta api/model/src/main/net/dpml/metro/meta api/part/src/main/net/dpml/metro/part standard/builder standard/builder/src/main/net/dpml/metro/builder/impl standard/meta test/example/impl test/execution, mcconnell, 03/12/2005

Archive powered by MHonArc 2.6.24.

Top of Page