notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1470 - in trunk/main/depot/tools/builder/src/main/net/dpml/tools: . impl tasks
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1470 - in trunk/main/depot/tools/builder/src/main/net/dpml/tools: . impl tasks
- Date: Mon, 29 May 2006 15:05:52 +0200
Author: mcconnell
Date: 2006-05-29 15:05:27 +0200 (Mon, 29 May 2006)
New Revision: 1470
Removed:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/Processor.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/ProcessorNotFoundException.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/AbstractProcessor.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardProcess.java
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/StandardBuildListener.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
Log:
removal of processor related artifacts
Deleted: trunk/main/depot/tools/builder/src/main/net/dpml/tools/Processor.java
===================================================================
--- trunk/main/depot/tools/builder/src/main/net/dpml/tools/Processor.java
2006-05-29 12:52:31 UTC (rev 1469)
+++ trunk/main/depot/tools/builder/src/main/net/dpml/tools/Processor.java
2006-05-29 13:05:27 UTC (rev 1470)
@@ -1,71 +0,0 @@
-/*
- * Copyright 2005-2006 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;
-
-/**
- * The Processor interface is implemented by phase-aware build processors.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public interface Processor
-{
- /**
- * Handle cleanup.
- * @param context the working context
- */
- void clean( Context context );
-
- /**
- * Handle initialization.
- * @param context the working context
- */
- void initialize( Context context );
-
- /**
- * Handle supplimentary codebase preparation.
- * @param context the working context
- */
- void prepare( Context context );
-
- /**
- * Handle type-specific construction in preparation for
- * data packaging.
- * @param context the working context
- */
- void build( Context context );
-
- /**
- * Packaging of type-specific data.
- * @param context the working context
- */
- void pack( Context context );
-
- /**
- * Datatype validation.
- * @param context the working context
- */
- void validate( Context context );
-
- /**
- * Post installation actions.
- * @param context the working context
- */
- void install( Context context );
-}
Deleted:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/ProcessorNotFoundException.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/ProcessorNotFoundException.java
2006-05-29 12:52:31 UTC (rev 1469)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/ProcessorNotFoundException.java
2006-05-29 13:05:27 UTC (rev 1470)
@@ -1,48 +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;
-
-/**
- * A ProcessorNotFoundException is thrown when a requested for a named
- * processor cannot be resolved.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class ProcessorNotFoundException extends Exception
-{
- /**
- * Creation of a new ProcessorNotFoundException.
- * @param message the exception message
- */
- public ProcessorNotFoundException( String message )
- {
- this( message, null );
- }
-
- /**
- * Creation of a new ProcessorNotFoundException.
- * @param message the exception message
- * @param cause the causal excetion
- */
- public ProcessorNotFoundException( String message, Throwable cause )
- {
- super( message, cause );
- }
-}
Deleted:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/AbstractProcessor.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/AbstractProcessor.java
2006-05-29 12:52:31 UTC (rev 1469)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/AbstractProcessor.java
2006-05-29 13:05:27 UTC (rev 1470)
@@ -1,88 +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 net.dpml.tools.Context;
-import net.dpml.tools.Processor;
-
-/**
- * Abstract build processor.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class AbstractProcessor implements Processor
-{
- /**
- * Handle cleanup.
- * @param context the working context
- */
- public void clean( Context context )
- {
- }
-
- /**
- * Handle initialization.
- * @param context the working context
- */
- public void initialize( Context context )
- {
- }
-
- /**
- * Handle supplimentary codebase preparation.
- * @param context the working context
- */
- public void prepare( Context context )
- {
- }
-
- /**
- * Handle type-specific construction in preparation for
- * data packaging.
- * @param context the working context
- */
- public void build( Context context )
- {
- }
-
- /**
- * Packaging of type-specific data.
- * @param context the working context
- */
- public void pack( Context context )
- {
- }
-
- /**
- * Datatype validation.
- * @param context the working context
- */
- public void validate( Context context )
- {
- }
-
- /**
- * Post installation actions.
- * @param context the working context
- */
- public void install( Context context )
- {
- }
-}
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-29 12:52:31 UTC (rev 1469)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
2006-05-29 13:05:27 UTC (rev 1470)
@@ -39,7 +39,6 @@
import net.dpml.tools.info.ListenerDirective;
import net.dpml.tools.Context;
-import net.dpml.tools.Processor;
import net.dpml.transit.Artifact;
import net.dpml.transit.Transit;
@@ -50,6 +49,7 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.types.Path;
/**
@@ -131,6 +131,8 @@
"project.info",
"---------------------------------------------------------------------------\n"
+ resource.getResourcePath()
+ + "#"
+ + resource.getVersion()
+
"\n---------------------------------------------------------------------------"
);
project.setNewProperty( "project.src.dir",
getSrcDirectory().toString() );
@@ -159,6 +161,8 @@
project.log( "adding listener: " + directive.getName(),
Project.MSG_VERBOSE );
BuildListener buildListener = loadBuildListener( directive );
project.addBuildListener( buildListener );
+ BuildEvent event = new BuildEvent( project );
+ buildListener.buildStarted( event );
}
}
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuildListener.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuildListener.java
2006-05-29 12:52:31 UTC (rev 1469)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuildListener.java
2006-05-29 13:05:27 UTC (rev 1470)
@@ -19,7 +19,6 @@
package net.dpml.tools.impl;
import net.dpml.tools.Context;
-import net.dpml.tools.Processor;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.BuildEvent;
@@ -27,10 +26,7 @@
import org.apache.tools.ant.Project;
/**
- * Standard build listener. The implementation provides support
- * for codebase structure normalization and execution of common build
- * procedures conditional to the presence of specific target directories
- * and declared resource production types.
+ * Standard build listener.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
@@ -38,7 +34,6 @@
public class StandardBuildListener implements BuildListener
{
private final Context m_context;
- private final Processor m_standard;
/**
* Creation of a new standard build listener.
@@ -52,7 +47,6 @@
}
m_context = context;
- m_standard = new StandardProcess();
}
/**
@@ -89,43 +83,6 @@
*/
public void targetStarted( BuildEvent event )
{
- Target target = event.getTarget();
- String targetName = target.getName();
- if( "clean".equals( targetName ) )
- {
- event.getProject().log( "executing cleanup phase",
Project.MSG_VERBOSE );
- m_standard.clean( m_context );
- }
- else if( "init".equals( targetName ) )
- {
- event.getProject().log( "executing initialization phase",
Project.MSG_VERBOSE );
- m_standard.initialize( m_context );
- }
- else if( "prepare".equals( targetName ) )
- {
- event.getProject().log( "executing preparation phase",
Project.MSG_VERBOSE );
- m_standard.prepare( m_context );
- }
- else if( "build".equals( targetName ) )
- {
- event.getProject().log( "executing build phase",
Project.MSG_VERBOSE );
- m_standard.build( m_context );
- }
- else if( "package".equals( targetName ) )
- {
- event.getProject().log( "executing packaging phase",
Project.MSG_VERBOSE );
- m_standard.pack( m_context );
- }
- else if( "test".equals( targetName ) )
- {
- event.getProject().log( "executing validation phase",
Project.MSG_VERBOSE );
- m_standard.validate( m_context );
- }
- else if( "install".equals( targetName ) )
- {
- event.getProject().log( "executing installation phase",
Project.MSG_VERBOSE );
- m_standard.install( m_context );
- }
}
/**
Deleted:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardProcess.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardProcess.java
2006-05-29 12:52:31 UTC (rev 1469)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardProcess.java
2006-05-29 13:05:27 UTC (rev 1470)
@@ -1,278 +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.io.File;
-
-import net.dpml.library.Resource;
-import net.dpml.library.Type;
-import net.dpml.library.info.Scope;
-import net.dpml.library.info.JarTypeDirective;
-
-import net.dpml.tools.Context;
-
-import net.dpml.tools.tasks.PrepareTask;
-import net.dpml.tools.tasks.InstallTask;
-import net.dpml.tools.tasks.JavacTask;
-import net.dpml.tools.tasks.JarTask;
-import net.dpml.tools.tasks.JUnitTestTask;
-import net.dpml.tools.tasks.ModuleTask;
-import net.dpml.tools.tasks.RMICTask;
-import net.dpml.tools.tasks.PartTask;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Delete;
-
-/**
- * Standard process dealing with context initialization, codfebase
- * normalization, and artifact installation.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class StandardProcess extends AbstractProcessor
-{
- /**
- * Handles context initialization.
- *
- * @param context the working context
- */
- public void initialize( Context context )
- {
- }
-
- /**
- * Handles normalization of a codebase during which a working copy of
- * the codebase is created under the target/build directory. Global
- * filters are applied and merging of the src/main with etc/main and
- * src/test wityh etc/test is undertaken.
- *
- * @param context the working context
- */
- public void prepare( Context context )
- {
- }
-
- /**
- * Handles build related concerns based on the target directory layout
content.
- *
- * @param context the working context
- */
- public void build( Context context )
- {
- /*
- // If a target/build/main or target/build/test exists then we should
be
- // triggering content compilation. Compilation requires project
input
- // with respect to javac source selection and subsequent rmic
- // postprocessing (both of which can be expressed as process data
associated
- // with the target/build/main and target/build/test directories). In
addition
- // there may be additional processes that need to be triggered (such
as
- // type compilation which consumes compiled classes).
-
- if( context.getTargetBuildMainDirectory().exists() )
- {
- // we need to add in here the aquisition of javac task
- // parameters based on transformation directives associated
- // with the target/classes/main directory
-
- Project project = context.getProject();
- final JavacTask task = new JavacTask( context );
- task.setProject( project );
- task.init();
- task.execute();
- }
-
- // resolve rmic selection
-
- Resource resource = context.getResource();
- if( resource.isa( "jar" ) )
- {
- Type type = resource.getType( "jar" );
- if( type instanceof JarTypeDirective )
- {
- JarTypeDirective directive = (JarTypeDirective) type;
- String[] includes = directive.getRMICIncludes();
- String[] excludes = directive.getRMICExcludes();
- RMICTask rmicTask = new RMICTask( context );
- Project project = context.getProject();
- rmicTask.setProject( project );
- rmicTask.setIncludes( includes );
- rmicTask.setExcludes( excludes );
- rmicTask.init();
- rmicTask.execute();
- }
- }
-
- // conditionaly compile test classes
-
- File source = context.getTargetBuildTestDirectory();
- if( source.exists() )
- {
- // we need to add in here the aquisition of javac task
- // parameters based on transformation directives associated
- // with the target/classes/main directory
-
- Project project = context.getProject();
- final JavacTask task = new JavacTask( context );
- task.setProject( project );
- File destination = context.getTargetClassesTestDirectory();
- task.setSrc( source );
- task.setDest( destination );
- Path path = context.getPath( Scope.TEST );
- File main = context.getTargetClassesMainDirectory();
- if( main.exists() )
- {
- path.createPathElement().setLocation( main );
- }
- task.setClasspath( path );
- task.init();
- task.execute();
- }
- */
- }
-
- /**
- * Packaging of type-specific data.
- * @param context the working context
- */
- public void pack( Context context )
- {
- /*
- Project project = context.getProject();
- Resource resource = context.getResource();
-
- // handle jar file packaging
-
- if( resource.isa( "jar" ) )
- {
- File base = context.getTargetClassesMainDirectory();
- final File jar = getJarFile( context );
- if( base.exists() )
- {
- final JarTask task = new JarTask();
- task.setProject( project );
- task.setTaskName( "jar" );
- task.setSrc( base );
- task.setDest( jar );
- task.init();
- task.execute();
- }
- }
-
- // handle part production
-
- if( resource.isa( "part" ) )
- {
- try
- {
- PartTask task = new PartTask();
- task.setProject( project );
- task.setTaskName( "part" );
- task.init();
- task.execute();
- }
- catch( BuildException e )
- {
- throw e;
- }
- catch( Throwable e )
- {
- final String error =
- "Unexpected failure during part externalization.";
- throw new BuildException( error, e );
- }
- }
-
- // handle module export
-
- if( resource.isa( "module" ) )
- {
- final ModuleTask task = new ModuleTask();
- task.setProject( project );
- task.setTaskName( "module" );
- task.init();
- task.execute();
- }
- */
- }
-
- /**
- * Datatype validation.
- * @param context the working context
- */
- public void validate( Context context )
- {
- Project project = context.getProject();
- File src = context.getTargetBuildTestDirectory();
- if( src.exists() )
- {
- Path path = context.getPath( Scope.TEST );
- final File jar = getJarFile( context );
- if( jar.exists() )
- {
- path.createPathElement().setLocation( jar );
- }
- else if( context.getTargetClassesMainDirectory().exists() )
- {
- File main = context.getTargetClassesMainDirectory();
- path.createPathElement().setLocation( main );
- }
- final File dest = context.getTargetClassesTestDirectory();
- path.createPathElement().setLocation( dest );
- final JUnitTestTask task = new JUnitTestTask();
- task.setProject( project );
- task.setTaskName( "junit" );
- task.setSrc( src );
- task.setClasspath( path );
- task.init();
- task.execute();
- }
- }
-
- /**
- * Handles replication of content under target/deliverables to the
- * common cache directory - includes validation of the presence of
declared
- * artifacts during execution.
- *
- * @param context the working context
- */
- public void install( Context context )
- {
- }
-
- /**
- * Handles cleanup of generated content.
- *
- * @param context the working context
- */
- public void clean( Context context )
- {
- }
-
- private File getJarFile( Context context )
- {
- Project project = context.getProject();
- File deliverables = context.getTargetDeliverablesDirectory();
- File jars = new File( deliverables, "jars" );
- String filename = context.getLayoutPath( "jar" );
- return new File( jars, filename );
- }
-}
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-29 12:52:31 UTC (rev 1469)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
2006-05-29 13:05:27 UTC (rev 1470)
@@ -109,10 +109,26 @@
public Context getContext()
{
Project project = getProject();
- Context context = (Context) project.getReference( "project.context"
);
- if( null != context )
+ Object object = project.getReference( "project.context" );
+ if( object != null )
{
- return context;
+ if( object instanceof Context )
+ {
+ return (Context) object;
+ }
+ else
+ {
+ //System.out.println(
+ // net.dpml.lang.StandardClassLoader.toString(
+ // object.getClass().getClassLoader(),
+ // Context.class.getClassLoader() ) );
+
+ final String error =
+ "Object assigned under the 'project.context' key is not
assignable to a context instance."
+ + "\nObject: " + object.getClass().getName()
+ + "\nExpecting: " + Context.class.getName();
+ throw new IllegalStateException( error );
+ }
}
else
{
@@ -129,7 +145,7 @@
try
{
- context = new DefaultContext( project );
+ Context context = new DefaultContext( project );
Resource resource = context.getResource();
String name = resource.getName();
String version = resource.getVersion();
- r1470 - in trunk/main/depot/tools/builder/src/main/net/dpml/tools: . impl tasks, mcconnell at BerliOS, 05/29/2006
Archive powered by MHonArc 2.6.24.