notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1325 - in trunk/main: . central/src/art central/src/docs/depot/tasks central/src/docs/metro/runtime/components depot/build/etc/bin depot/build/src/main/net/dpml/library/console depot/core depot/core/src/main/net/dpml/depot depot/library/etc/test/dpml depot/library/src/main/net/dpml/library/impl depot/library/src/test/net/dpml/library/impl depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks metro/component/src/main/net/dpml/component metro/model/src/main/net/dpml/metro/data metro/runtime/src/main/net/dpml/metro/builder metro/runtime/src/main/net/dpml/metro/runtime metro/state/impl/src/main/net/dpml/state/impl metro/test/src/test/net/dpml/test/part metro/tools/src/main/net/dpml/metro/tools planet/http/test/src/test/net/dpml/http/test station/api/src/test/net/dpml/station/info station/builder/src/main/net/dpml/station/builder station/console/etc/bin station/console/src/main/net/dpml/station/console station/exec/etc/bin st! ation/exec/src/main/net/dpml/station/exec station/server/etc/bin/scm/conf station/server/src/main/net/dpml/station/server station/server/src/test/net/dpml/station/server transit/console/etc/bin transit/console/src/main/net/dpml/transit/console transit/core/etc/test/trusted/dpml/test transit/core/src/main/net/dpml transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/transit transit/core/src/main/net/dpml/transit/artifact transit/core/src/main/net/dpml/transit/monitor transit/core/src/main/net/dpml/util transit/core/src/test/net/dpml transit/core/src/test/net/dpml/lang transit/tools/src/main/net/dpml/transit/tools util/job/impl/src/test/net/dpml/job/test
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1325 - in trunk/main: . central/src/art central/src/docs/depot/tasks central/src/docs/metro/runtime/components depot/build/etc/bin depot/build/src/main/net/dpml/library/console depot/core depot/core/src/main/net/dpml/depot depot/library/etc/test/dpml depot/library/src/main/net/dpml/library/impl depot/library/src/test/net/dpml/library/impl depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks metro/component/src/main/net/dpml/component metro/model/src/main/net/dpml/metro/data metro/runtime/src/main/net/dpml/metro/builder metro/runtime/src/main/net/dpml/metro/runtime metro/state/impl/src/main/net/dpml/state/impl metro/test/src/test/net/dpml/test/part metro/tools/src/main/net/dpml/metro/tools planet/http/test/src/test/net/dpml/http/test station/api/src/test/net/dpml/station/info station/builder/src/main/net/dpml/station/builder station/console/etc/bin station/console/src/main/net/dpml/station/console station/exec/etc/bin st! ation/exec/src/main/net/dpml/station/exec station/server/etc/bin/scm/conf station/server/src/main/net/dpml/station/server station/server/src/test/net/dpml/station/server transit/console/etc/bin transit/console/src/main/net/dpml/transit/console transit/core/etc/test/trusted/dpml/test transit/core/src/main/net/dpml transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/transit transit/core/src/main/net/dpml/transit/artifact transit/core/src/main/net/dpml/transit/monitor transit/core/src/main/net/dpml/util transit/core/src/test/net/dpml transit/core/src/test/net/dpml/lang transit/tools/src/main/net/dpml/transit/tools util/job/impl/src/test/net/dpml/job/test
- Date: Thu, 6 Apr 2006 00:47:21 +0200
Author: mcconnell
Date: 2006-04-06 00:46:20 +0200 (Thu, 06 Apr 2006)
New Revision: 1325
Added:
trunk/main/transit/core/src/main/net/dpml/lang/Builder.java
trunk/main/transit/core/src/main/net/dpml/lang/Info.java
trunk/main/transit/core/src/main/net/dpml/lang/Part.java
trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
trunk/main/transit/core/src/main/net/dpml/lang/PartError.java
trunk/main/transit/core/src/main/net/dpml/lang/PartException.java
trunk/main/transit/core/src/main/net/dpml/lang/Plugin.java
trunk/main/transit/core/src/main/net/dpml/lang/Resource.java
trunk/main/transit/core/src/main/net/dpml/lang/StandardClassLoader.java
trunk/main/transit/core/src/main/net/dpml/lang/SystemClassLoader.java
trunk/main/transit/core/src/main/net/dpml/lang/ValueDecoder.java
trunk/main/transit/core/src/main/net/dpml/lang/ValueEncoder.java
trunk/main/transit/core/src/main/net/dpml/util/DOM3DocumentBuilder.java
trunk/main/transit/core/src/main/net/dpml/util/DOMInput.java
trunk/main/transit/core/src/main/net/dpml/util/Decoder.java
trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
trunk/main/transit/core/src/main/net/dpml/util/DecodingException.java
trunk/main/transit/core/src/main/net/dpml/util/DefaultLogger.java
trunk/main/transit/core/src/main/net/dpml/util/Encoder.java
trunk/main/transit/core/src/main/net/dpml/util/Logger.java
trunk/main/transit/core/src/main/net/dpml/util/LoggingService.java
trunk/main/transit/core/src/test/net/dpml/lang/
Removed:
trunk/main/transit/core/etc/test/trusted/dpml/test/plugins/
trunk/main/transit/core/src/main/net/dpml/lang/DefaultLogger.java
trunk/main/transit/core/src/main/net/dpml/lang/Logger.java
trunk/main/transit/core/src/main/net/dpml/lang/LoggingService.java
trunk/main/transit/core/src/main/net/dpml/part/
trunk/main/transit/core/src/test/net/dpml/part/
Modified:
trunk/main/build.xml
trunk/main/central/src/art/apis.ppt
trunk/main/central/src/art/composition-handler-uml.ppt
trunk/main/central/src/docs/depot/tasks/javadoc.xml
trunk/main/central/src/docs/metro/runtime/components/index.xml
trunk/main/depot/build/etc/bin/build.lap
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
trunk/main/depot/core/build.xml
trunk/main/depot/core/src/main/net/dpml/depot/DepotRMIClassLoaderSpi.java
trunk/main/depot/core/src/main/net/dpml/depot/Main.java
trunk/main/depot/library/etc/test/dpml/module.xml
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultType.java
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryDecoder.java
trunk/main/depot/library/src/test/net/dpml/library/impl/AbstractTestCase.java
trunk/main/depot/library/src/test/net/dpml/library/impl/DuplicatesTestCase.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/ReactorTask.java
trunk/main/metro/component/src/main/net/dpml/component/Composition.java
trunk/main/metro/component/src/main/net/dpml/component/InitialContext.java
trunk/main/metro/component/src/main/net/dpml/component/LocalEventProducer.java
trunk/main/metro/model/src/main/net/dpml/metro/data/Composite.java
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentDecoder.java
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentTypeDecoder.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionClassLoader.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComposition.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultContextModel.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/StandardLogger.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
trunk/main/metro/state/impl/src/main/net/dpml/state/impl/StateDecoder.java
trunk/main/metro/test/src/test/net/dpml/test/part/PartLoadingTestCase.java
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
trunk/main/planet/http/test/src/test/net/dpml/http/test/ServerTestCase.java
trunk/main/station/api/src/test/net/dpml/station/info/ApplicationXMLTestCase.java
trunk/main/station/api/src/test/net/dpml/station/info/RegistryXMLTestCase.java
trunk/main/station/builder/src/main/net/dpml/station/builder/RegistryBuilder.java
trunk/main/station/console/etc/bin/station.lap
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
trunk/main/station/exec/etc/bin/metro.lap
trunk/main/station/exec/src/main/net/dpml/station/exec/AbstractAdapter.java
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
trunk/main/station/server/etc/bin/scm/conf/wrapper.conf
trunk/main/station/server/src/main/net/dpml/station/server/DefaultModel.java
trunk/main/station/server/src/main/net/dpml/station/server/ErrorStreamReader.java
trunk/main/station/server/src/main/net/dpml/station/server/OutputStreamReader.java
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplication.java
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplicationRegistry.java
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
trunk/main/station/server/src/main/net/dpml/station/server/StationServerPlugin.java
trunk/main/station/server/src/main/net/dpml/station/server/StreamReader.java
trunk/main/station/server/src/main/net/dpml/station/server/UnicastEventSource.java
trunk/main/station/server/src/test/net/dpml/station/server/RemoteApplicationRegistryTestCase.java
trunk/main/transit/console/etc/bin/transit.lap
trunk/main/transit/console/src/main/net/dpml/transit/console/TransitConsoleHandler.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCacheHandler.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCacheModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCodeBaseModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentRegistry.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentRegistryModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultHostModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutRegistry.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutRegistryModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultProxyModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultResourceHost.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
trunk/main/transit/core/src/main/net/dpml/transit/SaxMonitor.java
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
trunk/main/transit/core/src/main/net/dpml/transit/StandardLayoutModel.java
trunk/main/transit/core/src/main/net/dpml/transit/Transit.java
trunk/main/transit/core/src/main/net/dpml/transit/TransitBuilder.java
trunk/main/transit/core/src/main/net/dpml/transit/artifact/ArtifactURLConnection.java
trunk/main/transit/core/src/main/net/dpml/transit/monitor/Adapter.java
trunk/main/transit/core/src/main/net/dpml/transit/monitor/LoggingAdapter.java
trunk/main/transit/core/src/test/net/dpml/lang/PartTestCase.java
trunk/main/transit/tools/src/main/net/dpml/transit/tools/AntAdapter.java
trunk/main/transit/tools/src/main/net/dpml/transit/tools/PluginTask.java
trunk/main/transit/tools/src/main/net/dpml/transit/tools/TransitComponentHelper.java
trunk/main/util/job/impl/src/test/net/dpml/job/test/DefaultCommissionerTestCase.java
Log:
consolidate transit packages with removal of net.dpml.part (some content in
lang and part moved to util and the remaining part content moved to lang)
Modified: trunk/main/build.xml
===================================================================
--- trunk/main/build.xml 2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/build.xml 2006-04-05 22:46:20 UTC (rev 1325)
@@ -252,7 +252,6 @@
</group>
<group title="Transit">
<package name="net.dpml.lang"/>
- <package name="net.dpml.part"/>
<package name="net.dpml.transit"/>
<package name="net.dpml.transit.*"/>
<package name="net.dpml.util"/>
Modified: trunk/main/central/src/art/apis.ppt
===================================================================
(Binary files differ)
Modified: trunk/main/central/src/art/composition-handler-uml.ppt
===================================================================
(Binary files differ)
Modified: trunk/main/central/src/docs/depot/tasks/javadoc.xml
===================================================================
--- trunk/main/central/src/docs/depot/tasks/javadoc.xml 2006-04-05 21:32:57
UTC (rev 1324)
+++ trunk/main/central/src/docs/depot/tasks/javadoc.xml 2006-04-05 22:46:20
UTC (rev 1325)
@@ -24,8 +24,8 @@
<group title="Metro">
<package name="net.dpml.metro"/>
<package name="net.dpml.metro.*"/>
- <package name="net.dpml.part"/>
- <package name="net.dpml.part.*"/>
+ <package name="net.dpml.lang"/>
+ <package name="net.dpml.lang.*"/>
<package name="net.dpml.state"/>
<package name="net.dpml.state.*"/>
<package name="net.dpml.metro.tools"/>
Modified: trunk/main/central/src/docs/metro/runtime/components/index.xml
===================================================================
--- trunk/main/central/src/docs/metro/runtime/components/index.xml
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/central/src/docs/metro/runtime/components/index.xml
2006-04-05 22:46:20 UTC (rev 1325)
@@ -42,7 +42,7 @@
This internal controller deals with the establishment of the
lifestyle handler taking into
account lifestyle and collection policies declared under the
<tt>ComponentModel</tt>.
The <tt>DefaultComponentHandler</tt> maintains a map of objects
implementing the
- <tt>net.dpml.part.Instance</tt> interface. This map representes the
collection of
+ <tt>net.dpml.lang.Instance</tt> interface. This map representes the
collection of
runtime service providers bound to the type/directive combination.
</p>
Modified: trunk/main/depot/build/etc/bin/build.lap
===================================================================
--- trunk/main/depot/build/etc/bin/build.lap 2006-04-05 21:32:57 UTC (rev
1324)
+++ trunk/main/depot/build/etc/bin/build.lap 2006-04-05 22:46:20 UTC (rev
1325)
@@ -3,7 +3,7 @@
#
-Ddpml.transit.include.tools=true
--Djava.system.class.loader=net.dpml.part.SystemClassLoader
+-Djava.system.class.loader=net.dpml.lang.SystemClassLoader
-Djava.security.policy=${env.DPML_HOME}\share\bin\security.policy
-Djava.endorsed.dirs=${env.DPML_HOME}\share\lib\endorsed
-Ddpml.depot.application=dpml.builder
Modified:
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
===================================================================
---
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -27,9 +27,9 @@
import java.util.Map;
import java.util.Hashtable;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
-import net.dpml.part.Part;
+import net.dpml.lang.Part;
import net.dpml.library.Module;
import net.dpml.library.Resource;
Modified: trunk/main/depot/core/build.xml
===================================================================
--- trunk/main/depot/core/build.xml 2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/depot/core/build.xml 2006-04-05 22:46:20 UTC (rev 1325)
@@ -13,7 +13,7 @@
<filter token="DEPOT-PATH" value="${depot.short.filename}"/>
<filter token="TRANSIT-PATH" value="${transit.short.filename}"/>
<filter token="DEPOT-MAIN-CLASS" value="net.dpml.depot.Main" />
- <filter token="DEPOT-CLASSLOADER-CLASS"
value="net.dpml.part.SystemClassLoader" />
+ <filter token="DEPOT-CLASSLOADER-CLASS"
value="net.dpml.lang.SystemClassLoader" />
<x:filter token="DEPOT-CONSOLE-URI" feature="uri" type="jar"/>
<x:filter token="TRANSIT-CORE-URI" ref="dpml/transit/dpml-transit-main"
feature="uri" type="jar"/>
<x:filter token="TRANSIT-CONSOLE-URI"
ref="dpml/transit/dpml-transit-console" feature="uri" type="part"
alias="true"/>
Modified:
trunk/main/depot/core/src/main/net/dpml/depot/DepotRMIClassLoaderSpi.java
===================================================================
--- trunk/main/depot/core/src/main/net/dpml/depot/DepotRMIClassLoaderSpi.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/depot/core/src/main/net/dpml/depot/DepotRMIClassLoaderSpi.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -29,7 +29,7 @@
import java.util.IdentityHashMap;
import java.util.Map;
-import net.dpml.part.StandardClassLoader;
+import net.dpml.lang.StandardClassLoader;
/**
* The DepotRMIClassLoaderSpi handles the loading of classes that are based
on
Modified: trunk/main/depot/core/src/main/net/dpml/depot/Main.java
===================================================================
--- trunk/main/depot/core/src/main/net/dpml/depot/Main.java 2006-04-05
21:32:57 UTC (rev 1324)
+++ trunk/main/depot/core/src/main/net/dpml/depot/Main.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -38,9 +38,9 @@
import net.dpml.lang.Enum;
import net.dpml.lang.PID;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
-import net.dpml.part.Part;
+import net.dpml.lang.Part;
/**
* CLI hander for the depot package.
Modified: trunk/main/depot/library/etc/test/dpml/module.xml
===================================================================
--- trunk/main/depot/library/etc/test/dpml/module.xml 2006-04-05 21:32:57
UTC (rev 1324)
+++ trunk/main/depot/library/etc/test/dpml/module.xml 2006-04-05 22:46:20
UTC (rev 1325)
@@ -143,7 +143,7 @@
<property name="project.template" value="${basedir}/builder.xml"/>
</properties>
<types>
- <part:plugin alias="true" class="net.dpml.part.PartManager"/>
+ <part:plugin alias="true" class="net.dpml.lang.PartManager"/>
<type id="jar"/>
</types>
<dependencies>
Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -40,7 +40,7 @@
import net.dpml.transit.Artifact;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Utility class used for construction of a module model from an XML source.
Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -42,7 +42,7 @@
import net.dpml.lang.Category;
import net.dpml.lang.DuplicateKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* A Module is a collection of resources. It serves to establish a
Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -30,7 +30,7 @@
import java.util.Properties;
import net.dpml.lang.Category;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.library.Type;
import net.dpml.library.Resource;
Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultType.java
===================================================================
--- trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultType.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultType.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -21,7 +21,7 @@
import net.dpml.library.info.TypeDirective;
import net.dpml.library.Type;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import org.w3c.dom.Element;
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-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryDecoder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -40,10 +40,10 @@
import net.dpml.util.ElementHelper;
import net.dpml.lang.Category;
-import net.dpml.part.DecodingException;
-import net.dpml.part.Part;
+import net.dpml.util.DecodingException;
+import net.dpml.lang.Part;
-import net.dpml.part.DOM3DocumentBuilder;
+import net.dpml.util.DOM3DocumentBuilder;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/AbstractTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/AbstractTestCase.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/AbstractTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -29,7 +29,7 @@
import net.dpml.library.Resource;
import net.dpml.library.info.Scope;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.monitor.LoggingAdapter;
/**
Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/DuplicatesTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/DuplicatesTestCase.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/DuplicatesTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -20,7 +20,7 @@
import java.io.File;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.monitor.LoggingAdapter;
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -31,7 +31,7 @@
import net.dpml.tools.model.Context;
import net.dpml.transit.Artifact;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.tools.MainTask;
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -28,7 +28,7 @@
import net.dpml.library.Resource;
import net.dpml.library.impl.DefaultLibrary;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.monitor.LoggingAdapter;
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-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -31,8 +31,8 @@
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.BuildException;
-import net.dpml.part.Part;
-import net.dpml.part.Plugin;
+import net.dpml.lang.Part;
+import net.dpml.lang.Plugin;
/**
* Execute the install phase.
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-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -29,9 +29,9 @@
import net.dpml.lang.Classpath;
import net.dpml.lang.Category;
-import net.dpml.part.Info;
-import net.dpml.part.Part;
-import net.dpml.part.PartDecoder;
+import net.dpml.lang.Info;
+import net.dpml.lang.Part;
+import net.dpml.lang.PartDecoder;
import net.dpml.library.Type;
import net.dpml.library.Resource;
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/ReactorTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/ReactorTask.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/ReactorTask.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -24,7 +24,7 @@
import net.dpml.library.impl.DefaultLibrary;
import net.dpml.tools.impl.StandardBuilder;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.monitor.LoggingAdapter;
import org.apache.tools.ant.BuildException;
Modified:
trunk/main/metro/component/src/main/net/dpml/component/Composition.java
===================================================================
--- trunk/main/metro/component/src/main/net/dpml/component/Composition.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/metro/component/src/main/net/dpml/component/Composition.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -22,10 +22,10 @@
import java.net.URI;
import net.dpml.lang.Classpath;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
-import net.dpml.part.Info;
-import net.dpml.part.Part;
+import net.dpml.lang.Info;
+import net.dpml.lang.Part;
/**
* Component composition.
Modified:
trunk/main/metro/component/src/main/net/dpml/component/InitialContext.java
===================================================================
---
trunk/main/metro/component/src/main/net/dpml/component/InitialContext.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/component/src/main/net/dpml/component/InitialContext.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -27,10 +27,10 @@
import java.util.EventObject;
import java.util.EventListener;
-import net.dpml.lang.DefaultLogger;
+import net.dpml.util.DefaultLogger;
-import net.dpml.part.Part;
-import net.dpml.part.Plugin;
+import net.dpml.lang.Part;
+import net.dpml.lang.Plugin;
/**
* The CompositionControllerContext class wraps a ContentModel and supplies
convinience
Modified:
trunk/main/metro/component/src/main/net/dpml/component/LocalEventProducer.java
===================================================================
---
trunk/main/metro/component/src/main/net/dpml/component/LocalEventProducer.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/component/src/main/net/dpml/component/LocalEventProducer.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -25,7 +25,7 @@
import java.util.Map;
import java.util.WeakHashMap;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* A abstract base class that established an event queue and handles event
dispatch
Modified: trunk/main/metro/model/src/main/net/dpml/metro/data/Composite.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/data/Composite.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/metro/model/src/main/net/dpml/metro/data/Composite.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -20,12 +20,12 @@
import java.io.IOException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.lang.Classpath;
import net.dpml.lang.Value;
-import net.dpml.part.Info;
-import net.dpml.part.Plugin;
+import net.dpml.lang.Info;
+import net.dpml.lang.Plugin;
/**
* A component based plugin.
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentDecoder.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentDecoder.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentDecoder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -22,7 +22,7 @@
import java.net.URI;
import net.dpml.lang.Value;
-import net.dpml.part.DecodingException;
+import net.dpml.util.DecodingException;
import net.dpml.component.ActivationPolicy;
@@ -37,8 +37,8 @@
import net.dpml.metro.info.PartReference;
import net.dpml.metro.info.Priority;
-import net.dpml.part.DOM3DocumentBuilder;
-import net.dpml.part.ValueDecoder;
+import net.dpml.util.DOM3DocumentBuilder;
+import net.dpml.lang.ValueDecoder;
import net.dpml.util.ElementHelper;
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -29,9 +29,9 @@
import net.dpml.component.Directive;
import net.dpml.lang.Value;
-import net.dpml.part.Encoder;
+import net.dpml.util.Encoder;
-import net.dpml.part.ValueEncoder;
+import net.dpml.lang.ValueEncoder;
import net.dpml.metro.data.ContextDirective;
import net.dpml.metro.data.CategoryDirective;
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentTypeDecoder.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentTypeDecoder.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentTypeDecoder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -25,7 +25,7 @@
import java.util.Properties;
import net.dpml.lang.Version;
-import net.dpml.part.DecodingException;
+import net.dpml.util.DecodingException;
import net.dpml.metro.data.ComponentDirective;
import net.dpml.metro.info.Type;
@@ -40,7 +40,7 @@
import net.dpml.metro.info.ThreadSafePolicy;
import net.dpml.metro.info.Priority;
-import net.dpml.part.DOM3DocumentBuilder;
+import net.dpml.util.DOM3DocumentBuilder;
import net.dpml.state.State;
import net.dpml.state.impl.StateDecoder;
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-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -39,8 +39,8 @@
import net.dpml.lang.Classpath;
import net.dpml.lang.UnknownKeyException;
import net.dpml.lang.Value;
-import net.dpml.lang.Logger;
-import net.dpml.lang.DefaultLogger;
+import net.dpml.util.Logger;
+import net.dpml.util.DefaultLogger;
import net.dpml.metro.info.Type;
import net.dpml.metro.info.EntryDescriptor;
@@ -54,7 +54,7 @@
import net.dpml.parameters.Parameters;
-import net.dpml.part.StandardClassLoader;
+import net.dpml.lang.StandardClassLoader;
/**
* The ComponentController class is a controller of a component instance.
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionClassLoader.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionClassLoader.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionClassLoader.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -27,7 +27,7 @@
import net.dpml.transit.Artifact;
import net.dpml.transit.UnsupportedSchemeException;
-import net.dpml.part.StandardClassLoader;
+import net.dpml.lang.StandardClassLoader;
import net.dpml.lang.Category;
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-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -40,15 +40,15 @@
import net.dpml.component.Component;
import net.dpml.component.Composition;
-import net.dpml.part.Part;
-import net.dpml.part.Builder;
-import net.dpml.part.StandardClassLoader;
-import net.dpml.part.Info;
+import net.dpml.lang.Part;
+import net.dpml.lang.Builder;
+import net.dpml.lang.StandardClassLoader;
+import net.dpml.lang.Info;
import net.dpml.lang.Category;
import net.dpml.lang.Classpath;
-import net.dpml.lang.Logger;
-import net.dpml.lang.DefaultLogger;
+import net.dpml.util.Logger;
+import net.dpml.util.DefaultLogger;
import org.w3c.dom.Element;
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -43,7 +43,7 @@
import net.dpml.metro.PartsManager;
import net.dpml.metro.ComponentModelManager;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.component.Controller;
import net.dpml.component.ActivationPolicy;
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -50,7 +50,7 @@
import net.dpml.configuration.ConfigurationException;
import net.dpml.configuration.impl.DefaultConfiguration;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.parameters.Parameters;
import net.dpml.parameters.impl.DefaultParameters;
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComposition.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComposition.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComposition.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -28,9 +28,9 @@
import net.dpml.metro.builder.ComponentEncoder;
import net.dpml.lang.Classpath;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
-import net.dpml.part.Info;
+import net.dpml.lang.Info;
/**
* Component composition.
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultContextModel.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultContextModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultContextModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -35,7 +35,7 @@
import net.dpml.metro.ValidationException;
import net.dpml.metro.ValidationException.Issue;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.component.Directive;
import net.dpml.component.ModelException;
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-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -38,7 +38,7 @@
import net.dpml.lang.Version;
import net.dpml.lang.UnknownKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.job.CommissionerEvent;
import net.dpml.job.CommissionerController;
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -27,7 +27,7 @@
import java.util.EventObject;
import java.util.EventListener;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.component.Provider;
import net.dpml.component.ControlException;
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/StandardLogger.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/StandardLogger.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/StandardLogger.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -18,7 +18,7 @@
package net.dpml.metro.runtime;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.monitor.LoggingAdapter;
/**
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -24,7 +24,7 @@
import java.util.EventObject;
import java.util.EventListener;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.component.Disposable;
Modified:
trunk/main/metro/state/impl/src/main/net/dpml/state/impl/StateDecoder.java
===================================================================
---
trunk/main/metro/state/impl/src/main/net/dpml/state/impl/StateDecoder.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/state/impl/src/main/net/dpml/state/impl/StateDecoder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -28,7 +28,7 @@
import net.dpml.state.Trigger.TriggerEvent;
import net.dpml.state.StateBuilderRuntimeException;
-import net.dpml.part.DOM3DocumentBuilder;
+import net.dpml.util.DOM3DocumentBuilder;
import net.dpml.util.ElementHelper;
Modified:
trunk/main/metro/test/src/test/net/dpml/test/part/PartLoadingTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/test/part/PartLoadingTestCase.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/test/src/test/net/dpml/test/part/PartLoadingTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
-import net.dpml.part.Part;
+import net.dpml.lang.Part;
import net.dpml.transit.DefaultTransitModel;
import net.dpml.transit.Transit;
Modified:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
===================================================================
---
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -49,13 +49,13 @@
import net.dpml.parameters.Parameters;
import net.dpml.lang.Classpath;
-import net.dpml.part.Part;
-import net.dpml.part.Info;
+import net.dpml.lang.Part;
+import net.dpml.lang.Info;
import net.dpml.transit.monitor.LoggingAdapter;
-//import net.dpml.part.Strategy;
-//import net.dpml.part.PartDirective;
+//import net.dpml.lang.Strategy;
+//import net.dpml.lang.PartDirective;
import net.dpml.tools.tasks.PartTask;
Modified:
trunk/main/planet/http/test/src/test/net/dpml/http/test/ServerTestCase.java
===================================================================
---
trunk/main/planet/http/test/src/test/net/dpml/http/test/ServerTestCase.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/planet/http/test/src/test/net/dpml/http/test/ServerTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -22,7 +22,7 @@
import junit.framework.TestCase;
-import net.dpml.part.Part;
+import net.dpml.lang.Part;
/**
* Server component testcase.
Modified:
trunk/main/station/api/src/test/net/dpml/station/info/ApplicationXMLTestCase.java
===================================================================
---
trunk/main/station/api/src/test/net/dpml/station/info/ApplicationXMLTestCase.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/api/src/test/net/dpml/station/info/ApplicationXMLTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -22,7 +22,7 @@
import junit.framework.TestCase;
-import net.dpml.part.DOM3DocumentBuilder;
+import net.dpml.util.DOM3DocumentBuilder;
import net.dpml.util.ElementHelper;
import org.w3c.dom.Document;
Modified:
trunk/main/station/api/src/test/net/dpml/station/info/RegistryXMLTestCase.java
===================================================================
---
trunk/main/station/api/src/test/net/dpml/station/info/RegistryXMLTestCase.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/api/src/test/net/dpml/station/info/RegistryXMLTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -22,7 +22,7 @@
import junit.framework.TestCase;
-import net.dpml.part.DOM3DocumentBuilder;
+import net.dpml.util.DOM3DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
trunk/main/station/builder/src/main/net/dpml/station/builder/RegistryBuilder.java
===================================================================
---
trunk/main/station/builder/src/main/net/dpml/station/builder/RegistryBuilder.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/builder/src/main/net/dpml/station/builder/RegistryBuilder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -27,10 +27,10 @@
import net.dpml.station.info.ApplicationDescriptor;
import net.dpml.station.info.StartupPolicy;
-import net.dpml.part.DOM3DocumentBuilder;
+import net.dpml.util.DOM3DocumentBuilder;
-import net.dpml.part.DecodingException;
-import net.dpml.part.Decoder;
+import net.dpml.util.DecodingException;
+import net.dpml.util.Decoder;
import net.dpml.lang.ValueDirective;
import net.dpml.util.ElementHelper;
@@ -126,7 +126,7 @@
ValueDirective[] values = buildValueDirectives( params );
// need to rework ApplicationDescriptor such that the codebase is
presented
- // as an abstract type - e.g. net.dpml.part.CodeBaseDirective verus
+ // as an abstract type - e.g. net.dpml.lang.CodeBaseDirective verus
// net.dpml.metro.CodeBaseDirective
return new ApplicationDescriptor(
Modified: trunk/main/station/console/etc/bin/station.lap
===================================================================
--- trunk/main/station/console/etc/bin/station.lap 2006-04-05 21:32:57
UTC (rev 1324)
+++ trunk/main/station/console/etc/bin/station.lap 2006-04-05 22:46:20
UTC (rev 1325)
@@ -2,7 +2,7 @@
# This file contains the runtime configuration of the Janel java launcher
application.
#
--Djava.system.class.loader=net.dpml.part.SystemClassLoader
+-Djava.system.class.loader=net.dpml.lang.SystemClassLoader
-Djava.security.policy=${env.DPML_HOME}\share\bin\security.policy
-Djava.endorsed.dirs=${env.DPML_HOME}\share\lib\endorsed
-Ddpml.depot.application=dpml.station
Modified:
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
===================================================================
---
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -55,7 +55,7 @@
import net.dpml.state.Interface;
import net.dpml.transit.Artifact;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.lang.PID;
import net.dpml.transit.Disposable;
import net.dpml.lang.ValueDirective;
Modified: trunk/main/station/exec/etc/bin/metro.lap
===================================================================
--- trunk/main/station/exec/etc/bin/metro.lap 2006-04-05 21:32:57 UTC (rev
1324)
+++ trunk/main/station/exec/etc/bin/metro.lap 2006-04-05 22:46:20 UTC (rev
1325)
@@ -2,7 +2,7 @@
# This file contains the runtime configuration of the Janel java launcher
application.
#
--Djava.system.class.loader=net.dpml.part.SystemClassLoader
+-Djava.system.class.loader=net.dpml.lang.SystemClassLoader
-Djava.security.policy=${env.DPML_HOME}\share\bin\security.policy
-Djava.endorsed.dirs=${env.DPML_HOME}\share\lib\endorsed
-Ddpml.depot.application=dpml.metro
Modified:
trunk/main/station/exec/src/main/net/dpml/station/exec/AbstractAdapter.java
===================================================================
---
trunk/main/station/exec/src/main/net/dpml/station/exec/AbstractAdapter.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/exec/src/main/net/dpml/station/exec/AbstractAdapter.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -29,7 +29,7 @@
import net.dpml.component.ServiceNotFoundException;
import net.dpml.component.ActivationPolicy;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* The AbstractAdapter class is a minimalistic implementation of a part
Modified:
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
===================================================================
---
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -36,7 +36,7 @@
import net.dpml.util.PropertyResolver;
import net.dpml.lang.PID;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.cli.Option;
import net.dpml.cli.Group;
Modified:
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
===================================================================
---
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -49,10 +49,10 @@
import net.dpml.configuration.Configuration;
import net.dpml.configuration.impl.DefaultConfigurationBuilder;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
-import net.dpml.part.Part;
-import net.dpml.part.Plugin;
+import net.dpml.lang.Part;
+import net.dpml.lang.Plugin;
/**
* The ComponentAdapter provides support for the establishment of a part
Modified: trunk/main/station/server/etc/bin/scm/conf/wrapper.conf
===================================================================
--- trunk/main/station/server/etc/bin/scm/conf/wrapper.conf 2006-04-05
21:32:57 UTC (rev 1324)
+++ trunk/main/station/server/etc/bin/scm/conf/wrapper.conf 2006-04-05
22:46:20 UTC (rev 1325)
@@ -29,7 +29,7 @@
wrapper.java.library.path.1=../../share/bin/scm/lib
# Java Additional Parameters
-wrapper.java.additional.1=-Djava.system.class.loader=net.dpml.part.SystemClassLoader
+wrapper.java.additional.1=-Djava.system.class.loader=net.dpml.lang.SystemClassLoader
wrapper.java.additional.2=-Djava.security.policy=..\..\share\bin\security.policy
wrapper.java.additional.3=-Ddpml.depot.application=dpml.station
wrapper.java.additional.4=-Djava.protocol.handler.pkgs=net.dpml.transit
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/DefaultModel.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/DefaultModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/DefaultModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -27,7 +27,7 @@
import java.util.Map;
import java.util.WeakHashMap;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.monitor.LoggingAdapter;
/**
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/ErrorStreamReader.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/ErrorStreamReader.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/ErrorStreamReader.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -23,7 +23,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Stream reader utility class.
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/OutputStreamReader.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/OutputStreamReader.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/OutputStreamReader.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -23,7 +23,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Stream reader utility class.
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplication.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplication.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplication.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -40,7 +40,7 @@
import net.dpml.station.ApplicationListener;
import net.dpml.station.ApplicationEvent;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.lang.PID;
/**
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplicationRegistry.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplicationRegistry.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplicationRegistry.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -32,7 +32,7 @@
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.lang.UnknownKeyException;
import net.dpml.lang.DuplicateKeyException;
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -40,7 +40,7 @@
import net.dpml.station.info.StartupPolicy;
import net.dpml.station.ApplicationRegistry;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.Disposable;
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/StationServerPlugin.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/StationServerPlugin.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/StationServerPlugin.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -39,7 +39,7 @@
import net.dpml.transit.Artifact;
import net.dpml.transit.model.TransitModel;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* The RemoteStation is responsible for the establishment of
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/StreamReader.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/StreamReader.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/StreamReader.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -20,7 +20,7 @@
import java.io.InputStream;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Stream reader utility class.
Modified:
trunk/main/station/server/src/main/net/dpml/station/server/UnicastEventSource.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/UnicastEventSource.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/main/net/dpml/station/server/UnicastEventSource.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -23,7 +23,7 @@
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
Modified:
trunk/main/station/server/src/test/net/dpml/station/server/RemoteApplicationRegistryTestCase.java
===================================================================
---
trunk/main/station/server/src/test/net/dpml/station/server/RemoteApplicationRegistryTestCase.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/station/server/src/test/net/dpml/station/server/RemoteApplicationRegistryTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -30,7 +30,7 @@
import net.dpml.station.RegistryListener;
import net.dpml.station.RegistryEvent;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.lang.ValueDirective;
import net.dpml.lang.UnknownKeyException;
import net.dpml.lang.DuplicateKeyException;
Modified: trunk/main/transit/console/etc/bin/transit.lap
===================================================================
--- trunk/main/transit/console/etc/bin/transit.lap 2006-04-05 21:32:57
UTC (rev 1324)
+++ trunk/main/transit/console/etc/bin/transit.lap 2006-04-05 22:46:20
UTC (rev 1325)
@@ -2,7 +2,7 @@
# This file contains the runtime configuration of the Janel java launcher
application.
#
--Djava.system.class.loader=net.dpml.part.SystemClassLoader
+-Djava.system.class.loader=net.dpml.lang.SystemClassLoader
-Djava.security.policy=${env.DPML_HOME}\share\bin\security.policy
-Djava.endorsed.dirs=${env.DPML_HOME}\share\lib\endorsed
-Ddpml.depot.application=dpml.transit
Modified:
trunk/main/transit/console/src/main/net/dpml/transit/console/TransitConsoleHandler.java
===================================================================
---
trunk/main/transit/console/src/main/net/dpml/transit/console/TransitConsoleHandler.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/console/src/main/net/dpml/transit/console/TransitConsoleHandler.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -44,12 +44,12 @@
import net.dpml.cli.validation.URLValidator;
import net.dpml.cli.validation.NumberValidator;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.lang.UnknownKeyException;
import net.dpml.lang.ValueDirective;
-import net.dpml.part.Part;
-import net.dpml.part.PartException;
+import net.dpml.lang.Part;
+import net.dpml.lang.PartException;
import net.dpml.transit.Artifact;
import net.dpml.transit.Transit;
Copied: trunk/main/transit/core/src/main/net/dpml/lang/Builder.java (from rev
1322, trunk/main/transit/core/src/main/net/dpml/part/Builder.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/Builder.java 2006-04-05
21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Builder.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -0,0 +1,44 @@
+/*
+ * 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 net.dpml.lang;
+
+import java.io.IOException;
+
+import net.dpml.lang.Classpath;
+
+import org.w3c.dom.Element;
+
+/**
+ * Interace implemented by part builders.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface Builder
+{
+ /**
+ * Construct a new part.
+ * @param info the part information descriptor
+ * @param classpath the part classpath descriptor
+ * @param strategy the DOM element definining the deployment strategy
+ * @return the part definition
+ * @exception IOException if an I/O error occurs
+ */
+ Part build( Info info, Classpath classpath, Element strategy ) throws
IOException;
+}
Deleted: trunk/main/transit/core/src/main/net/dpml/lang/DefaultLogger.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/DefaultLogger.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/lang/DefaultLogger.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -1,243 +0,0 @@
-/*
- * 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 net.dpml.lang;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-/**
- * Generic logging channel.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public final class DefaultLogger implements net.dpml.lang.Logger
-{
- //
------------------------------------------------------------------------
- // static
- //
------------------------------------------------------------------------
-
- private static final PID ID = new PID();
-
- private static String clean( String category )
- {
- String result = category.replace( '/', '.' );
- if( result.startsWith( "." ) )
- {
- return clean( result.substring( 1 ) );
- }
- else if( result.endsWith( "." ) )
- {
- return clean( result.substring( 0, result.length() -1 ) );
- }
- else
- {
- return result;
- }
- }
-
- //
------------------------------------------------------------------------
- // state
- //
------------------------------------------------------------------------
-
- private Logger m_logger;
-
- //
------------------------------------------------------------------------
- // constructor
- //
------------------------------------------------------------------------
-
- /**
- * Creation of a new console adapter that is used to redirect transit
events
- * the system output stream.
- */
- public DefaultLogger()
- {
- this( "" );
- }
-
- /**
- * Creation of a new console adapter that is used to redirect transit
events
- * the system output stream.
- * @param category the logging channel category name
- */
- public DefaultLogger( String category )
- {
- this( Logger.getLogger( clean( category ) ) );
- }
-
- /**
- * Creation of a new console adapter that is used to redirect transit
events
- * the system output stream.
- * @param logger the assigned logging channel
- */
- public DefaultLogger( Logger logger )
- {
- m_logger = logger;
- }
-
- //
------------------------------------------------------------------------
- // Logger
- //
------------------------------------------------------------------------
-
- /**
- * Return TRUE is debug level logging is enabled.
- * @return the enabled state of debug logging
- */
- public boolean isDebugEnabled()
- {
- return m_logger.isLoggable( Level.FINE );
- }
-
- /**
- * Return TRUE is info level logging is enabled.
- * @return the enabled state of info logging
- */
- public boolean isInfoEnabled()
- {
- return m_logger.isLoggable( Level.INFO );
- }
-
- /**
- * Return TRUE is error level logging is enabled.
- * @return the enabled state of error logging
- */
- public boolean isWarnEnabled()
- {
- return m_logger.isLoggable( Level.WARNING );
- }
-
- /**
- * Return TRUE is error level logging is enabled.
- * @return the enabled state of error logging
- */
- public boolean isErrorEnabled()
- {
- return m_logger.isLoggable( Level.SEVERE );
- }
-
- /**
- * Log a debug message is debug mode is enabled.
- * @param message the message to log
- */
- public void debug( String message )
- {
- if( isDebugEnabled() )
- {
- m_logger.fine( message );
- }
- }
-
- /**
- * Log a info level message.
- * @param message the message to log
- */
- public void info( String message )
- {
- if( isInfoEnabled() )
- {
- m_logger.info( message );
- }
- }
-
- /**
- * Record a warning message.
- * @param message the warning message to record
- */
- public void warn( String message )
- {
- if( isWarnEnabled() )
- {
- m_logger.warning( message );
- }
- }
-
- /**
- * Record a warning message.
- * @param message the warning message to record
- * @param cause the causal exception
- */
- public void warn( String message, Throwable cause )
- {
- if( isWarnEnabled() )
- {
- m_logger.log( Level.WARNING, message, cause );
- }
- }
-
- /**
- * Log a error message.
- * @param message the message to log
- */
- public void error( String message )
- {
- if( isErrorEnabled() )
- {
- m_logger.log( Level.SEVERE, message );
- }
- }
-
- /**
- * Log a error message.
- * @param message the message to log
- * @param e the causal exception
- */
- public void error( String message, Throwable e )
- {
- if( isErrorEnabled() )
- {
- m_logger.log( Level.SEVERE, message, e );
- }
- }
-
- /**
- * Return a child logger.
- * @param category the sub-category name.
- * @return the child logging channel
- */
- public net.dpml.lang.Logger getChildLogger( String category )
- {
- if( ( null == category ) || "".equals( category ) )
- {
- return this;
- }
- else
- {
- String name = m_logger.getName();
- String path = trim( name + "." + category );
- return new DefaultLogger( Logger.getLogger( path ) );
- }
- }
-
- private String trim( String path )
- {
- if( path.startsWith( "." ) )
- {
- return trim( path.substring( 1 ) );
- }
- else if( ".".equals( path ) )
- {
- return "";
- }
- else
- {
- return path;
- }
- }
-}
-
Copied: trunk/main/transit/core/src/main/net/dpml/lang/Info.java (from rev
1322, trunk/main/transit/core/src/main/net/dpml/part/Info.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/Info.java 2006-04-05
21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Info.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -0,0 +1,132 @@
+/*
+ * 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 net.dpml.lang;
+
+import java.net.URI;
+import java.io.Serializable;
+
+/**
+ * Part info description.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class Info implements Serializable
+{
+ private final String m_title;
+ private final String m_description;
+ private final URI m_uri;
+
+ /**
+ * Creation of a new part info descriptor.
+ * @param uri the part uri
+ * @param title the title of the part
+ * @param description the part description
+ */
+ public Info( URI uri, String title, String description )
+ {
+ m_uri = uri;
+ if( null == title )
+ {
+ m_title = "Untitled";
+ }
+ else
+ {
+ m_title = title;
+ }
+ if( null == description )
+ {
+ m_description = "";
+ }
+ else
+ {
+ m_description = description;
+ }
+ }
+
+ /**
+ * Get the part uri.
+ *
+ * @return the uri
+ */
+ public URI getURI()
+ {
+ return m_uri;
+ }
+
+ /**
+ * Get the part title.
+ *
+ * @return the title
+ */
+ public String getTitle()
+ {
+ return m_title;
+ }
+
+ /**
+ * Get the part description.
+ *
+ * @return the description
+ */
+ public String getDescription()
+ {
+ return m_description;
+ }
+
+ /**
+ * Test if this instance is equal to the supplied instance.
+ * @param other the other instance
+ * @return the equality status
+ */
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( other instanceof Info )
+ {
+ Info info = (Info) other;
+ if( !m_title.equals( info.m_title ) )
+ {
+ return false;
+ }
+ else
+ {
+ return m_description.equals( info.m_description );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Get the hashcode for this instance.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ int hash = m_title.hashCode();
+ hash ^= m_description.hashCode();
+ return hash;
+ }
+}
Deleted: trunk/main/transit/core/src/main/net/dpml/lang/Logger.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Logger.java 2006-04-05
21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Logger.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -1,100 +0,0 @@
-/*
- * Copyright 2004-2005 Stephen J. McConnell.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.lang;
-
-/**
- * Transit Logger is a interface through which different logging solutions
- * can be provided.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public interface Logger
-{
- /**
- * Return TRUE is debug level logging is enabled.
- * @return the enabled state of debug logging
- */
- boolean isDebugEnabled();
-
- /**
- * Return TRUE is info level logging is enabled.
- * @return the enabled state of info logging
- */
- boolean isInfoEnabled();
-
- /**
- * Return TRUE is warn level logging is enabled.
- * @return the enabled state of warn level logging
- */
- boolean isWarnEnabled();
-
- /**
- * Return TRUE is error level logging is enabled.
- * @return the enabled state of error logging
- */
- boolean isErrorEnabled();
-
- /**
- * Record a debug level message.
- * @param message the debug message to record
- */
- void debug( String message );
-
- /**
- * Record a informative message.
- * @param message the info message to record
- */
- void info( String message );
-
- /**
- * Record a warning message.
- * @param message the warning message to record
- */
- void warn( String message );
-
- /**
- * Record a warning message.
- * @param message the warning message to record
- * @param cause the causal exception
- */
- void warn( String message, Throwable cause );
-
- /**
- * Record a error level message.
- * @param message the error message to record
- */
- void error( String message );
-
- /**
- * Record a error level message.
- * @param message the error message to record
- * @param cause the causal exception
- */
- void error( String message, Throwable cause );
-
- /**
- * Return a child logger relative to the current logger.
- * @param category the relative category name
- * @return the child logging channel
- */
- Logger getChildLogger( String category );
-}
-
-
Deleted: trunk/main/transit/core/src/main/net/dpml/lang/LoggingService.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/LoggingService.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/lang/LoggingService.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -1,45 +0,0 @@
-/*
- * Copyright 2005 Stephen 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.lang;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.util.logging.LogRecord;
-
-/**
- * Interface exposed by a remote logging service to local log aggregation
handlers.
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public interface LoggingService extends Remote
-{
- /**
- * Logging service key.
- */
- String LOGGING_KEY = "dpml/logging";
-
- /**
- * Register a log record with the log service.
- * @param process the process identifier
- * @param record the log record
- * @exception RemoteException if a remote exception occurs
- */
- void log( PID process, LogRecord record ) throws RemoteException;
-}
-
Copied: trunk/main/transit/core/src/main/net/dpml/lang/Part.java (from rev
1324, trunk/main/transit/core/src/main/net/dpml/part/Part.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/Part.java 2006-04-05
21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Part.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -0,0 +1,501 @@
+/*
+ * 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 net.dpml.lang;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.xml.XMLConstants;
+
+import net.dpml.lang.Category;
+import net.dpml.lang.Classpath;
+
+import net.dpml.util.Logger;
+
+/**
+ * Part datastructure.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public abstract class Part
+{
+ /**
+ * A value encoder.
+ */
+ protected static final ValueEncoder VALUE_ENCODER = new ValueEncoder();
+
+ /**
+ * Default XML header.
+ */
+ protected static final String XML_HEADER = "<?xml version=\"1.0\"?>";
+
+ /**
+ * Part schema URN.
+ */
+ protected static final String PART_SCHEMA_URN = "@PART-XSD-URI@";
+
+ /**
+ * Part header.
+ */
+ protected static final String PART_HEADER =
+ "<part xmlns=\""
+ + PART_SCHEMA_URN
+ + "\""
+ + "\n xmlns:xsi=\""
+ + XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI
+ + "\">";
+
+ /**
+ * Part footer.
+ */
+ protected static final String PART_FOOTER = "</part>";
+
+ private final Info m_info;
+ private final Classpath m_classpath;
+ private final ClassLoader m_classloader;
+ private final Logger m_logger;
+
+ /**
+ * Load a part from an external XML source.
+ * @param uri the external part source
+ * @return the resolved part
+ * @exception IOException of an I/O error occurs
+ */
+ public static Part load( URI uri ) throws IOException
+ {
+ return PartDecoder.getInstance().loadPart( uri );
+ }
+
+ /**
+ * Creation of a new part datastructure.
+ * @param logger the logging channel
+ * @param info the info descriptor
+ * @param classpath the part classpath definition
+ * @exception IOException if an I/O error occurs
+ */
+ public Part( Logger logger, Info info, Classpath classpath ) throws
IOException
+ {
+ super();
+ if( null == info )
+ {
+ throw new NullPointerException( "info" );
+ }
+ if( null == classpath )
+ {
+ throw new NullPointerException( "classpath" );
+ }
+ m_logger = logger;
+ m_info = info;
+ m_classpath = classpath;
+ m_classloader = buildClassLoader();
+ }
+
+ /**
+ * Return the default part content.
+ * @return the result of part instantiation
+ * @exception IOException if an IO error occurs
+ */
+ public Object getContent() throws IOException
+ {
+ try
+ {
+ return instantiate( new Object[0] );
+ }
+ catch( IOException e )
+ {
+ throw e;
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Part instantiation error.";
+ throw new PartException( error, e );
+ }
+ }
+
+ /**
+ * Return the part content or null if the result type is unresolvable
+ * relative to the supplied classes argument.
+ * @param classes the content type selection classes
+ * @return the content
+ * @exception IOException if an IO error occurs
+ */
+ public Object getContent( Class[] classes ) throws IOException
+ {
+ if( classes.length == 0 )
+ {
+ return getContent();
+ }
+ else
+ {
+ for( int i=0; i<classes.length; i++ )
+ {
+ Class c = classes[i];
+ Object content = getContent( c );
+ if( null != content )
+ {
+ return content;
+ }
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Return the part content or null if the result type is unresolvable
+ * relative to the supplied classes argument. Recognized class arguments
+ * include Info, Classpath, Part, ClassLoader, and Object.
+ *
+ * @param c the content type class
+ * @return the content
+ * @exception IOException if an IO error occurs
+ */
+ protected Object getContent( Class c ) throws IOException
+ {
+ if( Info.class.isAssignableFrom( c ) )
+ {
+ return getInfo();
+ }
+ else if( Classpath.class.isAssignableFrom( c ) )
+ {
+ return getClasspath();
+ }
+ else if( Part.class.isAssignableFrom( c ) )
+ {
+ return this;
+ }
+ else if( ClassLoader.class.isAssignableFrom( c ) )
+ {
+ return getClassLoader();
+ }
+ else if( Object.class == c )
+ {
+ try
+ {
+ return instantiate( new Object[0] );
+ }
+ catch( IOException e )
+ {
+ throw e;
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Part instantiation error.";
+ throw new PartException( error, e );
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Get the part info descriptor.
+ *
+ * @return the part info datastructure
+ */
+ public Info getInfo()
+ {
+ return m_info;
+ }
+
+ /**
+ * Get the part classpath definition.
+ *
+ * @return the classpath definition
+ */
+ public Classpath getClasspath()
+ {
+ return m_classpath;
+ }
+
+ /**
+ * Instantiate a value.
+ * @param args supplimentary arguments
+ * @return the resolved instance
+ * @exception Exception if a deployment error occurs
+ */
+ public abstract Object instantiate( Object[] args ) throws Exception;
+
+ /**
+ * Externalize the part to XML.
+ * @param output the output stream
+ * @exception IOException if an I/O error occurs
+ */
+ public void encode( OutputStream output ) throws IOException
+ {
+ final Writer writer = new OutputStreamWriter( output );
+ writer.write( XML_HEADER );
+ writer.write( "\n" );
+ writer.write( "\n" + PART_HEADER );
+ writer.write( "\n" );
+ encodeInfo( writer, getInfo() );
+ writer.write( "\n" );
+ encodeStrategy( writer, " " );
+ writer.write( "\n" );
+ encodeClasspath( writer, getClasspath() );
+ writer.write( "\n" );
+ writer.write( "\n" + PART_FOOTER );
+ writer.write( "\n" );
+ writer.flush();
+ output.close();
+ }
+
+ /**
+ * Test is this part is equiovalent to the supplied part.
+ *
+ * @param other the other object
+ * @return true if the parts are equivalent
+ */
+ public boolean equals( Object other )
+ {
+ if( other instanceof Part )
+ {
+ Part part = (Part) other;
+ if( !m_info.equals( part.getInfo() ) )
+ {
+ return false;
+ }
+ else
+ {
+ return m_classpath.equals( part.getClasspath() );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Get the part hashcode.
+ *
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ int hash = m_info.hashCode();
+ hash ^= m_classpath.hashCode();
+ return hash;
+ }
+
+ /**
+ * Encode this part strategy to XML.
+ *
+ * @param writer the output stream writer
+ * @param pad the character offset
+ * @exception IOException if an I/O error occurs during part
externalization
+ */
+ protected abstract void encodeStrategy( Writer writer, String pad )
throws IOException;
+
+ /**
+ * Get the implementation classloader.
+ * @return the resolved classloader
+ */
+ public ClassLoader getClassLoader()
+ {
+ return m_classloader;
+ }
+
+ /**
+ * Get the assigned logging channel.
+ * @return the logging channel
+ */
+ protected Logger getLogger()
+ {
+ return m_logger;
+ }
+
+ private ClassLoader buildClassLoader() throws IOException
+ {
+ ClassLoader base = getAnchorClassLoader();
+ Classpath classpath = getClasspath();
+ return newClassLoader( base, classpath );
+ }
+
+ private ClassLoader newClassLoader( ClassLoader base, Classpath
classpath ) throws IOException
+ {
+ URI uri = getInfo().getURI();
+ URI[] uris = classpath.getDependencies( Category.SYSTEM );
+ if( uris.length > 0 )
+ {
+ updateSystemClassLoader( uris );
+ }
+
+ URI[] apis = classpath.getDependencies( Category.PUBLIC );
+ ClassLoader api = StandardClassLoader.buildClassLoader( uri,
Category.PUBLIC, base, apis );
+ if( api != base )
+ {
+ classloaderConstructed( Category.PUBLIC, api );
+ }
+ URI[] spis = classpath.getDependencies( Category.PROTECTED );
+ ClassLoader spi = StandardClassLoader.buildClassLoader( uri,
Category.PROTECTED, api, spis );
+ if( spi != api )
+ {
+ classloaderConstructed( Category.PROTECTED, spi );
+ }
+ URI[] imps = classpath.getDependencies( Category.PRIVATE );
+ ClassLoader impl = StandardClassLoader.buildClassLoader( uri,
Category.PRIVATE, spi, imps );
+ if( impl != spi )
+ {
+ classloaderConstructed( Category.PRIVATE, impl );
+ }
+ return impl;
+ }
+
+ private ClassLoader getAnchorClassLoader()
+ {
+ ClassLoader context = Thread.currentThread().getContextClassLoader();
+ if( null != context )
+ {
+ return context;
+ }
+ else
+ {
+ return Part.class.getClassLoader();
+ }
+ }
+
+ private void updateSystemClassLoader( URI[] uris ) throws IOException
+ {
+ ClassLoader parent = ClassLoader.getSystemClassLoader();
+ synchronized( parent )
+ {
+ if( parent instanceof SystemClassLoader )
+ {
+ SystemClassLoader loader = (SystemClassLoader) parent;
+ loader.addDelegates( uris );
+ systemExpanded( uris );
+ }
+ else
+ {
+ final String message =
+ "Cannot load ["
+ + uris.length
+ + "] system artifacts into a foreign system classloader.";
+ getLogger().debug( message );
+ }
+ }
+ }
+
+
+ /**
+ * Handle notification of the creation of a new classloader.
+ * @param category the classloader category
+ * @param classloader the new classloader to report
+ */
+ private void classloaderConstructed( Category category, ClassLoader
classloader )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ int id = System.identityHashCode( classloader );
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "created classloader " );
+ buffer.append( m_info.getURI().toString() );
+ buffer.append( "#" + category.toString() );
+ buffer.append( " (" + id + ")" );
+ ClassLoader parent = classloader.getParent();
+ if( null != parent )
+ {
+ buffer.append( " 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 + "] \t" + url.toString() );
+ }
+ }
+ getLogger().debug( buffer.toString() );
+ }
+ }
+
+ /**
+ * Handle notification of system classloader expansion.
+ * @param uris the array of uris added to the system classloader
+ */
+ private void systemExpanded( URI[] uris )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "system classloader expansion" );
+ for( int i=0; i<uris.length; i++ )
+ {
+ int n = i+1;
+ buffer.append( "\n [" + n + "] \t" + uris[i] );
+ }
+ getLogger().debug( buffer.toString() );
+ }
+ }
+
+ private void encodeInfo( Writer writer, Info info ) throws IOException
+ {
+ String title = info.getTitle();
+ String description = info.getDescription();
+ if( null == description )
+ {
+ writer.write( "\n <info title=\"" + title + "\"/>" );
+ }
+ else
+ {
+ writer.write( "\n <info title=\"" + title + "\">" );
+ writer.write( "\n <description>" + description +
"</description>" );
+ writer.write( "\n </info>" );
+ }
+ }
+
+ private void encodeClasspath( Writer writer, Classpath classpath )
throws IOException
+ {
+ writer.write( "\n <classpath>" );
+ encodeClasspathCategory( writer, classpath, Category.SYSTEM );
+ encodeClasspathCategory( writer, classpath, Category.PUBLIC );
+ encodeClasspathCategory( writer, classpath, Category.PROTECTED );
+ encodeClasspathCategory( writer, classpath, Category.PRIVATE );
+ writer.write( "\n </classpath>" );
+ }
+
+ private void encodeClasspathCategory(
+ Writer writer, Classpath classpath, Category category ) throws
IOException
+ {
+ URI[] uris = classpath.getDependencies( category );
+ if( uris.length > 0 )
+ {
+ String name = category.getName();
+ writer.write( "\n <" + name + ">" );
+ for( int i=0; i<uris.length; i++ )
+ {
+ URI uri = uris[i];
+ writer.write( "\n <uri>" + uri.toASCIIString() +
"</uri>" );
+ }
+ writer.write( "\n </" + name + ">" );
+ }
+ }
+}
Copied: trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java (from
rev 1322, trunk/main/transit/core/src/main/net/dpml/part/PartDecoder.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/PartDecoder.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,397 @@
+/*
+ * 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 net.dpml.lang;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+import java.util.Hashtable;
+import java.lang.ref.WeakReference;
+
+import net.dpml.lang.Classpath;
+import net.dpml.lang.Value;
+
+import net.dpml.transit.Artifact;
+
+import net.dpml.util.Logger;
+import net.dpml.util.DefaultLogger;
+import net.dpml.util.ElementHelper;
+import net.dpml.util.DOM3DocumentBuilder;
+import net.dpml.util.Decoder;
+import net.dpml.util.DecodingException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.TypeInfo;
+
+/**
+ * Construct a part.
+ */
+public final class PartDecoder implements Decoder
+{
+ /**
+ * Part ZSD uri.
+ */
+ public static final String PART_XSD_URI = "@PART-XSD-URI@";
+
+ private static final DOM3DocumentBuilder DOCUMENT_BUILDER =
+ new DOM3DocumentBuilder();
+
+ private static final ValueDecoder VALUE_DECODER = new ValueDecoder();
+
+ private static final PartDecoder DECODER = new PartDecoder();
+
+ /**
+ * Get the singleton instance of the part decoder.
+ * @return the decoder instance.
+ */
+ public static PartDecoder getInstance()
+ {
+ return DECODER;
+ }
+
+ private Map m_map = new Hashtable();
+
+ private Logger m_logger;
+
+ private PartDecoder()
+ {
+ m_logger = new DefaultLogger();
+ }
+
+ /**
+ * Load a part from a uri.
+ * @param uri the part uri
+ * @return the part definition
+ * @exception IOException if an IO error occurs
+ */
+ public Part loadPart( URI uri ) throws IOException
+ {
+ if( null == uri )
+ {
+ throw new NullPointerException( "uri" );
+ }
+ String key = buildKey( uri );
+ WeakReference ref = (WeakReference) m_map.get( key );
+ if( null != ref )
+ {
+ Part part = (Part) ref.get();
+ if( null != part )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "loading part [" + uri + "] from
cache." );
+ }
+ return part;
+ }
+ }
+ try
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "loading part [" + uri + "] from source."
);
+ }
+ final Document document = DOCUMENT_BUILDER.parse( uri );
+ final Element root = document.getDocumentElement();
+ Part value = decodePart( uri, root );
+ WeakReference reference = new WeakReference( value );
+ m_map.put( key, reference );
+ return value;
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "An error while attempting to load a part."
+ + "\nURI: " + uri;
+ IOException exception = new IOException( error );
+ exception.initCause( e );
+ throw exception;
+ }
+ }
+
+ private String buildKey( URI uri )
+ {
+ ClassLoader classloader = getAnchorClassLoader();
+ int n = System.identityHashCode( classloader );
+ return "" + n + "#" + uri.toASCIIString();
+ }
+
+ /**
+ * Resolve a object from a DOM element.
+ * @param element the dom element
+ * @return the resolved object
+ * @exception IOException if an error occurs during element evaluation
+ */
+ public Object decode( Element element ) throws IOException
+ {
+ return decodePart( null, element );
+ }
+
+ /**
+ * Resolve a part from a DOM element.
+ * @param uri the part uri
+ * @param element element part definition
+ * @return the resoplved part datastructure
+ * @exception IOException if an error occurs during element evaluation
+ */
+ public Part decodePart( URI uri, Element element ) throws IOException
+ {
+ TypeInfo info = element.getSchemaTypeInfo();
+ String namespace = info.getTypeNamespace();
+ if( PART_XSD_URI.equals( namespace ) )
+ {
+ boolean alias = ElementHelper.getBooleanAttribute( element,
"alias", false );
+ Info information = getInfo( uri, element );
+ Classpath classpath = getClasspath( element );
+ Element strategy = getStrategyElement( element );
+ return build( information, classpath, strategy );
+ }
+ else
+ {
+ final String error =
+ "Part namespace not recognized."
+ + "\nExpecting: " + PART_XSD_URI
+ + "\nFound: " + namespace;
+ throw new DecodingException( element, error );
+ }
+ }
+
+ /**
+ * Resolve a part plugin or resource strategy.
+ * @param information the part info definition
+ * @param classpath the part classpath definition
+ * @param strategy part deployment strategy definition
+ * @return the resolved part
+ * @exception IOException if an error occurs during element evaluation
+ */
+ public Part build( Info information, Classpath classpath, Element
strategy ) throws IOException
+ {
+ TypeInfo info = strategy.getSchemaTypeInfo();
+ String namespace = info.getTypeNamespace();
+ if( PART_XSD_URI.equals( namespace ) )
+ {
+ // this is either a plugin or a resource
+
+ Logger logger = getLogger();
+ String name = info.getTypeName();
+ if( "plugin".equals( name ) )
+ {
+ String classname = ElementHelper.getAttribute( strategy,
"class" );
+ Element[] elements = ElementHelper.getChildren( strategy );
+ Value[] values = VALUE_DECODER.decodeValues( elements );
+ return new Plugin( logger, information, classpath,
classname, values );
+ }
+ else if( "resource".equals( name ) )
+ {
+ String urn = ElementHelper.getAttribute( strategy, "urn" );
+ String path = ElementHelper.getAttribute( strategy, "path" );
+ return new Resource( logger, information, classpath, urn,
path );
+ }
+ else
+ {
+ final String error =
+ "Element type name ["
+ + name
+ + "] is not a recognized element type within the "
+ + PART_XSD_URI
+ + " namespace.";
+ throw new DecodingException( strategy, error );
+ }
+ }
+ else
+ {
+ // this is a foreign part
+
+ try
+ {
+ URI uri = getDecoderURIFromNamespaceURI( strategy, namespace
);
+ Builder builder = loadForeignBuilder( uri );
+ return builder.build( information, classpath, strategy );
+ }
+ catch( Exception ioe )
+ {
+ final String error =
+ "Internal error while attempting to load foreign part
builder.";
+ throw new DecodingException( strategy, error, ioe );
+ }
+ }
+ }
+
+ /**
+ * Get the assigned logging channel.
+ * @return the logging channel
+ */
+ protected Logger getLogger()
+ {
+ return m_logger;
+ }
+
+ private URI getDecoderURIFromNamespaceURI( Element element, String urn )
throws DecodingException
+ {
+ try
+ {
+ URI raw = new URI( urn );
+ Artifact artifact = Artifact.createArtifact( raw );
+ String scheme = artifact.getScheme();
+ String group = artifact.getGroup();
+ String name = artifact.getName();
+ String type = artifact.getType();
+ String version = artifact.getVersion();
+ String path = "link:part:" + group + "/" + name;
+ Artifact link = Artifact.createArtifact( path );
+ return link.toURI();
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected error while resolving builder uri. "
+ + "\nNamespace: " + urn;
+ throw new DecodingException( element, error, e );
+ }
+ }
+
+ private Builder loadForeignBuilder( URI uri ) throws DecodingException,
Exception
+ {
+ Part part = loadPart( uri );
+ if( part instanceof Plugin )
+ {
+ Plugin plugin = (Plugin) part;
+ Logger logger = getLogger();
+ Object[] args = new Object[]{logger};
+ Object object = plugin.instantiate( args );
+ if( object instanceof Builder )
+ {
+ return (Builder) object;
+ }
+ else
+ {
+ final String error =
+ "Plugin does not implement the "
+ + Builder.class.getName()
+ + " interface."
+ + "\nURI: " + uri
+ + "\nClass: " + object.getClass().getName();
+ throw new PartException( error );
+ }
+ }
+ else
+ {
+ final String error =
+ "Cannot resolve an instance from a part that is not derived
from "
+ + Plugin.class.getName()
+ + "."
+ + "\nURI: " + uri
+ + "\nPart Type: " + part.getClass().getName();
+ throw new PartException( error );
+ }
+ }
+
+ private Element getStrategyElement( Element root ) throws
DecodingException
+ {
+ Element[] children = ElementHelper.getChildren( root );
+ if( children.length != 3 )
+ {
+ final String error =
+ "Illegal number of child elements in <part>. Expecting 3,
found "
+ + children.length
+ + ".";
+ throw new DecodingException( root, error );
+ }
+ return children[1];
+ }
+
+
+ private Info getInfo( URI uri, Element root )
+ {
+ Element element = ElementHelper.getChild( root, "info" );
+ String title = ElementHelper.getAttribute( element, "title",
"Unknown" );
+ Element descriptionElement = ElementHelper.getChild( element,
"description" );
+ String description = ElementHelper.getValue( descriptionElement );
+ return new Info( uri, title, description );
+ }
+
+ /**
+ * Construct the classpath defintion.
+ * @param root the element containing a 'classpath' element.
+ * @return the classpath definition
+ * @exception DecodingException if an error occurs during element
evaluation
+ */
+ protected Classpath getClasspath( Element root ) throws DecodingException
+ {
+ Element classpath = ElementHelper.getChild( root, "classpath" );
+ if( null == classpath )
+ {
+ final String error =
+ "Required classpath element is not present in plugin
descriptor.";
+ throw new DecodingException( root, error );
+ }
+
+ try
+ {
+ Element[] children = ElementHelper.getChildren( classpath );
+ URI[] sys = buildURIs( classpath, "system" );
+ URI[] pub = buildURIs( classpath, "public" );
+ URI[] prot = buildURIs( classpath, "protected" );
+ URI[] priv = buildURIs( classpath, "private" );
+ Classpath cp = new Classpath( sys, pub, prot, priv );
+ return cp;
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unable to decode classpath due to an unexpected error.";
+ throw new DecodingException( classpath, error, e );
+ }
+ }
+
+ private URI[] buildURIs( Element classpath, String key ) throws Exception
+ {
+ Element category = ElementHelper.getChild( classpath, key );
+ if( null == category )
+ {
+ return new URI[0];
+ }
+ else
+ {
+ Element[] children = ElementHelper.getChildren( category, "uri"
);
+ URI[] uris = new URI[ children.length ];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ String value = ElementHelper.getValue( child );
+ uris[i] = new URI( value );
+ }
+ return uris;
+ }
+ }
+
+ private ClassLoader getAnchorClassLoader()
+ {
+ ClassLoader classloader =
Thread.currentThread().getContextClassLoader();
+ if( null == classloader )
+ {
+ return Part.class.getClassLoader();
+ }
+ else
+ {
+ return classloader;
+ }
+ }
+
+}
Copied: trunk/main/transit/core/src/main/net/dpml/lang/PartError.java (from
rev 1322, trunk/main/transit/core/src/main/net/dpml/part/PartError.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/PartError.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/PartError.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004-2005 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.
+ */
+
+package net.dpml.lang;
+
+/**
+ * Fatal part related error.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class PartError extends Error
+{
+ /**
+ * Serial version identifier.
+ */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Construct a new <code>PartError</code> instance.
+ *
+ * @param message The detail message for this exception.
+ */
+ public PartError( final String message )
+ {
+ this( message, null );
+ }
+
+ /**
+ * Construct a new <code>PartError</code> instance.
+ *
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
+ */
+ public PartError( final String message, final Throwable cause )
+ {
+ super( message );
+ super.initCause( cause );
+ }
+}
+
+
Copied: trunk/main/transit/core/src/main/net/dpml/lang/PartException.java
(from rev 1322,
trunk/main/transit/core/src/main/net/dpml/part/PartException.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/PartException.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/PartException.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004-2005 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.
+ */
+
+package net.dpml.lang;
+
+import java.io.IOException;
+
+/**
+ * Exception to indicate that there was a part handler related error.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class PartException extends IOException
+{
+ /**
+ * Serial version identifier.
+ */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Construct a new <code>PartException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ */
+ public PartException( final String message )
+ {
+ this( message, null );
+ }
+
+ /**
+ * Construct a new <code>PartException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
+ */
+ public PartException( final String message, final Throwable cause )
+ {
+ super( message );
+ super.initCause( cause );
+ }
+}
+
+
Copied: trunk/main/transit/core/src/main/net/dpml/lang/Plugin.java (from rev
1322, trunk/main/transit/core/src/main/net/dpml/part/Plugin.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/Plugin.java 2006-04-05
21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Plugin.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -0,0 +1,498 @@
+/*
+ * 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 net.dpml.lang;
+
+import java.io.Writer;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Array;
+import java.beans.Expression;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import net.dpml.lang.Value;
+import net.dpml.util.Logger;
+import net.dpml.lang.Classpath;
+import net.dpml.lang.Construct;
+
+/**
+ * Plugin part strategy implementation datatype.
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class Plugin extends Part
+{
+ private final String m_classname;
+ private final Value[] m_params;
+
+ /**
+ * Creation of an new plugin datatype.
+ * @param logger the assigned logging channel
+ * @param info the part info descriptor
+ * @param classpath the classpath descriptor
+ * @param classname the target class
+ * @exception IOException if an I/O error occurs
+ */
+ public Plugin(
+ Logger logger, Info info, Classpath classpath, String classname )
+ throws IOException
+ {
+ this( logger, info, classpath, classname, new Value[0] );
+ }
+
+ /**
+ * Creation of an new plugin datatype.
+ * @param logger the assigned logging channel
+ * @param info the part info descriptor
+ * @param classpath the classpath descriptor
+ * @param classname the target class
+ * @param params an array of default value arguments
+ * @exception IOException if an I/O error occurs
+ */
+ public Plugin(
+ Logger logger, Info info, Classpath classpath, String classname,
Value[] params )
+ throws IOException
+ {
+ super( logger, info, classpath );
+ if( null == classname )
+ {
+ throw new NullPointerException( "classname" );
+ }
+ if( null == params )
+ {
+ throw new NullPointerException( "params" );
+ }
+ m_classname = classname;
+ m_params = params;
+ }
+
+ /**
+ * Return the part content or null if the result type is unresolvable
+ * relative to the supplied class argument.
+ * @param c the content class
+ * @return the content
+ * @exception IOException if an IO error occurs
+ */
+ protected Object getContent( Class c ) throws IOException
+ {
+ if( Class.class.equals( c ) )
+ {
+ return getPluginClass();
+ }
+ else
+ {
+ return super.getContent( c );
+ }
+ }
+
+ /**
+ * Get the target classname.
+ * @return the classname
+ */
+ public String getClassname()
+ {
+ return m_classname;
+ }
+
+ /**
+ * Get the array of default constructor values.
+ * @return the value array
+ */
+ public Value[] getValues()
+ {
+ return m_params;
+ }
+
+ /**
+ * Get the default plugin class.
+ * @return the plugin class
+ */
+ public Class getPluginClass()
+ {
+ ClassLoader classloader = getClassLoader();
+ String classname = getClassname();
+ try
+ {
+ return classloader.loadClass( classname );
+ }
+ catch( ClassNotFoundException e )
+ {
+ final String error =
+ "Plugin class [" + classname + "] not found.";
+ throw new IllegalStateException( error );
+ }
+ }
+
+ /**
+ * Instantiate a value.
+ * @param args supplimentary arguments
+ * @return the resolved instance
+ * @exception Exception if a deployment error occurs
+ */
+ public Object instantiate( Object[] args ) throws Exception
+ {
+ ClassLoader classloader = getClassLoader();
+ ClassLoader context = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader( classloader );
+ try
+ {
+ Value[] values = getValues();
+ Class c = getPluginClass();
+ Object[] params = Construct.getArgs( null, values, args );
+ return instantiate( c, params );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( context );
+ }
+ }
+
+ /**
+ * Test if this instance is equal to the supllied object.
+ * @param other the other object
+ * @return true if the supplied object is equal to this instance
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) )
+ {
+ if( other instanceof Plugin )
+ {
+ Plugin plugin = (Plugin) other;
+ if( !m_classname.equals( plugin.m_classname ) )
+ {
+ return false;
+ }
+ else
+ {
+ return Arrays.equals( m_params, plugin.m_params );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Get the has code for this instance.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ int hash = m_classname.hashCode();
+ for( int i=0; i<m_params.length; i++ )
+ {
+ hash ^= m_params[i].hashCode();
+ }
+ return hash;
+ }
+
+
+ /**
+ * Encode the pluginstrategy to XML.
+ * @param writer the output stream writer
+ * @param pad the character offset
+ * @exception IOException if an I/O error occurs
+ */
+ protected void encodeStrategy( Writer writer, String pad ) throws
IOException
+ {
+ String classname = getClassname();
+ writer.write( "\n" + pad + "<strategy xsi:type=\"plugin\" class=\""
);
+ writer.write( classname );
+ writer.write( "\"" );
+ if( getValues().length > 0 )
+ {
+ writer.write( ">" );
+ Value[] values = getValues();
+ VALUE_ENCODER.encodeValues( writer, values, pad + " " );
+ writer.write( "\n" + pad + "</strategy>" );
+ }
+ else
+ {
+ writer.write( "/>" );
+ }
+ }
+
+ /**
+ * Create a factory using a supplied class and command line arguments.
+ *
+ * @param clazz the the factory class
+ * @param args the command line args
+ * @return the plugin instance
+ * @exception IOException if a plugin creation error occurs
+ * @exception InvocationTargetException if a plugin constructor
invocation error occurs
+ */
+ public static Object instantiate( Class clazz, Object[] args ) throws
IOException, InvocationTargetException
+ {
+ if( null == clazz )
+ {
+ throw new NullPointerException( "clazz" );
+ }
+ if( null == args )
+ {
+ throw new NullPointerException( "args" );
+ }
+ for( int i=0; i < args.length; i++ )
+ {
+ Object p = args[i];
+ if( null == p )
+ {
+ final String error =
+ "User supplied instantiation argument at position ["
+ + i
+ + "] for the class ["
+ + clazz.getName()
+ + "] is a null value.";
+ throw new NullPointerException( error );
+ }
+ }
+
+ if( clazz.getConstructors().length == 1 )
+ {
+ Constructor constructor = getSingleConstructor( clazz );
+ return instantiate( constructor, args );
+ }
+ else
+ {
+ try
+ {
+ Expression expression = new Expression( clazz, "new", args );
+ return expression.getValue();
+ }
+ catch( InvocationTargetException e )
+ {
+ throw e;
+ }
+ catch( PartException e )
+ {
+ throw e;
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Class instantiation error [" + clazz.getName() + "]";
+ throw new PartException( error, e );
+ }
+ }
+ }
+
+ private static Object instantiate( Constructor constructor, Object[]
args )
+ throws PartException, InvocationTargetException
+ {
+ Object[] arguments = populate( constructor, args );
+ return newInstance( constructor, arguments );
+ }
+
+ private static Object[] populate( Constructor constructor, Object[] args
) throws PartException
+ {
+ if( null == constructor )
+ {
+ throw new NullPointerException( "constructor" );
+ }
+ if( null == args )
+ {
+ throw new NullPointerException( "args" );
+ }
+
+ Class[] classes = constructor.getParameterTypes();
+ Object[] arguments = new Object[ classes.length ];
+ ArrayList list = new ArrayList();
+ for( int i=0; i < args.length; i++ )
+ {
+ list.add( args[i] );
+ }
+
+ //
+ // sweep though the construct arguments one by one and
+ // see if we can assign a value based on the supplied args
+ //
+
+ for( int i=0; i < classes.length; i++ )
+ {
+ Class clazz = classes[i];
+ Iterator iterator = list.iterator();
+ while( iterator.hasNext() )
+ {
+ Object object = iterator.next();
+ Class c = object.getClass();
+ if( isAssignableFrom( clazz, c ) )
+ {
+ arguments[i] = object;
+ list.remove( object );
+ break;
+ }
+ }
+ }
+
+ //
+ // if any arguments are unresolved then check if the argument type
+ // is something we can implicity establish
+ //
+
+ for( int i=0; i < arguments.length; i++ )
+ {
+ if( null == arguments[i] )
+ {
+ Class c = classes[i];
+ if( c.isArray() )
+ {
+ arguments[i] = getEmptyArrayInstance( c );
+ }
+ else
+ {
+ final String error =
+ "Unable to resolve a value for a constructor
parameter."
+ + "\nConstructor class: " +
constructor.getDeclaringClass().getName()
+ + "\nParameter class: " + c.getName()
+ + "\nParameter position: " + ( i + 1 );
+ throw new PartException( error );
+ }
+ }
+ }
+ return arguments;
+ }
+
+ private static boolean isAssignableFrom( Class clazz, Class c )
+ {
+ if( clazz.isPrimitive() )
+ {
+ if( Integer.TYPE == clazz )
+ {
+ return Integer.class.isAssignableFrom( c );
+ }
+ else if( Boolean.TYPE == clazz )
+ {
+ return Boolean.class.isAssignableFrom( c );
+ }
+ else if( Byte.TYPE == clazz )
+ {
+ return Byte.class.isAssignableFrom( c );
+ }
+ else if( Short.TYPE == clazz )
+ {
+ return Short.class.isAssignableFrom( c );
+ }
+ else if( Long.TYPE == clazz )
+ {
+ return Long.class.isAssignableFrom( c );
+ }
+ else if( Float.TYPE == clazz )
+ {
+ return Float.class.isAssignableFrom( c );
+ }
+ else if( Double.TYPE == clazz )
+ {
+ return Double.class.isAssignableFrom( c );
+ }
+ else
+ {
+ final String error =
+ "Primitive type ["
+ + c.getName()
+ + "] not supported.";
+ throw new RuntimeException( error );
+ }
+ }
+ else
+ {
+ return clazz.isAssignableFrom( c );
+ }
+ }
+
+ private static Object newInstance( Constructor constructor, Object[]
arguments )
+ throws PartException, InvocationTargetException
+ {
+ try
+ {
+ Object instance = constructor.newInstance( arguments );
+ //getMonitor().pluginInstantiated( instance );
+ return instance;
+ }
+ catch( InvocationTargetException e )
+ {
+ throw e;
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Cannot create an instance of ["
+ + constructor.getDeclaringClass().getName()
+ + "] due to an instantiation failure.";
+ throw new PartException( error, e );
+ }
+ }
+
+ private static Constructor getSingleConstructor( Class clazz ) throws
PartException
+ {
+ if( null == clazz )
+ {
+ throw new NullPointerException( "clazz" );
+ }
+ Constructor[] constructors = clazz.getConstructors();
+ if( constructors.length < 1 )
+ {
+ final String error =
+ "Target class ["
+ + clazz.getName()
+ + "] does not declare a public constructor.";
+ throw new PartException( error );
+ }
+ else if( constructors.length > 1 )
+ {
+ final String error =
+ "Target class ["
+ + clazz.getName()
+ + "] declares multiple public constructors.";
+ throw new PartException( error );
+ }
+ else
+ {
+ return constructors[0];
+ }
+ }
+
+ /**
+ * Constructs an empty array instance.
+ * @param clazz the array class
+ * @return the empty array instance
+ * @exception RepositoryException if an error occurs
+ */
+ private static Object[] getEmptyArrayInstance( Class clazz ) throws
PartException
+ {
+ try
+ {
+ return (Object[]) Array.newInstance( clazz.getComponentType(), 0
);
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Internal error while attempting to construct an empty array
for the class: "
+ + clazz.getName();
+ throw new PartException( error, e );
+ }
+ }
+}
Copied: trunk/main/transit/core/src/main/net/dpml/lang/Resource.java (from
rev 1322, trunk/main/transit/core/src/main/net/dpml/part/Resource.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/Resource.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Resource.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,179 @@
+/*
+ * 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 net.dpml.lang;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+
+import net.dpml.lang.Classpath;
+
+import net.dpml.util.Logger;
+
+/**
+ * Resource part strategy implementation datatype.
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class Resource extends Part
+{
+ private final String m_urn;
+ private final String m_path;
+
+ /**
+ * Creation of resource datatype.
+ * @param logger the assigned logging channel
+ * @param info the part info descriptor
+ * @param classpath the part classpath descriptor
+ * @param urn the resource urn
+ * @param path the resource path
+ * @exception IOException if an I/O error occurs
+ */
+ public Resource( Logger logger, Info info, Classpath classpath, String
urn, String path )
+ throws IOException
+ {
+ super( logger, info, classpath );
+ if( null == urn )
+ {
+ throw new NullPointerException( "urn" );
+ }
+ if( null == path )
+ {
+ throw new NullPointerException( "path" );
+ }
+ m_urn = urn;
+ m_path = path;
+ }
+
+ /**
+ * Return the part content or null if the result type is unresolvable
+ * relative to the supplied classes argument. Class arguments recognized
+ * over an above plugin include the URL and String classes. If the URL
+ * class is supplied a URL referencing the resource identified by path
+ * is returned. If a String is requested the urn value is returned.
+ *
+ * @param c the content class
+ * @return the content
+ * @exception IOException if an IO error occurs
+ */
+ protected Object getContent( Class c ) throws IOException
+ {
+ if( URL.class.equals( c ) )
+ {
+ return getClassLoader().getResource( m_path );
+ }
+ else if( String.class.equals( c ) )
+ {
+ return getURN();
+ }
+ else
+ {
+ return super.getContent( c );
+ }
+ }
+
+ /**
+ * Get the resource urn.
+ * @return the urn
+ */
+ public String getURN()
+ {
+ return m_urn;
+ }
+
+ /**
+ * Get the resource path.
+ * @return the path
+ */
+ public String getPath()
+ {
+ return m_path;
+ }
+
+ /**
+ * Instantiate a value.
+ * @param args supplimentary arguments
+ * @return the resolved instance
+ * @exception Exception if a deployment error occurs
+ */
+ public Object instantiate( Object[] args ) throws Exception
+ {
+ return getClassLoader().getResource( m_path );
+ }
+
+ /**
+ * Encode the resource strategy to XML.
+ * @param writer the output stream writer
+ * @param pad the character offset
+ * @exception IOException if an I/O error occurs
+ */
+ protected void encodeStrategy( Writer writer, String pad ) throws
IOException
+ {
+ String urn = getURN();
+ String path = getPath();
+ writer.write( "\n <strategy xsi:type=\"resource\"" );
+ writer.write( " urn=\"" + urn );
+ writer.write( "\" path=\"" + path );
+ writer.write( "\"/>" );
+ }
+
+ /**
+ * Test if this instance is equal to the supplied instance.
+ * @param other the supplied instance
+ * @return the equality status
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) )
+ {
+ if( other instanceof Resource )
+ {
+ Resource resource = (Resource) other;
+ if( !m_path.equals( resource.m_path ) )
+ {
+ return false;
+ }
+ else
+ {
+ return m_urn.equals( resource.m_urn );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Get the hashcode for this instance.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_path.hashCode();
+ hash ^= m_urn.hashCode();
+ return hash;
+ }
+}
Copied:
trunk/main/transit/core/src/main/net/dpml/lang/StandardClassLoader.java (from
rev 1322,
trunk/main/transit/core/src/main/net/dpml/part/StandardClassLoader.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/StandardClassLoader.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/StandardClassLoader.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,464 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.lang;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.net.URL;
+import java.net.URI;
+import java.net.URLClassLoader;
+
+import net.dpml.lang.Category;
+
+import net.dpml.transit.Artifact;
+
+/**
+ * A named classloader.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class StandardClassLoader extends URLClassLoader
+{
+ //--------------------------------------------------------------------
+ // static
+ //--------------------------------------------------------------------
+
+ /**
+ * Internal utility class to build a classloader. If the supplied url
+ * sequence is zero length the parent classloader is returned directly.
+ *
+ * @param uri the uri identifying the classloader source part
+ * @param category the category that this classloader is handling
+ * @param parent the parent classloader
+ * @param uris the uris to assign as classloader content
+ * @return the classloader
+ * @exception IOException if an I/O error occurs
+ */
+ public static ClassLoader buildClassLoader( URI uri, Category category,
ClassLoader parent, URI[] uris )
+ throws IOException
+ {
+ URL[] urls = toURLs( uris );
+ if( 0 == urls.length )
+ {
+ return parent;
+ }
+ ArrayList list = new ArrayList();
+ for( int i=0; i < urls.length; i++ )
+ {
+ if( isaCandidate( parent, urls[i] ) )
+ {
+ list.add( urls[i] );
+ }
+ }
+ URL[] qualified = (URL[]) list.toArray( new URL[0] );
+ if( qualified.length == 0 )
+ {
+ return parent;
+ }
+ else
+ {
+ return new StandardClassLoader( uri, category, qualified, parent
);
+ }
+ }
+
+ /**
+ * Convert a sequncence of URIs to URLs.
+ * @param uris the uris to convert
+ * @return the corresponding urls
+ * @exception IOException of a transformation error occurs
+ */
+ public static URL[] toURLs( URI[] uris ) throws IOException
+ {
+ URL[] urls = new URL[ uris.length ];
+ for( int i=0; i < urls.length; i++ )
+ {
+ URI uri = uris[i];
+ if( Artifact.isRecognized( uri ) )
+ {
+ urls[i] = Artifact.toURL( uri );
+ }
+ else
+ {
+ urls[i] = uri.toURL();
+ }
+ }
+ return urls;
+ }
+
+ /**
+ * Test if the supplied url is already present within the supplied
classloader.
+ * @param classloader the classloader to validate against
+ * @param url to url to check for
+ * @return true if the url is not included in the classloader
+ */
+ private static boolean isaCandidate( ClassLoader classloader, URL url )
+ {
+ if( classloader instanceof URLClassLoader )
+ {
+ URL[] urls = ( (URLClassLoader) classloader ).getURLs();
+ for( int i=0; i < urls.length; i++ )
+ {
+ if( urls[i].equals( url ) )
+ {
+ return false;
+ }
+ }
+ ClassLoader parent = classloader.getParent();
+ if( parent == null )
+ {
+ return true;
+ }
+ else
+ {
+ return isaCandidate( parent, url );
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------------
+
+ private final Category m_category;
+ private final URI m_plugin;
+
+ //--------------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------------
+
+ /**
+ * Creation of a new classloader.
+ * @param plugin uri identifying the plugin
+ * @param category the classloader category identifier
+ * @param urls an array of urls to add to the classloader
+ * @param parent the parent classloader
+ */
+ public StandardClassLoader( URI plugin, Category category, URL[] urls,
ClassLoader parent )
+ {
+ super( urls, parent );
+ m_category = category;
+ m_plugin = plugin;
+ }
+
+ //--------------------------------------------------------------------
+ // StandardClassLoader
+ //--------------------------------------------------------------------
+
+ /**
+ * Return the classloader category
+ * @return the classloader category
+ */
+ public Category getCategory()
+ {
+ return m_category;
+ }
+
+ /**
+ * Return the plugin uri identifier
+ * @return the plugin uri
+ */
+ public URI getPluginURI()
+ {
+ return m_plugin;
+ }
+
+ /**
+ * Return a string representation of the classloader.
+ * @return the string value
+ */
+ public String getAnnotations()
+ {
+ StringBuffer buffer = new StringBuffer();
+ ClassLoader parent = getParent();
+ if( parent instanceof URLClassLoader )
+ {
+ URLClassLoader urlClassLoader = (URLClassLoader) parent;
+ buffer.append( getURLClassLoaderAnnotations( urlClassLoader ) );
+ }
+ buffer.append( " " );
+ URL[] urls = getURLs();
+ for( int i=0; i<urls.length; i++ )
+ {
+ String path = urls[i].toString();
+ if( !path.startsWith( "file:" ) )
+ {
+ buffer.append( path );
+ buffer.append( " " );
+ }
+ }
+ return buffer.toString().trim();
+ }
+
+ private String getURLClassLoaderAnnotations( URLClassLoader classloader )
+ {
+ StringBuffer buffer = new StringBuffer();
+ ClassLoader parent = classloader.getParent();
+ if( ( null != parent ) && ( parent instanceof URLClassLoader ) )
+ {
+ URLClassLoader urlClassLoader = (URLClassLoader) parent;
+ buffer.append( getURLClassLoaderAnnotations( urlClassLoader ) );
+ }
+ if( ClassLoader.getSystemClassLoader() == classloader )
+ {
+ return "";
+ }
+ buffer.append( " " );
+ URL[] urls = classloader.getURLs();
+ for( int i=0; i<urls.length; i++ )
+ {
+ String path = urls[i].toString();
+ if( !path.startsWith( "file:" ) )
+ {
+ buffer.append( path );
+ buffer.append( " " );
+ }
+ }
+ return buffer.toString().trim();
+ }
+
+ /**
+ * Return a string representing of the classloader.
+ * @param expanded if true return an expanded representation of the
classloader
+ * @return the string representation
+ */
+ public String toString( boolean expanded )
+ {
+ StringBuffer buffer = new StringBuffer();
+ listClasspath( buffer );
+ return buffer.toString();
+ }
+
+ //--------------------------------------------------------------------
+ // Object
+ //--------------------------------------------------------------------
+
+ /**
+ * Return a string representing of the classloader.
+ * @return the string representation
+ */
+ public String toString()
+ {
+ final String label =
+ getClass().getName()
+ + "#"
+ + System.identityHashCode( this );
+ return label;
+ }
+
+ /**
+ * Internal operation to list the classloader classpath.
+ * @param buffer the buffer to list to
+ */
+ protected void listClasspath( StringBuffer buffer )
+ {
+ listClasspath( buffer, this );
+ buffer.append( "\n" );
+ }
+
+ /**
+ * Internal operation to list a classloader classpath.
+ * @param buffer the buffer to list to
+ * @param classloader the classloader to list
+ */
+ protected void listClasspath( StringBuffer buffer, ClassLoader
classloader )
+ {
+ String label =
+ "\nClassLoader: "
+ + classloader.getClass().getName()
+ + " (" + System.identityHashCode( classloader ) + ")";
+
+ if( classloader instanceof StandardClassLoader )
+ {
+ StandardClassLoader cl = (StandardClassLoader) classloader;
+ ClassLoader parent = cl.getParent();
+ if( null != parent )
+ {
+ listClasspath( buffer, parent );
+ }
+
+ if( null != m_plugin )
+ {
+ label = label.concat( "\nGroup: " + m_plugin + " " +
cl.getCategory() );
+ }
+ else
+ {
+ label = label.concat( "\nCategory: " + cl.getCategory() );
+ }
+ buffer.append( label );
+ buffer.append( "\n" );
+ appendEntries( buffer, cl );
+ }
+ else if( classloader instanceof URLClassLoader )
+ {
+ URLClassLoader cl = (URLClassLoader) classloader;
+ ClassLoader parent = cl.getParent();
+ if( null != parent )
+ {
+ listClasspath( buffer, parent );
+ }
+ buffer.append( label );
+ appendEntries( buffer, cl );
+ }
+ else
+ {
+ buffer.append( label );
+ buffer.append( "]\n" );
+ }
+ }
+
+ private static void appendEntries( StringBuffer buffer, URLClassLoader
classloader )
+ {
+ URL[] urls = classloader.getURLs();
+ for( int i=0; i < urls.length; i++ )
+ {
+ buffer.append( "\n " );
+ URL url = urls[i];
+ String spec = url.toString();
+ buffer.append( spec );
+ }
+ buffer.append( "\n" );
+ }
+
+ /**
+ * Return a string representing a report fo the common classloader chain
+ * following by the primary annd seciondarty classloaders.
+ * @param primary the primary classloader
+ * @param secondary the secondary classloader
+ * @return the report
+ */
+ public static String toString( ClassLoader primary, ClassLoader
secondary )
+ {
+ StringBuffer buffer = new StringBuffer();
+ ClassLoader anchor = getCommonParent( primary, secondary );
+ if( null != anchor )
+ {
+ buffer.append(
"\n----------------------------------------------------------------" );
+ buffer.append( "\nCommon Classloader" );
+ buffer.append(
"\n----------------------------------------------------------------" );
+ list( buffer, anchor );
+ }
+ buffer.append(
"\n----------------------------------------------------------------" );
+ buffer.append( "\nPrimary Classloader" );
+ buffer.append(
"\n----------------------------------------------------------------" );
+ list( buffer, primary, anchor );
+ buffer.append(
"\n----------------------------------------------------------------" );
+ buffer.append( "\nSecondary Classloader" );
+ buffer.append(
"\n----------------------------------------------------------------" );
+ list( buffer, secondary, anchor );
+ buffer.append(
"\n----------------------------------------------------------------" );
+ return buffer.toString();
+ }
+
+ private static ClassLoader getCommonParent( ClassLoader primary,
ClassLoader secondary )
+ {
+ ClassLoader[] primaryChain = getClassLoaderChain( primary );
+ ClassLoader[] secondaryChain = getClassLoaderChain( secondary );
+ return getCommonClassLoader( primaryChain, secondaryChain );
+ }
+
+ private static ClassLoader[] getClassLoaderChain( ClassLoader
classloader )
+ {
+ ArrayList list = new ArrayList();
+ list.add( classloader );
+ ClassLoader parent = classloader.getParent();
+ while( null != parent )
+ {
+ list.add( parent );
+ parent = parent.getParent();
+ }
+ ArrayList result = new ArrayList();
+ int n = list.size() - 1;
+ for( int i=n; i>-1; i-- )
+ {
+ result.add( list.get( i ) );
+ }
+
+ return (ClassLoader[]) result.toArray( new ClassLoader[0] );
+ }
+
+ private static ClassLoader getCommonClassLoader( ClassLoader[] primary,
ClassLoader[] secondary )
+ {
+ ClassLoader anchor = null;
+ for( int i=0; i<primary.length; i++ )
+ {
+ ClassLoader classloader = primary[i];
+ if( secondary.length > i )
+ {
+ ClassLoader cl = secondary[i];
+ if( classloader == cl )
+ {
+ anchor = cl;
+ }
+ else
+ {
+ return anchor;
+ }
+ }
+ else
+ {
+ return anchor;
+ }
+ }
+ return anchor;
+ }
+
+ private static void list( StringBuffer buffer, ClassLoader classloader )
+ {
+ list( buffer, classloader, null );
+ }
+
+ private static void list( StringBuffer buffer, ClassLoader classloader,
ClassLoader anchor )
+ {
+ if( classloader == anchor )
+ {
+ return;
+ }
+ ClassLoader parent = classloader.getParent();
+ if( null != parent )
+ {
+ list( buffer, parent, anchor );
+ }
+ String label =
+ "\nClassLoader: "
+ + classloader.getClass().getName()
+ + " (" + System.identityHashCode( classloader ) + ")";
+ buffer.append( label );
+ if( classloader instanceof StandardClassLoader )
+ {
+ StandardClassLoader loader = (StandardClassLoader) classloader;
+ buffer.append( " " + loader.m_category );
+ URI uri = loader.getPluginURI();
+ if( null != uri )
+ {
+ buffer.append( "\nURI: " + uri );
+ }
+ }
+ if( classloader instanceof URLClassLoader )
+ {
+ URLClassLoader urlcl = (URLClassLoader) classloader;
+ buffer.append( "\n" );
+ appendEntries( buffer, urlcl );
+ }
+ }
+}
Copied: trunk/main/transit/core/src/main/net/dpml/lang/SystemClassLoader.java
(from rev 1322,
trunk/main/transit/core/src/main/net/dpml/part/SystemClassLoader.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/SystemClassLoader.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/SystemClassLoader.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2005 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.lang;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+import java.util.Arrays;
+
+import net.dpml.lang.Category;
+
+/**
+ * The SystemClassLoader is a URLClassLoader that supports late binding of
+ * URLs. This class may be configured as the system classloader when
loading plugins
+ * that declare system category plugin entries.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class SystemClassLoader extends StandardClassLoader
+{
+ private final ClassLoader m_parent;
+
+ /**
+ * Creation of a new Depot classloader.
+ *
+ * @param parent the parent classloader
+ */
+ public SystemClassLoader( ClassLoader parent )
+ {
+ super( SYSTEM_URI, Category.SYSTEM, new URL[0], parent );
+ m_parent = parent;
+
+ if( "true".equals( System.getProperty( "dpml.transit.include.tools"
) ) )
+ {
+ String jrePath = System.getProperty( "java.home" );
+ try
+ {
+ File jre = new File( jrePath );
+ File jdk = jre.getParentFile();
+ File lib = new File( jdk, "lib" );
+ File jar = new File( lib, "tools.jar" );
+ URL url = jar.toURL();
+ addURL( url );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Internal error while attempting to establish tools.jar in
the system classloader.";
+ throw new PartError( error, e );
+ }
+ }
+ }
+
+ synchronized void addDelegates( final URI[] uris ) throws IOException
+ {
+ URL[] urls = toURLs( uris );
+ URL[] local = super.getURLs();
+ List list = Arrays.asList( local );
+ for( int i=0; i<urls.length; i++ )
+ {
+ URL url = urls[i];
+ if( !list.contains( url ) )
+ {
+ try
+ {
+ url.getContent();
+ addURL( url );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Failed to resolve url " + url;
+ System.err.println( error );
+ }
+ }
+ }
+ }
+
+ private static final URI createSystemLabel()
+ {
+ try
+ {
+ return new URI( "transit:system" );
+ }
+ catch( Exception e )
+ {
+ return null;
+ }
+ }
+
+ private static final URI SYSTEM_URI = createSystemLabel();
+}
+
Copied: trunk/main/transit/core/src/main/net/dpml/lang/ValueDecoder.java
(from rev 1322,
trunk/main/transit/core/src/main/net/dpml/part/ValueDecoder.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/ValueDecoder.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/ValueDecoder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,71 @@
+/*
+ * 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 net.dpml.lang;
+
+import net.dpml.lang.Value;
+import net.dpml.lang.Construct;
+import net.dpml.util.ElementHelper;
+
+import org.w3c.dom.Element;
+
+/**
+ * Utility used to decode values from DOM elements.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class ValueDecoder
+{
+ /**
+ * Build an array of values for the supplied element array.
+ * @param elements the elements
+ * @return the resolved values
+ */
+ public Value[] decodeValues( Element[] elements )
+ {
+ Value[] values = new Value[ elements.length ];
+ for( int i=0; i<elements.length; i++ )
+ {
+ values[i] = decodeValue( elements[i] );
+ }
+ return values;
+ }
+
+ /**
+ * Build a single value instance from a supplied element.
+ * @param element the element
+ * @return the resolved value
+ */
+ public Value decodeValue( Element element )
+ {
+ String classname = ElementHelper.getAttribute( element, "class" );
+ String method = ElementHelper.getAttribute( element, "method" );
+ Element[] elements = ElementHelper.getChildren( element, "param" );
+ if( elements.length > 0 )
+ {
+ Value[] values = decodeValues( elements );
+ return new Construct( classname, method, values );
+ }
+ else
+ {
+ String value = ElementHelper.getAttribute( element, "value" );
+ return new Construct( classname, method, value );
+ }
+ }
+}
Copied: trunk/main/transit/core/src/main/net/dpml/lang/ValueEncoder.java
(from rev 1322,
trunk/main/transit/core/src/main/net/dpml/part/ValueEncoder.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/ValueEncoder.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/lang/ValueEncoder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,102 @@
+/*
+ * 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 net.dpml.lang;
+
+import java.io.Writer;
+import java.io.IOException;
+
+import net.dpml.lang.Value;
+import net.dpml.lang.Construct;
+
+/**
+ * Utility used to write value instances to an output stream as XML.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class ValueEncoder
+{
+ /**
+ * Write an array of values to XML.
+ * @param writer the output stream writer
+ * @param values the value array
+ * @param pad the character offset
+ * @exception IOException if an IO error occurs
+ */
+ public void encodeValues( Writer writer, Value[] values, String pad )
throws IOException
+ {
+ for( int i=0; i<values.length; i++ )
+ {
+ Value value = values[i];
+ encodeValue( writer, value, pad );
+ }
+ }
+
+
+ /**
+ * Write a value to XML.
+ * @param writer the output stream writer
+ * @param value the value
+ * @param pad the character offset
+ * @exception IOException if an IO error occurs
+ */
+ public void encodeValue( Writer writer, Value value, String pad ) throws
IOException
+ {
+ if( value instanceof Construct )
+ {
+ Construct construct = (Construct) value;
+ String method = construct.getMethodName();
+ String target = construct.getTargetExpression();
+
+ writer.write( "\n" + pad + "<param" );
+ if( null != target )
+ {
+ writer.write( " class=\"" + target + "\"" );
+ }
+ if( null != method )
+ {
+ writer.write( " method=\"" + method + "\"" );
+ }
+ if( construct.isCompound() )
+ {
+ writer.write( ">" );
+ Value[] values = construct.getValues();
+ encodeValues( writer, values, pad + " " );
+ writer.write( "\n" + pad + "</param>" );
+ }
+ else
+ {
+ String v = construct.getBaseValue();
+ if( null != v )
+ {
+ writer.write( " value=\"" + v + "\"" );
+ }
+ writer.write( "/>" );
+ }
+ }
+ else
+ {
+ final String error =
+ "Value class ["
+ + value.getClass().getName()
+ + "] not supported.";
+ throw new IOException( error );
+ }
+ }
+}
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCacheHandler.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCacheHandler.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCacheHandler.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -39,7 +39,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.artifact.ArtifactNotFoundException;
import net.dpml.transit.artifact.ArtifactAlreadyExistsException;
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCacheModel.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/DefaultCacheModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/DefaultCacheModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -31,7 +31,7 @@
import java.util.Set;
import java.util.TreeSet;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.info.LayoutDirective;
import net.dpml.transit.info.CacheDirective;
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCodeBaseModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCodeBaseModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultCodeBaseModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -26,7 +26,7 @@
import net.dpml.lang.Value;
import net.dpml.lang.ValueDirective;
import net.dpml.lang.Construct;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.info.CodeBaseDirective;
import net.dpml.transit.model.CodeBaseModel;
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -27,7 +27,7 @@
import net.dpml.transit.model.ContentListener;
import net.dpml.transit.model.ContentEvent;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Default implementation of a content model that maintains an active
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentRegistry.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentRegistry.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentRegistry.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -35,10 +35,10 @@
import net.dpml.lang.Value;
import net.dpml.lang.Construct;
import net.dpml.lang.UnknownKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
-import net.dpml.part.Part;
-import net.dpml.part.Plugin;
+import net.dpml.lang.Part;
+import net.dpml.lang.Plugin;
/**
* A registry of descriptions of plugable content handlers.
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentRegistryModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentRegistryModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultContentRegistryModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -36,7 +36,7 @@
import net.dpml.lang.UnknownKeyException;
import net.dpml.lang.DuplicateKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Default implementation of a content model registry manager that maitains
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultHostModel.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/DefaultHostModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/DefaultHostModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -39,7 +39,7 @@
import net.dpml.util.PropertyResolver;
import net.dpml.lang.UnknownKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Default implementation of a host manager.
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutModel.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -27,7 +27,7 @@
import net.dpml.transit.model.LayoutListener;
import net.dpml.transit.model.LayoutEvent;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* The DefaultLayoutModel is a model supplied to a layout strategy handler.
It
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutRegistry.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutRegistry.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutRegistry.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -31,10 +31,10 @@
import net.dpml.transit.model.LayoutModel;
import net.dpml.lang.UnknownKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
-import net.dpml.part.Part;
-import net.dpml.part.Plugin;
+import net.dpml.lang.Part;
+import net.dpml.lang.Plugin;
/**
* A registry of descriptions of plugable layout models.
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutRegistryModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutRegistryModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultLayoutRegistryModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -35,7 +35,7 @@
import net.dpml.lang.UnknownKeyException;
import net.dpml.lang.DuplicateKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Default implementation of a layout registry model that maitains
Modified: trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -29,7 +29,7 @@
import net.dpml.transit.monitor.LoggingAdapter;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* A abstract base class that established an event queue and handles event
dispatch
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultProxyModel.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/DefaultProxyModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/DefaultProxyModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -31,7 +31,7 @@
import net.dpml.transit.model.ProxyEvent;
import net.dpml.transit.model.RequestIdentifier;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* The ProxyModel class maintains an active configuration model of the
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultResourceHost.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultResourceHost.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultResourceHost.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -54,7 +54,7 @@
import net.dpml.util.Util;
import net.dpml.lang.UnknownKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* This class represents a single host where resources are stored at.
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -37,7 +37,7 @@
import net.dpml.transit.model.DisposalListener;
import net.dpml.transit.monitor.LoggingAdapter;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* The DefaultTransitModel class maintains an active configuration of the
Modified: trunk/main/transit/core/src/main/net/dpml/transit/SaxMonitor.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/SaxMonitor.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/SaxMonitor.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -22,7 +22,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Utility class supporting the reading and writing of standard plugins
definitions.
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -41,7 +41,7 @@
import net.dpml.transit.monitor.LoggingAdapter;
import net.dpml.lang.UnknownKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/StandardLayoutModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/StandardLayoutModel.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/StandardLayoutModel.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -24,7 +24,7 @@
import java.util.EventListener;
import net.dpml.lang.Value;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.model.LayoutModel;
import net.dpml.transit.model.LayoutListener;
Modified: trunk/main/transit/core/src/main/net/dpml/transit/Transit.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/Transit.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/Transit.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -33,7 +33,7 @@
import net.dpml.transit.model.TransitModel;
import net.dpml.lang.UnknownKeyException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* The Transit class manages the establishment of a singleton transit
instance
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/TransitBuilder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/TransitBuilder.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/TransitBuilder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -38,8 +38,8 @@
import net.dpml.transit.info.LayoutDirective;
import net.dpml.lang.ValueDirective;
-import net.dpml.part.DecodingException;
-import net.dpml.lang.Logger;
+import net.dpml.util.DecodingException;
+import net.dpml.util.Logger;
import org.xml.sax.ErrorHandler;
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/artifact/ArtifactURLConnection.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/artifact/ArtifactURLConnection.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/artifact/ArtifactURLConnection.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -37,7 +37,7 @@
import net.dpml.transit.CacheHandler;
import net.dpml.util.MimeTypeHandler;
-import net.dpml.part.Part;
+import net.dpml.lang.Part;
/**
* The connection handler for URLs based on the "artifact" protocol family.
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/monitor/Adapter.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/monitor/Adapter.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/core/src/main/net/dpml/transit/monitor/Adapter.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -20,7 +20,7 @@
import java.net.URL;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
/**
* Utility interface defining a monitor adapter. The contract defines a set
of operations
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/monitor/LoggingAdapter.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/monitor/LoggingAdapter.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/core/src/main/net/dpml/transit/monitor/LoggingAdapter.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -206,7 +206,7 @@
* @param category the sub-category name.
* @return the child logging channel
*/
- public net.dpml.lang.Logger getChildLogger( String category )
+ public net.dpml.util.Logger getChildLogger( String category )
{
if( ( null == category ) || "".equals( category ) )
{
Copied:
trunk/main/transit/core/src/main/net/dpml/util/DOM3DocumentBuilder.java (from
rev 1322,
trunk/main/transit/core/src/main/net/dpml/part/DOM3DocumentBuilder.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/DOM3DocumentBuilder.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/DOM3DocumentBuilder.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,260 @@
+/*
+ * 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 net.dpml.util;
+
+import java.net.URI;
+import java.net.URL;
+import java.net.URISyntaxException;
+import java.util.Hashtable;
+import java.util.Map;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.FileNotFoundException;
+
+import javax.xml.XMLConstants;
+
+import net.dpml.transit.Artifact;
+
+import org.w3c.dom.DOMError;
+import org.w3c.dom.DOMLocator;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.Document;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.w3c.dom.ls.LSInput;
+
+/**
+ * Utility class that creates a schema validating DOM3 parser.
+ */
+public class DOM3DocumentBuilder
+{
+ private final Map m_map;
+
+ /**
+ * Creation of a new DOM3 document builder.
+ */
+ public DOM3DocumentBuilder()
+ {
+ this( new Hashtable() );
+ }
+
+ /**
+ * Creation of a new DOM3 document builder.
+ * @param map namespace to builder uri map
+ */
+ public DOM3DocumentBuilder( Map map )
+ {
+ m_map = map;
+ }
+
+ /**
+ * Parse an xml schema document.
+ * @param uri the document uri
+ * @return the validated document
+ * @exception IOException if an IO error occurs
+ */
+ public Document parse( URI uri ) throws IOException
+ {
+ if( null == uri )
+ {
+ throw new NullPointerException( "uri" );
+ }
+ try
+ {
+ DOMImplementationRegistry registry =
+ DOMImplementationRegistry.newInstance();
+ DOMImplementationLS impl =
+ (DOMImplementationLS) registry.getDOMImplementation( "LS" );
+ if( null == impl )
+ {
+ final String error =
+ "Unable to locate a DOM3 parser.";
+ throw new IllegalStateException( error );
+ }
+ LSParser builder = impl.createLSParser(
DOMImplementationLS.MODE_SYNCHRONOUS, null );
+ DOMConfiguration config = builder.getDomConfig();
+ config.setParameter( "error-handler", new InternalErrorHandler()
);
+ config.setParameter( "resource-resolver", new
InternalResourceResolver( m_map ) );
+ config.setParameter( "validate", Boolean.TRUE );
+
+ DOMInput input = new DOMInput();
+ URL url = Artifact.toURL( uri );
+ InputStream stream = url.openStream();
+ InputStreamReader reader = new InputStreamReader( stream );
+ input.setCharacterStream( reader );
+
+ return builder.parse( input );
+ }
+ catch( FileNotFoundException e )
+ {
+ throw e;
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "DOM3 error while attempting to parse document."
+ + "\nSource: " + uri;
+ String message = ExceptionHelper.packException( error, e, true );
+ throw new IOException( message );
+ }
+ }
+
+ /**
+ * Write a document to an output stream.
+ * @param doc the document to write
+ * @param output the output stream
+ * @exception Exception if an error occurs
+ */
+ public void write( Document doc, OutputStream output ) throws Exception
+ {
+ DOMImplementationRegistry registry =
+ DOMImplementationRegistry.newInstance();
+ DOMImplementationLS impl =
+ (DOMImplementationLS) registry.getDOMImplementation( "LS" );
+ if( null == impl )
+ {
+ final String error =
+ "Unable to locate a DOM3 implementation.";
+ throw new IllegalStateException( error );
+ }
+ LSSerializer domWriter = impl.createLSSerializer();
+ LSOutput lsOut = impl.createLSOutput();
+ lsOut.setByteStream( output );
+ domWriter.write( doc, lsOut );
+ }
+
+ /**
+ * Utility class to handle namespace uri resolves.
+ */
+ private static class InternalResourceResolver implements
LSResourceResolver
+ {
+ private final Map m_map;
+
+ /**
+ * Creation of a new InternalResourceResolver.
+ * @param map the namespace to builder map
+ */
+ InternalResourceResolver( Map map )
+ {
+ m_map = map;
+ }
+
+ /**
+ * Resolve an LS input.
+ * @param type the node type
+ * @param namespace the node naespace
+ * @param publicId the public id
+ * @param systemId the system id
+ * @param base the base value
+ * @return the LS input instance
+ */
+ public LSInput resolveResource(
+ String type, String namespace, String publicId, String systemId,
String base )
+ {
+ if( XMLConstants.W3C_XML_SCHEMA_NS_URI.equals( type ) )
+ {
+ DOMInput input = new DOMInput();
+ input.setPublicId( publicId );
+ input.setSystemId( systemId );
+ input.setBaseURI( base );
+ try
+ {
+ URI uri = resolveURI( namespace );
+ URL url = Artifact.toURL( uri );
+ InputStream stream = url.openStream();
+ InputStreamReader reader = new InputStreamReader( stream
);
+ input.setCharacterStream( reader );
+ }
+ catch( URISyntaxException e )
+ {
+ // ignore
+ }
+ catch( IOException e )
+ {
+ // ignore
+ }
+ return input;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private URI resolveURI( String namespace ) throws URISyntaxException
+ {
+ if( m_map.containsKey( namespace ) )
+ {
+ return (URI) m_map.get( namespace );
+ }
+ else
+ {
+ return new URI( namespace );
+ }
+ }
+ }
+
+ /**
+ * Internal error handler with lots of room for improvement.
+ */
+ private static final class InternalErrorHandler implements
DOMErrorHandler
+ {
+ /**
+ * Handle the supplied error.
+ * @param error the error
+ * @return a boolean value
+ */
+ public boolean handleError( DOMError error )
+ {
+ DOMLocator locator = error.getLocation();
+ int line = locator.getLineNumber();
+ int column = locator.getColumnNumber();
+ String uri = locator.getUri();
+ if( null == uri )
+ {
+ uri = "";
+ }
+ String position = "[" + line + ":" + column + "] " + uri + ", ";
+ String message = error.getMessage();
+ short severity = error.getSeverity();
+ if( severity == DOMError.SEVERITY_ERROR )
+ {
+ System.out.println( "[ERROR]: " + position + message );
+ final String notice = "DOM3 Validation Error: " + position +
message;
+ throw new RuntimeException( notice );
+ }
+ else if( severity == DOMError.SEVERITY_WARNING )
+ {
+ System.out.println( "[WARNING]: " + position + message );
+ }
+ else
+ {
+ System.out.println( "[FATAL]: " + position + message );
+ }
+ return true;
+ }
+ }
+}
Copied: trunk/main/transit/core/src/main/net/dpml/util/DOMInput.java (from
rev 1322, trunk/main/transit/core/src/main/net/dpml/part/DOMInput.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/DOMInput.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/DOMInput.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,276 @@
+/*
+ * 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 net.dpml.util;
+
+import java.io.Reader;
+import java.io.InputStream;
+
+import org.w3c.dom.ls.LSInput;
+
+/**
+ * This Class <code>DOMInput</code> represents a single input source for an
XML entity.
+ * <p> This Class allows an application to encapsulate information about
+ * an input source in a single object, which may include a public
+ * identifier, a system identifier, a byte stream (possibly with a specified
+ * encoding), and/or a character stream.
+ * <p> The exact definitions of a byte stream and a character stream are
+ * binding dependent.
+ * <p> There are two places that the application will deliver this input
+ * source to the parser: as the argument to the <code>parse</code> method,
+ * or as the return value of the
<code>DOMResourceResolver.resolveEntity</code>
+ * method.
+ * <p> The <code>DOMParser</code> will use the <code>LSInput</code>
+ * object to determine how to read XML input. If there is a character stream
+ * available, the parser will read that stream directly; if not, the parser
+ * will use a byte stream, if available; if neither a character stream nor a
+ * byte stream is available, the parser will attempt to open a URI
+ * connection to the resource identified by the system identifier.
+ * <p> An <code>LSInput</code> object belongs to the application: the
+ * parser shall never modify it in any way (it may modify a copy if
+ * necessary). Eventhough all attributes in this interface are writable the
+ * DOM implementation is expected to never mutate a LSInput.
+ * <p>See also the <a
href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object
Model (DOM) Level 3 Abstract Schemas and Load
+and Save Specification</a>.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+class DOMInput implements LSInput
+{
+ private String m_publicId = null;
+ private String m_systemId = null;
+ private String m_base = null;
+ private InputStream m_byteStream = null;
+ private Reader m_reader = null;
+ private String m_data = null;
+ private String m_encoding = null;
+ private boolean m_certified = false;
+
+ /**
+ * Default constructor.
+ */
+ public DOMInput()
+ {
+ }
+
+ /**
+ * An attribute of a language-binding dependent type that represents a
+ * stream of bytes.
+ * <br>The parser will ignore this if there is also a character stream
+ * specified, but it will use a byte stream in preference to opening a
+ * URI connection itself.
+ * <br>If the application knows the character encoding of the byte stream,
+ * it should set the encoding property. Setting the encoding in this way
+ * will override any encoding specified in the XML declaration itself.
+ */
+ public InputStream getByteStream()
+ {
+ return m_byteStream;
+ }
+
+ /**
+ * An attribute of a language-binding dependent type that represents a
+ * stream of bytes.
+ * <br>The parser will ignore this if there is also a character stream
+ * specified, but it will use a byte stream in preference to opening a
+ * URI connection itself.
+ * <br>If the application knows the character encoding of the byte stream,
+ * it should set the encoding property. Setting the encoding in this way
+ * will override any encoding specified in the XML declaration itself.
+ */
+ public void setByteStream( InputStream byteStream )
+ {
+ m_byteStream = byteStream;
+ }
+
+ /**
+ * An attribute of a language-binding dependent type that represents a
+ * stream of 16-bit units. Application must encode the stream using
+ * UTF-16 (defined in and Amendment 1 of ).
+ * <br>If a character stream is specified, the parser will ignore any byte
+ * stream and will not attempt to open a URI connection to the system
+ * identifier.
+ */
+ public Reader getCharacterStream()
+ {
+ return m_reader;
+ }
+ /**
+ * An attribute of a language-binding dependent type that represents a
+ * stream of 16-bit units. Application must encode the stream using
+ * UTF-16 (defined in and Amendment 1 of ).
+ * <br>If a character stream is specified, the parser will ignore any byte
+ * stream and will not attempt to open a URI connection to the system
+ * identifier.
+ */
+ public void setCharacterStream( Reader characterStream )
+ {
+ m_reader = characterStream;
+ }
+
+ /**
+ * A string attribute that represents a sequence of 16 bit units (utf-16
+ * encoded characters).
+ * <br>If string data is available in the input source, the parser will
+ * ignore the character stream and the byte stream and will not attempt
+ * to open a URI connection to the system identifier.
+ */
+ public String getStringData()
+ {
+ return m_data;
+ }
+
+ /**
+ * A string attribute that represents a sequence of 16 bit units (utf-16
+ * encoded characters).
+ * <br>If string data is available in the input source, the parser will
+ * ignore the character stream and the byte stream and will not attempt
+ * to open a URI connection to the system identifier.
+ */
+ public void setStringData( String stringData )
+ {
+ m_data = stringData;
+ }
+
+ /**
+ * The character encoding, if known. The encoding must be a string
+ * acceptable for an XML encoding declaration ( section 4.3.3 "Character
+ * Encoding in Entities").
+ * <br>This attribute has no effect when the application provides a
+ * character stream. For other sources of input, an encoding specified
+ * by means of this attribute will override any encoding specified in
+ * the XML claration or the Text Declaration, or an encoding obtained
+ * from a higher level protocol, such as HTTP .
+ */
+ public String getEncoding()
+ {
+ return m_encoding;
+ }
+
+ /**
+ * The character encoding, if known. The encoding must be a string
+ * acceptable for an XML encoding declaration ( section 4.3.3 "Character
+ * Encoding in Entities").
+ * <br>This attribute has no effect when the application provides a
+ * character stream. For other sources of input, an encoding specified
+ * by means of this attribute will override any encoding specified in
+ * the XML claration or the Text Declaration, or an encoding obtained
+ * from a higher level protocol, such as HTTP .
+ */
+ public void setEncoding( String encoding )
+ {
+ m_encoding = encoding;
+ }
+
+ /**
+ * The public identifier for this input source. The public identifier is
+ * always optional: if the application writer includes one, it will be
+ * provided as part of the location information.
+ */
+ public String getPublicId()
+ {
+ return m_publicId;
+ }
+ /**
+ * The public identifier for this input source. The public identifier is
+ * always optional: if the application writer includes one, it will be
+ * provided as part of the location information.
+ */
+ public void setPublicId( String publicId )
+ {
+ m_publicId = publicId;
+ }
+
+ /**
+ * The system identifier, a URI reference , for this input source. The
+ * system identifier is optional if there is a byte stream or a
+ * character stream, but it is still useful to provide one, since the
+ * application can use it to resolve relative URIs and can include it in
+ * error messages and warnings (the parser will attempt to fetch the
+ * ressource identifier by the URI reference only if there is no byte
+ * stream or character stream specified).
+ * <br>If the application knows the character encoding of the object
+ * pointed to by the system identifier, it can register the encoding by
+ * setting the encoding attribute.
+ * <br>If the system ID is a relative URI reference (see section 5 in ),
+ * the behavior is implementation dependent.
+ */
+ public String getSystemId()
+ {
+ return m_systemId;
+ }
+ /**
+ * The system identifier, a URI reference , for this input source. The
+ * system identifier is optional if there is a byte stream or a
+ * character stream, but it is still useful to provide one, since the
+ * application can use it to resolve relative URIs and can include it in
+ * error messages and warnings (the parser will attempt to fetch the
+ * ressource identifier by the URI reference only if there is no byte
+ * stream or character stream specified).
+ * <br>If the application knows the character encoding of the object
+ * pointed to by the system identifier, it can register the encoding by
+ * setting the encoding attribute.
+ * <br>If the system ID is a relative URI reference (see section 5 in ),
+ * the behavior is implementation dependent.
+ */
+ public void setSystemId( String systemId )
+ {
+ m_systemId = systemId;
+ }
+
+ /**
+ * The base URI to be used (see section 5.1.4 in ) for resolving relative
+ * URIs to absolute URIs. If the baseURI is itself a relative URI, the
+ * behavior is implementation dependent.
+ */
+ public String getBaseURI()
+ {
+ return m_base;
+ }
+
+ /**
+ * The base URI to be used (see section 5.1.4 in ) for resolving relative
+ * URIs to absolute URIs. If the baseURI is itself a relative URI, the
+ * behavior is implementation dependent.
+ */
+ public void setBaseURI( String baseURI )
+ {
+ m_base = baseURI;
+ }
+
+ /**
+ * If set to true, assume that the input is certified (see section 2.13
+ * in [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML
1.1</a>]) when
+ * parsing [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML
1.1</a>].
+ */
+ public boolean getCertifiedText()
+ {
+ return m_certified;
+ }
+
+ /**
+ * If set to true, assume that the input is certified (see section 2.13
+ * in [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML
1.1</a>]) when
+ * parsing [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML
1.1</a>].
+ */
+ public void setCertifiedText( boolean certifiedText )
+ {
+ m_certified = certifiedText;
+ }
+}
Copied: trunk/main/transit/core/src/main/net/dpml/util/Decoder.java (from rev
1322, trunk/main/transit/core/src/main/net/dpml/part/Decoder.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/Decoder.java 2006-04-05
21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/Decoder.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -0,0 +1,38 @@
+/*
+ * 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 net.dpml.util;
+
+import java.io.IOException;
+
+import org.w3c.dom.Element;
+
+/**
+ * Interface implemented by generic decoders.
+ */
+public interface Decoder
+{
+ /**
+ * Create an object using a supplied classloader and DOM element.
+ * @param element the DOM element
+ * @return the decoded object
+ * @exception IOException if an error occurs in the evaluation
+ * of the supplied element
+ */
+ Object decode( Element element ) throws IOException;
+}
Copied: trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
(from rev 1322,
trunk/main/transit/core/src/main/net/dpml/part/DecoderFactory.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/DecoderFactory.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,220 @@
+/*
+ * 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 net.dpml.util;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+import java.util.Hashtable;
+
+import net.dpml.lang.Part;
+import net.dpml.lang.PartDecoder;
+
+import net.dpml.transit.Artifact;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.TypeInfo;
+
+/**
+ * Utility class supporting resolution of element decoders.
+ */
+public final class DecoderFactory
+{
+ private static final String PART_XSD_URI = "@PART-XSD-URI@";
+
+ private final Map m_map; // maps namespace uris to element handlers
+
+ /**
+ * Creation of a new helper factory using default mappings.
+ */
+ public DecoderFactory()
+ {
+ this( null );
+ }
+
+ /**
+ * Creation of a new decoder factory. The supplied map contains the
mapping
+ * of namespace urn to decoder plugin uris. If the "dpml/lang/dpml-part"
namespace
+ * is not included in the map a special uri will be assigned associating
the namespace
+ * with this package implementation.
+ *
+ * @param map the namespace to helper uri map
+ */
+ public DecoderFactory( Map map )
+ {
+ if( null == map )
+ {
+ m_map = new Hashtable();
+ }
+ else
+ {
+ m_map = map;
+ }
+ }
+
+ /**
+ * Get an element helper based on the namespace declared by the supplied
element. If
+ * the element namespace is the dpml/part namespace then a local uri is
returned,
+ * otherwise evaluation is based on namespace to hanlder mappings
supplied to
+ * the factory constructor. If a map entry is resolved, a delegating
builder is
+ * established with the resolved helper uri, otherwise a helper uri is
resolved
+ * by substituting the namespace uri artifact type for "part" on the
assumption that
+ * a part implemenation will be available.
+ *
+ * @param element the DOM element
+ * @return the associated helper instance
+ * @exception Exception if an eror occurs
+ */
+ public Decoder loadDecoder( Element element ) throws Exception
+ {
+ TypeInfo info = element.getSchemaTypeInfo();
+ String namespace = info.getTypeNamespace();
+ if( PART_XSD_URI.equals( namespace ) )
+ {
+ return PartDecoder.getInstance();
+ }
+ else
+ {
+ URI uri = getDecoderURI( namespace );
+ return new DelegatingDecoder( this, uri );
+ }
+ }
+
+ /**
+ * Resolve the element helper uri from a supplied element.
+ *
+ * @param namespace the DOM element namespace
+ * @return the builder uri
+ * @exception Exception if an error occurs
+ */
+ public URI getDecoderURI( String namespace ) throws Exception
+ {
+ if( m_map.containsKey( namespace ) )
+ {
+ return (URI) m_map.get( namespace );
+ }
+ else
+ {
+ return getDecoderURIFromNamespaceURI( namespace );
+ }
+ }
+
+ private URI getDecoderURIFromNamespaceURI( String urn ) throws Exception
+ {
+ URI raw = new URI( urn );
+ Artifact artifact = Artifact.createArtifact( raw );
+ String scheme = artifact.getScheme();
+ String group = artifact.getGroup();
+ String name = artifact.getName();
+ String type = artifact.getType();
+ String version = artifact.getVersion();
+
+ String path = "link:part:" + group + "/" + name;
+ Artifact link = Artifact.createArtifact( path );
+ return link.toURI();
+ }
+
+
+ /**
+ * Delegating builder that defers resolution until required.
+ */
+ private class DelegatingDecoder implements Decoder
+ {
+ private final DecoderFactory m_factory;
+ private final URI m_uri;
+ private Decoder m_delegate = null;
+
+ /**
+ * Creation of a new delegating builder instance.
+ * @param uri the uri of the builder that operations will be
delegated to
+ */
+ DelegatingDecoder( DecoderFactory factory, URI uri )
+ {
+ m_uri = uri;
+ m_factory = factory;
+ }
+
+ /**
+ * Delegating implementation of the decode operation.
+ * @param element the subject element
+ * @return the resulting object
+ * @exception IOException if an IO error occurs
+ */
+ public Object decode( Element element ) throws IOException
+ {
+ Decoder decoder = getDelegateDecoder();
+ return decoder.decode( element );
+ }
+
+ private Decoder getDelegateDecoder()
+ {
+ if( null != m_delegate )
+ {
+ return m_delegate;
+ }
+ else
+ {
+ Object instance = getInstance();
+ if( instance instanceof Decoder )
+ {
+ m_delegate = (Decoder) instance;
+ return m_delegate;
+ }
+ else
+ {
+ final String error =
+ "Object resolved from the uri does not provide
decoding services."
+ + "\nDelegate URI: " + m_uri
+ + "\nDelegate Class: " + instance.getClass().getName();
+ throw new IllegalStateException( error );
+ }
+ }
+ }
+
+ private Object getInstance()
+ {
+ try
+ {
+ Object[] args = new Object[]{m_factory};
+ Part part = Part.load( m_uri );
+ return part.instantiate( args );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected error occured while attempting to establish
the delegate decoder."
+ + "\nDelegate URI: " + m_uri;
+ throw new RuntimeException( error, e ); // change to a
factory exception
+ }
+ }
+ }
+
+ private static URI createURI( String spec )
+ {
+ try
+ {
+ return new URI( spec );
+ }
+ catch( Throwable e )
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+}
Copied: trunk/main/transit/core/src/main/net/dpml/util/DecodingException.java
(from rev 1322,
trunk/main/transit/core/src/main/net/dpml/part/DecodingException.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/DecodingException.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/DecodingException.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,96 @@
+/*
+ * 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 net.dpml.util;
+
+import java.io.IOException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Exception related to data decoding from a DOM element.
+ */
+public class DecodingException extends IOException
+{
+ private final Element m_element;
+
+ /**
+ * Create a new decoding exception.
+ * @param element the element representing the source of the error
+ * @param message the exception message
+ */
+ public DecodingException( Element element, String message )
+ {
+ this( element, message, null );
+ }
+
+ /**
+ * Create a new decoding exception.
+ * @param element the element representing the source of the error
+ * @param message the exception message
+ * @param cause the causal exception
+ */
+ public DecodingException( Element element, String message, Throwable
cause )
+ {
+ super( message );
+ if( null != cause )
+ {
+ super.initCause( cause );
+ }
+ m_element = element;
+ }
+
+ /**
+ * Get the element that is the subject of this exception.
+ * @return the subject element
+ */
+ public Element getElement()
+ {
+ return m_element;
+ }
+
+ /**
+ * Return a string representation of the exception.
+ * @return the string value
+ */
+ public String getMessage()
+ {
+ try
+ {
+ String message = super.getMessage();
+ StringBuffer buffer = new StringBuffer( message );
+ Element element = getElement();
+ String tag = element.getTagName();
+ buffer.append( "\nElement: <" );
+ buffer.append( tag );
+ buffer.append( " ...>" );
+ Document document = element.getOwnerDocument();
+ String uri = document.getDocumentURI();
+ if( null != uri )
+ {
+ buffer.append( "\nDocument: " + uri );
+ }
+ return buffer.toString();
+ }
+ catch( Throwable e )
+ {
+ return super.getMessage();
+ }
+ }
+}
Copied: trunk/main/transit/core/src/main/net/dpml/util/DefaultLogger.java
(from rev 1322,
trunk/main/transit/core/src/main/net/dpml/lang/DefaultLogger.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/DefaultLogger.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/DefaultLogger.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,245 @@
+/*
+ * 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 net.dpml.util;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+import net.dpml.lang.PID;
+
+/**
+ * Generic logging channel.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class DefaultLogger implements net.dpml.util.Logger
+{
+ //
------------------------------------------------------------------------
+ // static
+ //
------------------------------------------------------------------------
+
+ private static final PID ID = new PID();
+
+ private static String clean( String category )
+ {
+ String result = category.replace( '/', '.' );
+ if( result.startsWith( "." ) )
+ {
+ return clean( result.substring( 1 ) );
+ }
+ else if( result.endsWith( "." ) )
+ {
+ return clean( result.substring( 0, result.length() -1 ) );
+ }
+ else
+ {
+ return result;
+ }
+ }
+
+ //
------------------------------------------------------------------------
+ // state
+ //
------------------------------------------------------------------------
+
+ private Logger m_logger;
+
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ /**
+ * Creation of a new console adapter that is used to redirect transit
events
+ * the system output stream.
+ */
+ public DefaultLogger()
+ {
+ this( "" );
+ }
+
+ /**
+ * Creation of a new console adapter that is used to redirect transit
events
+ * the system output stream.
+ * @param category the logging channel category name
+ */
+ public DefaultLogger( String category )
+ {
+ this( Logger.getLogger( clean( category ) ) );
+ }
+
+ /**
+ * Creation of a new console adapter that is used to redirect transit
events
+ * the system output stream.
+ * @param logger the assigned logging channel
+ */
+ public DefaultLogger( Logger logger )
+ {
+ m_logger = logger;
+ }
+
+ //
------------------------------------------------------------------------
+ // Logger
+ //
------------------------------------------------------------------------
+
+ /**
+ * Return TRUE is debug level logging is enabled.
+ * @return the enabled state of debug logging
+ */
+ public boolean isDebugEnabled()
+ {
+ return m_logger.isLoggable( Level.FINE );
+ }
+
+ /**
+ * Return TRUE is info level logging is enabled.
+ * @return the enabled state of info logging
+ */
+ public boolean isInfoEnabled()
+ {
+ return m_logger.isLoggable( Level.INFO );
+ }
+
+ /**
+ * Return TRUE is error level logging is enabled.
+ * @return the enabled state of error logging
+ */
+ public boolean isWarnEnabled()
+ {
+ return m_logger.isLoggable( Level.WARNING );
+ }
+
+ /**
+ * Return TRUE is error level logging is enabled.
+ * @return the enabled state of error logging
+ */
+ public boolean isErrorEnabled()
+ {
+ return m_logger.isLoggable( Level.SEVERE );
+ }
+
+ /**
+ * Log a debug message is debug mode is enabled.
+ * @param message the message to log
+ */
+ public void debug( String message )
+ {
+ if( isDebugEnabled() )
+ {
+ m_logger.fine( message );
+ }
+ }
+
+ /**
+ * Log a info level message.
+ * @param message the message to log
+ */
+ public void info( String message )
+ {
+ if( isInfoEnabled() )
+ {
+ m_logger.info( message );
+ }
+ }
+
+ /**
+ * Record a warning message.
+ * @param message the warning message to record
+ */
+ public void warn( String message )
+ {
+ if( isWarnEnabled() )
+ {
+ m_logger.warning( message );
+ }
+ }
+
+ /**
+ * Record a warning message.
+ * @param message the warning message to record
+ * @param cause the causal exception
+ */
+ public void warn( String message, Throwable cause )
+ {
+ if( isWarnEnabled() )
+ {
+ m_logger.log( Level.WARNING, message, cause );
+ }
+ }
+
+ /**
+ * Log a error message.
+ * @param message the message to log
+ */
+ public void error( String message )
+ {
+ if( isErrorEnabled() )
+ {
+ m_logger.log( Level.SEVERE, message );
+ }
+ }
+
+ /**
+ * Log a error message.
+ * @param message the message to log
+ * @param e the causal exception
+ */
+ public void error( String message, Throwable e )
+ {
+ if( isErrorEnabled() )
+ {
+ m_logger.log( Level.SEVERE, message, e );
+ }
+ }
+
+ /**
+ * Return a child logger.
+ * @param category the sub-category name.
+ * @return the child logging channel
+ */
+ public net.dpml.util.Logger getChildLogger( String category )
+ {
+ if( ( null == category ) || "".equals( category ) )
+ {
+ return this;
+ }
+ else
+ {
+ String name = m_logger.getName();
+ String path = trim( name + "." + category );
+ return new DefaultLogger( Logger.getLogger( path ) );
+ }
+ }
+
+ private String trim( String path )
+ {
+ if( path.startsWith( "." ) )
+ {
+ return trim( path.substring( 1 ) );
+ }
+ else if( ".".equals( path ) )
+ {
+ return "";
+ }
+ else
+ {
+ return path;
+ }
+ }
+}
+
Copied: trunk/main/transit/core/src/main/net/dpml/util/Encoder.java (from rev
1322, trunk/main/transit/core/src/main/net/dpml/part/Encoder.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/Encoder.java 2006-04-05
21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/Encoder.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -0,0 +1,37 @@
+/*
+ * 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 net.dpml.util;
+
+import java.io.Writer;
+import java.io.IOException;
+
+/**
+ * Interface implemented by generic encoders.
+ */
+public interface Encoder
+{
+ /**
+ * Externalize a object to XML.
+ * @param writer the output stream writer
+ * @param object the object to externalize
+ * @param pad the character offset
+ * @exception IOException if an IO error occurs
+ */
+ public void encode( Writer writer, Object object, String pad ) throws
IOException;
+}
Copied: trunk/main/transit/core/src/main/net/dpml/util/Logger.java (from rev
1322, trunk/main/transit/core/src/main/net/dpml/lang/Logger.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Logger.java 2006-04-05
21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/Logger.java 2006-04-05
22:46:20 UTC (rev 1325)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004-2005 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.util;
+
+/**
+ * Transit Logger is a interface through which different logging solutions
+ * can be provided.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface Logger
+{
+ /**
+ * Return TRUE is debug level logging is enabled.
+ * @return the enabled state of debug logging
+ */
+ boolean isDebugEnabled();
+
+ /**
+ * Return TRUE is info level logging is enabled.
+ * @return the enabled state of info logging
+ */
+ boolean isInfoEnabled();
+
+ /**
+ * Return TRUE is warn level logging is enabled.
+ * @return the enabled state of warn level logging
+ */
+ boolean isWarnEnabled();
+
+ /**
+ * Return TRUE is error level logging is enabled.
+ * @return the enabled state of error logging
+ */
+ boolean isErrorEnabled();
+
+ /**
+ * Record a debug level message.
+ * @param message the debug message to record
+ */
+ void debug( String message );
+
+ /**
+ * Record a informative message.
+ * @param message the info message to record
+ */
+ void info( String message );
+
+ /**
+ * Record a warning message.
+ * @param message the warning message to record
+ */
+ void warn( String message );
+
+ /**
+ * Record a warning message.
+ * @param message the warning message to record
+ * @param cause the causal exception
+ */
+ void warn( String message, Throwable cause );
+
+ /**
+ * Record a error level message.
+ * @param message the error message to record
+ */
+ void error( String message );
+
+ /**
+ * Record a error level message.
+ * @param message the error message to record
+ * @param cause the causal exception
+ */
+ void error( String message, Throwable cause );
+
+ /**
+ * Return a child logger relative to the current logger.
+ * @param category the relative category name
+ * @return the child logging channel
+ */
+ Logger getChildLogger( String category );
+}
+
+
Copied: trunk/main/transit/core/src/main/net/dpml/util/LoggingService.java
(from rev 1322,
trunk/main/transit/core/src/main/net/dpml/lang/LoggingService.java)
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/LoggingService.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/main/net/dpml/util/LoggingService.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2005 Stephen 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.util;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.logging.LogRecord;
+
+import net.dpml.lang.PID;
+
+/**
+ * Interface exposed by a remote logging service to local log aggregation
handlers.
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface LoggingService extends Remote
+{
+ /**
+ * Logging service key.
+ */
+ String LOGGING_KEY = "dpml/logging";
+
+ /**
+ * Register a log record with the log service.
+ * @param process the process identifier
+ * @param record the log record
+ * @exception RemoteException if a remote exception occurs
+ */
+ void log( PID process, LogRecord record ) throws RemoteException;
+}
+
Copied: trunk/main/transit/core/src/test/net/dpml/lang (from rev 1322,
trunk/main/transit/core/src/test/net/dpml/part)
Modified: trunk/main/transit/core/src/test/net/dpml/lang/PartTestCase.java
===================================================================
--- trunk/main/transit/core/src/test/net/dpml/part/PartTestCase.java
2006-04-05 21:05:06 UTC (rev 1322)
+++ trunk/main/transit/core/src/test/net/dpml/lang/PartTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -16,11 +16,13 @@
* limitations under the License.
*/
-package net.dpml.part;
+package net.dpml.lang;
import java.io.File;
import java.io.FileOutputStream;
+import net.dpml.lang.Part;
+
import junit.framework.TestCase;
/**
Modified:
trunk/main/transit/tools/src/main/net/dpml/transit/tools/AntAdapter.java
===================================================================
--- trunk/main/transit/tools/src/main/net/dpml/transit/tools/AntAdapter.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/tools/src/main/net/dpml/transit/tools/AntAdapter.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -22,7 +22,7 @@
import net.dpml.transit.monitor.Adapter;
import net.dpml.util.ExceptionHelper;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.Project;
Modified:
trunk/main/transit/tools/src/main/net/dpml/transit/tools/PluginTask.java
===================================================================
--- trunk/main/transit/tools/src/main/net/dpml/transit/tools/PluginTask.java
2006-04-05 21:32:57 UTC (rev 1324)
+++ trunk/main/transit/tools/src/main/net/dpml/transit/tools/PluginTask.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -30,8 +30,8 @@
import net.dpml.util.ElementHelper;
-import net.dpml.part.Part;
-import net.dpml.part.Resource;
+import net.dpml.lang.Part;
+import net.dpml.lang.Resource;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildListener;
Modified:
trunk/main/transit/tools/src/main/net/dpml/transit/tools/TransitComponentHelper.java
===================================================================
---
trunk/main/transit/tools/src/main/net/dpml/transit/tools/TransitComponentHelper.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/transit/tools/src/main/net/dpml/transit/tools/TransitComponentHelper.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -23,9 +23,9 @@
import java.util.Hashtable;
import java.net.URI;
-import net.dpml.part.Part;
-import net.dpml.part.Plugin;
-import net.dpml.part.Resource;
+import net.dpml.lang.Part;
+import net.dpml.lang.Plugin;
+import net.dpml.lang.Resource;
import net.dpml.util.ElementHelper;
Modified:
trunk/main/util/job/impl/src/test/net/dpml/job/test/DefaultCommissionerTestCase.java
===================================================================
---
trunk/main/util/job/impl/src/test/net/dpml/job/test/DefaultCommissionerTestCase.java
2006-04-05 21:32:57 UTC (rev 1324)
+++
trunk/main/util/job/impl/src/test/net/dpml/job/test/DefaultCommissionerTestCase.java
2006-04-05 22:46:20 UTC (rev 1325)
@@ -20,7 +20,7 @@
import java.lang.reflect.InvocationTargetException;
-import net.dpml.lang.Logger;
+import net.dpml.util.Logger;
import net.dpml.transit.monitor.LoggingAdapter;
- r1325 - in trunk/main: . central/src/art central/src/docs/depot/tasks central/src/docs/metro/runtime/components depot/build/etc/bin depot/build/src/main/net/dpml/library/console depot/core depot/core/src/main/net/dpml/depot depot/library/etc/test/dpml depot/library/src/main/net/dpml/library/impl depot/library/src/test/net/dpml/library/impl depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks metro/component/src/main/net/dpml/component metro/model/src/main/net/dpml/metro/data metro/runtime/src/main/net/dpml/metro/builder metro/runtime/src/main/net/dpml/metro/runtime metro/state/impl/src/main/net/dpml/state/impl metro/test/src/test/net/dpml/test/part metro/tools/src/main/net/dpml/metro/tools planet/http/test/src/test/net/dpml/http/test station/api/src/test/net/dpml/station/info station/builder/src/main/net/dpml/station/builder station/console/etc/bin station/console/src/main/net/dpml/station/console station/exec/etc/bin st! ation/exec/src/main/net/dpml/station/exec station/server/etc/bin/scm/conf station/server/src/main/net/dpml/station/server station/server/src/test/net/dpml/station/server transit/console/etc/bin transit/console/src/main/net/dpml/transit/console transit/core/etc/test/trusted/dpml/test transit/core/src/main/net/dpml transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/transit transit/core/src/main/net/dpml/transit/artifact transit/core/src/main/net/dpml/transit/monitor transit/core/src/main/net/dpml/util transit/core/src/test/net/dpml transit/core/src/test/net/dpml/lang transit/tools/src/main/net/dpml/transit/tools util/job/impl/src/test/net/dpml/job/test, mcconnell at BerliOS, 04/05/2006
Archive powered by MHonArc 2.6.24.