notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1467 - in trunk/main/depot/tools/builder/src: main/net/dpml/tools main/net/dpml/tools/impl main/net/dpml/tools/info main/net/dpml/tools/tasks test/net/dpml/tools test/net/dpml/tools/info
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1467 - in trunk/main/depot/tools/builder/src: main/net/dpml/tools main/net/dpml/tools/impl main/net/dpml/tools/info main/net/dpml/tools/tasks test/net/dpml/tools test/net/dpml/tools/info
- Date: Mon, 29 May 2006 08:33:13 +0200
Author: mcconnell
Date: 2006-05-29 08:33:00 +0200 (Mon, 29 May 2006)
New Revision: 1467
Removed:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/ProcessorDirective.java
trunk/main/depot/tools/builder/src/test/net/dpml/tools/data/
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/Context.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/BuilderDirective.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/BuilderDirectiveHelper.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/ListenerDirective.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
trunk/main/depot/tools/builder/src/test/net/dpml/tools/info/ListenerDirectiveTestCase.java
Log:
resolve clean build issue related to depot initialization via a pre-existing
ant project (build.signature was not being initialized correctly during ant
driven start-up of the depot builder)
Modified: trunk/main/depot/tools/builder/src/main/net/dpml/tools/Context.java
===================================================================
--- trunk/main/depot/tools/builder/src/main/net/dpml/tools/Context.java
2006-05-28 17:49:29 UTC (rev 1466)
+++ trunk/main/depot/tools/builder/src/main/net/dpml/tools/Context.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -60,12 +60,6 @@
String getProperty( String key, String value );
/**
- * Return an array of processors.
- * @return the processor array
- */
- Processor[] getProcessors();
-
- /**
*Initialize the context.
*/
void init();
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -37,7 +37,6 @@
import net.dpml.library.impl.DefaultLibrary;
import net.dpml.tools.info.ListenerDirective;
-import net.dpml.tools.info.ProcessorDirective;
import net.dpml.tools.Context;
import net.dpml.tools.Processor;
@@ -63,8 +62,6 @@
{
private final Project m_project;
private final Resource m_resource;
- private final DefaultWorkbench m_workbench;
- private final Processor[] m_processors;
private Path m_runtime;
private Path m_test;
@@ -93,8 +90,6 @@
m_resource = resource;
Library library = resource.getLibrary();
- m_workbench = new DefaultWorkbench( library );
-
project.addReference( "project.timestamp", new Date() );
project.setBaseDir( resource.getBaseDir() );
@@ -165,56 +160,9 @@
BuildListener buildListener = loadBuildListener( directive );
project.addBuildListener( buildListener );
}
-
- // load processors declared under the builder configuration matching
the
- // types produced by the project (including dependent processors)
-
- ProcessorDirective[] processors = getProcessorSequence();
- m_processors = new Processor[ processors.length ];
- for( int i=0; i<processors.length; i++ )
- {
- ProcessorDirective processor = processors[i];
- project.log( "loading processor: " + processor.getName(),
Project.MSG_VERBOSE );
- m_processors[i] = loadProcessor( processor );
- }
}
/**
- * Return an array of processors.
- * @return the processor array
- */
- public Processor[] getProcessors()
- {
- return m_processors;
- }
-
- /**
- * Return the sequence of processor definitions supporting production of
a
- * the current resource. The implementation constructs a sequence of
process
- * instances based on the types declared by the resource combined with
- * dependencies declared by respective process definitions.
- *
- * @return a sorted array of processor definitions supporting type
production
- * @exception ProcessorNotFoundException if a processor referenced by
another
- * processor as a dependent cannot be resolved
- */
- private ProcessorDirective[] getProcessorSequence()
- {
- try
- {
- return m_workbench.getProcessorSequence( m_resource );
- }
- catch( UnknownKeyException e )
- {
- final String error =
- "Internal error while constructing processor sequence.";
- IllegalStateException ise = new IllegalStateException( error );
- ise.initCause( e );
- throw ise;
- }
- }
-
- /**
* Initialize the contex during which runtime and test path objects are
* established as project references.
*/
@@ -748,30 +696,7 @@
throw new BuilderError( error );
}
}
-
- private Processor loadProcessor( ProcessorDirective directive )
- {
- String name = directive.getName();
- URI uri = directive.getURI();
- try
- {
- String classname = directive.getClassname();
- Object object = loadInstance( name, uri, classname );
- return (Processor) object;
- }
- catch( ClassCastException e )
- {
- final String error =
- "Build processor ["
- + name
- + "] from uri ["
- + uri
- + "] does not implement "
- + Processor.class.getName();
- throw new BuilderError( error );
- }
- }
-
+
private Object loadInstance( String name, URI uri, String classname )
{
if( null == uri )
@@ -826,6 +751,5 @@
}
}
}
-
}
Deleted:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -1,202 +0,0 @@
-/*
- * Copyright 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.tools.impl;
-
-import java.util.List;
-import java.util.ArrayList;
-
-import net.dpml.lang.UnknownKeyException;
-
-import net.dpml.library.Library;
-import net.dpml.library.Resource;
-import net.dpml.library.Type;
-
-import net.dpml.tools.info.ProcessorDirective;
-
-/**
- * The Profile interface exposes the working configuration of the build
system.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-class DefaultWorkbench
-{
- private final Library m_library;
- private final ProcessorDirective[] m_processors;
-
- /**
- * Creation of a new workbench instance. The workbench loads the
- * build system configuration and establishes the available processor
- * definitions.
- *
- * @param library the common project library
- * @exception Exception if an error occurs
- */
- DefaultWorkbench( Library library ) throws Exception
- {
- if( null == library )
- {
- throw new NullPointerException( "library" );
- }
-
- m_library = library;
-
- m_processors =
StandardBuilder.CONFIGURATION.getProcessorDirectives();
- }
-
- /**
- * Return the common resource library.
- * @return the library
- */
- public Library getLibrary()
- {
- return m_library;
- }
-
- /**
- * Return an array of all registered processor definitions.
- * @return the processor definition array
- */
- public ProcessorDirective[] getProcessorDirectives()
- {
- return m_processors;
- }
-
- /**
- * Return the sequence of processor definitions supporting production of
a
- * supplied resource. The implementation constructs a sequence of process
- * instances based on the types declared by the resource combined with
- * dependencies declared by respective process defintions. Clients may
- * safely invoke processes sequentially relative to the returned process
- * sequence.
- *
- * @param resource the resource to be produced
- * @return a sorted array of processor definitions supporting resource
production
- * @exception ProcessorNotFoundException if a processor referenced by
another
- * processor as a dependent cannot be resolved
- */
- public ProcessorDirective[] getProcessorSequence( Resource resource )
- throws UnknownKeyException
- {
- Type[] types = resource.getTypes();
- return getDefaultProcessorSequence( types );
- }
-
- ProcessorDirective[] getDefaultProcessorSequence( Type[] types )
- throws UnknownKeyException
- {
- String[] names = getNames( types );
- ProcessorDirective[] processors = new ProcessorDirective[
names.length ];
- for( int i=0; i<names.length; i++ )
- {
- String name = names[i];
- processors[i] = getProcessorDirective( name );
- }
- return processors;
- }
-
- String[] getNames( Type[] types )
- {
- String[] names = getTypeNames( types );
- ProcessorDirective[] descriptors = getProcessorDirectives( names );
- ProcessorDirective[] sorted = sortProcessorDirectives( descriptors );
- String[] list = new String[ sorted.length ];
- for( int i=0; i<sorted.length; i++ )
- {
- ProcessorDirective directive = sorted[i];
- list[i] = directive.getName();
- }
- return list;
- }
-
- String[] getTypeNames( Type[] types )
- {
- String[] names = new String[ types.length ];
- for( int i=0; i<types.length; i++ )
- {
- Type type = types[i];
- names[i] = type.getID();
- }
- return names;
- }
-
- private ProcessorDirective[] getProcessorDirectives( String[] names )
- {
- ArrayList list = new ArrayList();
- for( int i=0; i<names.length; i++ )
- {
- String name = names[i];
- try
- {
- ProcessorDirective directive = getProcessorDirective( name );
- list.add( directive );
- }
- catch( UnknownKeyException e )
- {
- // ok
- }
- }
- return (ProcessorDirective[]) list.toArray( new
ProcessorDirective[0] );
- }
-
- private ProcessorDirective getProcessorDirective( String name ) throws
UnknownKeyException
- {
- for( int i=0; i<m_processors.length; i++ )
- {
- ProcessorDirective directive = m_processors[i];
- if( directive.getName().equals( name ) )
- {
- return directive;
- }
- }
- throw new UnknownKeyException( name );
- }
-
- private ProcessorDirective[] sortProcessorDirectives(
ProcessorDirective[] directives )
- {
- ArrayList visited = new ArrayList();
- ArrayList stack = new ArrayList();
- for( int i=0; i<directives.length; i++ )
- {
- ProcessorDirective directive = directives[i];
- processProcessorDirective( visited, stack, directive );
- }
- return (ProcessorDirective[]) stack.toArray( new
ProcessorDirective[0] );
- }
-
- private void processProcessorDirective(
- List visited, List stack, ProcessorDirective directive )
- {
- if( visited.contains( directive ) )
- {
- return;
- }
- else
- {
- visited.add( directive );
- String[] deps = directive.getDependencies();
- ProcessorDirective[] providers = getProcessorDirectives( deps );
- for( int i=0; i<providers.length; i++ )
- {
- processProcessorDirective( visited, stack, providers[i] );
- }
- stack.add( directive );
- }
- }
-}
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -139,9 +139,10 @@
public boolean build( Resource resource, String[] targets )
{
String path = resource.getResourcePath();
+ String version = resource.getVersion();
Project project = createProject( resource );
project.log(
"\n-------------------------------------------------------------------------"
);
- project.log( path );
+ project.log( path + "#" + version );
project.log(
"-------------------------------------------------------------------------" );
File template = getTemplateFile( resource );
return build( resource, project, template, targets );
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/BuilderDirective.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/BuilderDirective.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/BuilderDirective.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -36,7 +36,6 @@
public final class BuilderDirective extends AbstractDirective
{
private final ListenerDirective[] m_listeners;
- private final ProcessorDirective[] m_processors;
private final String m_phase;
/**
@@ -48,8 +47,7 @@
* @exception UnknownKeyException if a unknown key is referenced
*/
public BuilderDirective(
- ListenerDirective[] listeners, String phase,
- ProcessorDirective[] processors, Properties properties ) throws
UnknownKeyException
+ ListenerDirective[] listeners, String phase, Properties properties )
throws UnknownKeyException
{
super( properties );
@@ -61,10 +59,6 @@
{
throw new NullPointerException( "phase" );
}
- if( null == processors )
- {
- throw new NullPointerException( "processors" );
- }
for( int i=0; i<listeners.length; i++ )
{
if( null == listeners[i] )
@@ -74,8 +68,6 @@
}
m_phase = phase;
- m_processors = processors;
- //m_listeners = sortListenerDirectives( listeners );
m_listeners = listeners;
}
@@ -98,15 +90,6 @@
}
/**
- * Return the set of processor directives.
- * @return the processor directive array
- */
- public ProcessorDirective[] getProcessorDirectives()
- {
- return m_processors;
- }
-
- /**
* Compare this object with another for equality.
* @param other the other object
* @return true if equal
@@ -120,13 +103,9 @@
{
return false;
}
- if( !Arrays.equals( m_listeners, object.m_listeners ) )
- {
- return false;
- }
else
{
- return Arrays.equals( m_processors, object.m_processors );
+ return Arrays.equals( m_listeners, object.m_listeners );
}
}
else
@@ -144,70 +123,6 @@
int hash = super.hashCode();
hash ^= super.hashValue( m_phase );
hash ^= super.hashArray( m_listeners );
- hash ^= super.hashArray( m_processors );
return hash;
}
-
- /*
- private static ListenerDirective[] sortListenerDirectives(
ListenerDirective[] directives )
- throws UnknownKeyException
- {
- ArrayList visited = new ArrayList();
- ArrayList stack = new ArrayList();
- for( int i=0; i<directives.length; i++ )
- {
- ListenerDirective directive = directives[i];
- processListenerDirective( directives, visited, stack, directive
);
- }
- return (ListenerDirective[]) stack.toArray( new ListenerDirective[0]
);
- }
-
- private static void processListenerDirective(
- ListenerDirective[] directives, List visited, List stack,
ListenerDirective directive )
- throws UnknownKeyException
- {
- if( visited.contains( directive ) )
- {
- return;
- }
- else
- {
- visited.add( directive );
- String[] deps = directive.getDependencies();
- ListenerDirective[] providers = getListenerDirectives(
directives, deps );
- for( int i=0; i<providers.length; i++ )
- {
- processListenerDirective( directives, visited, stack,
providers[i] );
- }
- stack.add( directive );
- }
- }
-
- private static ListenerDirective[] getListenerDirectives(
- ListenerDirective[] directives, String[] names ) throws
UnknownKeyException
- {
- ArrayList list = new ArrayList();
- for( int i=0; i<names.length; i++ )
- {
- String name = names[i];
- ListenerDirective directive = getListenerDirective( directives,
name );
- list.add( directive );
- }
- return (ListenerDirective[]) list.toArray( new ListenerDirective[0]
);
- }
-
- private static ListenerDirective getListenerDirective(
- ListenerDirective[] directives, String name ) throws
UnknownKeyException
- {
- for( int i=0; i<directives.length; i++ )
- {
- ListenerDirective directive = directives[i];
- if( directive.getName().equals( name ) )
- {
- return directive;
- }
- }
- throw new UnknownKeyException( name );
- }
- */
}
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/BuilderDirectiveHelper.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/BuilderDirectiveHelper.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/BuilderDirectiveHelper.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -160,7 +160,6 @@
Properties properties = null;
ListenerDirective[] listeners = new ListenerDirective[0];
- ProcessorDirective[] processors = new ProcessorDirective[0];
Element[] children = ElementHelper.getChildren( element );
for( int i=0; i<children.length; i++ )
{
@@ -174,10 +173,6 @@
{
listeners = buildListenerDirectives( child );
}
- else if( PROCESSORS_ELEMENT_NAME.equals( tag ) )
- {
- processors = buildProcessorDirectives( child );
- }
else
{
final String error =
@@ -186,7 +181,7 @@
}
}
Arrays.sort( listeners );
- return new BuilderDirective( listeners, phase, processors,
properties );
+ return new BuilderDirective( listeners, phase, properties );
}
private static ListenerDirective[] buildListenerDirectives( Element
element ) throws Exception
@@ -213,9 +208,8 @@
final String value = ElementHelper.getAttribute( element,
"priority", null );
int priority = Integer.parseInt( value );
final String deps = ElementHelper.getAttribute( element,
"depends", null );
- final String[] depends = buildDependenciesArray( deps );
final Properties properties = buildProperties( element );
- return new ListenerDirective( name, priority, uri, classname,
depends, properties );
+ return new ListenerDirective( name, priority, uri, classname,
properties );
}
else
{
@@ -227,54 +221,6 @@
}
}
- private static ProcessorDirective[] buildProcessorDirectives( Element
element ) throws Exception
- {
- Element[] children = ElementHelper.getChildren( element );
- ProcessorDirective[] processors = new ProcessorDirective[
children.length ];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- processors[i] = buildProcessorDirective( child );
- }
- return processors;
- }
-
- private static ProcessorDirective buildProcessorDirective( Element
element ) throws Exception
- {
- final String tag = element.getTagName();
- if( PROCESSOR_ELEMENT_NAME.equals( tag ) )
- {
- final String name = ElementHelper.getAttribute( element, "name",
null );
- final String spec = ElementHelper.getAttribute( element, "uri",
null );
- final URI uri = createURI( spec );
- final String classname = ElementHelper.getAttribute( element,
"class", null );
- final String deps = ElementHelper.getAttribute( element,
"depends", null );
- final String[] depends = buildDependenciesArray( deps );
- final Properties properties = buildProperties( element );
- return new ProcessorDirective( name, uri, classname, depends,
properties );
- }
- else
- {
- final String error =
- "Invalid resource element name ["
- + tag
- + "].";
- throw new IllegalArgumentException( error );
- }
- }
-
- private static String[] buildDependenciesArray( String value )
- {
- if( null == value )
- {
- return new String[0];
- }
- else
- {
- return value.split( "," );
- }
- }
-
private static Properties buildProperties( Element element )
{
Properties properties = new Properties();
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/ListenerDirective.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/ListenerDirective.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/ListenerDirective.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -37,7 +37,6 @@
private final int m_priority;
private final URI m_uri;
private final String m_classname;
- private final String[] m_dependencies;
/**
* Creation of a new listener directive.
@@ -51,8 +50,7 @@
* @exception IllegalStateException if both classname and urn values are
null
*/
public ListenerDirective(
- String name, int priority, URI uri, String classname,
- String[] dependencies, Properties properties )
+ String name, int priority, URI uri, String classname, Properties
properties )
throws NullPointerException, IllegalStateException
{
super( properties );
@@ -60,10 +58,6 @@
{
throw new NullPointerException( "name" );
}
- if( null == dependencies )
- {
- throw new NullPointerException( "dependencies" );
- }
if( null == uri )
{
if( null == classname )
@@ -76,7 +70,6 @@
}
}
m_priority = priority;
- m_dependencies = dependencies;
m_name = name;
m_uri = uri;
m_classname = classname;
@@ -137,20 +130,6 @@
return m_classname;
}
- /**
- * Return the listener dependencies. If a listener declares a dependency
- * on another listener, it is in effect saying that the names listeners
- * must be executed before this listener. At an operational level
listener
- * dependencies effect the order in which listeners are attached to a
- * an Ant project.
- *
- * @return the array of listener names
- */
- public String[] getDependencies()
- {
- return m_dependencies;
- }
-
/**
* Compares this <code>ListenerDirective</code> object to another object.
* If the object is an <code>ListenerDirective</code>, this function
behaves
@@ -196,13 +175,9 @@
{
return false;
}
- else if( !equals( m_uri, object.m_uri ) )
- {
- return false;
- }
else
{
- return Arrays.equals( m_dependencies, object.m_dependencies
);
+ return equals( m_uri, object.m_uri );
}
}
else
@@ -219,7 +194,6 @@
{
int hash = super.hashCode();
hash ^= super.hashValue( m_name );
- hash ^= super.hashArray( m_dependencies );
hash ^= super.hashValue( m_uri );
hash ^= m_priority;
return hash;
Deleted:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/ProcessorDirective.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/ProcessorDirective.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/info/ProcessorDirective.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -1,191 +0,0 @@
-/*
- * Copyright 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.tools.info;
-
-import java.net.URI;
-import java.util.Properties;
-import java.util.Arrays;
-
-import net.dpml.library.info.AbstractDirective;
-
-/**
- * The ProcessorDirective is an immutable descriptor used to define
- * a build processor.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public final class ProcessorDirective extends AbstractDirective
-{
- private final String m_name;
- private final URI m_uri;
- private final String m_classname;
- private final String[] m_dependencies;
-
- /**
- * Creation of a new processor directive.
- * @param name the processor name
- * @param uri the processor codebase
- * @param classname optional classname of the plugin instantiation target
- * @param dependencies array of listener names that the listener depends
upon
- * @param properties supplimentary properties
- * @exception NullPointerException if name or dependencies are null
- * @exception IllegalStateException if both classname and urn values are
null
- */
- public ProcessorDirective( String name, URI uri, String classname,
- String[] dependencies, Properties properties )
- throws NullPointerException, IllegalStateException
- {
- super( properties );
- if( null == name )
- {
- throw new NullPointerException( "name" );
- }
- if( null == dependencies )
- {
- throw new NullPointerException( "dependencies" );
- }
- if( null == uri )
- {
- if( null == classname )
- {
- final String error =
- "Listener definition ["
- + name
- + "] does not declare a classname or uri value.";
- throw new IllegalStateException( error );
- }
- }
- m_dependencies = dependencies;
- m_name = name;
- m_uri = uri;
- m_classname = classname;
- }
-
- /**
- * Return the listener resource type name.
- * @return the name of the resource type produced by the listener
- */
- public String getName()
- {
- return m_name;
- }
-
- /**
- * Return the listener codebase urn.
- * @return the urn
- */
- public URI getURI()
- {
- return m_uri;
- }
-
- /**
- * Return the listener codebase urn.
- * @return the urn
- */
- public String getURISpec()
- {
- if( null == m_uri )
- {
- return null;
- }
- else
- {
- return m_uri.toASCIIString();
- }
- }
-
- /**
- * Return true if the listener produces a build artifact. If false
- * the listener may contribute to a build process but does not generate a
- * specific artifact type.
- *
- * @return true if the listener produces an artifact
- */
- public String getClassname()
- {
- return m_classname;
- }
-
- /**
- * Return the listener dependencies. If a listener declares a dependency
- * on another listener, it is in effect saying that the names listeners
- * must be executed before this listener. At an operational level
listener
- * dependencies effect the order in which listeners are attached to a
- * an Ant project.
- *
- * @return the array of listener names
- */
- public String[] getDependencies()
- {
- return m_dependencies;
- }
-
- /**
- * Return a string representation of this instance.
- * @return the string value
- */
- public String toString()
- {
- return "processor:" + m_name;
- }
-
- /**
- * Compare this object with another for equality.
- * @param other the other object
- * @return true if equal
- */
- public boolean equals( Object other )
- {
- if( super.equals( other ) && ( other instanceof ProcessorDirective )
)
- {
- ProcessorDirective object = (ProcessorDirective) other;
- if( !equals( m_name, object.m_name ) )
- {
- return false;
- }
- else if( !equals( m_uri, object.m_uri ) )
- {
- return false;
- }
- else
- {
- return Arrays.equals( m_dependencies, object.m_dependencies
);
- }
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Compute the hash value.
- * @return the hashcode value
- */
- public int hashCode()
- {
- int hash = super.hashCode();
- hash ^= super.hashValue( m_name );
- hash ^= super.hashArray( m_dependencies );
- hash ^= super.hashValue( m_uri );
- return hash;
- }
-}
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -116,9 +116,26 @@
}
else
{
+ // this is an Ant initiated bootstrapping of Depot (i.e. we are
+ // not using a project established via the default builder) as
such
+ // we need to declare the build signature argument and construct
the
+ // project context
+
+ String signature = project.getProperty( "build.signature" );
+ if( null != signature )
+ {
+ System.setProperty( "build.signature", signature );
+ }
+
try
{
context = new DefaultContext( project );
+ Resource resource = context.getResource();
+ String name = resource.getName();
+ String version = resource.getVersion();
+ project.log(
"\n-------------------------------------------------------------------------"
);
+ project.log( name + "#" + version );
+ project.log(
"-------------------------------------------------------------------------" );
project.addReference( "project.context", context );
return context;
}
Modified:
trunk/main/depot/tools/builder/src/test/net/dpml/tools/info/ListenerDirectiveTestCase.java
===================================================================
---
trunk/main/depot/tools/builder/src/test/net/dpml/tools/info/ListenerDirectiveTestCase.java
2006-05-28 17:49:29 UTC (rev 1466)
+++
trunk/main/depot/tools/builder/src/test/net/dpml/tools/info/ListenerDirectiveTestCase.java
2006-05-29 06:33:00 UTC (rev 1467)
@@ -31,7 +31,6 @@
static final int PRIORITY = 0;
static final String SPEC = "local:plugin:acme/widget";
static final String CLASSNAME = "net.dpml.tools.process.JarProcess";
- static final String[] DEPS = new String[0];
static final ListenerDirective[] LISTENERS = new ListenerDirective[3];
static
@@ -40,13 +39,13 @@
{
LISTENERS[0] =
new ListenerDirective(
- "jar", 0, (URI) null, CLASSNAME, DEPS, PROPERTIES );
+ "jar", 0, (URI) null, CLASSNAME, PROPERTIES );
LISTENERS[1] =
new ListenerDirective(
- "acme", 1, new URI( SPEC ), null, DEPS, PROPERTIES );
+ "acme", 1, new URI( SPEC ), null, PROPERTIES );
LISTENERS[2] =
new ListenerDirective(
- "widget", 2, (URI) null, CLASSNAME, new String[]{"acme"},
PROPERTIES );
+ "widget", 2, (URI) null, CLASSNAME, PROPERTIES );
}
catch( Exception e )
{
@@ -64,7 +63,7 @@
try
{
new ListenerDirective(
- null, 0, new URI( SPEC ), CLASSNAME, DEPS, PROPERTIES );
+ null, 0, new URI( SPEC ), CLASSNAME, PROPERTIES );
fail( "no-NPE" );
}
catch( NullPointerException e )
@@ -74,25 +73,6 @@
}
/**
- * Validate that the listener directive constructor throws an NPE
- * when supplied with a null depends argument.
- * @exception Exception if an error occurs
- */
- public void testNullDepends() throws Exception
- {
- try
- {
- new ListenerDirective(
- NAME, 0, new URI( SPEC ), CLASSNAME, null, PROPERTIES );
- fail( "no-NPE" );
- }
- catch( NullPointerException e )
- {
- // success
- }
- }
-
- /**
* Test name accessor.
* @exception Exception if an error occurs
*/
@@ -100,7 +80,7 @@
{
ListenerDirective process =
new ListenerDirective(
- NAME, 0, new URI( SPEC ), CLASSNAME, DEPS, PROPERTIES );
+ NAME, 0, new URI( SPEC ), CLASSNAME, PROPERTIES );
assertEquals( "name", NAME, process.getName() );
}
@@ -112,36 +92,18 @@
{
ListenerDirective process =
new ListenerDirective(
- NAME, 0, new URI( SPEC ), CLASSNAME, DEPS, PROPERTIES );
+ NAME, 0, new URI( SPEC ), CLASSNAME, PROPERTIES );
assertEquals( "uri", SPEC, process.getURISpec() );
}
/**
- * Test dependencies accessor.
- * @exception Exception if an error occurs
- */
- public void testDependencies() throws Exception
- {
- String dep1 = "abc";
- String dep2 = "def";
- String[] deps = new String[]{dep1, dep2};
- ListenerDirective process =
- new ListenerDirective( NAME, 0, new URI( SPEC ), CLASSNAME, deps,
PROPERTIES );
- assertEquals( "deps", deps, process.getDependencies() );
- }
-
- /**
* Test directive serialization.
* @exception Exception if an error occurs
*/
public void testSerialization() throws Exception
{
- String dep1 = "abc";
- String dep2 = "def";
- String[] deps = new String[]{dep1, dep2};
ListenerDirective process =
- new ListenerDirective( NAME, 0, new URI( SPEC ), CLASSNAME, deps,
PROPERTIES );
+ new ListenerDirective( NAME, 0, new URI( SPEC ), CLASSNAME,
PROPERTIES );
doSerializationTest( process );
}
-
}
- r1467 - in trunk/main/depot/tools/builder/src: main/net/dpml/tools main/net/dpml/tools/impl main/net/dpml/tools/info main/net/dpml/tools/tasks test/net/dpml/tools test/net/dpml/tools/info, mcconnell at BerliOS, 05/29/2006
Archive powered by MHonArc 2.6.24.