Skip to Content.
Sympa Menu

notify-dpml - r1661 - in trunk: central/site central/site/src/docs/depot central/site/src/docs/depot/tutorials central/site/src/docs/metro/tutorials/import central/site/src/docs/transit/tutorials central/site/src/stats main/depot/tools/builder/src/main/net/dpml/tools/tasks main/metro/model/src/main/net/dpml/metro/data main/metro/runtime/src/main/net/dpml/metro/runtime main/transit/core/src/main/net/dpml/lang tutorials/components tutorials/components/customize/custom/etc/data tutorials/components/import/api/src/main/org/acme tutorials/components/import/clock/src/main/org/acme/scheduler tutorials/components/import/demo/etc/data tutorials/components/import/demo/src/main/org/acme/demo tutorials/components/import/demo/src/test/org/acme/test tutorials/tooling/complex tutorials/tooling/complex/plugin tutorials/tooling/complex/plugin/impl/src/test/org/acme/impl/test

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: r1661 - in trunk: central/site central/site/src/docs/depot central/site/src/docs/depot/tutorials central/site/src/docs/metro/tutorials/import central/site/src/docs/transit/tutorials central/site/src/stats main/depot/tools/builder/src/main/net/dpml/tools/tasks main/metro/model/src/main/net/dpml/metro/data main/metro/runtime/src/main/net/dpml/metro/runtime main/transit/core/src/main/net/dpml/lang tutorials/components tutorials/components/customize/custom/etc/data tutorials/components/import/api/src/main/org/acme tutorials/components/import/clock/src/main/org/acme/scheduler tutorials/components/import/demo/etc/data tutorials/components/import/demo/src/main/org/acme/demo tutorials/components/import/demo/src/test/org/acme/test tutorials/tooling/complex tutorials/tooling/complex/plugin tutorials/tooling/complex/plugin/impl/src/test/org/acme/impl/test
  • Date: Tue, 25 Jul 2006 10:48:21 +0200

Author: mcconnell
Date: 2006-07-25 10:48:16 +0200 (Tue, 25 Jul 2006)
New Revision: 1661

Added:
trunk/central/site/src/docs/depot/tutorials/plugins.xml
trunk/central/site/src/docs/transit/tutorials/local.xml
trunk/tutorials/tooling/complex/plugin/
trunk/tutorials/tooling/complex/plugin/api/
trunk/tutorials/tooling/complex/plugin/impl/
Removed:
trunk/tutorials/tooling/complex/parts/
trunk/tutorials/tooling/complex/plugin/api/
trunk/tutorials/tooling/complex/plugin/impl/
Modified:
trunk/central/site/build.xml
trunk/central/site/src/docs/depot/navigation.xml
trunk/central/site/src/docs/depot/tutorials/export.xml
trunk/central/site/src/docs/metro/tutorials/import/index.xml
trunk/central/site/src/docs/transit/tutorials/plugins.xml
trunk/central/site/src/stats/stats.xls

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/FeatureTask.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
trunk/main/metro/model/src/main/net/dpml/metro/data/ComponentDirective.java
trunk/main/metro/model/src/main/net/dpml/metro/data/DefaultComposition.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
trunk/main/transit/core/src/main/net/dpml/lang/Builder.java
trunk/main/transit/core/src/main/net/dpml/lang/Classpath.java
trunk/main/transit/core/src/main/net/dpml/lang/Part.java
trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
trunk/tutorials/components/customize/custom/etc/data/logging.properties
trunk/tutorials/components/import/api/src/main/org/acme/Clock.java

trunk/tutorials/components/import/clock/src/main/org/acme/scheduler/SimpleClock.java
trunk/tutorials/components/import/demo/etc/data/logging.properties
trunk/tutorials/components/import/demo/src/main/org/acme/demo/Demo.java

trunk/tutorials/components/import/demo/src/test/org/acme/test/DemoTestCase.java
trunk/tutorials/components/module.xml

trunk/tutorials/tooling/complex/plugin/impl/src/test/org/acme/impl/test/DemoTestCase.java
trunk/tutorials/tooling/complex/plugin/index.xml
Log:
resolve bug related to unnecessary classloader creation (non-fatal but
expensive)

Modified: trunk/central/site/build.xml
===================================================================
--- trunk/central/site/build.xml 2006-07-24 20:11:24 UTC (rev 1660)
+++ trunk/central/site/build.xml 2006-07-25 08:48:16 UTC (rev 1661)
@@ -10,6 +10,16 @@

<!-- tooling tutorial build content -->

+ <x:property name="tooling.dir" feature="basedir"
ref="dpmlx/tutorials/tooling"/>
+ <property name="plugin.src.dir"
location="${tooling.dir}/complex/plugin"/>
+ <property name="local.plugin.docs.dir"
location="target/docs/depot/tutorials/plugin"/>
+ <mkdir dir="${local.plugin.docs.dir}"/>
+ <copy toDir="${local.plugin.docs.dir}" flatten="true">
+ <fileset dir="${plugin.src.dir}/target/reports/src">
+ <include name="**/*.html"/>
+ </fileset>
+ </copy>
+
<!--
<x:property name="tooling.dir" feature="basedir"
ref="dpmlx/tutorials/tooling"/>
<property name="simple.build.dir" location="${tooling.dir}/simple"/>

Modified: trunk/central/site/src/docs/depot/navigation.xml
===================================================================
--- trunk/central/site/src/docs/depot/navigation.xml 2006-07-24 20:11:24
UTC (rev 1660)
+++ trunk/central/site/src/docs/depot/navigation.xml 2006-07-25 08:48:16
UTC (rev 1661)
@@ -27,7 +27,7 @@
<menu>
<item name="Overview" href="concepts/index.html"/>
<item name="Tutorials" href="tutorials/index.html"/>
- <item name="Library Directive" href="library/index.html"/>
+ <item name="Directives" href="library/index.html"/>
<item name="Ant Builder" href="tools/index.html"/>
<item name="Ant Tasks" href="tasks/index.html"/>
<item name="CLI" href="cli/index.html"/>

Modified: trunk/central/site/src/docs/depot/tutorials/export.xml
===================================================================
--- trunk/central/site/src/docs/depot/tutorials/export.xml 2006-07-24
20:11:24 UTC (rev 1660)
+++ trunk/central/site/src/docs/depot/tutorials/export.xml 2006-07-25
08:48:16 UTC (rev 1661)
@@ -3,7 +3,7 @@
<document>
<properties>
<author email="mcconnell AT osm.net">Stephen McConnell</author>
- <title>Working with Modules</title>
+ <title>Exporting Modules</title>
</properties>

<body>
@@ -110,6 +110,55 @@

</subsection>

+ <subsection name="Technical Note">
+
+ <p>
+ The above module definition is not really ready for publication -
after all
+ it contains several references to <tt>SNAPSHOT</tt> versions (and we
don't
+ want to publish anything referrencing a generalized
<tt>SNAPSHOT</tt> version).
+ We can resolve this this using the <tt>-version</tt> option under
the <tt>build</tt>
+ command. For example, the following command will build the projects
and module
+ defintion using the version identifier <tt>324</tt>.
+ </p>
+
+<pre>$ build -version 324</pre>
+
+ <p>
+ The following module artifact demonstrates the impact of the
<tt>-version</tt> option
+ in terms of resource naming and the corresponding meta-data that is
generated by the
+ build process. All of the resources (jars, module files, etc.) are
now suitable for
+ publication into a public (or shared) repository.
+ </p>
+
+<source>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
+&lt;module name="org/acme" version="1.0.0"
+ xmlns="link:xsd:dpml/lang/dpml-module#1.0"&gt;
+
+ &lt;types&gt;
+ &lt;type id="module" version="1.0"/&gt;
+ &lt;/types&gt;
+
+ &lt;resource name="clock-api" version="<font color="blue">324</font>"&gt;
+ &lt;types&gt;
+ &lt;type id="jar"/&gt;
+ &lt;/types&gt;
+ &lt;/resource&gt;
+
+ &lt;resource name="clock-impl" version="<font color="blue">324</font>"&gt;
+ &lt;types&gt;
+ &lt;type id="jar"/&gt;
+ &lt;/types&gt;
+ &lt;dependencies&gt;
+ &lt;runtime&gt;
+ &lt;include ref="org/acme/clock-api"/&gt;
+ &lt;/runtime&gt;
+ &lt;/dependencies&gt;
+ &lt;/resource&gt;
+
+&lt;/module&gt;</source>
+
+ </subsection>
+
<subsection name="Summary">

<p>
@@ -137,17 +186,17 @@

</subsection>

- <subsection name="However ...">
-
+ <subsection name="Next Tutorial">
+
<p>
- The above module definition is not really ready for publication -
after all
- it contains several references to <tt>SNAPSHOT</tt> versions (and we
don't
- want to publish anything referrencing a generalized
<tt>SNAPSHOT</tt> version).
- The <a href="versioned.html">next tutorial</a> takes us through the
process
- of generating a version build with artifacts suitable for
publication into
- a shared repository.
+ Our next tutorial is also related to the capture and propergation of
+ build-time meta-data. In the above example we have demonstrated how
meta-data
+ derived from module and project defintions can be transformed into
artifacts
+ that can be used by other projects. In our <a
href="plugins.html">next tutorial</a>
+ we are going to focus on the capture and use of transitive
dependency information
+ related to runtime concerns.
</p>
-
+
</subsection>

</section>

Added: trunk/central/site/src/docs/depot/tutorials/plugins.xml
===================================================================
--- trunk/central/site/src/docs/depot/tutorials/plugins.xml 2006-07-24
20:11:24 UTC (rev 1660)
+++ trunk/central/site/src/docs/depot/tutorials/plugins.xml 2006-07-25
08:48:16 UTC (rev 1661)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<document>
+ <properties>
+ <author email="mcconnell AT osm.net">Stephen McConnell</author>
+ <title>Using Dependency Information at Runtime via Plugins</title>
+ </properties>
+
+ <body>
+
+ <section name="Using Dependency Information at Runtime">
+
+ <subsection name="Tutorial Objective">
+
+ <p>
+ Given the availability of full dependency information from the
+ Depot environment - the potential exists to capture the runtime
+ related concerns and use this information to create a plugin
definition
+ sufficient for the automatic deployment of a application. This
requires
+ the capture of classpath information and the object deployment
strategy.
+ </p>
+
+ <p>
+ This tutorial demonstrates the creation of a plugin using a simple
+ constructor injection model and the subsequent deployment of an
instance
+ of <a href="plugin/SimpleClock.java.html">SimpleClock</a> using only
+ the plugin defintion i.e. no references to implementation classes).
+ </p>
+
+ </subsection>
+
+ <subsection name="index.xml">
+
+ <p>
+ Our <tt>index.xml</tt> file has been updated to include a
<tt>part:plugin</tt>
+ production staement. The statement is declaring that the
SimpleClock class is
+ the deployment target and that two constructor arguments are to be
provided on
+ instantiation (a locale value and a format argument).
+ </p>
+
+<pre>
+&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
+&lt;index xmlns="link:xsd:dpml/lang/dpml-module#1.0"
+ <font
color="darkred">xmlns:part="link:xsd:dpml/lang/dpml-part#1.0"</font>&gt;
+
+ &lt;imports&gt;
+ &lt;import uri="link:module:ant"/&gt;
+ &lt;import uri="link:module:dpml"/&gt;
+ &lt;/imports&gt;
+
+ &lt;module name="org/acme/plugin" basedir="."&gt;
+
+ &lt;types&gt;
+ &lt;type id="module" version="1.0"&gt;
+ &lt;/types&gt;
+
+ &lt;project name="clock-api" basedir="api"&gt;
+ &lt;types&gt;
+ &lt;type id="jar"/&gt;
+ &lt;/types&gt;
+ &lt;/project&gt;
+
+ &lt;project name="clock-impl" basedir="impl"&gt;
+ &lt;types&gt;
+ &lt;type id="jar"/&gt;
+ <font color="darkred">&lt;part:plugin
class="org.acme.impl.SimpleClock"&gt;
+ &lt;part:param value="h:mm"/&gt;
+ &lt;part:param class="java.util.Locale" method="getDefault"/&gt;
+ &lt;/part:plugin&gt;</font>
+ &lt;/types&gt;
+ &lt;dependencies&gt;
+ &lt;runtime&gt;
+ &lt;include key="clock-api"/&gt;
+ &lt;/runtime&gt;
+ &lt;test&gt;
+ &lt;include ref="ant/ant-junit"/&gt;
+ &lt;include ref="dpml/transit/dpml-transit-main"/&gt;
+ &lt;/test&gt;
+ &lt;/dependencies&gt;
+ &lt;/project&gt;
+
+ &lt;/module&gt;
+
+&lt;/index&gt;
+</pre>
+
+ </subsection>
+
+ <subsection name="The Part Artifact">
+
+ <p>
+ During the build the following part defintion is created.
+ </p>
+
+ <p><i>Generated part:</i>
<tt>artifact:part:org/acme/plugin/clock-impl#SNAPSHOT</tt></p>
+
+<source>
+<font color="blue"><![CDATA[<?xml version="1.0"?>
+
+<part xmlns="link:xsd:dpml/lang/dpml-part#1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+
+ <info/>
+
+ <strategy xsi:type="plugin" class="org.acme.impl.SimpleClock">
+ <param value="h:mm"/>
+ <param class="java.util.Locale" method="getDefault"/>
+ </strategy>
+
+ <classpath>
+ <private>
+ <uri>artifact:jar:org/acme/plugin/clock-api#SNAPSHOT</uri>
+ <uri>artifact:jar:org/acme/plugin/clock-impl#SNAPSHOT</uri>
+ </private>
+ </classpath>
+
+</part>]]></font></source>
+
+ <p>It contains the following data:</p>
+
+ <ul>
+ <li>An information block.</li>
+ <li>A deployment strategy.</li>
+ <li>A classpath definition.</li>
+ </ul>
+
+ <p>
+ Collectively this information is sufficient to meet requirements of
+ automated plugin deployment. In the following code example we
demonstrate
+ the construction of a <a href="plugin/Clock.java.html">Clock</a>
instance
+ using the part artifact:
+ </p>
+
+ <pre>URI uri = new Uri(
"artifact:part:org/acme/plugin/clock-impl#SNAPSHOT" );
+Part part = Part.load( uri );
+Clock clock = (Clock) part.getContent();
+String timestamp = clock.getTimestamp();</pre>
+
+ </subsection>
+
+ <subsection name="Summary">
+
+ <p>
+ Two import considerations within the above code include:
+ </p>
+
+ <ul>
+ <li>no direct reference to a physical resource location (i.e. the
+ artifact resource identifier addresses the development concern
+ and the actual resource location and retrieval mechanism are
not
+ something that we as developer need be concerned with)</li>
+ <li>the code handling instance instantiation is not polluted with
details
+ concerning deployment strategy - in fact we could easily
+ substitute a more sophisticated deployment models without any
+ impact to the client code</li>
+ </ul>
+
+ <p>
+ However, the plugin strategy demonstrated above is for all intensive
purposes
+ a relatively primite model in that it does not address real-world
semantic issues
+ such as lifecycle or lifestyle management, composition,
thread-safety,
+ remote management, or collection policies. Our <a
href="../../metro/tutorials/index.html">
+ next collection of tutorials</a> takes you into another semantic
dimension with the
+ introduction of an alternative deployment strategy based on the
Metro Component Model.
+ </p>
+
+ </subsection>
+
+ </section>
+
+ </body>
+</document>
+

Modified: trunk/central/site/src/docs/metro/tutorials/import/index.xml
===================================================================
--- trunk/central/site/src/docs/metro/tutorials/import/index.xml
2006-07-24 20:11:24 UTC (rev 1660)
+++ trunk/central/site/src/docs/metro/tutorials/import/index.xml
2006-07-25 08:48:16 UTC (rev 1661)
@@ -17,7 +17,7 @@
jar files and deployment definitions. The demonstration uses three
projects
involving an API, an implementation of that API, and a demo
component and
associated testcase. The API is used by both the implementation and
the demo and
- the implementation is plugged into our demo component at runtime.
Appart from
+ the implementation is plugged into our demo component at runtime.
Apart from
the direct demonstration of different combination techniques used in
component
construction, the tutorial details the impact on classloader chain
construction.
</p>
@@ -29,11 +29,11 @@
<p>
The clock API is defined in a separate project so that we can reuse
the
service interface <a href="Clock.java.html">Clock</a> in our
- demo and implementation projects. The separation of the API into a
separate
- jar file ensures that the jar file can exist at a level in a
classloader
- heirachy appropriate for its role as a shared contract (as destint
from
- an jar file containing an private implementation which would
typically
- exist at a lower level in the classloader heirachy).
+ demo and implementation projects. The separation of the API ensures
+ that the jar file can exist at a level in a classloader heirachy
appropriate
+ for its role as a shared contract (as destinct from a jar file
containing an
+ private implementation which would typically exist at a lower level
in the
+ classloader heirachy).
</p>

<pre>&lt;index ..... &gt;<![CDATA[
@@ -51,7 +51,7 @@
<p>
The <tt>acme-clock-impl</tt> project contains a clock
implementation <a href="SimpleClock.java.html">SimpleClock</a>
- together with deployment information (as a part artifact).
+ together with deployment information (as a component-based part
artifact).
The project definition includes a runtime dependency on the
<tt>acme-clock-api</tt> API project and as such, the runtime
classloader chain definition for the implementation will include
@@ -84,14 +84,14 @@
as an internal part and uses the implementation through
the service API. In the following project definition we have
included the clock implementation deployment data by referencing the
- external data as a component <tt>uri</tt> argument (as such we are
- defining a new component type that extends from the base component
- referenced by the uri value) and we are overriding the context
- format argument with a new value.
+ component <tt>uri</tt> argument (as such we are
+ defining a new component type that extends the base component
+ referenced by the uri value) enabling the possibility to ovderride
the context
+ arguments with new values.
In addition we have declared a build time dependency
on the <tt>acme-clock-impl</tt> (just to ensure that it is build
before or demo project is built). It is important to note that
- a build time dependency only concerns build secuencing and does not
+ a build time dependency only concerns build sequencing and does not
impact our runtime dependency model. In fact, during runtime the
demo component is established and the clock implementation is created
within a classloader that is a child of the enclosing demo component
@@ -140,6 +140,7 @@
<subsection name="Summary">

<p>
+
</p>

</subsection>

Added: trunk/central/site/src/docs/transit/tutorials/local.xml
===================================================================
--- trunk/central/site/src/docs/transit/tutorials/local.xml 2006-07-24
20:11:24 UTC (rev 1660)
+++ trunk/central/site/src/docs/transit/tutorials/local.xml 2006-07-25
08:48:16 UTC (rev 1661)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<document>
+ <properties>
+ <author email="mcconnell AT osm.net">Stephen McConnell</author>
+ <title>Resource Management</title>
+ </properties>
+
+ <body>
+
+ <section name="Local Protocol">
+
+ <subsection name="Tutorial Objective">
+
+ <p>
+ The aim of this tutorial is to establish a good understanding
+ of the local protocal and how it can be leveraged in build and
runtime
+ environments.
+ </p>
+
+ </subsection>
+
+ <subsection name="Definition of an Local Artifact">
+
+ <p>
+ An local artifact is any streamable resource locatable using the
<code>local</code>
+ URL protocol. Examples of resources include - property files, XML
files, files
+ containing meta data, serialized objects, images, etc. The local
protocol resolves
+ uri value relative to the users local preferences directory -
specifically
+ <tt>${dpml.prefs}</tt>. All resources in the prefs directory are
maintained under
+ the <tt>CLASSIC</tt> layout (i.e.
<tt>${dpml.prefs}/[group]/[name]-[VERSION].[TYPE]</tt> or
+ <tt>${dpml.prefs}/[group]/[name].[TYPE]</tt> for non-versioned
resources).
+
+ The protocol structure is as follows:
+ </p>
+
+ <code>local:[type]:[group]/[name]</code>
+
+ <p>or:</p>
+
+ <code>local:[type]:[group]/[name]#[version]</code>
+
+ <p>
+ To locate a resource Transit maps the <code>[type], [group],
+ [name],</code> and <code>[version]</code> fields of the artifact URI
to a URL
+ using the <tt>CLASSIC</tt> layout.
+ </p>
+
+ </subsection>
+
+ <subsection name="Using Local Artifacts">
+
+ <p>
+ The following code demonstrates the use of a local artifact to
retrieve a property
+ file from <tt>DPML_PREFS</tt> and supply it as an input stream to a
Properties object.
+ We construct a new URL using a local artifact specification
+ that declares a resource type of "properties", a group named
"dpml/test", with the name
+ "example-property-file". We then pass the URLs resource stream to a
new Property
+ instance and print out the value of a property declared in the
properties resource.
+ </p>
+
+ <source>URL url = new URL(
"local:properties:dpml/test/demo-property-file" );
+InputStream input = url.openStream();
+Properties properties = new Properties();
+properties.load( input );
+String message = properties.getProperty( "tutorial.message" );
+System.out.println( message );</source>
+ </subsection>
+
+ </section>
+
+ </body>
+
+</document>
+

Modified: trunk/central/site/src/docs/transit/tutorials/plugins.xml
===================================================================
--- trunk/central/site/src/docs/transit/tutorials/plugins.xml 2006-07-24
20:11:24 UTC (rev 1660)
+++ trunk/central/site/src/docs/transit/tutorials/plugins.xml 2006-07-25
08:48:16 UTC (rev 1661)
@@ -46,50 +46,6 @@

</subsection>

- <subsection name="A sample part resource">
-
- <p>
- The following file is an example of a part resource. The
- example is a development version of the part resource used to mount
the
- runtime controller that executes within the Metro component
management
- platform.
- </p>
-
- <source><![CDATA[<?xml version="1.0"?>
-<part xmlns="link:xsd:dpml/lang/dpml-part#1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
-
- <info title="Metro Container Runtime">
- <description>DPML Component management platform runtime
container.</description>
- </info>
-
- <strategy xsi:type="plugin"
class="net.dpml.metro.runtime.CompositionController">
- <param class="net.dpml.component.InitialContext"/>
- </strategy>
-
- <classpath>
- <public>
- <uri>artifact:jar:dpml/util/dpml-logging-api#1.0.0-RC8</uri>
- </public>
- <protected>
- <uri>artifact:jar:dpml/metro/dpml-state-api#1.0.0-RC8</uri>
- <uri>artifact:jar:dpml/metro/dpml-job-api#1.0.0-RC8</uri>
- <uri>artifact:jar:dpml/transit/dpml-transit-main#1.0.0-RC8</uri>
- <uri>artifact:jar:dpml/metro/dpml-metro-component#1.0.0-RC8</uri>
- <uri>artifact:jar:dpml/metro/dpml-metro-model#1.0.0-RC8</uri>
- </protected>
- <private>
- <uri>artifact:jar:dpml/metro/dpml-job-impl#1.0.0-RC8</uri>
- <uri>artifact:jar:dpml/metro/dpml-state-impl#1.0.0-RC8</uri>
- <uri>artifact:jar:dpml/metro/dpml-metro-runtime#1.0.0-RC8</uri>
- </private>
- </classpath>
-
-</part>
-]]></source>
-
- </subsection>
-
<subsection name="Part Creation">

<p>
@@ -99,12 +55,19 @@
was developed from the ground up to provided full transitive
dependency management across build, runtime and test scopes. Using
the
Depot project model the job of creating a plugin definition is
reduced down
- to type production declaration within a project definition.
+ to type production declaration within a Depot project definition.
</p>
+
+ <p><i>An example Depot project defintion ...</i></p>

<pre>
+&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
+&lt;index xmlns="link:xsd:dpml/lang/dpml-module#1.0"&gt;
+
+ ...
+
&lt;project name="dpml-metro-runtime" basedir="runtime"&gt;
- &lt;info title="Metro Container Runtime"&gt;
+ &lt;info title="Metro Runtime"&gt;
&lt;description&gt;
DPML Component management platform runtime container.
&lt;/description&gt;
@@ -117,26 +80,60 @@
&lt;include ref="dpml/util/dpml-logging-api" tag="public"/&gt;
&lt;include key="dpml-metro-component" tag="protected"/&gt;
&lt;include key="dpml-metro-model" tag="protected"/&gt;
- &lt;include ref="dpml/util/dpml-job-impl"/&gt;
- &lt;include key="dpml-state-impl"/&gt;
&lt;/dependencies&gt;
&lt;dependencies scope="test"&gt;
&lt;include ref="ant/ant-junit"/&gt;
&lt;/dependencies&gt;
&lt;/project&gt;
+
+ ...
+
+&lt;/index&gt;
</pre>

<p>
- Observations concerning the above project definition with respect to
- part datastructure creation:
+ The following part description is generated automatically by the
Depot build system
+ based on the above project definition based on the following rules:
</p>

<ul>
<li>The <tt>info</tt> element is mapped directory to a part info
declaration.</li>
- <li>The <tt>part</tt> type element is mapped to a part deployment
<tt>strategy</tt>
+ <li>The <tt>part:plugin</tt> element is mapped to a part
deployment <tt>strategy</tt>
definition.</li>
- <li>All runtime dependencies are fully expanded relative to
respective runtime scope</li>
+ <li>All runtime dependencies are fully expanded.</li>
</ul>
+
+ <source><![CDATA[<?xml version="1.0"?>
+
+<part xmlns="link:xsd:dpml/lang/dpml-part#1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+
+ <info title="Metro Runtime">
+ <description>DPML Component management platform runtime
container.</description>
+ </info>
+
+ <strategy xsi:type="plugin"
class="net.dpml.metro.runtime.CompositionController">
+ <param class="net.dpml.component.InitialContext"/>
+ </strategy>
+
+ <classpath>
+ <public>
+ <uri>artifact:jar:dpml/util/dpml-logging-api#SNAPSHOT</uri>
+ </public>
+ <protected>
+ <uri>artifact:jar:dpml/transit/dpml-transit-main#SNAPSHOT</uri>
+ <uri>artifact:jar:dpml/metro/dpml-metro-state#SNAPSHOT</uri>
+ <uri>artifact:jar:dpml/metro/dpml-metro-component#SNAPSHOT</uri>
+ <uri>artifact:jar:dpml/metro/dpml-metro-model#SNAPSHOT</uri>
+ </protected>
+ <private>
+ <uri>artifact:jar:dpml/metro/dpml-metro-runtime#SNAPSHOT</uri>
+ </private>
+ </classpath>
+
+</part>
+
+]]></source>

</subsection>

@@ -152,14 +149,14 @@

<p>
The following example demonstrates the creation of a plugin
sub-system
- using Transit.
+ using Transit to establish a client instance.
</p>

<source>
URI uri = new URI( "@METRO-RUNTIME-URI@" );
Part part = Part.load( uri );
Logger logger = getLogger();
- m_handler = (ContentHandler) part.instantiate( new Object[]{ logger } );
+ Object instance = part.instantiate( new Object[]{ logger } );
</source>

<p>

Modified: trunk/central/site/src/stats/stats.xls
===================================================================
(Binary files differ)

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/FeatureTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/FeatureTask.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/FeatureTask.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -32,26 +32,13 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public abstract class FeatureTask extends GenericTask
+public abstract class FeatureTask extends ResourceTask
{
- private String m_key;
- private String m_ref;
private String m_feature;
private String m_type; // optional - used to select type when resolving
uris
private boolean m_alias = false; // used when resolving uris

/**
- * Set the key of the target project or resource description from which
features will be
- * resolved from. If not declared the key defaults to the current
defintion.
- *
- * @param key the resource key
- */
- public void setKey( final String key )
- {
- m_key = key;
- }
-
- /**
* Set filename resolution switch. If true the filename feature will
* return an alias path.
*
@@ -62,19 +49,7 @@
m_alias = flag;
}

-
/**
- * Set the ref of the target project or resource description from which
features will be
- * resolved from.
- *
- * @param ref the resource reference
- */
- public void setRef( final String ref )
- {
- m_ref = ref;
- }
-
- /**
* Set the name of the feature.
* @param feature the feature name
*/
@@ -117,8 +92,7 @@
log( "Processing feature: " + m_feature, Project.MSG_VERBOSE );
}

- String ref = getRef();
- Resource resource = getResource( ref );
+ Resource resource = getResource();
Feature feature = Feature.parse( m_feature );
if( null == m_type )
{
@@ -130,38 +104,4 @@
return Feature.resolve( resource, feature, type, m_alias );
}
}
-
- private String getRef()
- {
- if( null != m_ref )
- {
- return m_ref;
- }
- else if( null != m_key )
- {
- return getResource().getParent().getResourcePath() + "/" + m_key;
- }
- else
- {
- return getResource().getResourcePath();
- }
- }
-
- private Resource getResource( String ref )
- {
- try
- {
- return getContext().getLibrary().getResource( ref );
- }
- catch( ResourceNotFoundException e )
- {
- final String error =
- "Feature reference ["
- + ref
- + "] in the project ["
- + getResource()
- + "] is unknown.";
- throw new BuildException( error, e );
- }
- }
}

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -40,6 +40,9 @@

import net.dpml.tools.Context;

+import net.dpml.util.Logger;
+import net.dpml.util.DefaultLogger;
+
import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;

@@ -196,7 +199,8 @@
Type type = resource.getType( TYPE );
Element element = type.getElement();
PartDecoder decoder = PartDecoder.getInstance();
- return decoder.build( info, classpath, element, resource );
+ DefaultLogger logger = new DefaultLogger( getTaskName() );
+ return decoder.build( logger, info, classpath, element, resource
);
}
catch( Throwable e )
{

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/data/ComponentDirective.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/data/ComponentDirective.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/main/metro/model/src/main/net/dpml/metro/data/ComponentDirective.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -311,7 +311,7 @@
m_uri = uri;
if( null != uri )
{
- Part part = Part.load( uri );
+ Part part = Part.load( uri, false );
if( part instanceof DefaultComposition )
{
m_base = (DefaultComposition) part;

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/data/DefaultComposition.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/data/DefaultComposition.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/main/metro/model/src/main/net/dpml/metro/data/DefaultComposition.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -42,6 +42,8 @@
{
private ComponentDirective m_directive;

+ private final Classpath m_classpath;
+
/**
* Creation of a new composition diefinition.
* @param logger the assigned logging channel
@@ -58,6 +60,19 @@
super( logger, info, classpath, controller, directive,
directive.getName() );

m_directive = directive;
+
+ if( null != m_directive.getBaseDirective() )
+ {
+ // override the classpath defintion with a extended definition
+
+ DefaultComposition composition = m_directive.getBasePart();
+ Classpath base = composition.getClasspath();
+ m_classpath = new Classpath( base, classpath );
+ }
+ else
+ {
+ m_classpath = null;
+ }
}

/**
@@ -70,6 +85,23 @@
}

/**
+ * Get the part classpath definition.
+ *
+ * @return the classpath definition
+ */
+ public Classpath getClasspath()
+ {
+ if( null != m_classpath )
+ {
+ return m_classpath;
+ }
+ else
+ {
+ return super.getClasspath();
+ }
+ }
+
+ /**
* Encode the deployment directive to XML.
* @param writer the output stream writer
* @param pad the outoput offset

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -118,11 +118,11 @@
try
{
String partition = m_controller.getPartition() +
Model.PARTITION_SEPARATOR;
- ClassLoader classloader = composition.getClassLoader();
- Classpath classpath = composition.getClasspath();
ComponentDirective directive =
composition.getComponentDirective();
String name = directive.getName();
String path = partition + name;
+ Classpath classpath = composition.getClasspath();
+ ClassLoader classloader = getClassLoader( path,
ComponentModel.class.getClassLoader(), classpath );
Logger logger = new DefaultLogger( path );
EventQueue queue = m_controller.getEventQueue();
return new DefaultComponentModel(

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -113,16 +113,6 @@
m_context.addControllerContextListener( m_listener );
m_controller = new ComponentController( m_logger, this );
m_events = new EventQueue( m_logger );
-
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace(
- "loaded controller ["
- + getClass().getName()
- + "#"
- + System.identityHashCode( this )
- + "]" );
- }
}

EventQueue getEventQueue()
@@ -162,13 +152,8 @@
* @exception IOException if an I/O error occurs
*/
public Part build(
- Info info, Classpath classpath, Element strategy, Resolver resolver )
throws IOException
+ Logger logger, Info info, Classpath classpath, Element strategy,
Resolver resolver ) throws IOException
{
- if( getLogger().isTraceEnabled() )
- {
- String path = getPartSpec( info.getURI() );
- getLogger().trace( "new composition: " + path );
- }
ClassLoader context = Thread.currentThread().getContextClassLoader();
try
{
@@ -176,7 +161,6 @@
Thread.currentThread().setContextClassLoader( anchor );
ComponentDecoder decoder = new ComponentDecoder();
ComponentDirective directive = decoder.buildComponent( strategy,
resolver );
- Logger logger = getLogger();
return new DefaultComposition( logger, info, classpath, this,
directive );
}
finally
@@ -198,18 +182,43 @@
*/
public ClassLoader getClassLoader( String name, ClassLoader anchor,
Classpath classpath ) throws IOException
{
- if( null == classpath )
+ return getClassLoader( name, anchor, classpath, true );
+ }
+
+ /**
+ * Build a classloader stack.
+ * @param anchor the anchor classloader to server as the classloader
chain root
+ * @param classpath the part classpath definition
+ * @return the new classloader
+ * @exception IOException if an IO error occurs during classpath
evaluation
+ */
+ private ClassLoader getClassLoader( String name, ClassLoader anchor,
Classpath classpath, boolean expand ) throws IOException
+ {
+ Logger logger = getLogger();
+
+ if( expand )
{
- return anchor;
+ Classpath cp = classpath.getBaseClasspath();
+ if( null != cp )
+ {
+ ClassLoader cl = getClassLoader( name + " (super)", anchor,
cp );
+ return getClassLoader( name, cl, classpath, false );
+ }
}

+ Class root = ComponentDirective.class;
+ String classname = root.getName();
ClassLoader base = anchor;
- Logger logger = getLogger();
- Class root = ComponentDirective.class.getName();

+ if( null == classpath )
+ {
+ ClassLoader management = root.getClassLoader();
+ return new CompositionClassLoader( logger, name,
Category.PROTECTED, management, anchor );
+ }
+
try
{
- base.loadClass( root );
+ anchor.loadClass( classname );
}
catch( ClassNotFoundException e )
{
@@ -225,48 +234,6 @@
ClassLoader impl = StandardClassLoader.buildClassLoader( logger,
name, Category.PRIVATE, spi, imps );
return impl;
}
-
- /**
- * Handle notification of the creation of a new classloader.
- * @param category the classloader category (public, protected or private)
- * @param classloader the new classloader
- */
- public void classloaderConstructed( String name, Category category,
ClassLoader classloader )
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( classloader );
- StringBuffer buffer = new StringBuffer();
- buffer.append( "created " );
- buffer.append( category.toString() );
- buffer.append( " classloader for " + name );
- buffer.append( "\n ID: " + id );
- if( classloader instanceof CompositionClassLoader )
- {
- CompositionClassLoader loader = (CompositionClassLoader)
classloader;
- ClassLoader interceptor =
loader.getInterceptionClassLoader();
- int pid = System.identityHashCode( interceptor );
- buffer.append( "\n interceptor: " + pid );
- }
- ClassLoader parent = classloader.getParent();
- if( null != parent )
- {
- int pid = System.identityHashCode( parent );
- buffer.append( "\n extends: " + pid );
- }
- if( classloader instanceof URLClassLoader )
- {
- URLClassLoader loader = (URLClassLoader) classloader;
- URL[] urls = loader.getURLs();
- for( int i=0; i < urls.length; i++ )
- {
- URL url = urls[i];
- buffer.append( "\n [" + i + "] " + url.toString() );
- }
- }
- getLogger().debug( buffer.toString() );
- }
- }

//--------------------------------------------------------------------
// Controller
@@ -403,17 +370,20 @@
}
else
{
- getLogger().trace( "creating new managed component" );
+ getLogger().trace( "creating new remotelly controlled
component" );
}
}
if( model instanceof ComponentModel )
{
ClassLoader anchor = Logger.class.getClassLoader();
ComponentModel componentModel = (ComponentModel) model;
- Classpath classpath = componentModel.getClasspath();
- String name = componentModel.getName();
- ClassLoader classloader = getClassLoader( name, anchor,
classpath );
- return m_controller.createDefaultComponentHandler( classloader,
componentModel, flag );
+ return m_controller.createDefaultComponentHandler( anchor,
componentModel, flag );
+
+ //ClassLoader anchor = Logger.class.getClassLoader();
+ //Classpath classpath = componentModel.getClasspath();
+ //String name = componentModel.getName();
+ //ClassLoader classloader = getClassLoader( name, anchor,
classpath );
+ //return m_controller.createDefaultComponentHandler(
classloader, componentModel, flag );
}
else
{

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -81,6 +81,10 @@
String key = ref.getKey();
m_keys[i] = key;
Directive part = ref.getDirective();
+ if( provider.getLogger().isTraceEnabled() )
+ {
+ provider.getLogger().trace( "building part: " + key );
+ }
if( part instanceof ComponentDirective )
{
try

Modified: trunk/main/transit/core/src/main/net/dpml/lang/Builder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Builder.java 2006-07-24
20:11:24 UTC (rev 1660)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Builder.java 2006-07-25
08:48:16 UTC (rev 1661)
@@ -20,6 +20,7 @@

import java.io.IOException;

+import net.dpml.util.Logger;
import net.dpml.util.Resolver;

import org.w3c.dom.Element;
@@ -34,6 +35,7 @@
{
/**
* Construct a new part using a supplied value resolver.
+ * @param logger the logging channel
* @param info the part information descriptor
* @param classpath the part classpath descriptor
* @param strategy the DOM element definining the deployment strategy
@@ -41,5 +43,5 @@
* @return the part definition
* @exception IOException if an I/O error occurs
*/
- Part build( Info info, Classpath classpath, Element strategy, Resolver
resolver ) throws IOException;
+ Part build( Logger logger, Info info, Classpath classpath, Element
strategy, Resolver resolver ) throws IOException;
}

Modified: trunk/main/transit/core/src/main/net/dpml/lang/Classpath.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Classpath.java
2006-07-24 20:11:24 UTC (rev 1660)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Classpath.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -29,7 +29,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public final class Classpath implements Serializable
+public final class Classpath extends AbstractDirective
{
private static final URI[] EMPTY = new URI[0];

@@ -37,6 +37,7 @@
private final URI[] m_public;
private final URI[] m_protected;
private final URI[] m_private;
+ private final Classpath m_base;

/**
* Creation of a empty classpath definition.
@@ -48,6 +49,21 @@

/**
* Creation of a new classpath definition.
+ * @param base the base classpath from which this classpath is derived
+ * @param extension the extended classpath defintion
+ */
+ public Classpath( final Classpath base, final Classpath extension )
+ {
+ this( base, extension.m_system, extension.m_public,
extension.m_protected,extension.m_private );
+ //m_base = base;
+ //m_system = extension.m_system;
+ //m_public = extension.m_public;
+ //m_protected = extension.m_protected;
+ //m_private = extension.m_private;
+ }
+
+ /**
+ * Creation of a new classpath definition.
* @param systemUris an array of uris representing the system classpath
extensions
* @param publicUris an array of uris representing the public classpath
entries
* @param protectedUris an array of uris representing protected classpath
entries
@@ -56,6 +72,20 @@
public Classpath(
URI[] systemUris, URI[] publicUris, URI[] protectedUris, URI[]
privateUris )
{
+ this( null, systemUris, publicUris,protectedUris, privateUris );
+ }
+
+ /**
+ * Creation of a new classpath definition.
+ * @param systemUris an array of uris representing the system classpath
extensions
+ * @param publicUris an array of uris representing the public classpath
entries
+ * @param protectedUris an array of uris representing protected classpath
entries
+ * @param privateUris an array of uris representing private classpath
entries
+ */
+ public Classpath(
+ Classpath base, URI[] systemUris, URI[] publicUris, URI[]
protectedUris, URI[] privateUris )
+ {
+ m_base = base;
if( null == systemUris )
{
m_system = EMPTY_URIS;
@@ -94,6 +124,15 @@
}

/**
+ * Return the base classpath.
+ * @return the base classpath that this classpath extends (possibly null)
+ */
+ public Classpath getBaseClasspath()
+ {
+ return m_base;
+ }
+
+ /**
* Return the classloader dependencies relative to a supplied classloader
category.
*
* @param category the classloader category
@@ -136,6 +175,10 @@
if( other instanceof Classpath )
{
Classpath classpath = (Classpath) other;
+ //if( equals( m_base, classpath.m_base ) )
+ //{
+ // return false;
+ //}
if( !Arrays.equals( m_system, classpath.getDependencies(
Category.SYSTEM ) ) )
{
return false;
@@ -186,26 +229,6 @@
+ "]";
}

- /**
- * Utility to hash an array.
- * @param array the array
- * @return the hash value
- */
- protected int hashArray( Object[] array )
- {
- if( null == array )
- {
- return 0;
- }
- int hash = 0;
- for( int i=0; i<array.length; i++ )
- {
- Object object = array[i];
- hash ^= object.hashCode();
- }
- return hash;
- }
-
private static final URI[] EMPTY_URIS = new URI[0];

}

Modified: trunk/main/transit/core/src/main/net/dpml/lang/Part.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Part.java 2006-07-24
20:11:24 UTC (rev 1660)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Part.java 2006-07-25
08:48:16 UTC (rev 1661)
@@ -71,9 +71,11 @@

private final Info m_info;
private final Classpath m_classpath;
- private final ClassLoader m_classloader;
private final Logger m_logger;

+ private transient ClassLoader m_classloader;
+ private transient String m_label;
+
/**
* Load a part from an external XML source with part caching.
* @param uri the external part source
@@ -132,7 +134,7 @@
m_logger = logger;
m_info = info;
m_classpath = classpath;
- m_classloader = buildClassLoader( label );
+ m_label = label;
}

/**
@@ -341,6 +343,10 @@
*/
public ClassLoader getClassLoader()
{
+ if( null == m_classloader )
+ {
+ m_classloader = setupClassLoader();
+ }
return m_classloader;
}

@@ -353,6 +359,20 @@
return m_logger;
}

+ private ClassLoader setupClassLoader()
+ {
+ try
+ {
+ return buildClassLoader( m_label );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Classloader build error.";
+ throw new PartError( error, e );
+ }
+ }
+
private ClassLoader buildClassLoader( String label ) throws IOException
{
ClassLoader base = getAnchorClassLoader();
@@ -379,7 +399,23 @@

private ClassLoader newClassLoader( ClassLoader base, Classpath
classpath, String label ) throws IOException
{
+ return newClassLoader( base, classpath, label, true );
+ }
+
+ private ClassLoader newClassLoader( ClassLoader base, Classpath
classpath, String label, boolean expand ) throws IOException
+ {
Logger logger = getLogger();
+
+ if( expand )
+ {
+ Classpath cp = classpath.getBaseClasspath();
+ if( null != cp )
+ {
+ ClassLoader cl = newClassLoader( base, cp, label + "
(super)" );
+ return newClassLoader( cl, classpath, label, false );
+ }
+ }
+
URI[] uris = classpath.getDependencies( Category.SYSTEM );
if( uris.length > 0 )
{
@@ -428,45 +464,6 @@
}
}
}
-
-
- /**
- * Handle notification of the creation of a new classloader.
- * @param label the classloader label
- * @param category the classloader category
- * @param classloader the new classloader to report
- */
- /*
- private void classloaderConstructed( String label, Category category,
ClassLoader classloader )
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( classloader );
- StringBuffer buffer = new StringBuffer();
- buffer.append( "created new " );
- buffer.append( category.toString() );
- buffer.append( " classloader" );
- buffer.append( "\n ID: " + id );
- buffer.append( "\n Label: " + label + " " + category );
- ClassLoader parent = classloader.getParent();
- if( null != parent )
- {
- buffer.append( "\n Extends: " + System.identityHashCode(
parent ) );
- }
- if( classloader instanceof URLClassLoader )
- {
- URLClassLoader loader = (URLClassLoader) classloader;
- URL[] urls = loader.getURLs();
- for( int i=0; i < urls.length; i++ )
- {
- URL url = urls[i];
- buffer.append( "\n [" + i + "] " + url.toString() );
- }
- }
- getLogger().debug( buffer.toString() );
- }
- }
- */

/**
* Handle notification of system classloader expansion.

Modified: trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-07-24 20:11:24 UTC (rev 1660)
+++ trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -219,7 +219,7 @@
Info information = getInfo( uri, element );
Classpath classpath = getClasspath( element );
Element strategy = getStrategyElement( element );
- return build( information, classpath, strategy, resolver );
+ return build( m_logger, information, classpath, strategy,
resolver );
}
else
{
@@ -241,7 +241,7 @@
* @exception IOException if an error occurs during element evaluation
*/
public Part build(
- Info information, Classpath classpath, Element strategy, Resolver
resolver )
+ Logger logger, Info information, Classpath classpath, Element
strategy, Resolver resolver )
throws IOException
{
ClassLoader anchor = getAnchorClassLoader();
@@ -251,36 +251,35 @@
{
// this is either a plugin or a resource

- Logger logger = getLogger();
String name = info.getTypeName();
if( "plugin".equals( name ) )
{
- if( getLogger().isTraceEnabled() )
+ if( logger.isTraceEnabled() )
{
- getLogger().trace( "reading plugin definition" );
+ logger.trace( "reading plugin definition" );
}
String classname = ElementHelper.getAttribute( strategy,
"class" );
Element[] elements = ElementHelper.getChildren( strategy );
Value[] values = VALUE_DECODER.decodeValues( elements );
Part part = new Plugin( logger, information, classpath,
classname, values );
- if( getLogger().isTraceEnabled() )
+ if( logger.isTraceEnabled() )
{
- getLogger().trace( "loaded plugin definition" );
+ logger.trace( "loaded plugin definition" );
}
return part;
}
else if( "resource".equals( name ) )
{
- if( getLogger().isTraceEnabled() )
+ if( logger.isTraceEnabled() )
{
- getLogger().trace( "reading resource definition" );
+ logger.trace( "reading resource definition" );
}
String urn = ElementHelper.getAttribute( strategy, "urn" );
String path = ElementHelper.getAttribute( strategy, "path" );
Part part = new Resource( logger, information, classpath,
urn, path );
- if( getLogger().isTraceEnabled() )
+ if( logger.isTraceEnabled() )
{
- getLogger().trace( "loaded resource definition" );
+ logger.trace( "loaded resource definition" );
}
return part;
}
@@ -301,20 +300,24 @@

try
{
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "loading foreign builder" );
- }
URI uri = getDecoderURI( strategy );
Builder builder = loadForeignBuilder( uri );
- if( getLogger().isTraceEnabled() )
+ if( logger.isTraceEnabled() )
{
- getLogger().trace(
+ logger.trace(
"using builder ["
+ builder.getClass().getName()
+ "]" );
}
- return builder.build( information, classpath, strategy,
resolver );
+ Part part = builder.build( logger, information, classpath,
strategy, resolver );
+ if( logger.isTraceEnabled() )
+ {
+ logger.trace(
+ "loaded part ["
+ + part.getClass().getName()
+ + "]" );
+ }
+ return part;
}
catch( Exception ioe )
{

Modified:
trunk/tutorials/components/customize/custom/etc/data/logging.properties
===================================================================
--- trunk/tutorials/components/customize/custom/etc/data/logging.properties
2006-07-24 20:11:24 UTC (rev 1660)
+++ trunk/tutorials/components/customize/custom/etc/data/logging.properties
2006-07-25 08:48:16 UTC (rev 1661)
@@ -1,4 +1,4 @@
.level=FINEST
sun.rmi.level=INFO
-dpml.level=INFO
+dpml.level=FINEST


Modified: trunk/tutorials/components/import/api/src/main/org/acme/Clock.java
===================================================================
--- trunk/tutorials/components/import/api/src/main/org/acme/Clock.java
2006-07-24 20:11:24 UTC (rev 1660)
+++ trunk/tutorials/components/import/api/src/main/org/acme/Clock.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -29,4 +29,6 @@
public interface Clock
{
String getTimestamp();
+
+ void list();
}

Modified:
trunk/tutorials/components/import/clock/src/main/org/acme/scheduler/SimpleClock.java
===================================================================
---
trunk/tutorials/components/import/clock/src/main/org/acme/scheduler/SimpleClock.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/tutorials/components/import/clock/src/main/org/acme/scheduler/SimpleClock.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -23,6 +23,9 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;

+import net.dpml.lang.StandardClassLoader;
+import net.dpml.util.Logger;
+
import org.acme.Clock;

/**
@@ -69,6 +72,7 @@
//------------------------------------------------------------------

private final Context m_context;
+ private final Logger m_logger;

//------------------------------------------------------------------
// constructor
@@ -78,8 +82,9 @@
* Creation of a new instance.
* @param context the initial configuration
*/
- public SimpleClock( final Context context )
+ public SimpleClock( final Logger logger, final Context context )
{
+ m_logger = logger;
m_context = context;
}

@@ -98,6 +103,20 @@
return formatter.format( date );
}

+ public void list()
+ {
+ ClassLoader classloader = getClass().getClassLoader();
+ if( classloader instanceof StandardClassLoader )
+ {
+ StandardClassLoader loader = (StandardClassLoader) classloader;
+ m_logger.info( loader.toString( true ) );
+ }
+ else
+ {
+ m_logger.info( classloader.toString() );
+ }
+ }
+
private DateFormat getDateFormatter()
{
String format = m_context.getFormat( DEFAULT_PATTERN );

Modified: trunk/tutorials/components/import/demo/etc/data/logging.properties
===================================================================
--- trunk/tutorials/components/import/demo/etc/data/logging.properties
2006-07-24 20:11:24 UTC (rev 1660)
+++ trunk/tutorials/components/import/demo/etc/data/logging.properties
2006-07-25 08:48:16 UTC (rev 1661)
@@ -1,7 +1,7 @@
.level=FINEST
sun.rmi.level=INFO
-dpml.metro.level=INFO
-dpml.transit.level=INFO
-dpml.lang.level=INFO
-demo.level=FINE
+#dpml.metro.level=FINEST
+#dpml.transit.level=FINEST
+#dpml.lang.level=FINEST
+#demo.level=FINE


Modified:
trunk/tutorials/components/import/demo/src/main/org/acme/demo/Demo.java
===================================================================
--- trunk/tutorials/components/import/demo/src/main/org/acme/demo/Demo.java
2006-07-24 20:11:24 UTC (rev 1660)
+++ trunk/tutorials/components/import/demo/src/main/org/acme/demo/Demo.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -20,6 +20,8 @@

import org.acme.Clock;

+import net.dpml.lang.StandardClassLoader;
+
import net.dpml.logging.Logger;

/**
@@ -40,16 +42,44 @@
}

//------------------------------------------------------------------
+ // state
+ //------------------------------------------------------------------
+
+ private final Logger m_logger;
+ private final Parts m_parts;
+
+ //------------------------------------------------------------------
// constructor
//------------------------------------------------------------------

public Demo( final Logger logger, final Parts parts )
{
+ m_logger = logger;
+ m_parts = parts;
Clock clock = parts.getClock();
logger.info(
clock.getTimestamp()
+ " (from " + clock.getClass().getName()
+ ")"
);
+ list();
}
+
+ public void list()
+ {
+ m_logger.info( "A #############" );
+ ClassLoader classloader = getClass().getClassLoader();
+ if( classloader instanceof StandardClassLoader )
+ {
+ StandardClassLoader loader = (StandardClassLoader) classloader;
+ m_logger.info( loader.toString( true ) );
+ }
+ else
+ {
+ m_logger.info( classloader.toString() );
+ }
+ m_logger.info( "B #############" );
+ m_parts.getClock().list();
+ m_logger.info( "C #############" );
+ }
}

Modified:
trunk/tutorials/components/import/demo/src/test/org/acme/test/DemoTestCase.java
===================================================================
---
trunk/tutorials/components/import/demo/src/test/org/acme/test/DemoTestCase.java
2006-07-24 20:11:24 UTC (rev 1660)
+++
trunk/tutorials/components/import/demo/src/test/org/acme/test/DemoTestCase.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -25,8 +25,6 @@

import net.dpml.lang.Part;

-import org.acme.demo.Demo;
-
/**
* Deployment of the demo component.
*
@@ -43,7 +41,7 @@
{
URI uri = getPartURI();
Part part = Part.load( uri );
- Demo demo = (Demo) part.getContent();
+ part.getContent();
}

private URI getPartURI() throws Exception

Modified: trunk/tutorials/components/module.xml
===================================================================
--- trunk/tutorials/components/module.xml 2006-07-24 20:11:24 UTC (rev
1660)
+++ trunk/tutorials/components/module.xml 2006-07-25 08:48:16 UTC (rev
1661)
@@ -351,6 +351,30 @@
</dependencies>
</project>

+ <!-- extension demo -->
+
+ <project name="acme-extended-clock" basedir="customize/extension">
+ <info title="Extended Clock"/>
+ <types>
+ <component xmlns="link:xsd:dpml/lang/dpml-component#1.0"
+ uri="resource:part:dpmlx/tutorials/components/acme-simple-clock"
name="extension">
+ <context>
+ <entry key="format" value="K:mm a, z"/>
+ </context>
+ </component>
+ </types>
+ <dependencies>
+ <runtime>
+ <include key="acme-simple-clock"/>
+ </runtime>
+ <test>
+ <include ref="ant/ant-junit"/>
+ <include ref="dpml/transit/dpml-transit-main"/>
+ </test>
+ </dependencies>
+ </project>
+
+
<project name="acme-custom-clock" basedir="customize/custom">
<info title="Custom Clock"/>
<types>
@@ -388,11 +412,12 @@
<types>
<type id="jar"/>
<component xmlns="link:xsd:dpml/lang/dpml-component#1.0"
- type="org.acme.scheduler.SimpleClock"/>
+ type="org.acme.scheduler.SimpleClock" name="simple"/>
</types>
<dependencies>
<runtime>
<include key="acme-clock-api"/>
+ <include ref="dpml/transit/dpml-transit-main"/>
</runtime>
</dependencies>
</project>
@@ -401,7 +426,7 @@
<types>
<type id="jar"/>
<component xmlns="link:xsd:dpml/lang/dpml-component#1.0"
- type="org.acme.demo.Demo">
+ type="org.acme.demo.Demo" name="demo">
<parts>
<component key="clock"
uri="resource:part:dpmlx/tutorials/components/acme-clock-impl">
<context>
@@ -418,12 +443,24 @@
<runtime>
<include key="acme-clock-api"/>
<include ref="dpml/util/dpml-logging-api"/>
+ <include ref="dpml/transit/dpml-transit-main"/>
</runtime>
<test>
<include ref="ant/ant-junit"/>
+ </test>
+ </dependencies>
+ </project>
+
+ <project name="acme-clock-test" basedir="import/test">
+ <dependencies>
+ <test>
<include ref="dpml/transit/dpml-transit-main"/>
+ <include ref="ant/ant-junit"/>
</test>
</dependencies>
+ <filters>
+ <feature ref="dpmlx/tutorials/components/acme-clock-demo" token="PART"
id="uri" type="part"/>
+ </filters>
</project>

</module>
\ No newline at end of file

Copied: trunk/tutorials/tooling/complex/plugin (from rev 1641,
trunk/tutorials/tooling/complex/parts)

Copied: trunk/tutorials/tooling/complex/plugin/api (from rev 1660,
trunk/tutorials/tooling/complex/parts/api)

Copied: trunk/tutorials/tooling/complex/plugin/impl (from rev 1660,
trunk/tutorials/tooling/complex/parts/impl)

Modified:
trunk/tutorials/tooling/complex/plugin/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-24 20:11:24 UTC (rev 1660)
+++
trunk/tutorials/tooling/complex/plugin/impl/src/test/org/acme/impl/test/DemoTestCase.java
2006-07-25 08:48:16 UTC (rev 1661)
@@ -20,6 +20,7 @@

import java.io.File;
import java.net.URI;
+import java.util.logging.Logger;

import junit.framework.TestCase;

@@ -44,7 +45,10 @@
URI uri = getPartURI();
Part part = Part.load( uri );
Clock clock = (Clock) part.getContent();
- System.out.println( clock.getTimestamp() );
+ String timestamp = clock.getTimestamp();
+
+ Logger logger = Logger.getLogger( "test" );
+ logger.info( clock.getTimestamp() );
}

private URI getPartURI() throws Exception

Modified: trunk/tutorials/tooling/complex/plugin/index.xml
===================================================================
--- trunk/tutorials/tooling/complex/parts/index.xml 2006-07-24 07:42:33
UTC (rev 1641)
+++ trunk/tutorials/tooling/complex/plugin/index.xml 2006-07-25 08:48:16
UTC (rev 1661)
@@ -7,7 +7,7 @@
<import uri="link:module:dpml"/>
</imports>

- <module name="org/acme/parts" basedir=".">
+ <module name="org/acme/plugin" basedir=".">

<project name="clock-api" basedir="api">
<types>




  • r1661 - in trunk: central/site central/site/src/docs/depot central/site/src/docs/depot/tutorials central/site/src/docs/metro/tutorials/import central/site/src/docs/transit/tutorials central/site/src/stats main/depot/tools/builder/src/main/net/dpml/tools/tasks main/metro/model/src/main/net/dpml/metro/data main/metro/runtime/src/main/net/dpml/metro/runtime main/transit/core/src/main/net/dpml/lang tutorials/components tutorials/components/customize/custom/etc/data tutorials/components/import/api/src/main/org/acme tutorials/components/import/clock/src/main/org/acme/scheduler tutorials/components/import/demo/etc/data tutorials/components/import/demo/src/main/org/acme/demo tutorials/components/import/demo/src/test/org/acme/test tutorials/tooling/complex tutorials/tooling/complex/plugin tutorials/tooling/complex/plugin/impl/src/test/org/acme/impl/test, mcconnell at BerliOS, 07/25/2006

Archive powered by MHonArc 2.6.24.

Top of Page