Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1529 - in development/main: . central central/tutorials magic magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/model metro planet/facilities planet/facilities/http transit util

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1529 - in development/main: . central central/tutorials magic magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/model metro planet/facilities planet/facilities/http transit util
  • Date: Wed, 19 Jan 2005 02:39:27 +0100

Author: mcconnell
Date: Wed Jan 19 02:39:27 2005
New Revision: 1529

Modified:
development/main/central/index.xml
development/main/central/tutorials/index.xml
development/main/index.xml
development/main/magic/core/src/main/net/dpml/magic/Index.java
development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
development/main/magic/index.xml
development/main/metro/index.xml
development/main/planet/facilities/http/index.xml
development/main/planet/facilities/index.xml
development/main/transit/index.xml
development/main/util/index.xml
Log:
Bumping and tweaking module generation logic.

Modified: development/main/central/index.xml
==============================================================================
--- development/main/central/index.xml (original)
+++ development/main/central/index.xml Wed Jan 19 02:39:27 2005
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

-<index>
+<index key="dpml-central">

- <import index="../magic/index.xml"
- uri="artifact:module:dpml/magic/dpml-magic#SNAPSHOT"/>
- <import index="../metro/index.xml"
- uri="artifact:module:dpml/metro/dpml-metro#SNAPSHOT"/>
- <import index="tutorials/index.xml" />
+ <import index="../magic/index.xml"/>
+ <import index="../metro/index.xml"/>
+ <import index="tutorials/index.xml"/>

<!--
Module
-->

+ <!--
<project file="module.xml">
<info>
<group>dpml/central</group>
@@ -27,6 +26,7 @@
<include key="dpml-metro"/>
</dependencies>
</project>
+ -->

<!--
Central.

Modified: development/main/central/tutorials/index.xml
==============================================================================
--- development/main/central/tutorials/index.xml (original)
+++ development/main/central/tutorials/index.xml Wed Jan 19 02:39:27
2005
@@ -2,8 +2,7 @@

<index>

- <import index="../index.xml"
- uri="artifact:module:dpml/metro/dpml-metro#SNAPSHOT"/>
+ <import index="../index.xml"/>

<!--
Tutorial Modules
@@ -12,7 +11,7 @@
<!--
<project file="module.xml">
<info>
- <group>dpml/metro</group>
+ <group>dpml/central</group>
<name>dpml-metro-tutorials</name>
<version>1.0.0</version>
<status>SNAPSHOT</status>

Modified: development/main/index.xml
==============================================================================
--- development/main/index.xml (original)
+++ development/main/index.xml Wed Jan 19 02:39:27 2005
@@ -21,23 +21,11 @@

<index>

- <import index="util/index.xml"
- uri="artifact:module:dpml/util/dpml-util#SNAPSHOT"/>
-
- <import index="transit/index.xml"
- uri="artifact:module:dpml/transit/dpml-transit#SNAPSHOT"/>
-
- <import index="magic/index.xml"
- uri="artifact:module:dpml/magic/dpml-magic#SNAPSHOT"/>
-
- <import index="metro/index.xml"
- uri="artifact:module:dpml/metro/dpml-metro#SNAPSHOT"/>
-
+ <import index="util/index.xml"/>
+ <import index="transit/index.xml"/>
+ <import index="magic/index.xml"/>
+ <import index="metro/index.xml"/>
<import index="central/index.xml"/>
-
- <import index="planet/facilities/index.xml"
- uri="artifact:module:dpml/facilities/dpml-facilities#SNAPSHOT"/>
- <!--
- -->
+ <import index="planet/facilities/index.xml"/>

</index>

Modified: development/main/magic/core/src/main/net/dpml/magic/Index.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/Index.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/Index.java Wed
Jan 19 02:39:27 2005
@@ -475,7 +475,7 @@
final String rootElementName = root.getTagName();
if( "index".equals( rootElementName ) )
{
- buildIndex( root, source, uri );
+ buildIndex( source, root, uri );
}
else if( "module".equals( rootElementName ) )
{
@@ -484,7 +484,7 @@
else
{
final String error =
- "Unrecognized rooot element [" + rootElementName + "].";
+ "Unrecognized root element [" + rootElementName + "].";
throw new BuildException( error );
}
}
@@ -494,15 +494,28 @@
}
}

- private void buildIndex( Element root, File source, String uri )
+ private void buildIndex( File source, Element root, String uri )
{
//
// its a native magic index
//

+ String key = ElementHelper.getAttribute( root, "key", null );
final Element[] elements = ElementHelper.getChildren( root );
final File anchor = source.getParentFile();
- buildLocalList( anchor, elements, uri );
+
+ if( ( null != key ) || ( key.length() > 0 ) )
+ {
+ buildLocalList( anchor, elements, "key:" + key );
+ }
+ else if( ( null != uri ) && uri.length() > 0 )
+ {
+ buildLocalList( anchor, elements, uri );
+ }
+ else
+ {
+ buildLocalList( anchor, elements, "key:UNKNOWN" );
+ }
}

private void buildModule( Element root, File source, String uri )
@@ -513,7 +526,7 @@
//

final String moduleUri = ElementHelper.getAttribute( root, "uri" );
- if( "".equals( moduleUri ) )
+ if( "".equals( moduleUri ) || ( null == moduleUri ) )
{
String mess =
"Modules must contain a \"uri\" attribute in the root module
element: " + source;
@@ -575,7 +588,8 @@
if(( null != filename ) && ( !"".equals( filename )))
{
final File index = IndexBuilder.getFile( anchor,
filename );
- buildList( index, urn );
+ //buildList( index, urn );
+ buildList( index, uri );
}
else if(( null != urn ) && ( !"".equals( urn )))
{

Modified:
development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
Wed Jan 19 02:39:27 2005
@@ -22,6 +22,7 @@
import net.dpml.magic.Index;
import net.dpml.magic.UnknownResourceException;
import net.dpml.transit.artifact.Handler;
+import net.dpml.lang.NullArgumentException;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -48,14 +49,19 @@
private Index m_index;
private String m_uri;

- public Resource( final Index index, final Info info )
- {
- this( index, null, info, EMPTY_REFS, null );
- }
-
public Resource(
final Index index, final String key, final Info info, final
ResourceRef[] resources, String uri )
+ throws IllegalArgumentException, NullArgumentException
{
+ assertNotNull( index, "index" );
+ assertNotNull( key, "key" );
+ assertNotNull( info, "info" );
+ assertNotNull( resources, "resources" );
+ assertNotNull( uri, "uri" );
+
+ assertNotZeroLength( key, "key" );
+ assertNotInvalidKeyLength( key, uri, "uri" );
+
m_key = key;
m_info = info;
m_resources = resources;
@@ -63,6 +69,52 @@
m_uri = uri;
}

+ private void assertNotNull( Object object, String key ) throws
NullArgumentException
+ {
+ if( null == object )
+ {
+ throw new NullArgumentException( key );
+ }
+ }
+
+ private void assertNotZeroLength( String value, String key ) throws
IllegalArgumentException
+ {
+ if( value.length() == 0 )
+ {
+ final String error =
+ "Supplied argument value for the parameter ["
+ + key
+ + "] contains an illegal zero length string.";
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ private void assertNotInvalidKeyLength( String id, String value, String
key ) throws IllegalArgumentException
+ {
+ if( value.startsWith( "key:" ) )
+ {
+ final String ref = value.substring( 4 );
+ try
+ {
+ assertNotZeroLength( ref , key );
+ }
+ catch( IllegalArgumentException iae )
+ {
+ final String error =
+ "Module key binding for the resource ["
+ + id
+ + "] under the parameter ["
+ + key
+ + "] is undefined.";
+ throw new IllegalArgumentException ( error );
+ }
+ }
+ else
+ {
+ assertNotZeroLength( value, key );
+ }
+ }
+
public String getKey()
{
return m_key;
@@ -106,7 +158,28 @@
*/
public String getModule()
{
- return m_uri;
+ if( m_uri.startsWith( "key:" ) )
+ {
+ final String key = m_uri.substring( 4 );
+ try
+ {
+ return getIndex().getResource( key ).getInfo().getURI();
+ }
+ catch( BuildException e )
+ {
+ final String error =
+ "The resource ["
+ + getKey()
+ + "] contains an enclosing module reference ["
+ + key
+ + "] that is unresolvable.";
+ throw new BuildException( error, e );
+ }
+ }
+ else
+ {
+ return m_uri;
+ }
}

/**

Modified: development/main/magic/index.xml
==============================================================================
--- development/main/magic/index.xml (original)
+++ development/main/magic/index.xml Wed Jan 19 02:39:27 2005
@@ -19,10 +19,9 @@
-->


-<index>
+<index key="dpml-magic">

- <import index="../transit/index.xml"
- uri="artifact:module:dpml/transit/dpml-transit#SNAPSHOT"/>
+ <import index="../transit/index.xml"/>

<!--
Magic Module

Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Wed Jan 19 02:39:27 2005
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

-<index>
-
- <import index="../magic/index.xml"
- uri="artifact:module:dpml/magic/dpml-magic#SNAPSHOT"/>
+<index key="dpml-metro">

+ <import index="../magic/index.xml"/>

<!--
Metro Modules

Modified: development/main/planet/facilities/http/index.xml
==============================================================================
--- development/main/planet/facilities/http/index.xml (original)
+++ development/main/planet/facilities/http/index.xml Wed Jan 19 02:39:27
2005
@@ -16,7 +16,8 @@
* limitations under the License.
-->

-<index>
+<index key="dpml-http">
+
<import index="blocks/index.xml" />
<import index="examples/index.xml" />


Modified: development/main/planet/facilities/index.xml
==============================================================================
--- development/main/planet/facilities/index.xml (original)
+++ development/main/planet/facilities/index.xml Wed Jan 19 02:39:27
2005
@@ -18,9 +18,7 @@

<index>

- <import index="../../index.xml"
- uri="artifact:module:dpml/metro/dpml-metro#SNAPSHOT"/>
-
+ <import index="../../index.xml"/>
<import index="./http/index.xml"/>
<import index="./reflector/blocks/index.xml"/>


Modified: development/main/transit/index.xml
==============================================================================
--- development/main/transit/index.xml (original)
+++ development/main/transit/index.xml Wed Jan 19 02:39:27 2005
@@ -18,12 +18,10 @@
limitations under the License.
-->

-<index>
+<index key="dpml-transit">

- <import index="../magic/index.xml"
- uri="artifact:module:dpml/magic/dpml-magic#SNAPSHOT" />
- <import index="../util/index.xml"
- uri="artifact:module:dpml/util/dpml-util#SNAPSHOT" />
+ <import index="../magic/index.xml"/>
+ <import index="../util/index.xml"/>

<!--
Transit Module

Modified: development/main/util/index.xml
==============================================================================
--- development/main/util/index.xml (original)
+++ development/main/util/index.xml Wed Jan 19 02:39:27 2005
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

-<index>
+<index key="dpml-util">

- <import index="../magic/index.xml"
- uri="artifact:module:dpml/magic/dpml-magic#SNAPSHOT"/>
+ <import index="../magic/index.xml"/>

<!--
Metro Module
-->
- <import index="../magic/index.xml" />

<project file="module.xml">
<info>



  • svn commit: r1529 - in development/main: . central central/tutorials magic magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/model metro planet/facilities planet/facilities/http transit util, mcconnell, 01/18/2005

Archive powered by MHonArc 2.6.24.

Top of Page