Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1959 - in development/laboratory/plus: acme/src/main/acme tools/component/src/main/net/dpml/metro/tools/builder 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 dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1959 - in development/laboratory/plus: acme/src/main/acme tools/component/src/main/net/dpml/metro/tools/builder tools/part/src/main/net/dpml/metro/tools/part
  • Date: Sun, 06 Mar 2005 18:07:55 -0500

Author: mcconnell AT dpml.net
Date: Sat Mar 5 19:05:03 2005
New Revision: 1959

Added:

development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/PartDataType.java
Removed:

development/laboratory/plus/tools/part/src/main/net/dpml/metro/tools/part/PartTask.java
Modified:
development/laboratory/plus/acme/src/main/acme/WidgetComponent.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
Log:
general updates

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 19:05:03 2005
@@ -24,6 +24,7 @@

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;
@@ -34,14 +35,14 @@
* @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 WidgetComponent extends ProjectComponent implements Part
+public class WidgetComponent extends Task implements Part
{
/**
* Part preparation.
*/
public void prepare( Part parent ) throws BuildException
{
- log( "class: " + getClas().getName() );
+ log( "class: " + getClass().getName() );
log( "initization with parent: " + parent );
}


Modified:
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/ComponentPartHandler.java
(original)
+++
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/ComponentPartHandler.java
Sat Mar 5 19:05:03 2005
@@ -37,21 +37,24 @@
*/
public class ComponentPartHandler extends Task implements Part
{
+ //--------------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------------
+
private PartsDataType m_parts;

+ //--------------------------------------------------------------------
+ // Task
+ //--------------------------------------------------------------------
+
/**
- * Task initialization.
+ * 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 prepare( Part parent ) throws BuildException
+ public void execute() throws BuildException
{
- log( "class: " + getClas().getName() );
- 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 );
- }
+ log( "executing: " + this );
+ prepare( this );
}

public PartsDataType createParts()
@@ -63,13 +66,23 @@
return m_parts;
}

+ //--------------------------------------------------------------------
+ // Part
+ //--------------------------------------------------------------------
+
/**
- * Load the resource and assign the locally cached file path to the
supplied property name.
- * @exception BuildException if an error occurs during resource resolution
+ * Part initialization.
*/
- public void execute() throws BuildException
+ public void prepare( Part parent ) throws BuildException
{
- log( "executing: " + this );
- prepare( this );
+ log( "class: " + getClass().getName() );
+ log( "initization with parent: " + parent );
+ Part[] parts = m_parts.getParts();
+ log( "preparing children [" + parts.length + "]" );
+ for( int i=0; i<parts.length; i++ )
+ {
+ Part part = parts[i];
+ part.prepare( this );
+ }
}
}

Added:
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/PartDataType.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/PartDataType.java
Sat Mar 5 19:05:03 2005
@@ -0,0 +1,57 @@
+/*
+ * 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 task does something but I'm not sure what just yet.
+ *
+ * @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 PartDataType extends ProjectComponent implements Part
+{
+ private Part m_parent;
+ private Task m_owner;
+
+ public PartDataType( Task owner )
+ {
+ m_owner = owner;
+ }
+
+ /**
+ * Request the part to execute the preparation phase.
+ */
+ public void prepare( Part parent )
+ {
+ m_owner.log( "part class: " + getClass().getName() );
+ m_parent = parent;
+ m_owner.log( "part parent: " + m_parent );
+ }
+}

Modified:
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/PartsDataType.java
(original)
+++
development/laboratory/plus/tools/component/src/main/net/dpml/metro/tools/builder/PartsDataType.java
Sat Mar 5 19:05:03 2005
@@ -22,7 +22,6 @@
import java.util.LinkedList;

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

import org.apache.tools.ant.Task;
import org.apache.tools.ant.Target;
@@ -59,7 +58,9 @@
public Object createDynamicElement( String uri, String name, String
qualified )
{
String path = getProject().replaceProperties( uri );
- return loadPartHandler( path, name );
+ Part part = loadPartHandler( path, name );
+ m_parts.add( part );
+ return part;
}

private Part loadPartHandler( String uri, String name ) throws
BuildException
@@ -74,6 +75,10 @@
{
Thread.currentThread().setContextClassLoader(
getClass().getClassLoader() );
part = getProject().createDataType( urn );
+ if( part instanceof Task )
+ {
+ ((Task)part).setTaskName( name );
+ }
return (Part) part;
}
catch( ClassCastException e )
@@ -126,19 +131,11 @@
}
}

- /**
- * Add a standard part to the container.
- * @param the part to add
- */
- public void addPart( PartTask part )
+ public Part createPart()
{
+ PartDataType part = new PartDataType( m_owner );
m_parts.add( part );
- System.out.println( "adding part: " + part );
- part.setProject( getProject() );
- if( part instanceof Task )
- {
- ((Task)part).init();
- }
+ return part;
}

/**



  • svn commit: r1959 - in development/laboratory/plus: acme/src/main/acme tools/component/src/main/net/dpml/metro/tools/builder tools/part/src/main/net/dpml/metro/tools/part, mcconnell, 03/06/2005

Archive powered by MHonArc 2.6.24.

Top of Page