Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1954 - in development/laboratory/plus: . acme/src/main/acme test tools/block tools/block/src tools/block/src/main tools/block/src/main/net tools/block/src/main/net/dpml tools/block/src/main/net/dpml/metro tools/block/src/main/net/dpml/metro/tools tools/block/src/main/net/dpml/metro/tools/block tools/component tools/component/src tools/component/src/main tools/component/src/main/net tools/component/src/main/net/dpml tools/component/src/main/net/dpml/metro tools/component/src/main/net/dpml/metro/tools tools/component/src/main/net/dpml/metro/tools/builder tools/part/src/main/net/dpml/metro/tools tools/part/src/main/net/dpml/metro/tools/part

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1954 - in development/laboratory/plus: . acme/src/main/acme test tools/block tools/block/src tools/block/src/main tools/block/src/main/net tools/block/src/main/net/dpml tools/block/src/main/net/dpml/metro tools/block/src/main/net/dpml/metro/tools tools/block/src/main/net/dpml/metro/tools/block tools/component tools/component/src tools/component/src/main tools/component/src/main/net tools/component/src/main/net/dpml tools/component/src/main/net/dpml/metro tools/component/src/main/net/dpml/metro/tools tools/component/src/main/net/dpml/metro/tools/builder tools/part/src/main/net/dpml/metro/tools tools/part/src/main/net/dpml/metro/tools/part
  • Date: Sat, 05 Mar 2005 11:28:44 +0100

Author: mcconnell
Date: Sat Mar 5 11:28:44 2005
New Revision: 1954

Added:
development/laboratory/plus/tools/block/
development/laboratory/plus/tools/block/build.xml
development/laboratory/plus/tools/block/src/
development/laboratory/plus/tools/block/src/main/
development/laboratory/plus/tools/block/src/main/net/
development/laboratory/plus/tools/block/src/main/net/dpml/
development/laboratory/plus/tools/block/src/main/net/dpml/metro/
development/laboratory/plus/tools/block/src/main/net/dpml/metro/tools/

development/laboratory/plus/tools/block/src/main/net/dpml/metro/tools/block/

development/laboratory/plus/tools/block/src/main/net/dpml/metro/tools/block/BlockPartHandler.java

development/laboratory/plus/tools/block/src/main/net/dpml/metro/tools/block/antlib.xml
development/laboratory/plus/tools/component/
development/laboratory/plus/tools/component/build.xml
development/laboratory/plus/tools/component/src/
development/laboratory/plus/tools/component/src/main/
development/laboratory/plus/tools/component/src/main/net/
development/laboratory/plus/tools/component/src/main/net/dpml/
development/laboratory/plus/tools/component/src/main/net/dpml/metro/
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/

development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/

development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/ClassLoaderDataType.java

development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/ComponentPartHandler.java

development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/PartsDataType.java

development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/antlib.xml

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/part/Part.java
- copied unchanged from r1950,
development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/Part.java

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/part/PartTask.java
- copied unchanged from r1950,
development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/PartTask.java

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/part/antlib.xml
- copied, changed from r1950,
development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/antlib.xml
Removed:

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/ComponentTask.java

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/Part.java

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/PartTask.java

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/Parts.java

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/antlib.xml
Modified:
development/laboratory/plus/acme/src/main/acme/WidgetComponent.java
development/laboratory/plus/index.xml
development/laboratory/plus/test/build.xml
Log:
Playing around with structure so that we have a common project for the
abstract part abstraction, a project dealing with a component type handler
for classic blocks, a project containing the next gen component type handler,
and lastly, a project containing an acme component handler.

Modified: development/laboratory/plus/acme/src/main/acme/WidgetComponent.java
==============================================================================
--- development/laboratory/plus/acme/src/main/acme/WidgetComponent.java
(original)
+++ development/laboratory/plus/acme/src/main/acme/WidgetComponent.java Sat
Mar 5 11:28:44 2005
@@ -22,7 +22,7 @@
import java.net.URI;
import java.net.URL;

-import net.dpml.metro.tools.Part;
+import net.dpml.metro.tools.part.Part;

import org.apache.tools.ant.ProjectComponent;
import org.apache.tools.ant.BuildException;

Modified: development/laboratory/plus/index.xml
==============================================================================
--- development/laboratory/plus/index.xml (original)
+++ development/laboratory/plus/index.xml Sat Mar 5 11:28:44 2005
@@ -35,6 +35,17 @@
</dependencies>
</project>

+ <project basedir="tools/block">
+ <info>
+ <group>dpml/metro</group>
+ <name>dpml-metro-block-builder</name>
+ <type>jar</type>
+ </info>
+ <dependencies>
+ <include key="dpml-tools-part"/>
+ </dependencies>
+ </project>
+
<project basedir="acme">
<info>
<group>acme</group>
@@ -55,6 +66,7 @@
<dependencies>
<include key="dpml-tools-part"/>
<include key="acme-component-builder"/>
+ <include key="dpml-metro-block-builder"/>
</dependencies>
</project>


Modified: development/laboratory/plus/test/build.xml
==============================================================================
--- development/laboratory/plus/test/build.xml (original)
+++ development/laboratory/plus/test/build.xml Sat Mar 5 11:28:44 2005
@@ -3,7 +3,7 @@
<project name="dpml-tools-part-test" default="test" basedir="."
xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core"
- xmlns:m="plugin:dpml/metro/dpml-metro-tools">
+ xmlns:m="plugin:dpml/metro/dpml-metro-component-builder">

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


Added: development/laboratory/plus/tools/block/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/plus/tools/block/build.xml Sat Mar 5 11:28:44
2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="dpml-metro-block-builder" 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/block/antlib.xml"
urn="plugin:dpml/metro/dpml-metro-block-builder"/>
+ </x:export>
+ </target>
+
+</project>
+

Added:
development/laboratory/plus/tools/block/src/main/net/dpml/metro/tools/block/BlockPartHandler.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/tools/block/src/main/net/dpml/metro/tools/block/BlockPartHandler.java
Sat Mar 5 11:28:44 2005
@@ -0,0 +1,61 @@
+/*
+ * 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.tools.block;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+import net.dpml.metro.tools.part.Part;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+
+/**
+ * The DPML component buildtime handler for the classic 'block'.
+ *
+ * @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 BlockPartHandler extends Task implements Part
+{
+ /**
+ * Part preparation.
+ */
+ public void prepare( Part parent ) throws BuildException
+ {
+ log( "initization with parent: " + parent );
+ }
+
+ public String toString()
+ {
+ return "[class:" + getClass().getName()
+ + ":" + System.identityHashCode( Part.class );
+ }
+
+ /**
+ * Task execution.
+ */
+ public void execute()
+ {
+ log( "block execution" );
+ }
+}

Added:
development/laboratory/plus/tools/block/src/main/net/dpml/metro/tools/block/antlib.xml
==============================================================================
--- (empty file)
+++
development/laboratory/plus/tools/block/src/main/net/dpml/metro/tools/block/antlib.xml
Sat Mar 5 11:28:44 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+
+<antlib>
+ <taskdef name="block"
classname="net.dpml.metro.tools.block.BlockPartHandler"/>
+ <typedef name="component"
classname="net.dpml.metro.tools.block.ComponentPartHandler"/>
+ <typedef name="container"
classname="net.dpml.metro.tools.block.ContainerPartHandler"/>
+</antlib>

Added: development/laboratory/plus/tools/component/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/plus/tools/component/build.xml Sat Mar 5
11:28:44 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="dpml-metro-component-builder" 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/tools/antlib.xml"
urn="plugin:dpml/metro/dpml-metro-component-builder"/>
+ </x:export>
+ </target>
+
+</project>
+

Added:
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/ClassLoaderDataType.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/ClassLoaderDataType.java
Sat Mar 5 11:28:44 2005
@@ -0,0 +1,83 @@
+/*
+ * 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.tools.builder;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.net.URI;
+
+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;
+
+/**
+ * The task is a container of 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 class ClassLoaderDataType extends ProjectComponent
+{
+ private List m_entries = new LinkedList();
+ private Task m_owner;
+
+ public ClassLoaderDataType( Task owner )
+ {
+ m_owner = owner;
+ }
+
+ /**
+ * Return the set of parts contained within this container.
+ * @return the contained parts
+ */
+ public URI[] getPathElements()
+ {
+ return (URI[]) m_entries.toArray( new URI[0] );
+ }
+
+ public PathElement createPathelement()
+ {
+ PathElement element = new PathElement();
+ m_entries.add( element );
+ return element;
+ }
+
+ public static class PathElement
+ {
+ private URI m_uri;
+
+ public void setUri( String uri )
+ {
+ try
+ {
+ m_uri = new URI( uri );
+ }
+ catch( Throwable e )
+ {
+ throw new BuildException( e );
+ }
+ }
+ }
+}

Added:
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/ComponentPartHandler.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/ComponentPartHandler.java
Sat Mar 5 11:28:44 2005
@@ -0,0 +1,74 @@
+/*
+ * 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.tools.builder;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+import net.dpml.metro.tools.part.Part;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+
+/**
+ * The DPML component buildtime handler for the classic 'block'.
+ *
+ * @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 ComponentPartHandler extends Task implements Part
+{
+ private PartsDataType m_parts;
+
+ /**
+ * Task initialization.
+ */
+ public void prepare( Part parent ) throws BuildException
+ {
+ log( "initization with parent: " + parent );
+ Part[] parts = m_parts.getParts();
+ for( int i=0; i<parts.length; i++ )
+ {
+ Part part = parts[i];
+ part.prepare( this );
+ }
+ }
+
+ public PartsDataType createParts()
+ {
+ if( null == m_parts )
+ {
+ m_parts = new PartsDataType( this );
+ }
+ return m_parts;
+ }
+
+ /**
+ * Load the resource and assign the locally cached file path to the
supplied property name.
+ * @exception BuildException if an error occurs during resource resolution
+ */
+ public void execute() throws BuildException
+ {
+ log( "executing: " + this );
+ prepare( this );
+ }
+}

Added:
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/PartsDataType.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/PartsDataType.java
Sat Mar 5 11:28:44 2005
@@ -0,0 +1,147 @@
+/*
+ * 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.tools;
+
+import java.util.List;
+import java.util.LinkedList;
+
+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;
+
+/**
+ * The task is a container of 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 class PartsDataType extends ProjectComponent implements
DynamicElementNS
+{
+ private List m_parts = new LinkedList();
+ private Task m_owner;
+
+ public PartsDataType( Task owner )
+ {
+ 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 );
+ return loadPartHandler( path, name );
+ }
+
+ private Part loadPartHandler( String uri, String name ) throws
BuildException
+ {
+ String urn = uri + ":" + name;
+
+ Object part = null;
+ String target = m_owner.getOwningTarget().getName();
+ Location location = m_owner.getLocation();
+ ClassLoader context = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(
Parts.class.getClassLoader() );
+ part = getProject().createDataType( urn );
+ return (Part) part;
+ }
+ catch( ClassCastException e )
+ {
+ final String error =
+ "The custom part handler ["
+ + part.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.Part
interface.";
+ throw new BuildException( error, e, location );
+ }
+ 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, location );
+ }
+ 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, location );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( context );
+ }
+ }
+
+ /**
+ * Add a standard part to the container.
+ * @param the part to add
+ */
+ public void addPart( Part part )
+ {
+ m_parts.add( part );
+ System.out.println( "adding part: " + part );
+ part.setProject( getProject() );
+ part.init();
+ }
+
+ /**
+ * Return the set of parts contained within this container.
+ * @return the contained parts
+ */
+ public Part[] getParts()
+ {
+ return (Part[]) m_parts.toArray( new Part[0] );
+ }
+
+}

Added:
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/antlib.xml
==============================================================================
--- (empty file)
+++
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/antlib.xml
Sat Mar 5 11:28:44 2005
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+
+<antlib>
+ <taskdef name="component"
classname="net.dpml.metro.tools.part.ComponentTaskHandler"/>
+</antlib>
\ No newline at end of file

Copied:
development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/part/antlib.xml
(from r1950,
development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/antlib.xml)
==============================================================================
---
development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/antlib.xml
(original)
+++
development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/part/antlib.xml
Sat Mar 5 11:28:44 2005
@@ -1,6 +1,5 @@
<?xml version="1.0"?>

<antlib>
- <typedef name="part" classname="net.dpml.metro.tools.PartTask"/>
- <taskdef name="component" classname="net.dpml.metro.tools.ComponentTask"/>
+ <typedef name="part" classname="net.dpml.metro.tools.part.PartTask"/>
</antlib>
\ No newline at end of file



  • svn commit: r1954 - in development/laboratory/plus: . acme/src/main/acme test tools/block tools/block/src tools/block/src/main tools/block/src/main/net tools/block/src/main/net/dpml tools/block/src/main/net/dpml/metro tools/block/src/main/net/dpml/metro/tools tools/block/src/main/net/dpml/metro/tools/block tools/component tools/component/src tools/component/src/main tools/component/src/main/net tools/component/src/main/net/dpml tools/component/src/main/net/dpml/metro tools/component/src/main/net/dpml/metro/tools tools/component/src/main/net/dpml/metro/tools/builder tools/part/src/main/net/dpml/metro/tools tools/part/src/main/net/dpml/metro/tools/part, mcconnell, 03/05/2005

Archive powered by MHonArc 2.6.24.

Top of Page