Skip to Content.
Sympa Menu

notify-dpml - r1878 - in trunk/main: depot/library/src/main/dpml/library depot/library/src/main/dpml/library/impl depot/library/src/main/dpml/library/info depot/library/src/test/dpml/library/info metro/part/etc/xsds metro/sample metro/test

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1878 - in trunk/main: depot/library/src/main/dpml/library depot/library/src/main/dpml/library/impl depot/library/src/main/dpml/library/info depot/library/src/test/dpml/library/info metro/part/etc/xsds metro/sample metro/test
  • Date: Mon, 26 Feb 2007 00:00:34 +0100

Author: mcconnell
Date: 2007-02-26 00:00:31 +0100 (Mon, 26 Feb 2007)
New Revision: 1878

Modified:
trunk/main/depot/library/src/main/dpml/library/Resource.java
trunk/main/depot/library/src/main/dpml/library/impl/DefaultModule.java
trunk/main/depot/library/src/main/dpml/library/impl/DefaultResource.java
trunk/main/depot/library/src/main/dpml/library/info/LibraryDecoder.java
trunk/main/depot/library/src/main/dpml/library/info/LibraryEncoder.java
trunk/main/depot/library/src/main/dpml/library/info/ModuleDirective.java
trunk/main/depot/library/src/main/dpml/library/info/ResourceDirective.java

trunk/main/depot/library/src/test/dpml/library/info/ModuleDirectiveTestCase.java

trunk/main/depot/library/src/test/dpml/library/info/ResourceDirectiveTestCase.java
trunk/main/metro/part/etc/xsds/library.xsd
trunk/main/metro/sample/project.xml
trunk/main/metro/test/project.xml
Log:
add support for export policy on resources, projects and modules

Modified: trunk/main/depot/library/src/main/dpml/library/Resource.java
===================================================================
--- trunk/main/depot/library/src/main/dpml/library/Resource.java
2007-02-25 21:50:18 UTC (rev 1877)
+++ trunk/main/depot/library/src/main/dpml/library/Resource.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -42,6 +42,12 @@
public static final String DECIMAL_VERSIONING_KEY =
"project.decimal.versioning.enabled";

/**
+ * Return the export policy.
+ * @return the export policy value
+ */
+ boolean getExportPolicy();
+
+ /**
* Return the singleton library.
* @return the library
*/

Modified:
trunk/main/depot/library/src/main/dpml/library/impl/DefaultModule.java
===================================================================
--- trunk/main/depot/library/src/main/dpml/library/impl/DefaultModule.java
2007-02-25 21:50:18 UTC (rev 1877)
+++ trunk/main/depot/library/src/main/dpml/library/impl/DefaultModule.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -393,13 +393,20 @@
*/
ModuleDirective exportModule( final DefaultModule module, final String
name ) throws IllegalArgumentException
{
+ // TODO: check for non-export policy
+
DefaultResource[] resources = getDefaultResources();
- ResourceDirective[] directives = new ResourceDirective[
resources.length ];
- for( int i=0; i<directives.length; i++ )
+ List<ResourceDirective> list = new ArrayList<ResourceDirective>();
+ for( int i=0; i<resources.length; i++ )
{
DefaultResource resource = resources[i];
- directives[i] = resource.exportResource( module );
+ if( resource.getExportPolicy() )
+ {
+ ResourceDirective export = resource.exportResource( module );
+ list.add( export );
+ }
}
+ ResourceDirective[] directives = list.toArray( new
ResourceDirective[0] );
String version = getVersion();
String basedir = null;
InfoDirective info = m_directive.getInfoDirective();
@@ -408,7 +415,7 @@
return new ModuleDirective(
name, version, Classifier.EXTERNAL, basedir,
info, types, new DependencyDirective[0],
- directives, properties, null );
+ directives, properties, null, true );
}


//----------------------------------------------------------------------------

Modified:
trunk/main/depot/library/src/main/dpml/library/impl/DefaultResource.java
===================================================================
--- trunk/main/depot/library/src/main/dpml/library/impl/DefaultResource.java
2007-02-25 21:50:18 UTC (rev 1877)
+++ trunk/main/depot/library/src/main/dpml/library/impl/DefaultResource.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -242,6 +242,22 @@
}

/**
+ * Return the export policy.
+ * @return the export policy value
+ */
+ public boolean getExportPolicy()
+ {
+ if( null != m_directive )
+ {
+ return m_directive.getExportPolicy();
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ /**
* Return the name of the resource.
* @return the resource name
*/
@@ -911,7 +927,7 @@
Properties properties = getExportProperties();
return ResourceDirective.createResourceDirective(
name, version, Classifier.EXTERNAL, basedir,
- info, exportedTypes, dependencies, properties, null );
+ info, exportedTypes, dependencies, properties, null, true );
}

TypeDirective[] createExportedTypes( final TypeDirective[] types )

Modified:
trunk/main/depot/library/src/main/dpml/library/info/LibraryDecoder.java
===================================================================
--- trunk/main/depot/library/src/main/dpml/library/info/LibraryDecoder.java
2007-02-25 21:50:18 UTC (rev 1877)
+++ trunk/main/depot/library/src/main/dpml/library/info/LibraryDecoder.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -295,6 +295,8 @@
classifier = Classifier.EXTERNAL;
}

+ final boolean export = ElementHelper.getBooleanAttribute(
element, "export", true );
+
final InfoDirective info =
buildInfoDirective(
ElementHelper.getChild( element, "info" ) );
@@ -338,13 +340,13 @@
ResourceDirective[] resources = list.toArray( new
ResourceDirective[0] );
return ModuleDirective.createModuleDirective(
name, version, classifier, basedir, info, data,
dependencies,
- properties, filters, resources );
+ properties, filters, resources, export );
}
else
{
return ResourceDirective.createResourceDirective(
name, version, classifier, basedir, info, data,
dependencies,
- properties, filters );
+ properties, filters, export );
}
}
else

Modified:
trunk/main/depot/library/src/main/dpml/library/info/LibraryEncoder.java
===================================================================
--- trunk/main/depot/library/src/main/dpml/library/info/LibraryEncoder.java
2007-02-25 21:50:18 UTC (rev 1877)
+++ trunk/main/depot/library/src/main/dpml/library/info/LibraryEncoder.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -53,6 +53,10 @@
*/
public void export( final ModuleDirective module, final OutputStream
output ) throws IOException
{
+ if( !module.getExportPolicy() )
+ {
+ return;
+ }
final Writer writer = new OutputStreamWriter( output );
try
{
@@ -119,6 +123,11 @@

private void writeModule( Writer writer, ModuleDirective module, String
lead ) throws IOException
{
+ if( !module.getExportPolicy() )
+ {
+ return;
+ }
+
String name = module.getName();
String version = module.getVersion();

@@ -172,6 +181,11 @@

private void writeResource( Writer writer, ResourceDirective resource,
String lead ) throws IOException
{
+ if( !resource.getExportPolicy() )
+ {
+ return;
+ }
+
String name = resource.getName();
String version = resource.getVersion();


Modified:
trunk/main/depot/library/src/main/dpml/library/info/ModuleDirective.java
===================================================================
--- trunk/main/depot/library/src/main/dpml/library/info/ModuleDirective.java
2007-02-25 21:50:18 UTC (rev 1877)
+++ trunk/main/depot/library/src/main/dpml/library/info/ModuleDirective.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -55,7 +55,7 @@
String name, String version, Classifier classifier, String basedir,
InfoDirective info, TypeDirective[] data,
DependencyDirective[] dependencies, Properties properties,
- FilterDirective[] filters, ResourceDirective[] resources )
+ FilterDirective[] filters, ResourceDirective[] resources, boolean
export )
{
int n = name.indexOf( "/" );
if( n > -1 )
@@ -70,7 +70,7 @@
enclosing =
new ModuleDirective(
elem, version, classifier, basedir, info, data,
dependencies,
- resources, properties, filters );
+ resources, properties, filters, export );
}
else
{
@@ -78,7 +78,7 @@
new ModuleDirective(
elem, null, Classifier.EXTERNAL, null, null,
new TypeDirective[0], new DependencyDirective[0],
- new ResourceDirective[]{enclosing}, null, null );
+ new ResourceDirective[]{enclosing}, null, null, true
);
}
}
return enclosing;
@@ -87,7 +87,7 @@
{
return new ModuleDirective(
name, version, classifier, basedir, info, data, dependencies,
- resources, properties, filters );
+ resources, properties, filters, export );
}
}

@@ -104,7 +104,7 @@
this(
name, version, Classifier.ANONYMOUS, null, null,
new TypeDirective[0], new DependencyDirective[0],
- new ResourceDirective[]{resource}, null, null );
+ new ResourceDirective[]{resource}, null, null, true );
}

/**
@@ -124,9 +124,9 @@
String name, String version, Classifier classifier, String basedir,
InfoDirective info, TypeDirective[] data,
DependencyDirective[] dependencies, ResourceDirective[] resources,
- Properties properties, FilterDirective[] filters )
+ Properties properties, FilterDirective[] filters, boolean export )
{
- super( name, version, classifier, basedir, info, data, dependencies,
properties, filters );
+ super( name, version, classifier, basedir, info, data, dependencies,
properties, filters, export );

if( null == resources )
{

Modified:
trunk/main/depot/library/src/main/dpml/library/info/ResourceDirective.java
===================================================================
---
trunk/main/depot/library/src/main/dpml/library/info/ResourceDirective.java
2007-02-25 21:50:18 UTC (rev 1877)
+++
trunk/main/depot/library/src/main/dpml/library/info/ResourceDirective.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -59,6 +59,7 @@
private final Classifier m_classifier;
private final FilterDirective[] m_filters;
private final InfoDirective m_info;
+ private final boolean m_export;

/**
* Creation of a new anonymous resource directive.
@@ -72,7 +73,7 @@
public static ResourceDirective createAnonymousResource(
String scheme, String name, String version, String type, Properties
properties )
{
- return new ResourceDirective( scheme, name, type, version,
properties );
+ return new ResourceDirective( scheme, name, type, version,
properties, true );
}

/**
@@ -95,7 +96,7 @@
String name, String version, Classifier classifier, String basedir,
InfoDirective info, TypeDirective[] types,
DependencyDirective[] dependencies, Properties properties,
- FilterDirective[] filters )
+ FilterDirective[] filters, boolean export )
{
int n = name.indexOf( "/" );
if( n > -1 )
@@ -110,7 +111,7 @@
resource =
new ResourceDirective(
elem, version, classifier, basedir, info, types,
dependencies,
- properties, filters );
+ properties, filters, export );
}
else
{
@@ -118,7 +119,7 @@
new ModuleDirective(
elem, null, Classifier.EXTERNAL, null, null,
new TypeDirective[0], new DependencyDirective[0],
- new ResourceDirective[]{resource}, null, null );
+ new ResourceDirective[]{resource}, null, null, true
);
}
}
return resource;
@@ -127,7 +128,7 @@
{
return new ResourceDirective(
name, version, classifier, basedir, info, types,
- dependencies, properties, filters );
+ dependencies, properties, filters, export );
}
}

@@ -139,7 +140,7 @@
* @param properties suppliementary properties
*/
private ResourceDirective(
- String scheme, String name, String type, String version, Properties
properties )
+ String scheme, String name, String type, String version, Properties
properties, boolean export )
{
super( properties );

@@ -157,6 +158,7 @@
m_info = new InfoDirective( null, null );
m_filters = new FilterDirective[0];
m_scheme = scheme;
+ m_export = export;
}

/**
@@ -175,7 +177,7 @@
String name, String version, Classifier classifier, String basedir,
InfoDirective info, TypeDirective[] types,
DependencyDirective[] dependencies, Properties properties,
- FilterDirective[] filters )
+ FilterDirective[] filters, boolean export )
{
super( properties );

@@ -223,6 +225,7 @@
}

m_types = types;
+ m_export = export;
}

/**
@@ -243,7 +246,17 @@
return m_version;
}

+
/**
+ * Return the export policy.
+ * @return the export policy value
+ */
+ public boolean getExportPolicy()
+ {
+ return m_export;
+ }
+
+ /**
* Return the resource basedir.
* @return the basedir
*/
@@ -374,6 +387,10 @@
if( super.equals( other ) && ( other instanceof ResourceDirective ) )
{
ResourceDirective object = (ResourceDirective) other;
+ if( m_export != object.m_export )
+ {
+ return false;
+ }
if( !equals( m_name, object.m_name ) )
{
return false;
@@ -424,6 +441,10 @@
hash ^= super.hashArray( m_types );
hash ^= super.hashArray( m_dependencies );
hash ^= super.hashArray( m_filters );
+ if( m_export )
+ {
+ hash ^= 42;
+ }
return hash;
}
}

Modified:
trunk/main/depot/library/src/test/dpml/library/info/ModuleDirectiveTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/dpml/library/info/ModuleDirectiveTestCase.java
2007-02-25 21:50:18 UTC (rev 1877)
+++
trunk/main/depot/library/src/test/dpml/library/info/ModuleDirectiveTestCase.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -38,13 +38,13 @@

MODULES[0] = new ModuleDirective(
"aaa", "1.1", ResourceDirective.LOCAL, ".", info, types,
- dependencies, resources, PROPERTIES, null );
+ dependencies, resources, PROPERTIES, null, true );
MODULES[1] = new ModuleDirective(
"bbb", "1.1", ResourceDirective.LOCAL, ".", info, types,
- dependencies, resources, PROPERTIES, null );
+ dependencies, resources, PROPERTIES, null, false );
MODULES[2] = new ModuleDirective(
"ccc", "1.1", ResourceDirective.LOCAL, ".", info, types,
- dependencies, resources, PROPERTIES, null );
+ dependencies, resources, PROPERTIES, null, true );
}

private final Classifier m_classifier = ResourceDirective.LOCAL;
@@ -56,6 +56,7 @@
private final ResourceDirective[] m_resources =
ResourceDirectiveTestCase.RESOURCES;
private final FilterDirective[] m_filters = new FilterDirective[0];
private final TypeDirective[] m_data = TypeDirectiveTestCase.TYPES;
+ private final boolean m_export = false;

private ModuleDirective m_module;

@@ -68,7 +69,7 @@
m_module =
new ModuleDirective(
m_name, m_version, m_classifier, "test", m_info, m_data,
m_dependencies,
- m_resources, PROPERTIES, m_filters );
+ m_resources, PROPERTIES, m_filters, m_export );
}

/**
@@ -81,7 +82,7 @@
{
new ModuleDirective(
null, m_version, m_classifier, "test", m_info, m_data,
- m_dependencies, m_resources, PROPERTIES, m_filters );
+ m_dependencies, m_resources, PROPERTIES, m_filters, m_export );
fail( "no-NPE" );
}
catch( NullPointerException e )
@@ -100,7 +101,7 @@
{
new ModuleDirective(
m_name, null, m_classifier, "test", m_info, m_data,
m_dependencies,
- m_resources, PROPERTIES, m_filters );
+ m_resources, PROPERTIES, m_filters, m_export );
}
catch( NullPointerException e )
{
@@ -118,7 +119,7 @@
{
new ModuleDirective(
m_name, m_version, m_classifier, "test", m_info, m_data, null,
- m_resources, PROPERTIES, m_filters );
+ m_resources, PROPERTIES, m_filters, m_export );
fail( "no-NPE" );
}
catch( NullPointerException e )
@@ -137,7 +138,7 @@
{
new ModuleDirective(
m_name, m_version, m_classifier, "test", m_info, m_data,
- m_dependencies, null, PROPERTIES, m_filters );
+ m_dependencies, null, PROPERTIES, m_filters, m_export );
fail( "no-NPE" );
}
catch( NullPointerException e )

Modified:
trunk/main/depot/library/src/test/dpml/library/info/ResourceDirectiveTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/dpml/library/info/ResourceDirectiveTestCase.java
2007-02-25 21:50:18 UTC (rev 1877)
+++
trunk/main/depot/library/src/test/dpml/library/info/ResourceDirectiveTestCase.java
2007-02-25 23:00:31 UTC (rev 1878)
@@ -40,13 +40,13 @@
{
RESOURCES[0] =
new ResourceDirective(
- "fred", null, CLASSIFIER, "example/fred", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "fred", null, CLASSIFIER, "example/fred", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
RESOURCES[1] =
new ResourceDirective(
- "george", "1.3.0", CLASSIFIER, "example/george", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "george", "1.3.0", CLASSIFIER, "example/george", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, false );
RESOURCES[2] =
new ResourceDirective(
- "mary", "2.7", CLASSIFIER, "example/mary", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "mary", "2.7", CLASSIFIER, "example/mary", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
}

/**
@@ -59,7 +59,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- null, "1.0", CLASSIFIER, "test", INFO, TYPES, DEPENDENCIES,
PROPERTIES, FILTERS );
+ null, "1.0", CLASSIFIER, "test", INFO, TYPES, DEPENDENCIES,
PROPERTIES, FILTERS, true );
fail( "no-NPE" );
}
catch( NullPointerException e )
@@ -78,7 +78,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "fred", "1.0", CLASSIFIER, "test", INFO, null, DEPENDENCIES,
PROPERTIES, FILTERS );
+ "fred", "1.0", CLASSIFIER, "test", INFO, null, DEPENDENCIES,
PROPERTIES, FILTERS, true );
fail( "no-NPE" );
}
catch( NullPointerException e )
@@ -97,7 +97,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "fred", "1.0", CLASSIFIER, "test", INFO, TYPES, null,
PROPERTIES, FILTERS );
+ "fred", "1.0", CLASSIFIER, "test", INFO, TYPES, null,
PROPERTIES, FILTERS, true );
fail( "no-NPE" );
}
catch( NullPointerException e )
@@ -113,7 +113,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
assertEquals( "name", "resource", resource.getName() );
}

@@ -124,7 +124,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
assertEquals( "version", "2.7", resource.getVersion() );
}

@@ -135,7 +135,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
assertEquals( "basedir", "test", resource.getBasedir() );
}

@@ -146,7 +146,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
assertEquals( "types", 3, resource.getTypeDirectives().length );
}

@@ -157,7 +157,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
assertEquals( "dependencies", 3,
resource.getDependencyDirectives().length );
}

@@ -168,7 +168,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
assertEquals( "properties", PROPERTIES, resource.getProperties() );
}

@@ -180,7 +180,7 @@
{
ResourceDirective resource =
new ResourceDirective(
- "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS );
+ "resource", "2.7", CLASSIFIER, "test", INFO, TYPES,
DEPENDENCIES, PROPERTIES, FILTERS, true );
doSerializationTest( resource );
}
}

Modified: trunk/main/metro/part/etc/xsds/library.xsd
===================================================================
--- trunk/main/metro/part/etc/xsds/library.xsd 2007-02-25 21:50:18 UTC (rev
1877)
+++ trunk/main/metro/part/etc/xsds/library.xsd 2007-02-25 23:00:31 UTC (rev
1878)
@@ -72,6 +72,7 @@
<attribute name="name" type="string"/>
<attribute name="version" type="string"/>
<attribute name="basedir" type="string"/>
+ <attribute name="export" type="boolean" default="true"/>
<attribute name="file" type="string"/>
</complexType>


Modified: trunk/main/metro/sample/project.xml
===================================================================
--- trunk/main/metro/sample/project.xml 2007-02-25 21:50:18 UTC (rev 1877)
+++ trunk/main/metro/sample/project.xml 2007-02-25 23:00:31 UTC (rev 1878)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

-<project xmlns="dpml:library" name="dpml-metro-sample">
+<project xmlns="dpml:library" name="dpml-metro-sample" export="false">

<info title="DPML Component Example"/>


Modified: trunk/main/metro/test/project.xml
===================================================================
--- trunk/main/metro/test/project.xml 2007-02-25 21:50:18 UTC (rev 1877)
+++ trunk/main/metro/test/project.xml 2007-02-25 23:00:31 UTC (rev 1878)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

-<project xmlns="dpml:library" name="dpml-metro-test">
+<project xmlns="dpml:library" name="dpml-metro-test" export="false">

<info title="DPML Metro Test Suite"/>





  • r1878 - in trunk/main: depot/library/src/main/dpml/library depot/library/src/main/dpml/library/impl depot/library/src/main/dpml/library/info depot/library/src/test/dpml/library/info metro/part/etc/xsds metro/sample metro/test, mcconnell at BerliOS, 02/25/2007

Archive powered by MHonArc 2.6.24.

Top of Page