notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1129 - in trunk/main: . depot depot/library/common/etc depot/library/common/etc/main depot/library/common/etc/main/net depot/library/common/etc/main/net/dpml depot/library/common/etc/main/net/dpml/library external metro planet planet/http transit transit/core/etc/main/net/dpml/lang transit/core/src/main/net/dpml/lang util
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1129 - in trunk/main: . depot depot/library/common/etc depot/library/common/etc/main depot/library/common/etc/main/net depot/library/common/etc/main/net/dpml depot/library/common/etc/main/net/dpml/library external metro planet planet/http transit transit/core/etc/main/net/dpml/lang transit/core/src/main/net/dpml/lang util
- Date: Thu, 23 Feb 2006 14:18:59 +0100
Author: mcconnell
Date: 2006-02-23 14:18:53 +0100 (Thu, 23 Feb 2006)
New Revision: 1129
Added:
trunk/main/depot/library/common/etc/main/
trunk/main/depot/library/common/etc/main/net/
trunk/main/depot/library/common/etc/main/net/dpml/
trunk/main/depot/library/common/etc/main/net/dpml/library/
trunk/main/depot/library/common/etc/main/net/dpml/library/library_1_0.dtd
Modified:
trunk/main/depot/module.xml
trunk/main/external/library.xml
trunk/main/library.xml
trunk/main/metro/module.xml
trunk/main/planet/http/module.xml
trunk/main/planet/module.xml
trunk/main/transit/core/etc/main/net/dpml/lang/plugin_1_0.dtd
trunk/main/transit/core/src/main/net/dpml/lang/DefaultPlugin.java
trunk/main/transit/core/src/main/net/dpml/lang/DefaultPluginHelper.java
trunk/main/transit/module.xml
trunk/main/util/module.xml
Log:
add library DTD
Added:
trunk/main/depot/library/common/etc/main/net/dpml/library/library_1_0.dtd
===================================================================
--- trunk/main/depot/library/common/etc/main/net/dpml/library/library_1_0.dtd
2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/depot/library/common/etc/main/net/dpml/library/library_1_0.dtd
2006-02-23 13:18:53 UTC (rev 1129)
@@ -0,0 +1,58 @@
+<!--
+Copyright 2006 Stephen McConnell, DPML
+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.
+-->
+
+<!ELEMENT library ( imports?, modules? ) >
+
+<!ELEMENT imports ( import* ) >
+
+<!ELEMENT modules ( module* ) >
+
+<!ELEMENT import EMPTY >
+<!ATTLIST import uri CDATA #REQUIRED >
+
+<!ELEMENT module ( types?, properties?, resource*, project*, module* ) >
+<!ATTLIST module name CDATA #IMPLIED >
+<!ATTLIST module basedir CDATA #IMPLIED >
+<!ATTLIST module base CDATA #IMPLIED >
+
+<!ELEMENT types ( type* ) >
+
+<!ELEMENT type ( property* ) >
+<!ATTLIST type id CDATA #REQUIRED >
+<!ATTLIST type alias CDATA #IMPLIED >
+
+<!ELEMENT properties ( property* ) >
+
+<!ELEMENT property EMPTY >
+<!ATTLIST property name CDATA #REQUIRED >
+<!ATTLIST property value CDATA #REQUIRED >
+
+<!ELEMENT resource ( types?, dependencies* ) >
+<!ATTLIST resource name CDATA #REQUIRED >
+<!ATTLIST resource basedir CDATA #IMPLIED >
+
+<!ELEMENT project ( types?, dependencies* ) >
+<!ATTLIST project name CDATA #REQUIRED >
+<!ATTLIST project basedir CDATA #IMPLIED >
+
+<!ELEMENT dependencies ( include* ) >
+<!ATTLIST dependencies scope ( build | runtime | test ) "runtime" >
+
+<!ELEMENT include EMPTY >
+<!ATTLIST include key CDATA #IMPLIED >
+<!ATTLIST include ref CDATA #IMPLIED >
+<!ATTLIST include uri CDATA #IMPLIED >
Modified: trunk/main/depot/module.xml
===================================================================
--- trunk/main/depot/module.xml 2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/depot/module.xml 2006-02-23 13:18:53 UTC (rev 1129)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE module PUBLIC "-//DPML//DTD Library 1.0//EN"
"http://www.dpml.net/dtds/library_1_0.dtd" >
<module name="depot">
Modified: trunk/main/external/library.xml
===================================================================
--- trunk/main/external/library.xml 2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/external/library.xml 2006-02-23 13:18:53 UTC (rev 1129)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE library PUBLIC "-//DPML//DTD Library 1.0//EN"
"http://www.dpml.net/dtds/library_1_0.dtd" >
<library>
Modified: trunk/main/library.xml
===================================================================
--- trunk/main/library.xml 2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/library.xml 2006-02-23 13:18:53 UTC (rev 1129)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE library PUBLIC "-//DPML//DTD Library 1.0//EN"
"http://www.dpml.net/dtds/library_1_0.dtd" >
<library>
Modified: trunk/main/metro/module.xml
===================================================================
--- trunk/main/metro/module.xml 2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/metro/module.xml 2006-02-23 13:18:53 UTC (rev 1129)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE module PUBLIC "-//DPML//DTD Library 1.0//EN"
"http://www.dpml.net/dtds/library_1_0.dtd" >
<module name="metro">
Modified: trunk/main/planet/http/module.xml
===================================================================
--- trunk/main/planet/http/module.xml 2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/planet/http/module.xml 2006-02-23 13:18:53 UTC (rev 1129)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE module PUBLIC "-//DPML//DTD Library 1.0//EN"
"http://www.dpml.net/dtds/library_1_0.dtd" >
<module name="http">
Modified: trunk/main/planet/module.xml
===================================================================
--- trunk/main/planet/module.xml 2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/planet/module.xml 2006-02-23 13:18:53 UTC (rev 1129)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE module PUBLIC "-//DPML//DTD Library 1.0//EN"
"http://www.dpml.net/dtds/library_1_0.dtd" >
<module name="planet">
Modified: trunk/main/transit/core/etc/main/net/dpml/lang/plugin_1_0.dtd
===================================================================
--- trunk/main/transit/core/etc/main/net/dpml/lang/plugin_1_0.dtd
2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/transit/core/etc/main/net/dpml/lang/plugin_1_0.dtd
2006-02-23 13:18:53 UTC (rev 1129)
@@ -19,20 +19,33 @@
The plugin element is the document root, it defines an instantiation
strategy and
classloader chain.
- title Plugin title.
- description Description of the plugin.
- strategy The plugin instantiation strategy - the strategy element
may
- contain an arbitary number of property elements.
- classpath the classpath presented in terms of system, public,
protected
- and private categories. Each category may contain an
arbirary
- number of uri elements.
+ title optional Plugin title.
+ description optional Description of the plugin.
+ strategy required The plugin instantiation strategy - the strategy
element may
+ contain an arbitary number of property elements.
+ classpath required The classpath presented in terms of system,
public, protected
+ and private categories. Each category may
contain an arbirary
+ number of uri elements.
-->
<!ELEMENT plugin ( title?, description?, strategy, classpath ) >
<!ATTLIST plugin version CDATA #REQUIRED xmlns CDATA #IMPLIED >
+<!--
+The strategy element is used to associate a set of properties which are
supplied
+to a plugin handler at runtime. The default runtime handler uses the
property name
+"project.plugin.class" to identify an instantiation target. Other handlers
may
+specify alternative properties (for additional info on custom handler
properties
+the reader is referred to the corresponsing handler class documentation).
+
+ property 0..n Declaration of 0..n named value pairs.
+
+The plugin runtime handler class may be overriden using the 'class'
attribute. The
+default runtime handler is net.dpml.transit.StandardHandler.
+-->
+
<!ELEMENT strategy ( property* ) >
-<!ATTLIST strategy class CDATA #REQUIRED >
+<!ATTLIST strategy class CDATA #IMPLIED >
<!ELEMENT property EMPTY >
<!ATTLIST property name CDATA #REQUIRED value CDATA #REQUIRED >
Modified: trunk/main/transit/core/src/main/net/dpml/lang/DefaultPlugin.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/DefaultPlugin.java
2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/transit/core/src/main/net/dpml/lang/DefaultPlugin.java
2006-02-23 13:18:53 UTC (rev 1129)
@@ -218,7 +218,14 @@
String handler = strategy.getHandlerClassname();
Properties properties = strategy.getProperties();
String[] keys = (String[]) properties.keySet().toArray( new
String[0] );
- writer.write( "\n <strategy class=\"" + handler + "\">" );
+ if( DefaultPluginHelper.STANDARD_HANDLER.equals( handler ) )
+ {
+ writer.write( "\n <strategy>" );
+ }
+ else
+ {
+ writer.write( "\n <strategy class=\"" + handler + "\">" );
+ }
for( int i=0; i<keys.length; i++ )
{
String key = keys[i];
Modified:
trunk/main/transit/core/src/main/net/dpml/lang/DefaultPluginHelper.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/DefaultPluginHelper.java
2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/transit/core/src/main/net/dpml/lang/DefaultPluginHelper.java
2006-02-23 13:18:53 UTC (rev 1129)
@@ -49,6 +49,11 @@
*/
public class DefaultPluginHelper implements PluginHelper
{
+ /**
+ * The default runtime handler class name.
+ */
+ public static final String STANDARD_HANDLER =
"net.dpml.transit.StandardHandler";
+
private static final Version VERSION = new Version( 1, 0, 0 );
public Plugin resolve( URI uri, Element element ) throws Exception
@@ -128,26 +133,17 @@
throw new IllegalStateException( error );
}
- String classname = ElementHelper.getAttribute( strategy, "class" );
- if( null == classname )
+ String classname = ElementHelper.getAttribute( strategy, "class",
STANDARD_HANDLER );
+ Properties properties = new Properties();
+ Element[] elements = ElementHelper.getChildren( strategy, "property"
);
+ for( int i=0; i<elements.length; i++ )
{
- final String error =
- "Required plugin runtime handler 'class' attribute is not
present in the plugin strategy descriptor.";
- throw new IllegalStateException( error );
+ Element element = elements[i];
+ String name = ElementHelper.getAttribute( element, "name" );
+ String value = ElementHelper.getAttribute( element, "value" );
+ properties.setProperty( name, value );
}
- else
- {
- Properties properties = new Properties();
- Element[] elements = ElementHelper.getChildren( strategy,
"property" );
- for( int i=0; i<elements.length; i++ )
- {
- Element element = elements[i];
- String name = ElementHelper.getAttribute( element, "name" );
- String value = ElementHelper.getAttribute( element, "value"
);
- properties.setProperty( name, value );
- }
- return new DefaultStrategy( classname, properties );
- }
+ return new DefaultStrategy( classname, properties );
}
private URI[] buildURIs( Element classpath, String key ) throws Exception
Modified: trunk/main/transit/module.xml
===================================================================
--- trunk/main/transit/module.xml 2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/transit/module.xml 2006-02-23 13:18:53 UTC (rev 1129)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE module PUBLIC "-//DPML//DTD Library 1.0//EN"
"http://www.dpml.net/dtds/library_1_0.dtd" >
<module name="transit">
Modified: trunk/main/util/module.xml
===================================================================
--- trunk/main/util/module.xml 2006-02-23 12:29:36 UTC (rev 1128)
+++ trunk/main/util/module.xml 2006-02-23 13:18:53 UTC (rev 1129)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE module PUBLIC "-//DPML//DTD Library 1.0//EN"
"http://www.dpml.net/dtds/library_1_0.dtd" >
<module name="util">
- r1129 - in trunk/main: . depot depot/library/common/etc depot/library/common/etc/main depot/library/common/etc/main/net depot/library/common/etc/main/net/dpml depot/library/common/etc/main/net/dpml/library external metro planet planet/http transit transit/core/etc/main/net/dpml/lang transit/core/src/main/net/dpml/lang util, mcconnell at BerliOS, 02/23/2006
Archive powered by MHonArc 2.6.24.