Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1173 - in development/main: magic magic/bootstrap/src/main/net/dpml/magic/bootstrap magic/spells/checkstyle magic/spells/checkstyle/etc/deliverables magic/spells/checkstyle/etc/deliverables/formats magic/spells/checkstyle/etc/deliverables/templates magic/spells/checkstyle/etc/deliverables/xsls magic/spells/checkstyle/etc/templates magic/spells/checkstyle/src/main/net/dpml/magic/checkstyle magic/spells/style magic/spells/style/src magic/spells/style/src/main magic/spells/style/src/main/net magic/spells/style/src/main/net/dpml magic/spells/style/src/main/net/dpml/magic magic/spells/style/src/main/net/dpml/magic/style transit/plugin/src/main/net/dpml/transit/control util util/cli util/criteria/src/main/net/dpml/criteria

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: r1173 - in development/main: magic magic/bootstrap/src/main/net/dpml/magic/bootstrap magic/spells/checkstyle magic/spells/checkstyle/etc/deliverables magic/spells/checkstyle/etc/deliverables/formats magic/spells/checkstyle/etc/deliverables/templates magic/spells/checkstyle/etc/deliverables/xsls magic/spells/checkstyle/etc/templates magic/spells/checkstyle/src/main/net/dpml/magic/checkstyle magic/spells/style magic/spells/style/src magic/spells/style/src/main magic/spells/style/src/main/net magic/spells/style/src/main/net/dpml magic/spells/style/src/main/net/dpml/magic magic/spells/style/src/main/net/dpml/magic/style transit/plugin/src/main/net/dpml/transit/control util util/cli util/criteria/src/main/net/dpml/criteria
  • Date: Mon, 13 Dec 2004 17:01:23 +0100

Author: mcconnell
Date: Mon Dec 13 17:01:22 2004
New Revision: 1173

Added:
development/main/magic/spells/checkstyle/etc/deliverables/
development/main/magic/spells/checkstyle/etc/deliverables/formats/

development/main/magic/spells/checkstyle/etc/deliverables/formats/standard.format
development/main/magic/spells/checkstyle/etc/deliverables/templates/

development/main/magic/spells/checkstyle/etc/deliverables/templates/checkstyle.template
development/main/magic/spells/checkstyle/etc/deliverables/xsls/

development/main/magic/spells/checkstyle/etc/deliverables/xsls/checkstyle-frames.xsl
(contents, props changed)
development/main/magic/spells/style/
development/main/magic/spells/style/build.xml (contents, props changed)
development/main/magic/spells/style/src/
development/main/magic/spells/style/src/main/
development/main/magic/spells/style/src/main/net/
development/main/magic/spells/style/src/main/net/dpml/
development/main/magic/spells/style/src/main/net/dpml/magic/
development/main/magic/spells/style/src/main/net/dpml/magic/style/

development/main/magic/spells/style/src/main/net/dpml/magic/style/StyleTask.java
(contents, props changed)

development/main/magic/spells/style/src/main/net/dpml/magic/style/antlib.xml
(contents, props changed)

development/main/transit/plugin/src/main/net/dpml/transit/control/TracePolicy.java
(contents, props changed)
development/main/util/criteria/src/main/net/dpml/criteria/Dictionary.java
(contents, props changed)
Removed:
development/main/magic/spells/checkstyle/etc/templates/
Modified:

development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/MainTask.java

development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/PluginTask.java

development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/TransitComponentHelper.java
development/main/magic/index.xml
development/main/magic/spells/checkstyle/build.xml

development/main/magic/spells/checkstyle/src/main/net/dpml/magic/checkstyle/CheckstyleTask.java
development/main/util/cli/build.xml
development/main/util/module.xml
Log:
Improvements to plugin handling within the PluginTask and the addition of
plugin initialization options to the MainTask. Addition of a style spell
that takes xls specs as artifact uris and updating of the checkstyle task to
use the new style task. Also updated the checkstyle template to be
referencable via an artifact uri.

Modified:
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/MainTask.java
==============================================================================
---
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/MainTask.java
(original)
+++
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/MainTask.java
Mon Dec 13 17:01:22 2004
@@ -19,6 +19,8 @@
package net.dpml.magic.bootstrap;

import java.io.File;
+import java.util.ArrayList;
+import java.util.List;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.ComponentHelper;
@@ -35,9 +37,11 @@
import net.dpml.transit.repository.StandardLoader;

/**
- * Task that initializes the Transit sub-system and establishes a set of ant
properties
- * enabling convenient script based access to DPML dirctories.
-
+ * Task that initializes the Transit sub-system duruing which a transit
+ * is assigned to the current project. In addition the initization
procedures
+ * establishes a set of ant properties enabling convenient script based
access
+ * to DPML dirctories.
+ *
* <pre>
&lt;project name="example"
xmlns:TRANSIT="antlib:net.dpml.transit">
@@ -64,62 +68,55 @@
//
------------------------------------------------------------------------

/**
- * Key.
+ * The one-time initialized state of the transit system.
*/
- public static final String KEY = "dpml.transit.plugin";
+ private static boolean init = false;
+
+ //
------------------------------------------------------------------------
+ // state
+ //
------------------------------------------------------------------------

/**
- * TRANSIT instance.
+ * List of plugin declarations.
*/
- private static final Transit TRANSIT = setupTransit();
+ private List m_plugins = new ArrayList();
+
+ //
------------------------------------------------------------------------
+ // Task
+ //
------------------------------------------------------------------------

/**
- * The plugin repository.
+ * Task initialization.
*/
- private static final Repository REPOSITORY = setupRepository();
-
- private static Transit setupTransit()
+ public void init()
{
- try
- {
- return Transit.getInstance();
- }
- catch( TransitException e )
- {
- e.printStackTrace();
- final String error =
- "Failed to initialize Transit.";
- throw new RuntimeException( error, e );
- }
+ setTaskName( "transit" );
}

- private static Repository setupRepository()
+ /**
+ * Create and return a new plugin definition.
+ * @return the plugin definition
+ */
+ public PluginTask createPlugin()
{
- try
- {
- return new StandardLoader();
- }
- catch( TransitException e )
- {
- e.printStackTrace();
- final String error =
- "Failed to initialize Repository.";
- throw new RuntimeException( error, e );
- }
+ PluginTask task = new PluginTask();
+ task.init();
+ m_plugins.add( task );
+ return task;
}

- private static boolean init = false;
-
- //
------------------------------------------------------------------------
- // Task
- //
------------------------------------------------------------------------
-
- public void setProject( Project project )
+ /**
+ * Updates properties on the current project and install any plugins
declared
+ * as children of the transit init tag.
+ *
+ * @exception BuildException if an execution error occurs
+ */
+ public void execute() throws BuildException
{
- super.setProject( project );
+ Project project = getProject();
+ checkProperties( project );
if( !init )
{
- setTaskName( "transit" );
setupMonitors();
File home = Transit.HOME;
log( "home: " + home.getAbsolutePath() );
@@ -128,59 +125,93 @@
TransitComponentHelper.initialize( project );
init = true;
}
+
+ PluginTask[] plugins = (PluginTask[]) m_plugins.toArray( new
PluginTask[0] );
+ for( int i=0; i<plugins.length; i++ )
+ {
+ PluginTask plugin = plugins[i];
+ //register( plugin );
+ }
}

- /**
- * Return the repository service.
- * @return the repository service
- */
- Repository getRepository()
+ /*
+ private static void register( Project project, PluginTask plugin )
{
- return REPOSITORY;
+ URI uri = plugin.getURI();
+ if( !m_uris.contains( uri ) )
+ {
+ plugin.setProject( project );
+ plugin.init();
+ plugin.execute();
+ }
}
+ */
+

/**
* Declares four properties into the current project covering the DPML
home directory,
* template directory, doc and main cache directories.
+ * @param project the current project
* @exception BuildException if an execution error occurs
*/
- public void execute() throws BuildException
+ private void checkProperties( Project project ) throws BuildException
{
File home = Transit.HOME;
File templates = new File( home, "templates" );
File docs = new File( home, "docs" );
File cache = new File( home, "main" );
- updateProperty( "dpml.home", home.getAbsolutePath() );
- updateProperty( "dpml.templates", templates.getAbsolutePath() );
- updateProperty( "dpml.docs", docs.getAbsolutePath() );
- updateProperty( "dpml.cache", cache.getAbsolutePath() );
+ updateProperty( project, "dpml.home", home.getAbsolutePath() );
+ updateProperty( project, "dpml.templates",
templates.getAbsolutePath() );
+ updateProperty( project, "dpml.docs", docs.getAbsolutePath() );
+ updateProperty( project, "dpml.cache", cache.getAbsolutePath() );
}

- private void updateProperty( String key, String value )
+
+ /**
+ * Setup the monitors.
+ */
+ private void setupMonitors()
{
- String v = getProject().getProperty( key );
- if( null == v )
+ try
{
- getProject().setProperty( key, value );
+ Transit instance = Transit.getInstance();
+ Adapter adapter = new AntAdapter( this );
+ instance.getRepositoryMonitorRouter().addMonitor(
+ new RepositoryMonitorAdapter( adapter ) );
+ instance.getCacheMonitorRouter().addMonitor(
+ new CacheMonitorAdapter( adapter ) );
+ instance.getNetworkMonitorRouter().addMonitor(
+ new NetworkMonitorAdapter( adapter ) );
}
- else if( !v.equals( value ) )
+ catch( TransitException e )
{
- getProject().setNewProperty( key, value );
+ final String error =
+ "Failed to initialize Transit.";
+ throw new BuildException( error, e );
}
}

/**
- * Setup the monitors.
+ * Update a property. If the property is already defined, the
implementation
+ * checks if the current value is the same as the supplied value and if
not the
+ * property value is updated. If not property exists for the given key a
new
+ * property will be created.
+ *
+ * @param project the ant project
+ * @param key the property key
+ * @param value the property value
*/
- private void setupMonitors()
+ private void updateProperty( Project project, String key, String value )
{
- Adapter adapter = new AntAdapter( this );
- TRANSIT.getRepositoryMonitorRouter().addMonitor(
- new RepositoryMonitorAdapter( adapter ) );
- TRANSIT.getCacheMonitorRouter().addMonitor(
- new CacheMonitorAdapter( adapter ) );
- TRANSIT.getNetworkMonitorRouter().addMonitor(
- new NetworkMonitorAdapter( adapter ) );
+ String v = project.getProperty( key );
+ if( null == v )
+ {
+ project.setProperty( key, value );
+ }
+ else if( !v.equals( value ) )
+ {
+ project.setNewProperty( key, value );
+ }
}
}


Modified:
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/PluginTask.java
==============================================================================
---
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/PluginTask.java
(original)
+++
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/PluginTask.java
Mon Dec 13 17:01:22 2004
@@ -22,6 +22,10 @@
import java.util.List;
import java.util.ArrayList;

+import net.dpml.transit.TransitException;
+import net.dpml.transit.repository.Repository;
+import net.dpml.transit.repository.StandardLoader;
+import net.dpml.transit.repository.Plugin;
import net.dpml.transit.util.ElementHelper;

import org.apache.tools.ant.BuildException;
@@ -38,8 +42,10 @@
* @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 PluginTask extends MainTask
+public class PluginTask extends org.apache.tools.ant.Task
{
+ private static final Repository REPOSITORY = setupRepository();
+
/**
* The uri of the plugin to load.
*/
@@ -66,11 +72,17 @@
private String m_name;

/**
+ * A flag indicating that nested directives have been provided.
+ */
+ private boolean m_flag = false;
+
+ /**
* Create and associate a new antlib urn entry with the plugin.
* @return the new antlib entry
*/
public Antlib createAntlib()
{
+ m_flag = true;
final Antlib antlib = new Antlib();
m_antlibs.add( antlib );
return antlib;
@@ -83,6 +95,7 @@
*/
public Task createTask()
{
+ m_flag = true;
final Task task = new Task();
m_tasks.add( task );
return task;
@@ -94,6 +107,7 @@
*/
public Listener createListener()
{
+ m_flag = true;
final Listener listener = new Listener();
m_listeners.add( listener );
return listener;
@@ -109,6 +123,26 @@
}

/**
+ * Return the artifact uri of the plugin.
+ * @return the plugin uri
+ */
+ public URI getUri()
+ {
+ try
+ {
+ return new URI( m_uri );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Cound not convert the supplied uri spec ["
+ + m_uri
+ + "] to a formal URI.";
+ throw new BuildException( error, e );
+ }
+ }
+
+ /**
* Load the plugin and handle registration of listeners, tasks, and antlib
* declarations based on the nested nested task directives.
* @exception BuildException if an error occurs during plugin loading or
deployment
@@ -127,6 +161,11 @@
final ComponentHelper helper =
ComponentHelper.getComponentHelper( project );

+ if( !m_flag )
+ {
+ createAntlib();
+ }
+
try
{
URI uri = new URI( m_uri );
@@ -189,7 +228,7 @@
Antlib[] antlibs = (Antlib[]) m_antlibs.toArray( new Antlib[0] );
for( int i=0; i < antlibs.length; i++ )
{
- loadAntlib( loader, helper, antlibs[i] );
+ loadAntlib( uri, loader, helper, antlibs[i] );
}
}
catch( BuildException e )
@@ -213,10 +252,39 @@
* @param antlib the antlib to load
* @exception Exception if it doesn't work out
*/
- private void loadAntlib( ClassLoader classloader, ComponentHelper
helper, Antlib antlib ) throws Exception
+ private void loadAntlib(
+ URI uri, ClassLoader classloader, ComponentHelper helper, Antlib
antlib ) throws Exception
{
+ Plugin descriptor = getRepository().getPluginDescriptor( uri );
+ String resource = antlib.getPath();
+ if( null == resource )
+ {
+ resource = descriptor.getResource();
+ }
+ if( null == resource )
+ {
+ final String error =
+ "Resource path for the antlib is not declared in the plugin
descriptor "
+ + "or antlib directive ["
+ + uri
+ + "]";
+ throw new BuildException( error );
+ }
+
String urn = antlib.getURN();
- String resource = antlib.getPath();
+ if( null == urn )
+ {
+ urn = descriptor.getURN();
+ }
+ if( null == urn )
+ {
+ final String error =
+ "URN for the antlib is not declared in the plugin descriptor "
+ + "or antlib directive ["
+ + uri
+ + "]";
+ throw new BuildException( error );
+ }

InputStream input = classloader.getResourceAsStream( resource );
Element root = ElementHelper.getRootElement( input );
@@ -436,17 +504,11 @@

/**
* Return the antlib urn.
- * @return the urn
- * @exception BuildException if the urn attribute is missing
+ * @return the urn (possibly null in which case the a urn must be
declared
+ * within the plugin descriptor)
*/
public String getURN() throws BuildException
{
- if( null == m_urn )
- {
- final String error =
- "Missing antlib urn attribute.";
- throw new BuildException( error );
- }
return m_urn;
}

@@ -461,18 +523,34 @@

/**
* Return the antlib resource path.
- * @return the path
- * @exception BuildException if the resource attribute is missing
+ * @return the path (possibly null in which case the resource
reference
+ * must exist in the polugin descriptor)
*/
public String getPath() throws BuildException
{
- if( null == m_urn )
- {
- final String error =
- "Missing antlib resource attribute.";
- throw new BuildException( error );
- }
return m_path;
}
}
+
+ private static Repository getRepository()
+ {
+ if( null == REPOSITORY )
+ {
+ throw new NullPointerException( "REPOSITORY" );
+ }
+ return REPOSITORY;
+ }
+
+ private static Repository setupRepository()
+ {
+ try
+ {
+ return new StandardLoader();
+ }
+ catch( TransitException e )
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
}

Modified:
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/TransitComponentHelper.java
==============================================================================
---
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/TransitComponentHelper.java
(original)
+++
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/TransitComponentHelper.java
Mon Dec 13 17:01:22 2004
@@ -103,7 +103,6 @@
*/
private static Vector m_uris = new Vector();

-
//------------------------------------------------------------------------
// state
//------------------------------------------------------------------------

Modified: development/main/magic/index.xml
==============================================================================
--- development/main/magic/index.xml (original)
+++ development/main/magic/index.xml Mon Dec 13 17:01:22 2004
@@ -109,7 +109,21 @@
</info>
<dependencies>
<include key="checkstyle"/>
- <include key="dpml-magic-core" build="true"/>
+ <include key="dpml-magic-core"/>
+ <include key="dpml-magic-style"/>
+ </dependencies>
+ </project>
+
+ <project basedir="spells/style">
+ <info>
+ <group>dpml/magic</group>
+ <name>dpml-magic-style</name>
+ <version>1.0.0</version>
+ <status>SNAPSHOT</status>
+ <type>jar</type>
+ </info>
+ <dependencies>
+ <include key="dpml-transit-main"/>
</dependencies>
</project>


Modified: development/main/magic/spells/checkstyle/build.xml
==============================================================================
--- development/main/magic/spells/checkstyle/build.xml (original)
+++ development/main/magic/spells/checkstyle/build.xml Mon Dec 13 17:01:22
2004
@@ -25,11 +25,12 @@

<target name="init" depends="standard.init">
<x:filter feature="plugin" token="PLUGIN-URI"/>
+ <x:filter feature="plugin" key="dpml-magic-style"
token="STYLE-PLUGIN-URI"/>
</target>

<target name="build" depends="standard.build">
<x:export>
- <antlib urn="antlib:net.dpml.magic.checkstyle"
resource="net/dpml/magic/checkstyle/antlib.xml"/>
+ <antlib urn="plugin:net.dpml.magic.checkstyle"
resource="net/dpml/magic/checkstyle/antlib.xml"/>
</x:export>
</target>


Added:
development/main/magic/spells/checkstyle/etc/deliverables/formats/standard.format
==============================================================================
--- (empty file)
+++
development/main/magic/spells/checkstyle/etc/deliverables/formats/standard.format
Mon Dec 13 17:01:22 2004
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd";>
+<module name="Checker">
+ <module name="TreeWalker">
+ <module
name="com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck">
+ <property name="severity" value="ignore"/>
+ <property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheck">
+ <property name="format" value="\s+$"/>
+ <property name="ignoreCase" value="false"/>
+ <property name="ignoreComments" value="false"/>
+ <property name="message" value="Line has trailing spaces."/>
+ <property name="severity" value="ignore"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.ModifierOrderCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.RedundantModifierCheck">
+ <property name="severity" value="ignore"/>
+ <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="com.puppycrawl.tools.checkstyle.checks.UpperEllCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.blocks.AvoidNestedBlocksCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck">
+ <property name="option" value="stmt"/>
+ <property name="severity" value="warning"/>
+ <property name="tokens" value="LITERAL_CATCH, LITERAL_DO,
LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY,
LITERAL_WHILE, STATIC_INIT"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck">
+ <property name="maxLineLength" value="80"/>
+ <property name="option" value="nl"/>
+ <property name="severity" value="warning"/>
+ <property name="tokens" value="CLASS_DEF, CTOR_DEF,
INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY,
LITERAL_WHILE, METHOD_DEF"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck">
+ <property name="option" value="alone"/>
+ <property name="severity" value="warning"/>
+ <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE,
LITERAL_TRY"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.AvoidInlineConditionalsCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.DoubleCheckedLockingCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.IllegalInstantiationCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.MissingSwitchDefaultCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <!--
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.RedundantThrowsCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ -->
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanExpressionCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanReturnCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck">
+ <property name="severity" value="ignore"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.design.HideUtilityClassConstructorCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.design.InterfaceIsTypeCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.imports.RedundantImportCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.LocalFinalVariableNameCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck">
+ <property name="applyToPackage" value="true"/>
+ <property name="applyToPrivate" value="true"/>
+ <property name="applyToProtected" value="true"/>
+ <property name="applyToPublic" value="true"/>
+ <property name="format" value="^m_[a-z][a-zA-Z0-9]*$"/>
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.MethodNameCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.StaticVariableNameCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.naming.TypeNameCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck">
+ <property name="ignorePattern" value="^$"/>
+ <property name="max" value="80"/>
+ <property name="severity" value="ignore"/>
+ <property name="tabWidth" value="4"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.sizes.MethodLengthCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck">
+ <property name="max" value="12"/>
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck">
+ <property name="option" value="space"/>
+ <property name="severity" value="warning"/>
+ <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL,
RPAREN, SUPER_CTOR_CALL"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.whitespace.TabCharacterCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck">
+ <property name="severity" value="warning"/>
+ </module>
+ <module
name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck">
+ <property name="severity" value="warning"/>
+ <property name="tokens" value="BAND, BAND_ASSIGN, BOR,
BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN,
LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS,
PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR,
STAR_ASSIGN"/> <!-- LITERAL_SYNCHRONIZED, ASSIGN, LITERAL_FOR, LITERAL_WHILE,
-->
+ </module>
+ </module>
+</module>

Added:
development/main/magic/spells/checkstyle/etc/deliverables/templates/checkstyle.template
==============================================================================
--- (empty file)
+++
development/main/magic/spells/checkstyle/etc/deliverables/templates/checkstyle.template
Mon Dec 13 17:01:22 2004
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ 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.
+-->
+
+<project name="checkstyle"
+ xmlns:transit="antlib:net.dpml.transit" >
+
+ <target name="checkstyle" depends="prepare"
unless="project.checkstyle.disable" >
+ <transit:plugin uri="@PLUGIN-URI@"/>
+ <transit:plugin uri="@STYLE-PLUGIN-URI@"/>
+ <mkdir dir="target/checkstyle"/>
+ <checkstyle xmlns="plugin:net.dpml.magic.checkstyle"
+ uri="artifact:format:dpml/magic/standard">
+ <formatter type="xml"
toFile="target/checkstyle/checkstyle_errors.xml"/>
+ </checkstyle>
+ <mkdir dir="target/reports/checkstyle"/>
+ <style xmlns="plugin:net.dpml.magic.style"
+ in="target/checkstyle/checkstyle_errors.xml"
+ out="target/reports/checkstyle/checkstyle_report.html"
+ style="artifact:xsl:dpml/magic/checkstyle-frames"/>
+ </target>
+
+</project>

Added:
development/main/magic/spells/checkstyle/etc/deliverables/xsls/checkstyle-frames.xsl
==============================================================================
--- (empty file)
+++
development/main/magic/spells/checkstyle/etc/deliverables/xsls/checkstyle-frames.xsl
Mon Dec 13 17:01:22 2004
@@ -0,0 +1,382 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0"
+ xmlns:lxslt="http://xml.apache.org/xslt";
+ xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
+ extension-element-prefixes="redirect">
+
+<!--
+ The Apache Software License, Version 1.1
+
+ Copyright (c) 2002 The Apache Software Foundation. All rights
+ reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ 3. The end-user documentation included with the redistribution, if
+ any, must include the following acknowlegement:
+ "This product includes software developed by the
+ Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowlegement may appear in the software itself,
+ if and wherever such third-party acknowlegements normally appear.
+
+ 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ Foundation" must not be used to endorse or promote products derived
+ from this software without prior written permission. For written
+ permission, please contact apache AT apache.org.
+
+ 5. Products derived from this software may not be called "Apache"
+ nor may "Apache" appear in their names without prior written
+ permission of the Apache Group.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Apache Software Foundation. For more
+ information on the Apache Software Foundation, please see
+ <http://www.apache.org/>.
+ -->
+
+ <xsl:output method="html" indent="yes" encoding="US-ASCII"/>
+ <xsl:decimal-format decimal-separator="." grouping-separator="," />
+
+ <xsl:param name="output.dir" select="'.'"/>
+
+ <xsl:template match="checkstyle">
+ <!-- create the index.html -->
+ <redirect:write file="{$output.dir}/index.html">
+ <xsl:call-template name="index.html"/>
+ </redirect:write>
+
+ <!-- create the stylesheet.css -->
+ <redirect:write file="{$output.dir}/stylesheet.css">
+ <xsl:call-template name="stylesheet.css"/>
+ </redirect:write>
+
+ <!-- create the overview-summary.html at the root -->
+ <redirect:write file="{$output.dir}/overview-frame.html">
+ <xsl:apply-templates select="." mode="overview"/>
+ </redirect:write>
+
+ <!-- create the all-classes.html at the root -->
+ <redirect:write file="{$output.dir}/allclasses-frame.html">
+ <xsl:apply-templates select="." mode="all.classes"/>
+ </redirect:write>
+
+ <!-- process all files -->
+ <xsl:apply-templates select="file"/>
+ </xsl:template>
+
+ <xsl:template name="index.html">
+ <html>
+ <head>
+ <title>CheckStyle Audit</title>
+ </head>
+ <frameset cols="20%,80%">
+ <frame src="allclasses-frame.html" name="fileListFrame"/>
+ <frame src="overview-frame.html" name="fileFrame"/>
+ </frameset>
+ <noframes>
+ <h2>Frame Alert</h2>
+ <p>
+ This document is designed to be viewed using the frames
feature. If you see this message, you are using a non-frame-capable web
client.
+ </p>
+ </noframes>
+ </html>
+ </xsl:template>
+
+ <xsl:template name="pageHeader">
+ <table border="0" cellpadding="0" cellspacing="0" width="100%">
+ <tr>
+ <td class="text-align:right"><h2>CheckStyle Audit</h2></td>
+ </tr>
+ <tr>
+ <td class="text-align:right">Designed for use with <a
href='http://checkstyle.sourceforge.net/'>CheckStyle</a> and <a
href='http://jakarta.apache.org'>Ant</a>.</td>
+ </tr>
+ </table>
+ <hr size="1"/>
+ </xsl:template>
+
+ <xsl:template match="checkstyle" mode="overview">
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css"
href="stylesheet.css"/>
+ </head>
+ <body>
+ <!-- page header -->
+ <xsl:call-template name="pageHeader"/>
+
+ <!-- Summary part -->
+ <xsl:apply-templates select="." mode="summary"/>
+ <hr size="1" width="100%" align="left"/>
+
+ <!-- File list part -->
+ <xsl:apply-templates select="." mode="filelist"/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template name="stylesheet.css">
+ .bannercell {
+ border: 0px;
+ padding: 0px;
+ }
+ body {
+ margin-left: 10;
+ margin-right: 10;
+ font:normal 80% arial,helvetica,sanserif;
+ background-color:#FFFFFF;
+ color:#000000;
+ }
+ .a td {
+ background: #efefef;
+ }
+ .b td {
+ background: #fff;
+ }
+ th, td {
+ text-align: left;
+ vertical-align: top;
+ }
+ th {
+ font-weight:bold;
+ background: #ccc;
+ color: black;
+ }
+ table, th, td {
+ font-size:100%;
+ border: none
+ }
+ table.log tr td, tr th {
+
+ }
+ h2 {
+ font-weight:bold;
+ font-size:140%;
+ margin-bottom: 5;
+ }
+ h3 {
+ font-size:100%;
+ font-weight:bold;
+ background: #525D76;
+ color: white;
+ text-decoration: none;
+ padding: 5px;
+ margin-right: 2px;
+ margin-left: 2px;
+ margin-bottom: 0;
+ }
+ </xsl:template>
+
+ <!--
+ Replace DOS characters in a path.
+ Replace '\' with '/', ':' with '_'.
+ -->
+ <xsl:template name="from-dos">
+ <xsl:param name="path"/>
+ <xsl:value-of select="translate($path, '\:', '/_')"/>
+ </xsl:template>
+
+ <!--
+ Creates an all-classes.html file that contains a link to all files.
+ -->
+ <xsl:template match="checkstyle" mode="all.classes">
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css"
href="stylesheet.css"/>
+ </head>
+ <body>
+ <h2>Files</h2>
+ <p><a href="overview-frame.html"
target="fileFrame">Summary</a></p>
+ <p>
+ <table width="100%">
+ <!-- For each file create its part -->
+ <xsl:apply-templates select="file"
mode="all.classes">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </table>
+ </p>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="checkstyle" mode="filelist">
+ <h3>Files</h3>
+ <table class="log" border="0" cellpadding="5" cellspacing="2"
width="100%">
+ <tr>
+ <th>Name</th>
+ <th>Errors</th>
+ </tr>
+ <xsl:apply-templates select="file" mode="filelist">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="file" mode="filelist">
+ <xsl:variable name="first">
+ <xsl:call-template name="isfirst">
+ <xsl:with-param name="name" select="@name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name" select="@name" />
+
+ <xsl:if test="$first = 'true'">
+ <xsl:variable name="new-name">
+ <xsl:call-template name="from-dos">
+ <xsl:with-param name="path" select="@name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <tr>
+ <xsl:call-template name="alternated-row" />
+ <td nowrap="nowrap">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>files/</xsl:text><xsl:value-of
select="$new-name"/><xsl:text>.html</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="@name"/>
+ </a>
+ </td>
+ <td><xsl:value-of select="count(../file[@name =
$name]/error)"/></td>
+ </tr>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="file" mode="all.classes">
+ <xsl:variable name="first">
+ <xsl:call-template name="isfirst">
+ <xsl:with-param name="name" select="@name"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="$first = 'true'">
+ <xsl:variable name="new-name">
+ <xsl:call-template name="from-dos">
+ <xsl:with-param name="path" select="@name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <tr>
+ <td nowrap="nowrap">
+ <a target="fileFrame">
+ <xsl:attribute name="href">
+ <xsl:text>files/</xsl:text><xsl:value-of
select="$new-name"/><xsl:text>.html</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="@name"/>
+ </a>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:template>
+
+ <!--
+ transform string like a/b/c to ../../../
+ @param path the path to transform into a descending directory path
+ -->
+ <xsl:template name="path">
+ <xsl:param name="path"/>
+ <xsl:if test="contains($path,'/')">
+ <xsl:text>../</xsl:text>
+ <xsl:call-template name="path">
+ <xsl:with-param name="path"><xsl:value-of
select="substring-after($path,'/')"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not(contains($path,'/')) and not($path = '')">
+ <xsl:text>../</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="file">
+ <xsl:variable name="first">
+ <xsl:call-template name="isfirst">
+ <xsl:with-param name="name" select="@name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name" select="@name" />
+
+ <xsl:if test="$first = 'true'">
+ <xsl:variable name="new-name">
+ <xsl:call-template name="from-dos">
+ <xsl:with-param name="path" select="@name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <redirect:write file="{$output.dir}/files/{$new-name}.html">
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css">
+ <xsl:attribute name="href"><xsl:call-template
name="path"><xsl:with-param name="path"
select="$new-name"/></xsl:call-template><xsl:text>stylesheet.css</xsl:text></xsl:attribute>
+ </link>
+ </head>
+ <body>
+ <xsl:call-template name="pageHeader"/>
+ <h3>File <xsl:value-of select="@name"/></h3>
+ <table class="log" border="0" cellpadding="5"
cellspacing="2" width="100%">
+ <tr>
+ <th>Error Description</th>
+ <th>Line</th>
+ </tr>
+ <xsl:for-each select="../file[@name =
$name]/error">
+ <tr>
+ <xsl:call-template
name="alternated-row"/>
+ <td><xsl:value-of
select="@message"/></td>
+ <td><xsl:value-of select="@line"/></td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </body>
+ </html>
+ </redirect:write>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="checkstyle" mode="summary">
+ <h3>Summary</h3>
+ <xsl:variable name="fileCount" select="count(file)"/>
+ <xsl:variable name="errorCount" select="count(file/error)"/>
+ <table class="log" border="0" cellpadding="5" cellspacing="2"
width="100%">
+ <tr>
+ <th>Files</th>
+ <th>Errors</th>
+ </tr>
+ <tr>
+ <xsl:call-template name="alternated-row"/>
+ <td><xsl:value-of select="$fileCount"/></td>
+ <td><xsl:value-of select="$errorCount"/></td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="alternated-row">
+ <xsl:attribute name="class">
+ <xsl:if test="position() mod 2 = 1">a</xsl:if>
+ <xsl:if test="position() mod 2 = 0">b</xsl:if>
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- determine if this is the first occurance of the given name in the
input -->
+ <xsl:template name="isfirst">
+ <xsl:param name="name"/>
+ <xsl:value-of select="count(preceding-sibling::file[@name=$name]) =
0"/>
+ </xsl:template>
+
+</xsl:stylesheet>
+

Modified:
development/main/magic/spells/checkstyle/src/main/net/dpml/magic/checkstyle/CheckstyleTask.java
==============================================================================
---
development/main/magic/spells/checkstyle/src/main/net/dpml/magic/checkstyle/CheckstyleTask.java
(original)
+++
development/main/magic/spells/checkstyle/src/main/net/dpml/magic/checkstyle/CheckstyleTask.java
Mon Dec 13 17:01:22 2004
@@ -25,9 +25,13 @@
import net.dpml.magic.project.Context;
import net.dpml.magic.Index;

+import net.dpml.transit.artifact.Handler;
+
import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.BuildException;

import java.io.File;
+import java.net.URL;

public class CheckstyleTask extends CheckStyleTask
{
@@ -51,6 +55,23 @@
m_init = true;
}

+ public void setUri( String uri )
+ {
+ try
+ {
+ URL url = new URL( null, uri, new Handler() );
+ File local = (File) url.getContent( new Class[]{File.class} );
+ super.setConfig( local );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Could not resolve the uri ["
+ + uri
+ + "]";
+ throw new BuildException( error, e );
+ }
+ }

private void addTargetToFileset( Definition def )
{

Added: development/main/magic/spells/style/build.xml
==============================================================================
--- (empty file)
+++ development/main/magic/spells/style/build.xml Mon Dec 13 17:01:22
2004
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ 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.
+-->
+
+<project name="dpml-magic-style" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit" xmlns:x="antlib:net.dpml.magic" >
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+
+ <target name="build" depends="standard.build">
+ <x:export>
+ <antlib urn="plugin:net.dpml.magic.style"
resource="net/dpml/magic/style/antlib.xml"/>
+ </x:export>
+ </target>
+
+</project>

Added:
development/main/magic/spells/style/src/main/net/dpml/magic/style/StyleTask.java
==============================================================================
--- (empty file)
+++
development/main/magic/spells/style/src/main/net/dpml/magic/style/StyleTask.java
Mon Dec 13 17:01:22 2004
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 Apache Software Foundation
+ * 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.magic.style;
+
+import java.io.File;
+import java.net.URL;
+
+import net.dpml.transit.artifact.Handler;
+
+import org.apache.tools.ant.taskdefs.XSLTProcess;
+import org.apache.tools.ant.BuildException;
+
+
+public class StyleTask extends XSLTProcess
+{
+ public void setStyle( String uri )
+ {
+ if( !uri.startsWith( "artifact:" ) )
+ {
+ super.setStyle( uri );
+ }
+
+ try
+ {
+ URL url = new URL( null, uri, new Handler() );
+ File local = (File) url.getContent( new Class[]{File.class} );
+ super.setStyle( local.getAbsolutePath() );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Could not resolve the uri ["
+ + uri
+ + "]";
+ throw new BuildException( error, e );
+ }
+ }
+}
\ No newline at end of file

Added:
development/main/magic/spells/style/src/main/net/dpml/magic/style/antlib.xml
==============================================================================
--- (empty file)
+++
development/main/magic/spells/style/src/main/net/dpml/magic/style/antlib.xml
Mon Dec 13 17:01:22 2004
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<antlib>
+
+ <taskdef name="style" classname="net.dpml.magic.style.StyleTask"/>
+
+</antlib>

Added:
development/main/transit/plugin/src/main/net/dpml/transit/control/TracePolicy.java
==============================================================================
--- (empty file)
+++
development/main/transit/plugin/src/main/net/dpml/transit/control/TracePolicy.java
Mon Dec 13 17:01:22 2004
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004 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.transit.control;
+
+
+/**
+ * A trace policy object is used to declare the endabled or disabled state
of
+ * trace logging.
+ *
+ * @author <a href="mailto:dev@dpmlnet";>Stephen J. McConnell</a>
+ * @version $Id: Metro.java 916 2004-11-25 12:15:17Z niclas AT apache.org $
+ */
+public class TracePolicy
+{
+ //
------------------------------------------------------------------------
+ // state
+ //
------------------------------------------------------------------------
+
+ /**
+ * The trace policy value.
+ */
+ private boolean m_trace = false;
+
+ //
------------------------------------------------------------------------
+ // constructors
+ //
------------------------------------------------------------------------
+
+ /**
+ * Creation of a new trace policy instance.
+ *
+ * @param policy TRUE if trace is enabled else FALSE
+ */
+ public TracePolicy( boolean policy )
+ {
+ m_trace = policy;
+ }
+
+ //
------------------------------------------------------------------------
+ // implementation
+ //
------------------------------------------------------------------------
+
+ /**
+ * Test is the policy is enabled.
+ * @return TRUE if the policy is enabled else FALSE
+ */
+ public boolean isEnabled()
+ {
+ return m_trace;
+ }
+}
+

Modified: development/main/util/cli/build.xml
==============================================================================
--- development/main/util/cli/build.xml (original)
+++ development/main/util/cli/build.xml Mon Dec 13 17:01:22 2004
@@ -3,6 +3,12 @@
<project name="dpml-util-cli" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit">

+ <transit:init>
+ <plugin uri="dpml/magic/dpml-magic-core#SNAPSHOT">
+ <antlib/>
+ </plugin>
+ </transit:init>
+
<transit:import uri="artifact:template:dpml/magic/standard"/>

</project>

Added:
development/main/util/criteria/src/main/net/dpml/criteria/Dictionary.java
==============================================================================
--- (empty file)
+++ development/main/util/criteria/src/main/net/dpml/criteria/Dictionary.java
Mon Dec 13 17:01:22 2004
@@ -0,0 +1,260 @@
+/*
+ * Copyright 2004 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.criteria;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The dictionary class is a read-only map of keyed values.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: Criteria.java 259 2004-10-30 07:24:40Z mcconnell $
+ */
+public class Dictionary implements Map
+{
+ //--------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------
+
+ private final Map m_map;
+
+ //--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ /**
+ * Creation of a new criteria instance.
+ * @param map the key value pairs
+ */
+ public Dictionary( final Map map )
+ {
+ if( null == map )
+ {
+ throw new NullPointerException( "map" );
+ }
+ m_map = map;
+ }
+
+ //--------------------------------------------------------------
+ // Map
+ //--------------------------------------------------------------
+
+ /**
+ * Returns the number of key-value mappings in this map. If the
+ * map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
+ * <tt>Integer.MAX_VALUE</tt>.
+ *
+ * @return the number of key-value mappings in this map.
+ */
+ public int size()
+ {
+ return m_map.size();
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map contains no key-value mappings.
+ *
+ * @return <tt>true</tt> if this map contains no key-value mappings.
+ */
+ public boolean isEmpty()
+ {
+ return m_map.isEmpty();
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map contains a mapping for the specified
+ * key. More formally, returns <tt>true</tt> if and only if
+ * this map contains at a mapping for a key <tt>k</tt> such that
+ * <tt>(key==null ? k==null : key.equals(k))</tt>. (There can be
+ * at most one such mapping.)
+ *
+ * @param key key whose presence in this map is to be tested.
+ * @return <tt>true</tt> if this map contains a mapping for the specified
+ * key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for
+ * this map (optional).
+ * @throws NullPointerException if the key is <tt>null</tt> and this map
+ * does not not permit <tt>null</tt> keys (optional).
+ */
+ public boolean containsKey( Object key )
+ {
+ return m_map.containsKey( key );
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map maps one or more keys to the
+ * specified value. More formally, returns <tt>true</tt> if and only if
+ * this map contains at least one mapping to a value <tt>v</tt> such that
+ * <tt>(value==null ? v==null : value.equals(v))</tt>. This operation
+ * will probably require time linear in the map size for most
+ * implementations of the <tt>Map</tt> interface.
+ *
+ * @param value value whose presence in this map is to be tested.
+ * @return <tt>true</tt> if this map maps one or more keys to the
+ * specified value.
+ * @throws ClassCastException if the value is of an inappropriate type
for
+ * this map (optional).
+ * @throws NullPointerException if the value is <tt>null</tt> and this
map
+ * does not not permit <tt>null</tt> values (optional).
+ */
+ public boolean containsValue( Object value )
+ {
+ return m_map.containsValue( value );
+ }
+
+ /**
+ * Returns the value to which this map maps the specified key. Returns
+ * <tt>null</tt> if the map contains no mapping for this key. A return
+ * value of <tt>null</tt> does not <i>necessarily</i> indicate that the
+ * map contains no mapping for the key; it's also possible that the map
+ * explicitly maps the key to <tt>null</tt>. The <tt>containsKey</tt>
+ * operation may be used to distinguish these two cases.
+ *
+ * <p>More formally, if this map contains a mapping from a key
+ * <tt>k</tt> to a value <tt>v</tt> such that <tt>(key==null ? k==null :
+ * key.equals(k))</tt>, then this method returns <tt>v</tt>; otherwise
+ * it returns <tt>null</tt>. (There can be at most one such mapping.)
+ *
+ * @param key key whose associated value is to be returned.
+ * @return the value to which this map maps the specified key, or
+ * <tt>null</tt> if the map contains no mapping for this key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for
+ * this map (optional).
+ * @throws NullPointerException key is <tt>null</tt> and this map does
not
+ * not permit <tt>null</tt> keys (optional).
+ *
+ * @see #containsKey(Object)
+ */
+ public Object get( Object key )
+ {
+ return m_map.get( key );
+ }
+
+ /**
+ * The dictionary class does not support modification of the map and as
+ * such this implementation will allways throw an
UnsupportedOperationException.
+ *
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @return nothing.
+ *
+ * @throws UnsupportedOperationException in all cases
+ */
+ public Object put( Object key, Object value )
+ {
+ throw new UnsupportedOperationException( "put" );
+ }
+
+ /**
+ * The dictionary class does not support modification of the map and as
+ * such this implementation will allways throw an
UnsupportedOperationException.
+ *
+ * @param key key whose mapping is to be removed from the map.
+ * @return nothing
+ *
+ * @throws UnsupportedOperationException in all cases
+ */
+ public Object remove( Object key )
+ {
+ throw new UnsupportedOperationException( "remove" );
+ }
+
+ /**
+ * The dictionary class does not support modification of the map and as
+ * such this implementation will allways throw an
UnsupportedOperationException.
+ *
+ * @param map Mappings to be stored in this map.
+ *
+ * @throws UnsupportedOperationException in all cases
+ */
+ public void putAll( Map map )
+ {
+ throw new UnsupportedOperationException( "putAll" );
+ }
+
+ /**
+ * The dictionary class does not support modification of the map and as
+ * such this implementation will allways throw an
UnsupportedOperationException.
+ *
+ * @throws UnsupportedOperationException in all cases
+ */
+ public void clear()
+ {
+ throw new UnsupportedOperationException( "clear" );
+ }
+
+ // Views
+
+ /**
+ * Returns a set view of the keys contained in this map. The set is
+ * backed by the map, so changes to the map are reflected in the set, and
+ * vice-versa. If the map is modified while an iteration over the set is
+ * in progress, the results of the iteration are undefined. The set
+ * supports element removal, which removes the corresponding mapping from
+ * the map, via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
+ * <tt>removeAll</tt> <tt>retainAll</tt>, and <tt>clear</tt> operations.
+ * It does not support the add or <tt>addAll</tt> operations.
+ *
+ * @return a set view of the keys contained in this map.
+ */
+ public Set keySet()
+ {
+ return m_map.keySet();
+ }
+
+ /**
+ * Returns a collection view of the values contained in this map. The
+ * collection is backed by the map, so changes to the map are reflected
in
+ * the collection, and vice-versa. If the map is modified while an
+ * iteration over the collection is in progress, the results of the
+ * iteration are undefined. The collection supports element removal,
+ * which removes the corresponding mapping from the map, via the
+ * <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>,
+ * <tt>removeAll</tt>, <tt>retainAll</tt> and <tt>clear</tt> operations.
+ * It does not support the add or <tt>addAll</tt> operations.
+ *
+ * @return a collection view of the values contained in this map.
+ */
+ public Collection values()
+ {
+ return m_map.values();
+ }
+
+ /**
+ * Returns a set view of the mappings contained in this map. Each
element
+ * in the returned set is a {@link Map.Entry}. The set is backed by the
+ * map, so changes to the map are reflected in the set, and vice-versa.
+ * If the map is modified while an iteration over the set is in progress,
+ * the results of the iteration are undefined. The set supports element
+ * removal, which removes the corresponding mapping from the map, via the
+ * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, <tt>removeAll</tt>,
+ * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not support
+ * the <tt>add</tt> or <tt>addAll</tt> operations.
+ *
+ * @return a set view of the mappings contained in this map.
+ */
+ public Set entrySet()
+ {
+ return m_map.entrySet();
+ }
+}

Modified: development/main/util/module.xml
==============================================================================
--- development/main/util/module.xml (original)
+++ development/main/util/module.xml Mon Dec 13 17:01:22 2004
@@ -2,18 +2,16 @@

<project name="dpml-util" default="docs" basedir="."
xmlns:transit="antlib:net.dpml.transit"
- xmlns:x="antlib:net.dpml.magic" >
+ xmlns:x="antlib:net.dpml.magic">

<transit:import uri="artifact:template:dpml/magic/standard"/>
-
- <!--<import file="${dpml.templates}/checkstyle/checkstyle.xml"
optional="true"/>-->
+ <transit:import uri="artifact:template:dpml/magic/checkstyle"/>

<target name="build" depends="standard.build">
<x:module index="index.xml"/>
</target>

- <!--<target name="docs" depends="install,checkstyle,junit-report">-->
- <target name="docs" depends="install,junit-report">
+ <target name="docs" depends="install,junit-report,checkstyle">
<x:javadoc overview="overview.html" title="DPML Utilities API -
${project.version}">
<link href="http://java.sun.com/j2se/1.4/docs/api"/>
</x:javadoc>



  • svn commit: r1173 - in development/main: magic magic/bootstrap/src/main/net/dpml/magic/bootstrap magic/spells/checkstyle magic/spells/checkstyle/etc/deliverables magic/spells/checkstyle/etc/deliverables/formats magic/spells/checkstyle/etc/deliverables/templates magic/spells/checkstyle/etc/deliverables/xsls magic/spells/checkstyle/etc/templates magic/spells/checkstyle/src/main/net/dpml/magic/checkstyle magic/spells/style magic/spells/style/src magic/spells/style/src/main magic/spells/style/src/main/net magic/spells/style/src/main/net/dpml magic/spells/style/src/main/net/dpml/magic magic/spells/style/src/main/net/dpml/magic/style transit/plugin/src/main/net/dpml/transit/control util util/cli util/criteria/src/main/net/dpml/criteria, mcconnell, 12/13/2004

Archive powered by MHonArc 2.6.24.

Top of Page