notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1639 - in trunk: central/site/src/docs/depot/tutorials tutorials/tooling/complex tutorials/tooling/complex/parts tutorials/tooling/complex/parts/api tutorials/tooling/complex/parts/api/src tutorials/tooling/complex/parts/api/src/main tutorials/tooling/complex/parts/api/src/main/org tutorials/tooling/complex/parts/api/src/main/org/acme tutorials/tooling/complex/parts/impl tutorials/tooling/complex/parts/impl/src tutorials/tooling/complex/parts/impl/src/main tutorials/tooling/complex/parts/impl/src/main/org tutorials/tooling/complex/parts/impl/src/main/org/acme tutorials/tooling/complex/parts/impl/src/main/org/acme/impl tutorials/tooling/complex/parts/impl/src/test tutorials/tooling/complex/parts/impl/src/test/org tutorials/tooling/complex/parts/impl/src/test/org/acme tutorials/tooling/complex/parts/impl/src/test/org/acme/impl tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/test tutorials/tooling/imports
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1639 - in trunk: central/site/src/docs/depot/tutorials tutorials/tooling/complex tutorials/tooling/complex/parts tutorials/tooling/complex/parts/api tutorials/tooling/complex/parts/api/src tutorials/tooling/complex/parts/api/src/main tutorials/tooling/complex/parts/api/src/main/org tutorials/tooling/complex/parts/api/src/main/org/acme tutorials/tooling/complex/parts/impl tutorials/tooling/complex/parts/impl/src tutorials/tooling/complex/parts/impl/src/main tutorials/tooling/complex/parts/impl/src/main/org tutorials/tooling/complex/parts/impl/src/main/org/acme tutorials/tooling/complex/parts/impl/src/main/org/acme/impl tutorials/tooling/complex/parts/impl/src/test tutorials/tooling/complex/parts/impl/src/test/org tutorials/tooling/complex/parts/impl/src/test/org/acme tutorials/tooling/complex/parts/impl/src/test/org/acme/impl tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/test tutorials/tooling/imports
- Date: Sun, 23 Jul 2006 21:40:47 +0200
Author: mcconnell
Date: 2006-07-23 21:40:39 +0200 (Sun, 23 Jul 2006)
New Revision: 1639
Added:
trunk/tutorials/tooling/complex/parts/
trunk/tutorials/tooling/complex/parts/api/
trunk/tutorials/tooling/complex/parts/api/build.xml
trunk/tutorials/tooling/complex/parts/api/src/
trunk/tutorials/tooling/complex/parts/api/src/main/
trunk/tutorials/tooling/complex/parts/api/src/main/org/
trunk/tutorials/tooling/complex/parts/api/src/main/org/acme/
trunk/tutorials/tooling/complex/parts/api/src/main/org/acme/Clock.java
trunk/tutorials/tooling/complex/parts/impl/
trunk/tutorials/tooling/complex/parts/impl/build.xml
trunk/tutorials/tooling/complex/parts/impl/src/
trunk/tutorials/tooling/complex/parts/impl/src/main/
trunk/tutorials/tooling/complex/parts/impl/src/main/org/
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/SimpleClock.java
trunk/tutorials/tooling/complex/parts/impl/src/test/
trunk/tutorials/tooling/complex/parts/impl/src/test/org/
trunk/tutorials/tooling/complex/parts/impl/src/test/org/acme/
trunk/tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/
trunk/tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/test/
trunk/tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/test/DemoTestCase.java
trunk/tutorials/tooling/complex/parts/impl/test.properties
trunk/tutorials/tooling/complex/parts/index.xml
trunk/tutorials/tooling/imports/test.properties
Modified:
trunk/central/site/src/docs/depot/tutorials/complex.xml
trunk/central/site/src/docs/depot/tutorials/imports.xml
trunk/tutorials/tooling/imports/index.xml
Log:
add depot tutorial that introduces the <component> tag
Modified: trunk/central/site/src/docs/depot/tutorials/complex.xml
===================================================================
--- trunk/central/site/src/docs/depot/tutorials/complex.xml 2006-07-23
18:13:23 UTC (rev 1638)
+++ trunk/central/site/src/docs/depot/tutorials/complex.xml 2006-07-23
19:40:39 UTC (rev 1639)
@@ -68,12 +68,12 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<index xmlns="link:xsd:dpml/lang/dpml-module#1.0">
- <font color="darkred"><imports>
+ <imports>
<import uri="link:module:ant"/>
<import uri="link:module:dpml"/>
</imports>
- <project name="clock-api" basedir="api">
+ <font color="darkred"><project name="clock-api" basedir="api">
<types>
<type id="jar"/>
</types>
Modified: trunk/central/site/src/docs/depot/tutorials/imports.xml
===================================================================
--- trunk/central/site/src/docs/depot/tutorials/imports.xml 2006-07-23
18:13:23 UTC (rev 1638)
+++ trunk/central/site/src/docs/depot/tutorials/imports.xml 2006-07-23
19:40:39 UTC (rev 1639)
@@ -28,7 +28,10 @@
a single resource reference to <tt>ant/ant-junit</tt>. When Depot
resolves the transitive dependencies it will take into account the
dependencies declared by the <tt>ant/ant-junit</tt> resource
resulting
- in a reliable and complete dependency set.
+ in a reliable and complete dependency set. We have also include the
+ dpml module in the includes directive (mainly because the Transit
+ core package includes a better log formatter than the default
+ provided in the JDK).
</p>
<pre>
@@ -37,6 +40,7 @@
<font color="darkred"><imports>
<import uri="link:module:ant"/>
+ <import uri="link:module:dpml"/>
</imports></font>
<project name="demo" basedir=".">
@@ -49,7 +53,8 @@
</types>
<dependencies>
<test>
- <font color="darkred"><include ref="ant/ant-unit"/></font>
+ <font color="darkred"><include ref="ant/ant-unit"/>
+ <include ref="dpml/transit/dpml-transit-main"/></font>
</test>
</dependencies>
<filters>
@@ -92,14 +97,14 @@
resource:ant/ant#1.6.5
resource:junit/junit#3.8.1
resource:ant/ant-junit#1.6.5
-</pre>
+ resource:dpml/transit/dpml-transit-main#SNAPSHOT</pre>
</subsection>
<subsection name="Summary">
<p>
- This tutorial has presented the benefits arrising from the usage of
+ This tutorial has presented the benefits arising from the usage of
modules - and in-effect, leveraging dependency information from
external
projects.
</p>
Added: trunk/tutorials/tooling/complex/parts/api/build.xml
===================================================================
--- trunk/tutorials/tooling/complex/parts/api/build.xml 2006-07-23 18:13:23
UTC (rev 1638)
+++ trunk/tutorials/tooling/complex/parts/api/build.xml 2006-07-23 19:40:39
UTC (rev 1639)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="demo" default="install"
+ xmlns:transit="antlib:net.dpml.transit">
+
+ <transit:import uri="local:template:dpml/tools/standard"/>
+
+</project>
Added: trunk/tutorials/tooling/complex/parts/api/src/main/org/acme/Clock.java
===================================================================
--- trunk/tutorials/tooling/complex/parts/api/src/main/org/acme/Clock.java
2006-07-23 18:13:23 UTC (rev 1638)
+++ trunk/tutorials/tooling/complex/parts/api/src/main/org/acme/Clock.java
2006-07-23 19:40:39 UTC (rev 1639)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 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 org.acme;
+
+import java.util.Date;
+
+/**
+ * Clock interface.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface Clock
+{
+ String getTimestamp();
+}
Added: trunk/tutorials/tooling/complex/parts/impl/build.xml
===================================================================
--- trunk/tutorials/tooling/complex/parts/impl/build.xml 2006-07-23
18:13:23 UTC (rev 1638)
+++ trunk/tutorials/tooling/complex/parts/impl/build.xml 2006-07-23
19:40:39 UTC (rev 1639)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="demo" default="install"
+ xmlns:transit="antlib:net.dpml.transit">
+
+ <transit:import uri="local:template:dpml/tools/standard"/>
+
+</project>
Added:
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/SimpleClock.java
===================================================================
---
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/SimpleClock.java
2006-07-23 18:13:23 UTC (rev 1638)
+++
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/SimpleClock.java
2006-07-23 19:40:39 UTC (rev 1639)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 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 org.acme.impl;
+
+import java.util.Date;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import org.acme.Clock;
+
+/**
+ * A minimal implementation of a clock.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class SimpleClock implements Clock
+{
+ //------------------------------------------------------------------
+ // static
+ //------------------------------------------------------------------
+
+ private static final String DEFAULT_PATTERN = "K:mm a, z";
+ private static final Locale DEFAULT_LOCALE = Locale.getDefault();
+
+ //------------------------------------------------------------------
+ // criteria
+ //------------------------------------------------------------------
+
+
+ /**
+ * Declaration of the context information required by the implementation.
+ */
+ public interface Context
+ {
+ /**
+ * Return the optional date format as a string.
+ * @param format the default value
+ * @return the date format value
+ */
+ public String getFormat( final String format );
+
+ /**
+ * Return the operational locale.
+ * @param locale the default value
+ * @return the locale
+ */
+ public Locale getLocale( final Locale locale );
+ }
+
+ //------------------------------------------------------------------
+ // state
+ //------------------------------------------------------------------
+
+ private final Context m_context;
+
+ //------------------------------------------------------------------
+ // constructor
+ //------------------------------------------------------------------
+
+ /**
+ * Creation of a new instance.
+ * @param context the initial configuration
+ */
+ public SimpleClock( final Context context )
+ {
+ m_context = context;
+ }
+
+ //------------------------------------------------------------------
+ // Clock
+ //------------------------------------------------------------------
+
+ /**
+ * Return the current time as a formatted string.
+ * @return the current time as a string
+ */
+ public String getTimestamp()
+ {
+ Date date = new Date();
+ DateFormat formatter = getDateFormatter();
+ return formatter.format( date );
+ }
+
+ //------------------------------------------------------------------
+ // implementation
+ //------------------------------------------------------------------
+
+ private DateFormat getDateFormatter()
+ {
+ String format = m_context.getFormat( DEFAULT_PATTERN );
+ Locale locale = m_context.getLocale( DEFAULT_LOCALE );
+ return new SimpleDateFormat( format, locale );
+ }
+}
Added:
trunk/tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/test/DemoTestCase.java
===================================================================
---
trunk/tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/test/DemoTestCase.java
2006-07-23 18:13:23 UTC (rev 1638)
+++
trunk/tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/test/DemoTestCase.java
2006-07-23 19:40:39 UTC (rev 1639)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 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 org.acme.impl.test;
+
+import java.io.File;
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import net.dpml.lang.Part;
+
+import org.acme.Clock;
+
+/**
+ * Deployment of the demo component.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class DemoTestCase extends TestCase
+{
+ /**
+ * Test component deployment.
+ * @exception Exception if an error occurs
+ */
+ public void testComponent() throws Exception
+ {
+ URI uri = getPartURI();
+ Part part = Part.load( uri );
+ Clock clock = (Clock) part.getContent();
+ System.out.println( clock.getTimestamp() );
+ }
+
+ private URI getPartURI() throws Exception
+ {
+ String path = System.getProperty( "project.deliverable.part.path" );
+ File file = new File( path );
+ return file.toURI();
+ }
+}
Added: trunk/tutorials/tooling/complex/parts/impl/test.properties
===================================================================
--- trunk/tutorials/tooling/complex/parts/impl/test.properties 2006-07-23
18:13:23 UTC (rev 1638)
+++ trunk/tutorials/tooling/complex/parts/impl/test.properties 2006-07-23
19:40:39 UTC (rev 1639)
@@ -0,0 +1 @@
+java.util.logging.config.class = net.dpml.util.ConfigurationHandler
\ No newline at end of file
Added: trunk/tutorials/tooling/complex/parts/index.xml
===================================================================
--- trunk/tutorials/tooling/complex/parts/index.xml 2006-07-23 18:13:23
UTC (rev 1638)
+++ trunk/tutorials/tooling/complex/parts/index.xml 2006-07-23 19:40:39
UTC (rev 1639)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<index xmlns="link:xsd:dpml/lang/dpml-module#1.0">
+
+ <imports>
+ <import uri="link:module:ant"/>
+ <import uri="link:module:dpml"/>
+ </imports>
+
+ <module name="org/acme/parts" basedir=".">
+
+ <project name="clock-api" basedir="api">
+ <types>
+ <type id="jar"/>
+ </types>
+ </project>
+
+ <project name="clock-impl" basedir="impl">
+ <types>
+ <type id="jar"/>
+ <component xmlns="link:xsd:dpml/lang/dpml-component#1.0"
+ type="org.acme.impl.SimpleClock" name="clock">
+ <context>
+ <entry key="format" value="K:mm a, z"/>
+ </context>
+ </component>
+ </types>
+ <dependencies>
+ <runtime>
+ <include key="clock-api"/>
+ </runtime>
+ <test>
+ <include ref="ant/ant-junit"/>
+ <include ref="dpml/transit/dpml-transit-main"/>
+ </test>
+ </dependencies>
+ </project>
+
+ </module>
+
+</index>
Modified: trunk/tutorials/tooling/imports/index.xml
===================================================================
--- trunk/tutorials/tooling/imports/index.xml 2006-07-23 18:13:23 UTC (rev
1638)
+++ trunk/tutorials/tooling/imports/index.xml 2006-07-23 19:40:39 UTC (rev
1639)
@@ -3,6 +3,7 @@
<imports>
<import uri="link:module:ant"/>
+ <import uri="link:module:dpml"/>
</imports>
<project name="demo" basedir=".">
@@ -16,6 +17,7 @@
<dependencies>
<test>
<include ref="ant/ant-junit"/>
+ <include ref="dpml/transit/dpml-transit-main"/>
</test>
</dependencies>
<filters>
Added: trunk/tutorials/tooling/imports/test.properties
===================================================================
--- trunk/tutorials/tooling/imports/test.properties 2006-07-23 18:13:23
UTC (rev 1638)
+++ trunk/tutorials/tooling/imports/test.properties 2006-07-23 19:40:39
UTC (rev 1639)
@@ -0,0 +1 @@
+java.util.logging.config.class = net.dpml.util.ConfigurationHandler
\ No newline at end of file
- r1639 - in trunk: central/site/src/docs/depot/tutorials tutorials/tooling/complex tutorials/tooling/complex/parts tutorials/tooling/complex/parts/api tutorials/tooling/complex/parts/api/src tutorials/tooling/complex/parts/api/src/main tutorials/tooling/complex/parts/api/src/main/org tutorials/tooling/complex/parts/api/src/main/org/acme tutorials/tooling/complex/parts/impl tutorials/tooling/complex/parts/impl/src tutorials/tooling/complex/parts/impl/src/main tutorials/tooling/complex/parts/impl/src/main/org tutorials/tooling/complex/parts/impl/src/main/org/acme tutorials/tooling/complex/parts/impl/src/main/org/acme/impl tutorials/tooling/complex/parts/impl/src/test tutorials/tooling/complex/parts/impl/src/test/org tutorials/tooling/complex/parts/impl/src/test/org/acme tutorials/tooling/complex/parts/impl/src/test/org/acme/impl tutorials/tooling/complex/parts/impl/src/test/org/acme/impl/test tutorials/tooling/imports, mcconnell at BerliOS, 07/23/2006
Archive powered by MHonArc 2.6.24.