Skip to Content.
Sympa Menu

notify-dpml - r1410 - in trunk/main/depot/library/src: main/net/dpml/library/impl main/net/dpml/library/info test/net/dpml/library test/net/dpml/library/impl

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1410 - in trunk/main/depot/library/src: main/net/dpml/library/impl main/net/dpml/library/info test/net/dpml/library test/net/dpml/library/impl
  • Date: Wed, 26 Apr 2006 08:38:17 +0200

Author: mcconnell
Date: 2006-04-26 08:38:09 +0200 (Wed, 26 Apr 2006)
New Revision: 1410

Added:

trunk/main/depot/library/src/main/net/dpml/library/info/GenericDataDirective.java

trunk/main/depot/library/src/main/net/dpml/library/info/LibraryConstants.java
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryEncoder.java
Removed:

trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryConstants.java
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryDecoder.java
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
Modified:
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/test/net/dpml/library/XMLTestCase.java

trunk/main/depot/library/src/test/net/dpml/library/impl/DuplicatesTestCase.java
trunk/main/depot/library/src/test/net/dpml/library/impl/ExportTestCase.java

trunk/main/depot/library/src/test/net/dpml/library/impl/FiltersTestCase.java
trunk/main/depot/library/src/test/net/dpml/library/impl/RMICTestCase.java
Log:
housekeeping

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-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -26,6 +26,7 @@
import java.util.Properties;
import java.util.Hashtable;

+import net.dpml.library.info.LibraryDecoder;
import net.dpml.library.info.ImportDirective;
import net.dpml.library.info.LibraryDirective;
import net.dpml.library.info.ModuleDirective;
@@ -91,7 +92,7 @@
m_logger = logger;
m_directive = (LibraryDirective) super.getAbstractDirective();
m_root = source.getParentFile().getCanonicalFile();
- m_module = new DefaultModule( m_logger, this, m_directive );
+ m_module = new DefaultModule( this, m_directive );

getLogger().debug( "loaded root module: " + m_root );
System.setProperty( "dpml.library.basedir", m_root.toString() );
@@ -397,7 +398,7 @@
}
try
{
- DefaultModule root = new DefaultModule( m_logger, this,
m_directive );
+ DefaultModule root = new DefaultModule( this, m_directive );
root.addResource( enclosing );
DefaultResource resource = root.getDefaultResource( group + "/"
+ name );
m_anonymous.put( urn, resource );

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-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -68,9 +68,9 @@
* @param library the library
* @param directive the library directive from which common properties
are established
*/
- DefaultModule( Logger logger, DefaultLibrary library, AbstractDirective
directive )
+ DefaultModule( DefaultLibrary library, AbstractDirective directive )
{
- super( logger, library, directive );
+ super( library, directive );

m_root = true;
m_directive = null;
@@ -83,10 +83,10 @@
* @param module the parent module
* @param directive the library directive from which common properties
are established
*/
- DefaultModule( Logger logger, DefaultLibrary library, DefaultModule
module, ModuleDirective directive )
+ DefaultModule( DefaultLibrary library, DefaultModule module,
ModuleDirective directive )
throws DuplicateKeyException
{
- super( logger, library, module, directive );
+ super( library, module, directive );

m_root = false;
m_directive = directive;
@@ -193,18 +193,17 @@
}
else
{
- Logger logger = getLogger();
DefaultLibrary library = getDefaultLibrary();
if( directive instanceof ModuleDirective )
{
ModuleDirective d = (ModuleDirective) directive;
- DefaultModule module = new DefaultModule( logger,
library, this, d );
+ DefaultModule module = new DefaultModule( library, this,
d );
m_map.put( key, module );
return module;
}
else
{
- DefaultResource resource = new DefaultResource( logger,
library, this, directive );
+ DefaultResource resource = new DefaultResource( library,
this, directive );
m_map.put( key, resource );
return resource;
}

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-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -82,7 +82,6 @@
private final String[] m_typeNames;
private final String m_path;
private final File m_basedir;
- private final Logger m_logger;
private final Map m_filters = new Hashtable();

/**
@@ -91,7 +90,7 @@
* @param library the reference library
* @param directive the directive
*/
- DefaultResource( Logger logger, DefaultLibrary library,
AbstractDirective directive )
+ DefaultResource( DefaultLibrary library, AbstractDirective directive )
{
super( null, directive );

@@ -102,7 +101,6 @@
m_typeNames = new String[0];
m_path = "";
m_basedir = null;
- m_logger = logger;
}

/**
@@ -112,7 +110,7 @@
* @param module the parent module
* @param directive the resource directive
*/
- DefaultResource( Logger logger, DefaultLibrary library, DefaultModule
module, ResourceDirective directive )
+ DefaultResource( DefaultLibrary library, DefaultModule module,
ResourceDirective directive )
{
super( module, directive );
if( null == directive )
@@ -123,7 +121,6 @@
m_library = library;
m_directive = directive;
m_parent = module;
- m_logger = logger;

if( module.isRoot() )
{
@@ -211,7 +208,7 @@
for( int i=0; i<directives.length; i++ )
{
TypeDirective directive = directives[i];
- types[i] = new DefaultType( m_logger, this, directive );
+ types[i] = new DefaultType( this, directive );
}
return types;
}
@@ -1330,8 +1327,8 @@
* Return the logging channel.
* @return the logging channel
*/
- protected Logger getLogger()
- {
- return m_logger;
- }
+ //protected Logger getLogger()
+ //{
+ // return m_logger;
+ //}
}

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-25 20:37:10 UTC (rev 1409)
+++ trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultType.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -21,8 +21,6 @@
import net.dpml.library.info.TypeDirective;
import net.dpml.library.Type;

-import net.dpml.util.Logger;
-
import org.w3c.dom.Element;

/**
@@ -35,20 +33,18 @@
{
private final DefaultResource m_resource;
private final TypeDirective m_directive;
- private final Logger m_logger;

/**
* Creation of a new DefaultType.
* @param resource the enclosing resource
* @param directive the type production directive
*/
- DefaultType( Logger logger, DefaultResource resource, TypeDirective
directive )
+ DefaultType( DefaultResource resource, TypeDirective directive )
{
super( resource, directive );

m_resource = resource;
m_directive = directive;
- m_logger = logger;
}

/**
@@ -77,9 +73,4 @@
{
return m_directive.getElement();
}
-
- Logger getLogger()
- {
- return m_logger;
- }
}

Deleted:
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryConstants.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryConstants.java
2006-04-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryConstants.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -1,54 +0,0 @@
-/*
- * 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.library.impl;
-
-/**
- * Abstract base class for encoder and decoder..
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-abstract class LibraryConstants
-{
- static final String PART_XSD_URI = "@PART-XSD-URI@";
- static final String MODULE_XSD_URI = "@MODULE-XSD-URI@";
- static final String COMMON_XSD_URI = "@COMMON-XSD-URI@";
-
- static final String XML_HEADER =
- "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
- static final String LIBRARY_ELEMENT_NAME = "library";
- static final String IMPORTS_ELEMENT_NAME = "imports";
- static final String IMPORT_ELEMENT_NAME = "import";
- static final String MODULE_ELEMENT_NAME = "module";
- static final String MODULES_ELEMENT_NAME = "modules";
- static final String DEPENDENCIES_ELEMENT_NAME = "dependencies";
- static final String INCLUDE_ELEMENT_NAME = "include";
- static final String RESOURCE_ELEMENT_NAME = "resource";
- static final String TYPES_ELEMENT_NAME = "types";
- static final String TYPE_ELEMENT_NAME = "type";
- static final String PROJECT_ELEMENT_NAME = "project";
- static final String PROPERTIES_ELEMENT_NAME = "properties";
-
- /**
- * Abstract base class for encoder and decoder.
- */
- LibraryConstants()
- {
- }
-}

Deleted:
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-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryDecoder.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -1,1043 +0,0 @@
-/*
- * 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.library.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.FileNotFoundException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Properties;
-
-import net.dpml.library.Feature;
-import net.dpml.library.TypeBuilder;
-import net.dpml.library.info.InfoDirective;
-import net.dpml.library.info.LibraryDirective;
-import net.dpml.library.info.ImportDirective;
-import net.dpml.library.info.IncludeDirective;
-import net.dpml.library.info.ModuleDirective;
-import net.dpml.library.info.ResourceDirective;
-import net.dpml.library.info.ResourceDirective.Classifier;
-import net.dpml.library.info.DependencyDirective;
-import net.dpml.library.info.TypeDirective;
-import net.dpml.library.info.FilterDirective;
-import net.dpml.library.info.FiltersDirective;
-import net.dpml.library.info.SimpleFilterDirective;
-import net.dpml.library.info.FeatureFilterDirective;
-import net.dpml.library.info.DataDirective;
-import net.dpml.library.info.Scope;
-import net.dpml.library.info.PatternDirective;
-import net.dpml.library.info.IncludePatternDirective;
-import net.dpml.library.info.ExcludePatternDirective;
-import net.dpml.library.info.RMICDirective;
-
-import net.dpml.lang.Category;
-import net.dpml.lang.Part;
-
-import net.dpml.util.DecodingException;
-import net.dpml.util.DOM3DocumentBuilder;
-import net.dpml.util.ElementHelper;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.TypeInfo;
-
-/**
- * Utility class used for construction of a module model from an XML source.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public final class LibraryDecoder extends LibraryConstants
-{
- private static final DOM3DocumentBuilder DOCUMENT_BUILDER = new
DOM3DocumentBuilder();
-
- /**
- * Construct a library directive from XML source.
- * @param source the XML source file
- * @return the library directive
- * @exception IOException if an IO exception occurs
- */
- public LibraryDirective build( File source ) throws IOException
- {
- if( null == source )
- {
- throw new NullPointerException( "source" );
- }
- if( !source.exists() )
- {
- throw new FileNotFoundException( source.toString() );
- }
- if( source.isDirectory() )
- {
- final String error =
- "File ["
- + source
- + "] references a directory.";
- throw new IllegalArgumentException( error );
- }
- try
- {
- final Element root = getRootElement( source );
- File base = source.getParentFile();
- return buildLibraryDirective( base, root );
- }
- catch( IOException e )
- {
- throw e;
- }
- catch( Exception e )
- {
- final String error =
- "Unexpected error while attempting to load library."
- + "File: '" + source + "'";
- IOException ioe = new IOException( error );
- ioe.initCause( e );
- throw ioe;
- }
- }
-
- /**
- * Construct a resource directive from source.
- * @param uri the source uri
- * @return the resource directive
- * @exception IOException if an IO exception occurs
- */
- public ResourceDirective buildResource( URI uri ) throws IOException
- {
- try
- {
- final Document document = DOCUMENT_BUILDER.parse( uri );
- Element root = document.getDocumentElement();
- return buildResourceDirectiveFromElement( null, root, null );
- }
- catch( IOException e )
- {
- throw e;
- }
- catch( Exception e )
- {
- final String error =
- "Unexpected error while attempting to load module."
- + "URI: '" + uri + "'";
- IOException ioe = new IOException( error );
- ioe.initCause( e );
- throw ioe;
- }
- }
-
- private Element getRootElement( File source ) throws IOException
- {
- File file = source.getCanonicalFile();
- final Document document = DOCUMENT_BUILDER.parse( file.toURI() );
- return document.getDocumentElement();
- }
-
- /**
- * Build a module using an XML element.
- * @param base the base directory
- * @param element the module element
- * @return the library directive
- * @exception Exception if an exception occurs
- */
- private LibraryDirective buildLibraryDirective( File base, Element
element ) throws Exception
- {
- final String elementName = element.getTagName();
- if( !LIBRARY_ELEMENT_NAME.equals( elementName ) )
- {
- final String error =
- "Element is not a library.";
- throw new IllegalArgumentException( error );
- }
-
- // get type descriptors, modules and properties
-
- Properties properties = null;
- ImportDirective[] imports = new ImportDirective[0];
- ResourceDirective[] resources = new ResourceDirective[0];
- Element[] children = ElementHelper.getChildren( element );
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- final String tag = child.getTagName();
- if( PROPERTIES_ELEMENT_NAME.equals( tag ) )
- {
- properties = buildProperties( child );
- }
- else if( IMPORTS_ELEMENT_NAME.equals( tag ) )
- {
- imports = buildImportDirectives( child );
- }
- else if( MODULES_ELEMENT_NAME.equals( tag ) )
- {
- resources = buildResourceDirectivesFromElement( base, child
);
- }
- else
- {
- final String error =
- "Illegal element name [" + tag + "] within 'library'
element.";
- throw new IllegalArgumentException( error );
- }
- }
- return new LibraryDirective( imports, resources, properties );
- }
-
- /**
- * Construct a module directive relative to the supplied base directory
- * using the supplied DOM element.
- * @param base the basedire of the enclosing library or module
- * @param element the element definting the module
- */
- private ResourceDirective[] buildResourceDirectivesFromElement(
- File base, Element element ) throws Exception
- {
- String tag = element.getTagName();
- if( !"modules".equals( element.getTagName() ) )
- {
- final String error =
- "Unsupported library element name [" + tag + "].";
- throw new IllegalArgumentException( error );
- }
- Element[] children = ElementHelper.getChildren( element );
- ResourceDirective[] resources = new ModuleDirective[ children.length
];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- resources[i] = buildResourceDirectiveFromElement( base, child,
null );
- }
- return resources;
- }
-
- /**
- * Build a resource directive from an XML file.
- * @param source the XML source
- * @param path the relative path
- * @return the resource directive
- * @exception IOException if an IO exception occurs
- */
- public ResourceDirective buildResourceDirective( File source, String
path ) throws IOException
- {
- if( null == source )
- {
- throw new NullPointerException( "source" );
- }
- if( !source.exists() )
- {
- throw new FileNotFoundException( source.toString() );
- }
- if( source.isDirectory() )
- {
- final String error =
- "File ["
- + source
- + "] references a directory.";
- throw new IllegalArgumentException( error );
- }
- final File parent = source.getParentFile();
- final String basedir = path;
- final Element root = getRootElement( source );
- final String tag = root.getTagName();
- if( "module".equals( tag ) || "project".equals( tag ) ||
"resource".equals( tag ) )
- {
- try
- {
- return buildResourceDirectiveFromElement( parent, root,
basedir );
- }
- catch( DecodingException e )
- {
- throw e;
- }
- catch( Throwable e )
- {
- final String error =
- "An error occured while attempting to build a resource
from a local source [ "
- + source
- + "] from the path ["
- + path
- + "].";
- throw new DecodingException( root, error, e );
- }
- }
- else
- {
- throw new IllegalArgumentException( tag );
- }
- }
-
-
- /**
- * Build a resource using an XML element.
- * @param base the base directory
- * @param element the module element
- * @param offset the imported file directory offset
- * @throws Exception if an error occurs
- */
- private ResourceDirective buildResourceDirectiveFromElement(
- File base, Element element, String offset ) throws Exception
- {
- final String elementName = element.getTagName();
- if( "import".equals( elementName ) )
- {
- try
- {
- String path = ElementHelper.getAttribute( element, "file" );
- File file = new File( base, path );
- File dir = file.getParentFile();
- String spec = getRelativePath( base, dir );
- File source = file.getCanonicalFile();
- if( !source.exists() )
- {
- final String error =
- "Cannot include module ["
- + source
- + "] because the file does not exist.";
- throw new DecodingException( element, error );
- }
- else
- {
- return buildResourceDirective( source, spec );
- }
- }
- catch( DecodingException e )
- {
- throw e;
- }
- catch( Throwable e )
- {
- final String error =
- "Internal error while attempting to resolve a import
directive.";
- throw new DecodingException( element, error, e );
- }
- }
- else if( RESOURCE_ELEMENT_NAME.equals( elementName ) )
- {
- return buildResourceDirective( base, element, offset );
- }
- else if( PROJECT_ELEMENT_NAME.equals( elementName ) )
- {
- return buildResourceDirective( base, element, offset );
- }
- else if( MODULE_ELEMENT_NAME.equals( elementName ) )
- {
- return buildResourceDirective( base, element, offset );
- }
- else
- {
- final String error =
- "Element ["
- + elementName
- + "] is not a module.";
- throw new DecodingException( element, error );
- }
- }
-
- private String getRelativePath( File base, File dir ) throws IOException
- {
- String baseSpec = base.getCanonicalPath();
- String dirSpec = dir.getCanonicalPath();
- if( dirSpec.equals( baseSpec ) )
- {
- return ".";
- }
- if( dirSpec.startsWith( baseSpec ) )
- {
- return dirSpec.substring( baseSpec.length() + 1 );
- }
- else
- {
- final String error =
- "Supplied dir [" + dirSpec + "] is not with base [" + baseSpec
+ "].";
- throw new IllegalArgumentException( error );
- }
- }
-
- /**
- * Build an array of include directives contained within the supplied
enclosing element.
- * @param element the enclosing element
- * @return the array of includes
- */
- private ImportDirective[] buildImportDirectives( Element element )
throws DecodingException
- {
- Element[] children = ElementHelper.getChildren( element );
- ImportDirective[] includes = new ImportDirective[ children.length ];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- includes[i] = buildImportDirective( child );
- }
- return includes;
- }
-
- private ImportDirective buildImportDirective( Element element ) throws
DecodingException
- {
- final String tag = element.getTagName();
- final Properties properties = buildProperties( element );
- if( IMPORT_ELEMENT_NAME.equals( tag ) )
- {
- try
- {
- if( element.hasAttribute( "file" ) )
- {
- final String value = ElementHelper.getAttribute(
element, "file", null );
- return new ImportDirective( ImportDirective.FILE, value,
properties );
- }
- else if( element.hasAttribute( "uri" ) )
- {
- final String value = ElementHelper.getAttribute(
element, "uri", null );
- return new ImportDirective( ImportDirective.URI, value,
properties );
- }
- else
- {
- final String error =
- "Import element does not declare a 'file' or 'uri'
attribute.\n"
- + element.toString();
- throw new IllegalArgumentException( error );
- }
- }
- catch( Throwable e )
- {
- final String error =
- "Internal error while attempting to resolve an import
directive.";
- throw new DecodingException( element, error, e );
- }
- }
- else
- {
- final String error =
- "Invalid include element name ["
- + tag
- + "].";
- throw new IllegalArgumentException( error );
- }
- }
-
- private DependencyDirective[] buildDependencyDirectives( Element element
) throws DecodingException
- {
- if( null == element )
- {
- return new DependencyDirective[0];
- }
- else
- {
- final String tag = element.getTagName();
- if( DEPENDENCIES_ELEMENT_NAME.equals( tag ) )
- {
- Element[] children = ElementHelper.getChildren( element );
- DependencyDirective[] dependencies = new
DependencyDirective[ children.length ];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- dependencies[i] = buildDependencyDirective( child );
- }
- return dependencies;
- }
- else
- {
- final String error =
- "Invalid dependency element name ["
- + tag
- + "].";
- throw new IllegalArgumentException( error );
- }
- }
- }
-
- private DependencyDirective buildDependencyDirective( Element element )
throws DecodingException
- {
- String name = element.getTagName();
- Scope scope = Scope.parse( name );
- IncludeDirective[] includes = buildIncludeDirectives( element );
- if( Scope.BUILD.equals( scope ) )
- {
- return new DependencyDirective( Scope.BUILD, includes );
- }
- else if( Scope.RUNTIME.equals( scope ) )
- {
- return new DependencyDirective( Scope.RUNTIME, includes );
- }
- else
- {
- return new DependencyDirective( Scope.TEST, includes );
- }
- }
-
- /**
- * Build an array of include directives contained within the supplied
enclosing element.
- * @param element the enclosing element
- * @return the array of includes
- */
- private IncludeDirective[] buildIncludeDirectives( Element element )
throws DecodingException
- {
- Element[] children = ElementHelper.getChildren( element );
- IncludeDirective[] includes = new IncludeDirective[ children.length
];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- includes[i] = buildIncludeDirective( child );
- }
- return includes;
- }
-
- private IncludeDirective buildIncludeDirective( Element element ) throws
DecodingException
- {
- final String tag = element.getTagName();
- final Properties properties = buildProperties( element );
- if( INCLUDE_ELEMENT_NAME.equals( tag ) )
- {
- final String tagValue = ElementHelper.getAttribute( element,
"tag", "private" );
- Category category = Category.parse( tagValue );
- if( element.hasAttribute( "key" ) )
- {
- final String value = ElementHelper.getAttribute( element,
"key", null );
- return new IncludeDirective( IncludeDirective.KEY, category,
value, properties );
- }
- else if( element.hasAttribute( "ref" ) )
- {
- final String value = ElementHelper.getAttribute( element,
"ref", null );
- return new IncludeDirective( IncludeDirective.REF, category,
value, properties );
- }
- else if( element.hasAttribute( "urn" ) )
- {
- final String value = ElementHelper.getAttribute( element,
"urn", null );
- return new IncludeDirective( IncludeDirective.URN, category,
value, properties );
- }
- else
- {
- final String error =
- "Include directive does not declare a 'urn', 'key' or
'ref' attribute.\n"
- + element.toString();
- throw new IllegalArgumentException( error );
- }
- }
- else
- {
- final String error =
- "Invalid include element name ["
- + tag
- + "].";
- throw new DecodingException( element, error );
- }
- }
-
- private ResourceDirective buildResourceDirective( File base, Element
element ) throws Exception
- {
- return buildResourceDirective( base, element, null );
- }
-
- private ResourceDirective buildResourceDirective( File base, Element
element, String path ) throws Exception
- {
- Classifier classifier = null;
- final String tag = element.getTagName();
- if( RESOURCE_ELEMENT_NAME.equals( tag ) ||
PROJECT_ELEMENT_NAME.equals( tag )
- || MODULE_ELEMENT_NAME.equals( tag ) )
- {
- final String name = ElementHelper.getAttribute( element, "name",
null );
- final String version = ElementHelper.getAttribute( element,
"version", null );
- String basedir = ElementHelper.getAttribute( element, "basedir",
null );
- if( path != null )
- {
- if( basedir == null )
- {
- basedir = path;
- }
- else
- {
- basedir = path + "/" + basedir;
- }
- }
-
- if( PROJECT_ELEMENT_NAME.equals( tag ) )
- {
- classifier = Classifier.LOCAL;
- if( null == basedir )
- {
- final String error =
- "Missing basedir attribute on project ["
- + name
- + "].";
- throw new DecodingException( element, error );
- }
- }
- else if( MODULE_ELEMENT_NAME.equals( tag ) )
- {
- if( null != basedir )
- {
- classifier = Classifier.LOCAL;
- }
- else
- {
- classifier = Classifier.EXTERNAL;
- }
- }
- else
- {
- classifier = Classifier.EXTERNAL;
- }
-
- final InfoDirective info =
- buildInfoDirective(
- ElementHelper.getChild( element, "info" ) );
-
- final TypeDirective[] types =
- buildTypes(
- ElementHelper.getChild( element, "types" ) );
-
- final DependencyDirective[] dependencies =
- buildDependencyDirectives(
- ElementHelper.getChild( element, "dependencies" ) );
-
- final DataDirective[] data =
- buildDataDirectives(
- ElementHelper.getChild( element, "data" ) );
-
- final Properties properties =
- buildProperties(
- ElementHelper.getChild( element, "properties" ) );
-
- if( MODULE_ELEMENT_NAME.equals( tag ) )
- {
- ArrayList list = new ArrayList();
- Element[] children = ElementHelper.getChildren( element );
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- final String t = child.getTagName();
- if( MODULE_ELEMENT_NAME.equals( t ) )
- {
- ResourceDirective directive =
- buildResourceDirectiveFromElement( base, child,
null );
- list.add( directive );
- }
- else if( IMPORT_ELEMENT_NAME.equals( t ) )
- {
- ResourceDirective directive =
- buildResourceDirectiveFromElement( base, child,
null );
- list.add( directive );
- }
- else if( PROJECT_ELEMENT_NAME.equals( t ) )
- {
- ResourceDirective directive =
- buildResourceDirective( base, child );
- list.add( directive );
- }
- else if( RESOURCE_ELEMENT_NAME.equals( t ) )
- {
- ResourceDirective directive =
- buildResourceDirective( base, child );
- list.add( directive );
- }
- }
-
- ResourceDirective[] resources =
- (ResourceDirective[]) list.toArray( new
ResourceDirective[0] );
- return ModuleDirective.createModuleDirective(
- name, version, classifier, basedir, info, types,
dependencies,
- properties, data, resources );
- }
- else
- {
- return ResourceDirective.createResourceDirective(
- name, version, classifier, basedir, info, types,
dependencies,
- properties, data );
- }
- }
- else
- {
- final String error =
- "Invalid element name ["
- + tag
- + "].";
- throw new DecodingException( element, error );
- }
- }
-
- private InfoDirective buildInfoDirective( Element element )
- {
- if( null == element )
- {
- return null;
- }
- else
- {
- Element child = ElementHelper.getChild( element, "description" );
- if( null == child )
- {
- return null;
- }
- else
- {
- String title = ElementHelper.getAttribute( child, "title" );
- String value = ElementHelper.getValue( child );
- String description = trim( value );
- return new InfoDirective( title, description );
- }
- }
- }
-
- private String trim( String value )
- {
- if( null == value )
- {
- return null;
- }
- String trimmed = value.trim();
- if( trimmed.startsWith( "\n" ) )
- {
- return trim( trimmed.substring( 1 ) );
- }
- else if( trimmed.endsWith( "\n" ) )
- {
- return trim( trimmed.substring( 0, trimmed.length() - 1 ) );
- }
- else
- {
- return trimmed;
- }
- }
-
- private DataDirective[] buildDataDirectives( Element element ) throws
Exception
- {
- Element[] children = ElementHelper.getChildren( element );
- DataDirective[] data = new DataDirective[ children.length ];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- data[i] = buildDataDirective( child );
- }
- return data;
- }
-
- private DataDirective buildDataDirective( Element element ) throws
Exception
- {
- TypeInfo info = element.getSchemaTypeInfo();
- String namespace = info.getTypeNamespace();
- if( null == namespace )
- {
- throw new NullPointerException( "namespace" );
- }
- else if( MODULE_XSD_URI.equals( namespace ) )
- {
- String tag = element.getTagName();
- if( FiltersDirective.KEY.equals( tag ) )
- {
- return buildFiltersDirective( element );
- }
- else if( RMICDirective.KEY.equals( tag ) )
- {
- return buildRMICDirective( element );
- }
- else
- {
- final String error =
- "Element name ["
- + tag
- + "] declared within the module namespace is not
recognized.";
- throw new DecodingException( element, error );
- }
- }
- else
- {
- final String error =
- "Foreign datatype loading not implemented.";
- throw new DecodingException( element, error );
- }
- }
-
- private RMICDirective buildRMICDirective( Element element ) throws
Exception
- {
- PatternDirective[] patterns = buildPatternDirectives( element );
- return new RMICDirective( patterns );
- }
-
- private PatternDirective[] buildPatternDirectives( Element element )
throws Exception
- {
- Element[] children = ElementHelper.getChildren( element );
- PatternDirective[] patterns = new PatternDirective[ children.length
];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- String tag = child.getTagName();
- String name = ElementHelper.getAttribute( child, "name" );
- if( "include".equals( tag ) )
- {
- patterns[i] = new IncludePatternDirective( name );
- }
- else
- {
- patterns[i] = new ExcludePatternDirective( name );
- }
- }
- return patterns;
- }
-
- private FiltersDirective buildFiltersDirective( Element element ) throws
Exception
- {
- if( null == element )
- {
- return new FiltersDirective( new FilterDirective[0] );
- }
- else
- {
- Element[] children = ElementHelper.getChildren( element );
- FilterDirective[] filters = new FilterDirective[ children.length
];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- String token = ElementHelper.getAttribute( child, "token" );
- if( "filter".equals( child.getTagName() ) )
- {
- String value = ElementHelper.getAttribute( child,
"value" );
- filters[i] = new SimpleFilterDirective( token, value );
- }
- else if( "feature".equals( child.getTagName() ) )
- {
- String id = ElementHelper.getAttribute( child, "id" );
- Feature feature = Feature.parse( id );
- String ref = ElementHelper.getAttribute( child, "ref" );
- String type = ElementHelper.getAttribute( child, "type"
);
- boolean alias = ElementHelper.getBooleanAttribute(
child, "alias" );
- filters[i] = new FeatureFilterDirective( token, ref,
feature, type, alias );
- }
- else
- {
- final String error =
- "Element name not recognized ["
- + child.getTagName()
- + "] (expecting 'filter').";
- throw new DecodingException( element, error );
- }
- }
- return new FiltersDirective( filters );
- }
- }
-
- private TypeDirective[] buildTypes( Element element ) throws Exception
- {
- if( null == element )
- {
- return new TypeDirective[0];
- }
- Element[] children = ElementHelper.getChildren( element );
- TypeDirective[] types = new TypeDirective[ children.length ];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- types[i] = buildType( child );
- }
- return types;
- }
-
- private TypeDirective buildType( Element element ) throws Exception
- {
- TypeInfo info = element.getSchemaTypeInfo();
- String namespace = info.getTypeNamespace();
- if( null == namespace )
- {
- throw new NullPointerException( "namespace" );
- }
- String typeName = info.getTypeName();
- if( info.isDerivedFrom( COMMON_XSD_URI, "AbstractType",
TypeInfo.DERIVATION_EXTENSION ) )
- {
- final boolean alias = getAliasFlag( element );
- if( MODULE_XSD_URI.equals( namespace ) )
- {
- if( "GenericType".equals( typeName ) )
- {
- final String id = getID( element );
- final Properties properties = getProperties( element );
- return new TypeDirective( id, alias, properties );
- }
- else
- {
- final String error =
- "Element namespace is recognized as within the module
definition "
- + " however the type identifier is not recognized."
- + "\nNamespace: "
- + namespace
- + "\nType Name: "
- + info.getTypeName();
- throw new DecodingException( element, error );
- }
- }
- else if( info.isDerivedFrom( PART_XSD_URI, "StrategyType",
TypeInfo.DERIVATION_EXTENSION ) )
- {
- return new TypeDirective( "part", alias, element );
- }
- else
- {
- final String error =
- "Element is recognized as an AbstractType however the type
id is not resolvable."
- + "\nNamespace: "
- + namespace
- + "\nElement Name (from Schema Info): "
- + info.getTypeName();
- throw new DecodingException( element, error );
- }
- }
- else
- {
- final String error =
- "Element is not derived from the schema type 'AbstractType'
defined under the common namespace."
- + "\nNamespace: " + namespace
- + "\nElement Name (from Schema Info): " + info.getTypeName();
- throw new DecodingException( element, error );
- }
- }
-
- private Properties buildProperties( Element element )
- {
- if( null == element )
- {
- return null;
- }
- Properties properties = new Properties();
- Element[] children = ElementHelper.getChildren( element );
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- String tag = child.getTagName();
- if( "property".equals( tag ) )
- {
- String key = ElementHelper.getAttribute( child, "name", null
);
- if( null == key )
- {
- final String error =
- "Property declaration does not contain a 'name'
attribute.";
- throw new IllegalArgumentException( error );
- }
- else
- {
- String value = ElementHelper.getAttribute( child,
"value", null );
- properties.setProperty( key, value );
- }
- }
- }
- return properties;
- }
-
- private URI getURIFromSpec( String spec )
- {
- if( null == spec )
- {
- return null;
- }
- else
- {
- try
- {
- return new URI( spec );
- }
- catch( URISyntaxException e )
- {
- final String error =
- "Type descriptor uri ["
- + spec
- + "] could not be converted to a URI value.";
- throw new IllegalArgumentException( error );
- }
- }
- }
-
- private TypeBuilder loadTypeBuilder( URI uri ) throws Exception
- {
- ClassLoader classloader = TypeBuilder.class.getClassLoader();
- Object[] args = new Object[0];
- Part part = Part.load( uri );
- Object handler = part.instantiate( args );
- if( handler instanceof TypeBuilder )
- {
- return (TypeBuilder) handler;
- }
- else
- {
- final String error =
- "Plugin ["
- + uri
- + "] does not implement the "
- + TypeBuilder.class.getName()
- + " interface.";
- throw new IllegalArgumentException( error );
- }
- }
-
- /**
- * Return the id attribute of the supplied element.
- * @param element the DOM element
- * @return the id value
- * @exception DecodingException if an error occurs during element
evaluation
- */
- protected String getID( Element element ) throws DecodingException
- {
- final String id = ElementHelper.getAttribute( element, "id" );
- if( null == id )
- {
- final String error =
- "Missing type 'id'.";
- throw new DecodingException( element, error );
- }
- else
- {
- return id;
- }
- }
-
- /**
- * Return the alias attribute of the supplied element.
- * @param element the DOM element
- * @return the alias production flag value
- */
- protected boolean getAliasFlag( Element element )
- {
- return ElementHelper.getBooleanAttribute( element, "alias", false );
- }
-
- /**
- * Return properties declared within the supplied element as immediate
- * child <property> elements.
- * @param element the enclosing DOM element
- * @return the resolved properties instance
- */
- protected Properties getProperties( Element element )
- {
- Properties properties = new Properties();
- Element[] children = ElementHelper.getChildren( element );
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- String tag = child.getTagName();
- if( "property".equals( tag ) )
- {
- String key = ElementHelper.getAttribute( child, "name", null
);
- if( null == key )
- {
- final String error =
- "Property declaration does not contain a 'name'
attribute.";
- throw new IllegalArgumentException( error );
- }
- else
- {
- String value = ElementHelper.getAttribute( child,
"value", null );
- properties.setProperty( key, value );
- }
- }
- }
- return properties;
- }
-}

Deleted:
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
2006-04-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -1,386 +0,0 @@
-/*
- * 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.library.impl;
-
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.Writer;
-import java.io.OutputStreamWriter;
-import java.util.Properties;
-
-import javax.xml.XMLConstants;
-
-import net.dpml.lang.Category;
-
-import net.dpml.library.info.InfoDirective;
-import net.dpml.library.info.IncludeDirective;
-import net.dpml.library.info.IncludeDirective.Mode;
-import net.dpml.library.info.ModuleDirective;
-import net.dpml.library.info.ResourceDirective;
-import net.dpml.library.info.DependencyDirective;
-import net.dpml.library.info.TypeDirective;
-import net.dpml.library.info.Scope;
-
-/**
- * Utility class used for construction of a module model from an XML source.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public final class LibraryEncoder extends LibraryConstants
-{
- /**
- * Write a module directive to an output stream as a portable XML
definition.
- * During export dependencies are limited to runtime concerns
(eliminating
- * build and test scoped dependencies). Artifact production is strippped
down
- * to a generic type declaration. The resulting XML file is suitable for
- * publication and usage by external projects.
- *
- * @param module the moudle directive to externalize
- * @param output the output stream
- * @exception IOException if an error occurs during module externalization
- */
- public void export( final ModuleDirective module, final OutputStream
output ) throws IOException
- {
- final Writer writer = new OutputStreamWriter( output );
- try
- {
- writer.write( XML_HEADER );
- writer.write( "\n" );
-
- String name = module.getName();
- String version = module.getVersion();
-
- if( null != name )
- {
- writer.write( "<module name=\"" + name + "\"" );
- }
- if( null != version )
- {
- writer.write( " version=\"" + version + "\"" );
- }
-
- writer.write(
- "\n xmlns=\""
- + MODULE_XSD_URI
- + "\""
- + "\n xmlns:xsi=\""
- + XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI
- + "\""
- + "\n xmlns:common=\""
- + COMMON_XSD_URI
- + "\">" );
-
-
- String basedir = module.getBasedir();
- InfoDirective info = module.getInfoDirective();
- Properties properties = module.getProperties();
- TypeDirective[] types = module.getTypeDirectives();
- DependencyDirective[] dependencies =
module.getDependencyDirectives();
- ResourceDirective[] resources = module.getResourceDirectives();
-
- if( !info.isNull() )
- {
- writer.write( "\n" );
- writeInfo( writer, info, " " );
- }
- if( properties.size() > 0 )
- {
- writer.write( "\n" );
- writeProperties( writer, properties, " ", true );
- }
- if( types.length > 0 )
- {
- writer.write( "\n" );
- writeTypes( writer, types, " " );
- }
- if( dependencies.length > 0 )
- {
- writer.write( "\n" );
- writeDependencies( writer, dependencies, " " );
- }
- if( resources.length > 0 )
- {
- writeResources( writer, resources, " " );
- }
- writer.write( "\n\n</module>" );
- writer.write( "\n" );
- }
- finally
- {
- writer.flush();
- writer.close();
- }
- }
-
- private void writeModule( Writer writer, ModuleDirective module, String
lead ) throws IOException
- {
- String name = module.getName();
- String version = module.getVersion();
-
- InfoDirective info = module.getInfoDirective();
- Properties properties = module.getProperties();
- String basedir = module.getBasedir();
- TypeDirective[] types = module.getTypeDirectives();
- DependencyDirective[] dependencies =
module.getDependencyDirectives();
- ResourceDirective[] resources = module.getResourceDirectives();
-
- writer.write( "\n" + lead + "<module" );
- if( null != name )
- {
- writer.write( " name=\"" + name + "\"" );
- }
- if( null != version )
- {
- writer.write( " version=\"" + version + "\"" );
- }
- writer.write( ">" );
-
- if( !info.isNull() )
- {
- writer.write( "\n" );
- writeInfo( writer, info, lead + " " );
- }
- if( properties.size() > 0 )
- {
- writer.write( "\n" );
- writeProperties( writer, properties, lead + " ", true );
- }
-
- if( types.length > 0 )
- {
- writer.write( "\n" );
- writeTypes( writer, types, lead + " " );
- }
-
- if( dependencies.length > 0 )
- {
- writer.write( "\n" );
- writeDependencies( writer, dependencies, lead + " " );
- }
-
- if( resources.length > 0 )
- {
- writeResources( writer, resources, lead + " " );
- }
- writer.write( "\n\n" + lead + "</module>" );
- }
-
- private void writeResource( Writer writer, ResourceDirective resource,
String lead ) throws IOException
- {
- String name = resource.getName();
- String version = resource.getVersion();
-
- InfoDirective info = resource.getInfoDirective();
- Properties properties = resource.getProperties();
- String basedir = resource.getBasedir();
- TypeDirective[] types = resource.getTypeDirectives();
- DependencyDirective[] dependencies =
resource.getDependencyDirectives();
-
- writer.write( "\n" + lead + "<resource" );
- if( null != name )
- {
- writer.write( " name=\"" + name + "\"" );
- }
- if( null != version )
- {
- writer.write( " version=\"" + version + "\"" );
- }
- writer.write( ">" );
-
- if( !info.isNull() )
- {
- writer.write( "\n" );
- writeInfo( writer, info, lead + " " );
- }
- if( properties.size() > 0 )
- {
- writeProperties( writer, properties, lead + " ", true );
- }
- if( types.length > 0 )
- {
- writeTypes( writer, types, lead + " " );
- }
- if( dependencies.length > 0 )
- {
- writeDependencies( writer, dependencies, lead + " " );
- }
- writer.write( "\n" + lead + "</resource>" );
- }
-
- private void writeInfo(
- Writer writer, InfoDirective info, String lead ) throws IOException
- {
- writer.write( "\n" + lead + "<info>" );
- writer.write( "\n" + lead + " <description" );
- if( null != info.getTitle() )
- {
- writer.write( " title=\"" + info.getTitle() + "\"" );
- }
- String description = info.getDescription();
- if( null != info.getDescription() )
- {
- writer.write( ">" );
- writer.write( "\n" + lead + " " + info.getDescription() );
- writer.write( "\n" + lead + " </description>" );
- }
- else
- {
- writer.write( "/>" );
- }
- writer.write( "\n" + lead + "</info>" );
- }
-
- private void writeProperties(
- Writer writer, Properties properties, String lead, boolean flag )
throws IOException
- {
- if( properties.size() > 0 )
- {
- if( flag )
- {
- writer.write( "\n" + lead + "<properties>" );
- }
- String[] names = (String[]) properties.keySet().toArray( new
String[0] );
- for( int i=0; i<names.length; i++ )
- {
- String name = names[i];
- String value = properties.getProperty( name );
- writer.write( "\n" + lead );
- if( flag )
- {
- writer.write( " " );
- }
- writer.write( "<property name=\"" + name + "\" value=\"" +
value + "\"/>" );
- }
- if( flag )
- {
- writer.write( "\n" + lead + "</properties>" );
- }
- }
- }
-
- private void writeTypes( Writer writer, TypeDirective[] types, String
lead ) throws IOException
- {
- if( types.length > 0 )
- {
- writer.write( "\n" + lead + "<types>" );
- for( int i=0; i<types.length; i++ )
- {
- TypeDirective type = types[i];
- writeType( writer, type, lead + " " );
- }
- writer.write( "\n" + lead + "</types>" );
- }
- }
-
- private void writeType( Writer writer, TypeDirective type, String lead )
throws IOException
- {
- String id = type.getID();
- boolean alias = type.getAlias();
- writer.write( "\n" + lead + "<type id=\"" + id + "\"" );
- if( alias )
- {
- writer.write( " alias=\"true\"" );
- }
- writer.write( "/>" );
- }
-
- private void writeDependencies(
- Writer writer, DependencyDirective[] dependencies, String lead )
throws IOException
- {
- if( dependencies.length > 0 )
- {
- writer.write( "\n" + lead + "<dependencies>" );
-
- for( int i=0; i<dependencies.length; i++ )
- {
- DependencyDirective dependency = dependencies[i];
- IncludeDirective[] includes =
dependency.getIncludeDirectives();
- if( includes.length > 0 )
- {
- Scope scope = dependency.getScope();
- String label = scope.toString().toLowerCase();
- writer.write( "\n" + lead + " <" + label + ">" );
- for( int j=0; j<includes.length; j++ )
- {
- IncludeDirective include = includes[j];
- Mode mode = include.getMode();
- String value = include.getValue();
- writer.write( "\n" + lead + " <include" );
- if( Mode.KEY.equals( mode ) )
- {
- writer.write( " key=\"" + value + "\"" );
- }
- else if( Mode.REF.equals( mode ) )
- {
- writer.write( " ref=\"" + value + "\"" );
- }
- else if( Mode.URN.equals( mode ) )
- {
- writer.write( " urn=\"" + value + "\"" );
- }
-
- if( Scope.RUNTIME.equals( scope ) )
- {
- Category category = include.getCategory();
- if( !Category.PRIVATE.equals( category ) )
- {
- String name =
category.getName().toLowerCase();
- writer.write( " tag=\"" + name + "\"" );
- }
- }
-
- Properties props = include.getProperties();
- if( props.size() > 0 )
- {
- writer.write( ">" );
- writeProperties( writer, props, lead + " ",
false );
- writer.write( "\n" + lead + " </include>" );
- }
- else
- {
- writer.write( "/>" );
- }
- }
- writer.write( "\n" + lead + " </" + label + ">" );
- }
- }
- writer.write( "\n" + lead + "</dependencies>" );
- }
- }
-
- private void writeResources( Writer writer, ResourceDirective[]
resources, String lead ) throws IOException
- {
- for( int i=0; i<resources.length; i++ )
- {
- ResourceDirective resource = resources[i];
- if( resource instanceof ModuleDirective )
- {
- writer.write( "\n" );
- ModuleDirective module = (ModuleDirective) resource;
- writeModule( writer, module, lead );
- }
- else
- {
- writer.write( "\n" );
- writeResource( writer, resource, lead );
- }
- }
- }
-}

Added:
trunk/main/depot/library/src/main/net/dpml/library/info/GenericDataDirective.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/info/GenericDataDirective.java
2006-04-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/GenericDataDirective.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -0,0 +1,66 @@
+/*
+ * 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.library.info;
+
+import net.dpml.lang.AbstractDirective;
+
+import org.w3c.dom.Element;
+
+/**
+ * Generic data directives.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class GenericDataDirective extends DataDirective
+{
+ private final Element m_element;
+
+ /**
+ * Creation of a new generic data directive.
+ * @param element the definining element
+ */
+ public GenericDataDirective( Element element )
+ {
+ super( getElementID( element ) );
+
+ m_element = element;
+ }
+
+ /**
+ * Return the element defining this datatype.
+ * @return the DOM element
+ */
+ public Element getElement()
+ {
+ return m_element;
+ }
+
+ private static String getElementID( Element element )
+ {
+ if( null == element )
+ {
+ throw new NullPointerException( "element" );
+ }
+ else
+ {
+ return element.getTagName();
+ }
+ }
+}

Copied:
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryConstants.java
(from rev 1405,
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryConstants.java)
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryConstants.java
2006-04-25 16:16:17 UTC (rev 1405)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryConstants.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -0,0 +1,54 @@
+/*
+ * 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.library.info;
+
+/**
+ * Abstract base class for encoder and decoder..
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+abstract class LibraryConstants
+{
+ static final String PART_XSD_URI = "@PART-XSD-URI@";
+ static final String MODULE_XSD_URI = "@MODULE-XSD-URI@";
+ static final String COMMON_XSD_URI = "@COMMON-XSD-URI@";
+
+ static final String XML_HEADER =
+ "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
+ static final String LIBRARY_ELEMENT_NAME = "library";
+ static final String IMPORTS_ELEMENT_NAME = "imports";
+ static final String IMPORT_ELEMENT_NAME = "import";
+ static final String MODULE_ELEMENT_NAME = "module";
+ static final String MODULES_ELEMENT_NAME = "modules";
+ static final String DEPENDENCIES_ELEMENT_NAME = "dependencies";
+ static final String INCLUDE_ELEMENT_NAME = "include";
+ static final String RESOURCE_ELEMENT_NAME = "resource";
+ static final String TYPES_ELEMENT_NAME = "types";
+ static final String TYPE_ELEMENT_NAME = "type";
+ static final String PROJECT_ELEMENT_NAME = "project";
+ static final String PROPERTIES_ELEMENT_NAME = "properties";
+
+ /**
+ * Abstract base class for encoder and decoder.
+ */
+ LibraryConstants()
+ {
+ }
+}

Copied:
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
(from rev 1406,
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-25 18:27:26 UTC (rev 1406)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -0,0 +1,1022 @@
+/*
+ * 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.library.info;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import net.dpml.library.Feature;
+import net.dpml.library.TypeBuilder;
+import net.dpml.library.info.ResourceDirective.Classifier;
+import net.dpml.library.info.DependencyDirective;
+
+import net.dpml.lang.Category;
+import net.dpml.lang.Part;
+
+import net.dpml.util.DecodingException;
+import net.dpml.util.DOM3DocumentBuilder;
+import net.dpml.util.ElementHelper;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Document;
+import org.w3c.dom.TypeInfo;
+
+/**
+ * Utility class used for construction of a module model from an XML source.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class LibraryDecoder extends LibraryConstants
+{
+ private static final DOM3DocumentBuilder DOCUMENT_BUILDER = new
DOM3DocumentBuilder();
+
+ /**
+ * Construct a library directive from XML source.
+ * @param source the XML source file
+ * @return the library directive
+ * @exception IOException if an IO exception occurs
+ */
+ public LibraryDirective build( File source ) throws IOException
+ {
+ if( null == source )
+ {
+ throw new NullPointerException( "source" );
+ }
+ if( !source.exists() )
+ {
+ throw new FileNotFoundException( source.toString() );
+ }
+ if( source.isDirectory() )
+ {
+ final String error =
+ "File ["
+ + source
+ + "] references a directory.";
+ throw new IllegalArgumentException( error );
+ }
+ try
+ {
+ final Element root = getRootElement( source );
+ File base = source.getParentFile();
+ return buildLibraryDirective( base, root );
+ }
+ catch( IOException e )
+ {
+ throw e;
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Unexpected error while attempting to load library."
+ + "File: '" + source + "'";
+ IOException ioe = new IOException( error );
+ ioe.initCause( e );
+ throw ioe;
+ }
+ }
+
+ /**
+ * Construct a resource directive from source.
+ * @param uri the source uri
+ * @return the resource directive
+ * @exception IOException if an IO exception occurs
+ */
+ public ResourceDirective buildResource( URI uri ) throws IOException
+ {
+ try
+ {
+ final Document document = DOCUMENT_BUILDER.parse( uri );
+ Element root = document.getDocumentElement();
+ return buildResourceDirectiveFromElement( null, root, null );
+ }
+ catch( IOException e )
+ {
+ throw e;
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Unexpected error while attempting to load module."
+ + "URI: '" + uri + "'";
+ IOException ioe = new IOException( error );
+ ioe.initCause( e );
+ throw ioe;
+ }
+ }
+
+ private Element getRootElement( File source ) throws IOException
+ {
+ File file = source.getCanonicalFile();
+ final Document document = DOCUMENT_BUILDER.parse( file.toURI() );
+ return document.getDocumentElement();
+ }
+
+ /**
+ * Build a module using an XML element.
+ * @param base the base directory
+ * @param element the module element
+ * @return the library directive
+ * @exception Exception if an exception occurs
+ */
+ private LibraryDirective buildLibraryDirective( File base, Element
element ) throws Exception
+ {
+ final String elementName = element.getTagName();
+ if( !LIBRARY_ELEMENT_NAME.equals( elementName ) )
+ {
+ final String error =
+ "Element is not a library.";
+ throw new IllegalArgumentException( error );
+ }
+
+ // get type descriptors, modules and properties
+
+ Properties properties = null;
+ ImportDirective[] imports = new ImportDirective[0];
+ ResourceDirective[] resources = new ResourceDirective[0];
+ Element[] children = ElementHelper.getChildren( element );
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ final String tag = child.getTagName();
+ if( PROPERTIES_ELEMENT_NAME.equals( tag ) )
+ {
+ properties = buildProperties( child );
+ }
+ else if( IMPORTS_ELEMENT_NAME.equals( tag ) )
+ {
+ imports = buildImportDirectives( child );
+ }
+ else if( MODULES_ELEMENT_NAME.equals( tag ) )
+ {
+ resources = buildResourceDirectivesFromElement( base, child
);
+ }
+ else
+ {
+ final String error =
+ "Illegal element name [" + tag + "] within 'library'
element.";
+ throw new IllegalArgumentException( error );
+ }
+ }
+ return new LibraryDirective( imports, resources, properties );
+ }
+
+ /**
+ * Construct a module directive relative to the supplied base directory
+ * using the supplied DOM element.
+ * @param base the basedire of the enclosing library or module
+ * @param element the element definting the module
+ */
+ private ResourceDirective[] buildResourceDirectivesFromElement(
+ File base, Element element ) throws Exception
+ {
+ String tag = element.getTagName();
+ if( !"modules".equals( element.getTagName() ) )
+ {
+ final String error =
+ "Unsupported library element name [" + tag + "].";
+ throw new IllegalArgumentException( error );
+ }
+ Element[] children = ElementHelper.getChildren( element );
+ ResourceDirective[] resources = new ModuleDirective[ children.length
];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ resources[i] = buildResourceDirectiveFromElement( base, child,
null );
+ }
+ return resources;
+ }
+
+ /**
+ * Build a resource directive from an XML file.
+ * @param source the XML source
+ * @param path the relative path
+ * @return the resource directive
+ * @exception IOException if an IO exception occurs
+ */
+ public ResourceDirective buildResourceDirective( File source, String
path ) throws IOException
+ {
+ if( null == source )
+ {
+ throw new NullPointerException( "source" );
+ }
+ if( !source.exists() )
+ {
+ throw new FileNotFoundException( source.toString() );
+ }
+ if( source.isDirectory() )
+ {
+ final String error =
+ "File ["
+ + source
+ + "] references a directory.";
+ throw new IllegalArgumentException( error );
+ }
+ final File parent = source.getParentFile();
+ final String basedir = path;
+ final Element root = getRootElement( source );
+ final String tag = root.getTagName();
+ if( "module".equals( tag ) || "project".equals( tag ) ||
"resource".equals( tag ) )
+ {
+ try
+ {
+ return buildResourceDirectiveFromElement( parent, root,
basedir );
+ }
+ catch( DecodingException e )
+ {
+ throw e;
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "An error occured while attempting to build a resource
from a local source [ "
+ + source
+ + "] from the path ["
+ + path
+ + "].";
+ throw new DecodingException( root, error, e );
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException( tag );
+ }
+ }
+
+
+ /**
+ * Build a resource using an XML element.
+ * @param base the base directory
+ * @param element the module element
+ * @param offset the imported file directory offset
+ * @throws Exception if an error occurs
+ */
+ private ResourceDirective buildResourceDirectiveFromElement(
+ File base, Element element, String offset ) throws Exception
+ {
+ final String elementName = element.getTagName();
+ if( "import".equals( elementName ) )
+ {
+ try
+ {
+ String path = ElementHelper.getAttribute( element, "file" );
+ File file = new File( base, path );
+ File dir = file.getParentFile();
+ String spec = getRelativePath( base, dir );
+ File source = file.getCanonicalFile();
+ if( !source.exists() )
+ {
+ final String error =
+ "Cannot include module ["
+ + source
+ + "] because the file does not exist.";
+ throw new DecodingException( element, error );
+ }
+ else
+ {
+ return buildResourceDirective( source, spec );
+ }
+ }
+ catch( DecodingException e )
+ {
+ throw e;
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Internal error while attempting to resolve a import
directive.";
+ throw new DecodingException( element, error, e );
+ }
+ }
+ else if( RESOURCE_ELEMENT_NAME.equals( elementName ) )
+ {
+ return buildResourceDirective( base, element, offset );
+ }
+ else if( PROJECT_ELEMENT_NAME.equals( elementName ) )
+ {
+ return buildResourceDirective( base, element, offset );
+ }
+ else if( MODULE_ELEMENT_NAME.equals( elementName ) )
+ {
+ return buildResourceDirective( base, element, offset );
+ }
+ else
+ {
+ final String error =
+ "Element ["
+ + elementName
+ + "] is not a module.";
+ throw new DecodingException( element, error );
+ }
+ }
+
+ private String getRelativePath( File base, File dir ) throws IOException
+ {
+ String baseSpec = base.getCanonicalPath();
+ String dirSpec = dir.getCanonicalPath();
+ if( dirSpec.equals( baseSpec ) )
+ {
+ return ".";
+ }
+ if( dirSpec.startsWith( baseSpec ) )
+ {
+ return dirSpec.substring( baseSpec.length() + 1 );
+ }
+ else
+ {
+ final String error =
+ "Supplied dir [" + dirSpec + "] is not with base [" + baseSpec
+ "].";
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ /**
+ * Build an array of include directives contained within the supplied
enclosing element.
+ * @param element the enclosing element
+ * @return the array of includes
+ */
+ private ImportDirective[] buildImportDirectives( Element element )
throws DecodingException
+ {
+ Element[] children = ElementHelper.getChildren( element );
+ ImportDirective[] includes = new ImportDirective[ children.length ];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ includes[i] = buildImportDirective( child );
+ }
+ return includes;
+ }
+
+ private ImportDirective buildImportDirective( Element element ) throws
DecodingException
+ {
+ final String tag = element.getTagName();
+ final Properties properties = buildProperties( element );
+ if( IMPORT_ELEMENT_NAME.equals( tag ) )
+ {
+ try
+ {
+ if( element.hasAttribute( "file" ) )
+ {
+ final String value = ElementHelper.getAttribute(
element, "file", null );
+ return new ImportDirective( ImportDirective.FILE, value,
properties );
+ }
+ else if( element.hasAttribute( "uri" ) )
+ {
+ final String value = ElementHelper.getAttribute(
element, "uri", null );
+ return new ImportDirective( ImportDirective.URI, value,
properties );
+ }
+ else
+ {
+ final String error =
+ "Import element does not declare a 'file' or 'uri'
attribute.\n"
+ + element.toString();
+ throw new IllegalArgumentException( error );
+ }
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Internal error while attempting to resolve an import
directive.";
+ throw new DecodingException( element, error, e );
+ }
+ }
+ else
+ {
+ final String error =
+ "Invalid include element name ["
+ + tag
+ + "].";
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ private DependencyDirective[] buildDependencyDirectives( Element element
) throws DecodingException
+ {
+ if( null == element )
+ {
+ return new DependencyDirective[0];
+ }
+ else
+ {
+ final String tag = element.getTagName();
+ if( DEPENDENCIES_ELEMENT_NAME.equals( tag ) )
+ {
+ Element[] children = ElementHelper.getChildren( element );
+ DependencyDirective[] dependencies = new
DependencyDirective[ children.length ];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ dependencies[i] = buildDependencyDirective( child );
+ }
+ return dependencies;
+ }
+ else
+ {
+ final String error =
+ "Invalid dependency element name ["
+ + tag
+ + "].";
+ throw new IllegalArgumentException( error );
+ }
+ }
+ }
+
+ private DependencyDirective buildDependencyDirective( Element element )
throws DecodingException
+ {
+ String name = element.getTagName();
+ Scope scope = Scope.parse( name );
+ IncludeDirective[] includes = buildIncludeDirectives( element );
+ if( Scope.BUILD.equals( scope ) )
+ {
+ return new DependencyDirective( Scope.BUILD, includes );
+ }
+ else if( Scope.RUNTIME.equals( scope ) )
+ {
+ return new DependencyDirective( Scope.RUNTIME, includes );
+ }
+ else
+ {
+ return new DependencyDirective( Scope.TEST, includes );
+ }
+ }
+
+ /**
+ * Build an array of include directives contained within the supplied
enclosing element.
+ * @param element the enclosing element
+ * @return the array of includes
+ */
+ private IncludeDirective[] buildIncludeDirectives( Element element )
throws DecodingException
+ {
+ Element[] children = ElementHelper.getChildren( element );
+ IncludeDirective[] includes = new IncludeDirective[ children.length
];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ includes[i] = buildIncludeDirective( child );
+ }
+ return includes;
+ }
+
+ private IncludeDirective buildIncludeDirective( Element element ) throws
DecodingException
+ {
+ final String tag = element.getTagName();
+ final Properties properties = buildProperties( element );
+ if( INCLUDE_ELEMENT_NAME.equals( tag ) )
+ {
+ final String tagValue = ElementHelper.getAttribute( element,
"tag", "private" );
+ Category category = Category.parse( tagValue );
+ if( element.hasAttribute( "key" ) )
+ {
+ final String value = ElementHelper.getAttribute( element,
"key", null );
+ return new IncludeDirective( IncludeDirective.KEY, category,
value, properties );
+ }
+ else if( element.hasAttribute( "ref" ) )
+ {
+ final String value = ElementHelper.getAttribute( element,
"ref", null );
+ return new IncludeDirective( IncludeDirective.REF, category,
value, properties );
+ }
+ else if( element.hasAttribute( "urn" ) )
+ {
+ final String value = ElementHelper.getAttribute( element,
"urn", null );
+ return new IncludeDirective( IncludeDirective.URN, category,
value, properties );
+ }
+ else
+ {
+ final String error =
+ "Include directive does not declare a 'urn', 'key' or
'ref' attribute.\n"
+ + element.toString();
+ throw new IllegalArgumentException( error );
+ }
+ }
+ else
+ {
+ final String error =
+ "Invalid include element name ["
+ + tag
+ + "].";
+ throw new DecodingException( element, error );
+ }
+ }
+
+ private ResourceDirective buildResourceDirective( File base, Element
element ) throws Exception
+ {
+ return buildResourceDirective( base, element, null );
+ }
+
+ private ResourceDirective buildResourceDirective( File base, Element
element, String path ) throws Exception
+ {
+ Classifier classifier = null;
+ final String tag = element.getTagName();
+ if( RESOURCE_ELEMENT_NAME.equals( tag ) ||
PROJECT_ELEMENT_NAME.equals( tag )
+ || MODULE_ELEMENT_NAME.equals( tag ) )
+ {
+ final String name = ElementHelper.getAttribute( element, "name",
null );
+ final String version = ElementHelper.getAttribute( element,
"version", null );
+ String basedir = ElementHelper.getAttribute( element, "basedir",
null );
+ if( path != null )
+ {
+ if( basedir == null )
+ {
+ basedir = path;
+ }
+ else
+ {
+ basedir = path + "/" + basedir;
+ }
+ }
+
+ if( PROJECT_ELEMENT_NAME.equals( tag ) )
+ {
+ classifier = Classifier.LOCAL;
+ if( null == basedir )
+ {
+ final String error =
+ "Missing basedir attribute on project ["
+ + name
+ + "].";
+ throw new DecodingException( element, error );
+ }
+ }
+ else if( MODULE_ELEMENT_NAME.equals( tag ) )
+ {
+ if( null != basedir )
+ {
+ classifier = Classifier.LOCAL;
+ }
+ else
+ {
+ classifier = Classifier.EXTERNAL;
+ }
+ }
+ else
+ {
+ classifier = Classifier.EXTERNAL;
+ }
+
+ final InfoDirective info =
+ buildInfoDirective(
+ ElementHelper.getChild( element, "info" ) );
+
+ final TypeDirective[] types =
+ buildTypes(
+ ElementHelper.getChild( element, "types" ) );
+
+ final DependencyDirective[] dependencies =
+ buildDependencyDirectives(
+ ElementHelper.getChild( element, "dependencies" ) );
+
+ final DataDirective[] data =
+ buildDataDirectives(
+ ElementHelper.getChild( element, "data" ) );
+
+ final Properties properties =
+ buildProperties(
+ ElementHelper.getChild( element, "properties" ) );
+
+ if( MODULE_ELEMENT_NAME.equals( tag ) )
+ {
+ ArrayList list = new ArrayList();
+ Element[] children = ElementHelper.getChildren( element );
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ final String t = child.getTagName();
+ if( MODULE_ELEMENT_NAME.equals( t ) )
+ {
+ ResourceDirective directive =
+ buildResourceDirectiveFromElement( base, child,
null );
+ list.add( directive );
+ }
+ else if( IMPORT_ELEMENT_NAME.equals( t ) )
+ {
+ ResourceDirective directive =
+ buildResourceDirectiveFromElement( base, child,
null );
+ list.add( directive );
+ }
+ else if( PROJECT_ELEMENT_NAME.equals( t ) )
+ {
+ ResourceDirective directive =
+ buildResourceDirective( base, child );
+ list.add( directive );
+ }
+ else if( RESOURCE_ELEMENT_NAME.equals( t ) )
+ {
+ ResourceDirective directive =
+ buildResourceDirective( base, child );
+ list.add( directive );
+ }
+ }
+
+ ResourceDirective[] resources =
+ (ResourceDirective[]) list.toArray( new
ResourceDirective[0] );
+ return ModuleDirective.createModuleDirective(
+ name, version, classifier, basedir, info, types,
dependencies,
+ properties, data, resources );
+ }
+ else
+ {
+ return ResourceDirective.createResourceDirective(
+ name, version, classifier, basedir, info, types,
dependencies,
+ properties, data );
+ }
+ }
+ else
+ {
+ final String error =
+ "Invalid element name ["
+ + tag
+ + "].";
+ throw new DecodingException( element, error );
+ }
+ }
+
+ private InfoDirective buildInfoDirective( Element element )
+ {
+ if( null == element )
+ {
+ return null;
+ }
+ else
+ {
+ Element child = ElementHelper.getChild( element, "description" );
+ if( null == child )
+ {
+ return null;
+ }
+ else
+ {
+ String title = ElementHelper.getAttribute( child, "title" );
+ String value = ElementHelper.getValue( child );
+ String description = trim( value );
+ return new InfoDirective( title, description );
+ }
+ }
+ }
+
+ private String trim( String value )
+ {
+ if( null == value )
+ {
+ return null;
+ }
+ String trimmed = value.trim();
+ if( trimmed.startsWith( "\n" ) )
+ {
+ return trim( trimmed.substring( 1 ) );
+ }
+ else if( trimmed.endsWith( "\n" ) )
+ {
+ return trim( trimmed.substring( 0, trimmed.length() - 1 ) );
+ }
+ else
+ {
+ return trimmed;
+ }
+ }
+
+ private DataDirective[] buildDataDirectives( Element element ) throws
Exception
+ {
+ Element[] children = ElementHelper.getChildren( element );
+ DataDirective[] data = new DataDirective[ children.length ];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ data[i] = buildDataDirective( child );
+ }
+ return data;
+ }
+
+ private DataDirective buildDataDirective( Element element ) throws
Exception
+ {
+ TypeInfo info = element.getSchemaTypeInfo();
+ String namespace = info.getTypeNamespace();
+ if( null == namespace )
+ {
+ throw new NullPointerException( "namespace" );
+ }
+ else if( MODULE_XSD_URI.equals( namespace ) )
+ {
+ String tag = element.getTagName();
+ if( FiltersDirective.KEY.equals( tag ) )
+ {
+ return buildFiltersDirective( element );
+ }
+ else if( RMICDirective.KEY.equals( tag ) )
+ {
+ return buildRMICDirective( element );
+ }
+ else
+ {
+ final String error =
+ "Datatype not recognized.";
+ throw new DecodingException( element, error );
+ }
+ }
+ else
+ {
+ return new GenericDataDirective( element );
+ }
+ }
+
+ private RMICDirective buildRMICDirective( Element element ) throws
Exception
+ {
+ PatternDirective[] patterns = buildPatternDirectives( element );
+ return new RMICDirective( patterns );
+ }
+
+ private PatternDirective[] buildPatternDirectives( Element element )
throws Exception
+ {
+ Element[] children = ElementHelper.getChildren( element );
+ PatternDirective[] patterns = new PatternDirective[ children.length
];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ String tag = child.getTagName();
+ String name = ElementHelper.getAttribute( child, "name" );
+ if( "include".equals( tag ) )
+ {
+ patterns[i] = new IncludePatternDirective( name );
+ }
+ else
+ {
+ patterns[i] = new ExcludePatternDirective( name );
+ }
+ }
+ return patterns;
+ }
+
+ private FiltersDirective buildFiltersDirective( Element element ) throws
Exception
+ {
+ if( null == element )
+ {
+ return new FiltersDirective( new FilterDirective[0] );
+ }
+ else
+ {
+ Element[] children = ElementHelper.getChildren( element );
+ FilterDirective[] filters = new FilterDirective[ children.length
];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ String token = ElementHelper.getAttribute( child, "token" );
+ if( "filter".equals( child.getTagName() ) )
+ {
+ String value = ElementHelper.getAttribute( child,
"value" );
+ filters[i] = new SimpleFilterDirective( token, value );
+ }
+ else if( "feature".equals( child.getTagName() ) )
+ {
+ String id = ElementHelper.getAttribute( child, "id" );
+ Feature feature = Feature.parse( id );
+ String ref = ElementHelper.getAttribute( child, "ref" );
+ String type = ElementHelper.getAttribute( child, "type"
);
+ boolean alias = ElementHelper.getBooleanAttribute(
child, "alias" );
+ filters[i] = new FeatureFilterDirective( token, ref,
feature, type, alias );
+ }
+ else
+ {
+ final String error =
+ "Element name not recognized ["
+ + child.getTagName()
+ + "] (expecting 'filter').";
+ throw new DecodingException( element, error );
+ }
+ }
+ return new FiltersDirective( filters );
+ }
+ }
+
+ private TypeDirective[] buildTypes( Element element ) throws Exception
+ {
+ if( null == element )
+ {
+ return new TypeDirective[0];
+ }
+ Element[] children = ElementHelper.getChildren( element );
+ TypeDirective[] types = new TypeDirective[ children.length ];
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ types[i] = buildType( child );
+ }
+ return types;
+ }
+
+ private TypeDirective buildType( Element element ) throws Exception
+ {
+ TypeInfo info = element.getSchemaTypeInfo();
+ String namespace = info.getTypeNamespace();
+ if( null == namespace )
+ {
+ throw new NullPointerException( "namespace" );
+ }
+ String typeName = info.getTypeName();
+ if( info.isDerivedFrom( COMMON_XSD_URI, "AbstractType",
TypeInfo.DERIVATION_EXTENSION ) )
+ {
+ final boolean alias = getAliasFlag( element );
+ if( MODULE_XSD_URI.equals( namespace ) )
+ {
+ if( "GenericType".equals( typeName ) )
+ {
+ final String id = getID( element );
+ final Properties properties = getProperties( element );
+ return new TypeDirective( id, alias, properties );
+ }
+ else
+ {
+ final String error =
+ "Element namespace is recognized as within the module
definition "
+ + " however the type identifier is not recognized."
+ + "\nNamespace: "
+ + namespace
+ + "\nType Name: "
+ + info.getTypeName();
+ throw new DecodingException( element, error );
+ }
+ }
+ else if( info.isDerivedFrom( PART_XSD_URI, "StrategyType",
TypeInfo.DERIVATION_EXTENSION ) )
+ {
+ return new TypeDirective( "part", alias, element );
+ }
+ else
+ {
+ final String error =
+ "Element type is invalid."
+ + "\nNamespace: "
+ + namespace
+ + "\nElement Type Name: "
+ + info.getTypeName();
+ throw new DecodingException( element, error );
+ }
+ }
+ else
+ {
+ final String error =
+ "Element is not derived from the schema type 'AbstractType'
defined under the common namespace."
+ + "\nNamespace: " + namespace
+ + "\nElement Name (from Schema Info): " + info.getTypeName();
+ throw new DecodingException( element, error );
+ }
+ }
+
+ private Properties buildProperties( Element element )
+ {
+ if( null == element )
+ {
+ return null;
+ }
+ Properties properties = new Properties();
+ Element[] children = ElementHelper.getChildren( element );
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ String tag = child.getTagName();
+ if( "property".equals( tag ) )
+ {
+ String key = ElementHelper.getAttribute( child, "name", null
);
+ if( null == key )
+ {
+ final String error =
+ "Property declaration does not contain a 'name'
attribute.";
+ throw new IllegalArgumentException( error );
+ }
+ else
+ {
+ String value = ElementHelper.getAttribute( child,
"value", null );
+ properties.setProperty( key, value );
+ }
+ }
+ }
+ return properties;
+ }
+
+ private URI getURIFromSpec( String spec )
+ {
+ if( null == spec )
+ {
+ return null;
+ }
+ else
+ {
+ try
+ {
+ return new URI( spec );
+ }
+ catch( URISyntaxException e )
+ {
+ final String error =
+ "Type descriptor uri ["
+ + spec
+ + "] could not be converted to a URI value.";
+ throw new IllegalArgumentException( error );
+ }
+ }
+ }
+
+ private TypeBuilder loadTypeBuilder( URI uri ) throws Exception
+ {
+ ClassLoader classloader = TypeBuilder.class.getClassLoader();
+ Object[] args = new Object[0];
+ Part part = Part.load( uri );
+ Object handler = part.instantiate( args );
+ if( handler instanceof TypeBuilder )
+ {
+ return (TypeBuilder) handler;
+ }
+ else
+ {
+ final String error =
+ "Plugin ["
+ + uri
+ + "] does not implement the "
+ + TypeBuilder.class.getName()
+ + " interface.";
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ /**
+ * Return the id attribute of the supplied element.
+ * @param element the DOM element
+ * @return the id value
+ * @exception DecodingException if an error occurs during element
evaluation
+ */
+ protected String getID( Element element ) throws DecodingException
+ {
+ final String id = ElementHelper.getAttribute( element, "id" );
+ if( null == id )
+ {
+ final String error =
+ "Missing type 'id'.";
+ throw new DecodingException( element, error );
+ }
+ else
+ {
+ return id;
+ }
+ }
+
+ /**
+ * Return the alias attribute of the supplied element.
+ * @param element the DOM element
+ * @return the alias production flag value
+ */
+ protected boolean getAliasFlag( Element element )
+ {
+ return ElementHelper.getBooleanAttribute( element, "alias", false );
+ }
+
+ /**
+ * Return properties declared within the supplied element as immediate
+ * child <property> elements.
+ * @param element the enclosing DOM element
+ * @return the resolved properties instance
+ */
+ protected Properties getProperties( Element element )
+ {
+ Properties properties = new Properties();
+ Element[] children = ElementHelper.getChildren( element );
+ for( int i=0; i<children.length; i++ )
+ {
+ Element child = children[i];
+ String tag = child.getTagName();
+ if( "property".equals( tag ) )
+ {
+ String key = ElementHelper.getAttribute( child, "name", null
);
+ if( null == key )
+ {
+ final String error =
+ "Property declaration does not contain a 'name'
attribute.";
+ throw new IllegalArgumentException( error );
+ }
+ else
+ {
+ String value = ElementHelper.getAttribute( child,
"value", null );
+ properties.setProperty( key, value );
+ }
+ }
+ }
+ return properties;
+ }
+}

Copied:
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryEncoder.java
(from rev 1405,
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java)
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/LibraryEncoder.java
2006-04-25 16:16:17 UTC (rev 1405)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryEncoder.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -0,0 +1,379 @@
+/*
+ * 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.library.info;
+
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.util.Properties;
+
+import javax.xml.XMLConstants;
+
+import net.dpml.library.info.IncludeDirective.Mode;
+
+import net.dpml.lang.Category;
+
+/**
+ * Utility class used for construction of a module model from an XML source.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class LibraryEncoder extends LibraryConstants
+{
+ /**
+ * Write a module directive to an output stream as a portable XML
definition.
+ * During export dependencies are limited to runtime concerns
(eliminating
+ * build and test scoped dependencies). Artifact production is strippped
down
+ * to a generic type declaration. The resulting XML file is suitable for
+ * publication and usage by external projects.
+ *
+ * @param module the moudle directive to externalize
+ * @param output the output stream
+ * @exception IOException if an error occurs during module externalization
+ */
+ public void export( final ModuleDirective module, final OutputStream
output ) throws IOException
+ {
+ final Writer writer = new OutputStreamWriter( output );
+ try
+ {
+ writer.write( XML_HEADER );
+ writer.write( "\n" );
+
+ String name = module.getName();
+ String version = module.getVersion();
+
+ if( null != name )
+ {
+ writer.write( "<module name=\"" + name + "\"" );
+ }
+ if( null != version )
+ {
+ writer.write( " version=\"" + version + "\"" );
+ }
+
+ writer.write(
+ "\n xmlns=\""
+ + MODULE_XSD_URI
+ + "\""
+ + "\n xmlns:xsi=\""
+ + XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI
+ + "\""
+ + "\n xmlns:common=\""
+ + COMMON_XSD_URI
+ + "\">" );
+
+
+ String basedir = module.getBasedir();
+ InfoDirective info = module.getInfoDirective();
+ Properties properties = module.getProperties();
+ TypeDirective[] types = module.getTypeDirectives();
+ DependencyDirective[] dependencies =
module.getDependencyDirectives();
+ ResourceDirective[] resources = module.getResourceDirectives();
+
+ if( !info.isNull() )
+ {
+ writer.write( "\n" );
+ writeInfo( writer, info, " " );
+ }
+ if( properties.size() > 0 )
+ {
+ writer.write( "\n" );
+ writeProperties( writer, properties, " ", true );
+ }
+ if( types.length > 0 )
+ {
+ writer.write( "\n" );
+ writeTypes( writer, types, " " );
+ }
+ if( dependencies.length > 0 )
+ {
+ writer.write( "\n" );
+ writeDependencies( writer, dependencies, " " );
+ }
+ if( resources.length > 0 )
+ {
+ writeResources( writer, resources, " " );
+ }
+ writer.write( "\n\n</module>" );
+ writer.write( "\n" );
+ }
+ finally
+ {
+ writer.flush();
+ writer.close();
+ }
+ }
+
+ private void writeModule( Writer writer, ModuleDirective module, String
lead ) throws IOException
+ {
+ String name = module.getName();
+ String version = module.getVersion();
+
+ InfoDirective info = module.getInfoDirective();
+ Properties properties = module.getProperties();
+ String basedir = module.getBasedir();
+ TypeDirective[] types = module.getTypeDirectives();
+ DependencyDirective[] dependencies =
module.getDependencyDirectives();
+ ResourceDirective[] resources = module.getResourceDirectives();
+
+ writer.write( "\n" + lead + "<module" );
+ if( null != name )
+ {
+ writer.write( " name=\"" + name + "\"" );
+ }
+ if( null != version )
+ {
+ writer.write( " version=\"" + version + "\"" );
+ }
+ writer.write( ">" );
+
+ if( !info.isNull() )
+ {
+ writer.write( "\n" );
+ writeInfo( writer, info, lead + " " );
+ }
+ if( properties.size() > 0 )
+ {
+ writer.write( "\n" );
+ writeProperties( writer, properties, lead + " ", true );
+ }
+
+ if( types.length > 0 )
+ {
+ writer.write( "\n" );
+ writeTypes( writer, types, lead + " " );
+ }
+
+ if( dependencies.length > 0 )
+ {
+ writer.write( "\n" );
+ writeDependencies( writer, dependencies, lead + " " );
+ }
+
+ if( resources.length > 0 )
+ {
+ writeResources( writer, resources, lead + " " );
+ }
+ writer.write( "\n\n" + lead + "</module>" );
+ }
+
+ private void writeResource( Writer writer, ResourceDirective resource,
String lead ) throws IOException
+ {
+ String name = resource.getName();
+ String version = resource.getVersion();
+
+ InfoDirective info = resource.getInfoDirective();
+ Properties properties = resource.getProperties();
+ String basedir = resource.getBasedir();
+ TypeDirective[] types = resource.getTypeDirectives();
+ DependencyDirective[] dependencies =
resource.getDependencyDirectives();
+
+ writer.write( "\n" + lead + "<resource" );
+ if( null != name )
+ {
+ writer.write( " name=\"" + name + "\"" );
+ }
+ if( null != version )
+ {
+ writer.write( " version=\"" + version + "\"" );
+ }
+ writer.write( ">" );
+
+ if( !info.isNull() )
+ {
+ writer.write( "\n" );
+ writeInfo( writer, info, lead + " " );
+ }
+ if( properties.size() > 0 )
+ {
+ writeProperties( writer, properties, lead + " ", true );
+ }
+ if( types.length > 0 )
+ {
+ writeTypes( writer, types, lead + " " );
+ }
+ if( dependencies.length > 0 )
+ {
+ writeDependencies( writer, dependencies, lead + " " );
+ }
+ writer.write( "\n" + lead + "</resource>" );
+ }
+
+ private void writeInfo(
+ Writer writer, InfoDirective info, String lead ) throws IOException
+ {
+ writer.write( "\n" + lead + "<info>" );
+ writer.write( "\n" + lead + " <description" );
+ if( null != info.getTitle() )
+ {
+ writer.write( " title=\"" + info.getTitle() + "\"" );
+ }
+ String description = info.getDescription();
+ if( null != info.getDescription() )
+ {
+ writer.write( ">" );
+ writer.write( "\n" + lead + " " + info.getDescription() );
+ writer.write( "\n" + lead + " </description>" );
+ }
+ else
+ {
+ writer.write( "/>" );
+ }
+ writer.write( "\n" + lead + "</info>" );
+ }
+
+ private void writeProperties(
+ Writer writer, Properties properties, String lead, boolean flag )
throws IOException
+ {
+ if( properties.size() > 0 )
+ {
+ if( flag )
+ {
+ writer.write( "\n" + lead + "<properties>" );
+ }
+ String[] names = (String[]) properties.keySet().toArray( new
String[0] );
+ for( int i=0; i<names.length; i++ )
+ {
+ String name = names[i];
+ String value = properties.getProperty( name );
+ writer.write( "\n" + lead );
+ if( flag )
+ {
+ writer.write( " " );
+ }
+ writer.write( "<property name=\"" + name + "\" value=\"" +
value + "\"/>" );
+ }
+ if( flag )
+ {
+ writer.write( "\n" + lead + "</properties>" );
+ }
+ }
+ }
+
+ private void writeTypes( Writer writer, TypeDirective[] types, String
lead ) throws IOException
+ {
+ if( types.length > 0 )
+ {
+ writer.write( "\n" + lead + "<types>" );
+ for( int i=0; i<types.length; i++ )
+ {
+ TypeDirective type = types[i];
+ writeType( writer, type, lead + " " );
+ }
+ writer.write( "\n" + lead + "</types>" );
+ }
+ }
+
+ private void writeType( Writer writer, TypeDirective type, String lead )
throws IOException
+ {
+ String id = type.getID();
+ boolean alias = type.getAlias();
+ writer.write( "\n" + lead + "<type id=\"" + id + "\"" );
+ if( alias )
+ {
+ writer.write( " alias=\"true\"" );
+ }
+ writer.write( "/>" );
+ }
+
+ private void writeDependencies(
+ Writer writer, DependencyDirective[] dependencies, String lead )
throws IOException
+ {
+ if( dependencies.length > 0 )
+ {
+ writer.write( "\n" + lead + "<dependencies>" );
+
+ for( int i=0; i<dependencies.length; i++ )
+ {
+ DependencyDirective dependency = dependencies[i];
+ IncludeDirective[] includes =
dependency.getIncludeDirectives();
+ if( includes.length > 0 )
+ {
+ Scope scope = dependency.getScope();
+ String label = scope.toString().toLowerCase();
+ writer.write( "\n" + lead + " <" + label + ">" );
+ for( int j=0; j<includes.length; j++ )
+ {
+ IncludeDirective include = includes[j];
+ Mode mode = include.getMode();
+ String value = include.getValue();
+ writer.write( "\n" + lead + " <include" );
+ if( Mode.KEY.equals( mode ) )
+ {
+ writer.write( " key=\"" + value + "\"" );
+ }
+ else if( Mode.REF.equals( mode ) )
+ {
+ writer.write( " ref=\"" + value + "\"" );
+ }
+ else if( Mode.URN.equals( mode ) )
+ {
+ writer.write( " urn=\"" + value + "\"" );
+ }
+
+ if( Scope.RUNTIME.equals( scope ) )
+ {
+ Category category = include.getCategory();
+ if( !Category.PRIVATE.equals( category ) )
+ {
+ String name =
category.getName().toLowerCase();
+ writer.write( " tag=\"" + name + "\"" );
+ }
+ }
+
+ Properties props = include.getProperties();
+ if( props.size() > 0 )
+ {
+ writer.write( ">" );
+ writeProperties( writer, props, lead + " ",
false );
+ writer.write( "\n" + lead + " </include>" );
+ }
+ else
+ {
+ writer.write( "/>" );
+ }
+ }
+ writer.write( "\n" + lead + " </" + label + ">" );
+ }
+ }
+ writer.write( "\n" + lead + "</dependencies>" );
+ }
+ }
+
+ private void writeResources( Writer writer, ResourceDirective[]
resources, String lead ) throws IOException
+ {
+ for( int i=0; i<resources.length; i++ )
+ {
+ ResourceDirective resource = resources[i];
+ if( resource instanceof ModuleDirective )
+ {
+ writer.write( "\n" );
+ ModuleDirective module = (ModuleDirective) resource;
+ writeModule( writer, module, lead );
+ }
+ else
+ {
+ writer.write( "\n" );
+ writeResource( writer, resource, lead );
+ }
+ }
+ }
+}

Modified: trunk/main/depot/library/src/test/net/dpml/library/XMLTestCase.java
===================================================================
--- trunk/main/depot/library/src/test/net/dpml/library/XMLTestCase.java
2006-04-25 20:37:10 UTC (rev 1409)
+++ trunk/main/depot/library/src/test/net/dpml/library/XMLTestCase.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -24,9 +24,8 @@
import net.dpml.library.info.ModuleDirective;
import net.dpml.library.info.ResourceDirective;
import net.dpml.library.info.TypeDirective;
+import net.dpml.library.info.LibraryDecoder;

-import net.dpml.library.impl.LibraryDecoder;
-
import junit.framework.TestCase;



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-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/DuplicatesTestCase.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -20,10 +20,12 @@

import java.io.File;

-import net.dpml.util.Logger;
+import net.dpml.library.info.LibraryDecoder;

import net.dpml.transit.monitor.LoggingAdapter;

+import net.dpml.util.Logger;
+
import junit.framework.TestCase;



Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/ExportTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/ExportTestCase.java
2006-04-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/ExportTestCase.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -26,7 +26,10 @@
import net.dpml.library.info.ModuleDirective;
import net.dpml.library.info.ResourceDirective;
import net.dpml.library.info.TypeDirective;
+import net.dpml.library.info.LibraryDecoder;
+import net.dpml.library.info.LibraryEncoder;

+
/**
* Test DefaultLibrary implementation.
*

Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/FiltersTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/FiltersTestCase.java
2006-04-25 20:37:10 UTC (rev 1409)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/FiltersTestCase.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -24,6 +24,8 @@
import net.dpml.library.Module;
import net.dpml.library.Resource;

+import net.dpml.library.info.LibraryDecoder;
+
import net.dpml.util.Logger;
import net.dpml.util.DefaultLogger;


Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/RMICTestCase.java
===================================================================
--- trunk/main/depot/library/src/test/net/dpml/library/impl/RMICTestCase.java
2006-04-25 20:37:10 UTC (rev 1409)
+++ trunk/main/depot/library/src/test/net/dpml/library/impl/RMICTestCase.java
2006-04-26 06:38:09 UTC (rev 1410)
@@ -25,6 +25,7 @@
import net.dpml.library.Resource;

import net.dpml.library.info.RMICDirective;
+import net.dpml.library.info.LibraryDecoder;

import net.dpml.util.Logger;
import net.dpml.util.DefaultLogger;




  • r1410 - in trunk/main/depot/library/src: main/net/dpml/library/impl main/net/dpml/library/info test/net/dpml/library test/net/dpml/library/impl, mcconnell at BerliOS, 04/26/2006

Archive powered by MHonArc 2.6.24.

Top of Page