Skip to Content.
Sympa Menu

notify-dpml - r1352 - in trunk/main: central/src/docs/depot/tools depot/library/etc/test/samples depot/library/src/main/net/dpml/library/impl depot/library/src/test/net/dpml/library/impl depot/tools/builder/etc/prefs/xmls depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1352 - in trunk/main: central/src/docs/depot/tools depot/library/etc/test/samples depot/library/src/main/net/dpml/library/impl depot/library/src/test/net/dpml/library/impl depot/tools/builder/etc/prefs/xmls depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks
  • Date: Mon, 10 Apr 2006 19:56:41 +0200

Author: mcconnell
Date: 2006-04-10 19:56:36 +0200 (Mon, 10 Apr 2006)
New Revision: 1352

Added:
trunk/main/depot/library/etc/test/samples/info.xml
trunk/main/depot/library/src/test/net/dpml/library/impl/InfoTestCase.java
Modified:
trunk/main/central/src/docs/depot/tools/index.xml
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryDecoder.java
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
trunk/main/depot/tools/builder/etc/prefs/xmls/builder.xml

trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
Log:
fix issue in module externalization concerning the <info> block

Modified: trunk/main/central/src/docs/depot/tools/index.xml
===================================================================
--- trunk/main/central/src/docs/depot/tools/index.xml 2006-04-10 10:23:36
UTC (rev 1351)
+++ trunk/main/central/src/docs/depot/tools/index.xml 2006-04-10 17:56:36
UTC (rev 1352)
@@ -33,6 +33,18 @@
property. If neither property is defined, the default template
<tt>local:template:dpml/tools/standard</tt> will be assigned.
</p>
+
+ <p>
+ During project initialization the the current resource is consulted
with
+ respect to the types it declares it produced. Each type is identified
by a
+ unique type id. The collection of type ids are used to resolve an
ordered array
+ of build listeners. The build listener list is established based on
the initial
+ type ids combined with any dependencies declared by respective
listeneners.
+ Finally, the sorted listeners are attached to the current ant project.

+ Targets in the project template trigger init, prepare, build, package,
test and
+ install build events which in-turn trigger sequentially executed
phased
+ build-functionality.
+ </p>

<subsection name="Builder Configuration">


Added: trunk/main/depot/library/etc/test/samples/info.xml
===================================================================
--- trunk/main/depot/library/etc/test/samples/info.xml 2006-04-10 10:23:36
UTC (rev 1351)
+++ trunk/main/depot/library/etc/test/samples/info.xml 2006-04-10 17:56:36
UTC (rev 1352)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<library xmlns="@MODULE-XSD-URI@"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+ xmlns:part="artifact:xsd:dpml/lang/dpml-part#1.0">
+
+ <modules>
+ <module name="acme-1">
+ <info/>
+ </module>
+ <module name="acme-2">
+ <info>
+ <description/>
+ </info>
+ </module>
+ <module name="acme-3">
+ <info>
+ <description title="Widget"/>
+ </info>
+ </module>
+ <module name="acme-4">
+ <info>
+ <description title="Widget">
+ An example of a widget.
+ </description>
+ </info>
+ </module>
+ <module name="acme-5">
+ <info>
+ <description>
+ An example of a widget.
+ </description>
+ </info>
+ </module>
+ </modules>
+
+</library>

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryDecoder.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryDecoder.java
2006-04-10 10:23:36 UTC (rev 1351)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryDecoder.java
2006-04-10 17:56:36 UTC (rev 1352)
@@ -744,12 +744,34 @@
else
{
String title = ElementHelper.getAttribute( child, "title" );
- String description = ElementHelper.getValue( child );
+ String value = ElementHelper.getValue( child );
+ String description = trim( value );
return new InfoDirective( title, description );
}
}
}

+ private String trim( String value )
+ {
+ if( null == value )
+ {
+ return null;
+ }
+ String trimmed = value.trim();
+ if( trimmed.startsWith( "\n" ) )
+ {
+ return trim( trimmed.substring( 1 ) );
+ }
+ else if( trimmed.endsWith( "\n" ) )
+ {
+ return trim( trimmed.substring( 0, trimmed.length() - 1 ) );
+ }
+ else
+ {
+ return trimmed;
+ }
+ }
+
private FilterDirective[] buildFilters( Element element ) throws
Exception
{
if( null == element )

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
2006-04-10 10:23:36 UTC (rev 1351)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
2006-04-10 17:56:36 UTC (rev 1352)
@@ -231,9 +231,9 @@
writer.write( "\n" + lead + " <description" );
if( null != info.getTitle() )
{
- writer.write( " title\"" + info.getTitle() + "\"" );
+ writer.write( " title=\"" + info.getTitle() + "\"" );
}
- String description = info.getDescription().trim();
+ String description = info.getDescription();
if( null != info.getDescription() )
{
writer.write( ">" );

Added:
trunk/main/depot/library/src/test/net/dpml/library/impl/InfoTestCase.java
===================================================================
--- trunk/main/depot/library/src/test/net/dpml/library/impl/InfoTestCase.java
2006-04-10 10:23:36 UTC (rev 1351)
+++ trunk/main/depot/library/src/test/net/dpml/library/impl/InfoTestCase.java
2006-04-10 17:56:36 UTC (rev 1352)
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2004-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.library.impl;
+
+import java.io.File;
+
+import net.dpml.library.Info;
+import net.dpml.library.Module;
+
+import net.dpml.util.Logger;
+import net.dpml.util.DefaultLogger;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test filter definition and propergation.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class InfoTestCase extends TestCase
+{
+ static
+ {
+ System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
+ }
+
+ private DefaultLibrary m_library;
+
+ /**
+ * Setup the library directive builder.
+ * @exception Exception if an error occurs during test execution
+ */
+ public void setUp() throws Exception
+ {
+ String base = System.getProperty( "project.test.dir" );
+ File test = new File( base );
+ File file = new File( test, "samples/info.xml" );
+ Logger logger = new DefaultLogger( "test" );
+ m_library = new DefaultLibrary( logger, file );
+ }
+
+ /**
+ * Test an empty info descriptor.
+ * @exception Exception if an error occurs during test execution
+ */
+ public void testEmptyInfo() throws Exception
+ {
+ Module acme = m_library.getModule( "acme-1" );
+ Info info = acme.getInfo();
+ assertNull( "title", info.getTitle() );
+ assertNull( "description", info.getDescription() );
+ }
+
+ /**
+ * Test an empty info descriptor.
+ * @exception Exception if an error occurs during test execution
+ */
+ public void testEmptyInfoWithEmptyDescription() throws Exception
+ {
+ Module acme = m_library.getModule( "acme-2" );
+ Info info = acme.getInfo();
+ assertNull( "title", info.getTitle() );
+ assertNull( "description", info.getDescription() );
+ }
+
+ /**
+ * Test an empty info descriptor.
+ * @exception Exception if an error occurs during test execution
+ */
+ public void testInfoTitle() throws Exception
+ {
+ Module acme = m_library.getModule( "acme-3" );
+ Info info = acme.getInfo();
+ assertEquals( "title", "Widget", info.getTitle() );
+ assertNull( "description", info.getDescription() );
+ }
+
+ /**
+ * Test an empty info descriptor.
+ * @exception Exception if an error occurs during test execution
+ */
+ public void testInfoTitleAndDescription() throws Exception
+ {
+ Module acme = m_library.getModule( "acme-4" );
+ Info info = acme.getInfo();
+ assertEquals( "title", "Widget", info.getTitle() );
+ assertEquals( "description", "An example of a widget.",
info.getDescription() );
+ }
+
+ /**
+ * Test an empty info descriptor.
+ * @exception Exception if an error occurs during test execution
+ */
+ public void testInfoDescription() throws Exception
+ {
+ Module acme = m_library.getModule( "acme-5" );
+ Info info = acme.getInfo();
+ assertNull( "title", info.getTitle() );
+ assertEquals( "description", "An example of a widget.",
info.getDescription() );
+ }
+}

Modified: trunk/main/depot/tools/builder/etc/prefs/xmls/builder.xml
===================================================================
--- trunk/main/depot/tools/builder/etc/prefs/xmls/builder.xml 2006-04-10
10:23:36 UTC (rev 1351)
+++ trunk/main/depot/tools/builder/etc/prefs/xmls/builder.xml 2006-04-10
17:56:36 UTC (rev 1352)
@@ -1,14 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
-Default configuration for the Ant-based builder.
+Default configuration for Depot-on-Ant.
-->

<builder>

- <properties>
- </properties>
-
<listeners>
<listener name="jar" class="net.dpml.tools.process.JarProcess"/>
<listener name="part" class="net.dpml.tools.process.PluginProcess"
depends="jar"/>

Modified:
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-04-10 10:23:36 UTC (rev 1351)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java
2006-04-10 17:56:36 UTC (rev 1352)
@@ -143,13 +143,13 @@
String[] names = getTypeNames( types );
ListenerDirective[] descriptors = getListenerDirectives( names );
ListenerDirective[] sorted = sortListenerDirectives( descriptors );
- String[] processors = new String[ sorted.length ];
+ String[] listeners = new String[ sorted.length ];
for( int i=0; i<sorted.length; i++ )
{
ListenerDirective directive = sorted[i];
- processors[i] = directive.getName();
+ listeners[i] = directive.getName();
}
- return processors;
+ return listeners;
}

String[] getTypeNames( Type[] types )

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
2006-04-10 10:23:36 UTC (rev 1351)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
2006-04-10 17:56:36 UTC (rev 1352)
@@ -45,7 +45,15 @@
private ArrayList m_list = new ArrayList();

/**
- * Initialize type to processor mapping.
+ * Initialize type to processor mapping. During execution the current
+ * resource is consulted with respect to the types it declares it
produced.
+ * Each type is identified by a unique type id. The collection of type
ids
+ * are used to resolve an ordered array of build listeners. The build
listener
+ * list is established based on the initial type ids combined with any
dependencies
+ * declared by respective listeneners. Finally, the sorted listeners are
attached
+ * to the current ant project. Targets in the project template trigger
init,
+ * prepare, build, package, test and install build events which in-turn
trigger
+ * sequentially executed phased functionality within the repective
listeners.
*/
public void execute()
{




  • r1352 - in trunk/main: central/src/docs/depot/tools depot/library/etc/test/samples depot/library/src/main/net/dpml/library/impl depot/library/src/test/net/dpml/library/impl depot/tools/builder/etc/prefs/xmls depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks, mcconnell at BerliOS, 04/10/2006

Archive powered by MHonArc 2.6.24.

Top of Page