Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2024 - in development/laboratory/plus: . api/builder/src/main/net/dpml/metro/builder api/model api/model/src/main/net/dpml/metro/model api/model/src/test/net/dpml/metro/model core standard standard/builder/src/main/net/dpml/metro/builder/impl standard/control/src/main/net/dpml/metro/control/impl test/execution

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2024 - in development/laboratory/plus: . api/builder/src/main/net/dpml/metro/builder api/model api/model/src/main/net/dpml/metro/model api/model/src/test/net/dpml/metro/model core standard standard/builder/src/main/net/dpml/metro/builder/impl standard/control/src/main/net/dpml/metro/control/impl test/execution
  • Date: Thu, 10 Mar 2005 17:56:35 -0500

Author: mcconnell AT dpml.net
Date: Thu Mar 10 17:56:34 2005
New Revision: 2024

Modified:

development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/PartBuilder.java
development/laboratory/plus/api/model/build.xml

development/laboratory/plus/api/model/src/main/net/dpml/metro/model/ClassLoaderModel.java

development/laboratory/plus/api/model/src/test/net/dpml/metro/model/ComponentModelTestCase.java
development/laboratory/plus/core/build.xml
development/laboratory/plus/index.xml
development/laboratory/plus/standard/build.xml

development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/BuilderComponent.java

development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilder.java

development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ConstructionException.java

development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/PartsDataType.java

development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/antlib.xml

development/laboratory/plus/standard/control/src/main/net/dpml/metro/control/impl/DefaultController.java
development/laboratory/plus/test/execution/build.xml
Log:
back in working shape again

Modified:
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/PartBuilder.java
==============================================================================
---
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/PartBuilder.java
(original)
+++
development/laboratory/plus/api/builder/src/main/net/dpml/metro/builder/PartBuilder.java
Thu Mar 10 17:56:34 2005
@@ -18,6 +18,8 @@

package net.dpml.metro.builder;

+import java.net.URI;
+
import net.dpml.metro.part.Part;

/**
@@ -34,4 +36,12 @@
* @exception ConstructionException if a construction error occurs
*/
Part build() throws Exception;
+
+ /**
+ * Build the part.
+ * @return the serializable part
+ * @exception ConstructionException if a construction error occurs
+ */
+ Part build( URI[] uris ) throws Exception;
+
}

Modified: development/laboratory/plus/api/model/build.xml
==============================================================================
--- development/laboratory/plus/api/model/build.xml (original)
+++ development/laboratory/plus/api/model/build.xml Thu Mar 10 17:56:34
2005
@@ -7,7 +7,7 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="init" depends="standard.init">
- <x:filter key="dpml-metro-control" feature="plugin"
token="STRATEGY-URI"/>
+ <x:filter key="dpml-metro-control-impl" feature="plugin"
token="STRATEGY-URI"/>
</target>

<target name="package" depends="standard.package">

Modified:
development/laboratory/plus/api/model/src/main/net/dpml/metro/model/ClassLoaderModel.java
==============================================================================
---
development/laboratory/plus/api/model/src/main/net/dpml/metro/model/ClassLoaderModel.java
(original)
+++
development/laboratory/plus/api/model/src/main/net/dpml/metro/model/ClassLoaderModel.java
Thu Mar 10 17:56:34 2005
@@ -31,30 +31,51 @@
*/
public class ClassLoaderModel implements Model
{
- private final URI[] m_uris;
+ private final URI[] m_api;
+ private final URI[] m_impl;

- public ClassLoaderModel( URI[] uris )
+ public ClassLoaderModel( URI[] api, URI[] impl )
{
- if( null == uris )
+ if( null == api )
{
- throw new NullPointerException( "uris" );
+ throw new NullPointerException( "api" );
}
- m_uris = uris;
+ if( null == impl )
+ {
+ throw new NullPointerException( "impl" );
+ }
+ m_api = api;
+ m_impl = impl;
+ }
+
+ /**
+ * Return the set of API uris declared within the classloader model.
+ * @return the uris
+ */
+ public URI[] getApiURIs()
+ {
+ return m_api;
}

/**
- * Return the set of uris declared within the classloader model.
+ * Return the set of implementation uris declared within the classloader
model.
* @return the uris
*/
- public URI[] getURIs()
+ public URI[] getImplementationURIs()
{
- return m_uris;
+ return m_impl;
}

public int hashCode()
{
int hash = 0;
- URI[] uris = getURIs();
+ URI[] uris = getApiURIs();
+ for( int i=0; i<uris.length; i++ )
+ {
+ URI uri = uris[i];
+ hash ^= uri.hashCode();
+ }
+ uris = getImplementationURIs();
for( int i=0; i<uris.length; i++ )
{
URI uri = uris[i];
@@ -72,14 +93,32 @@
else if( other instanceof ClassLoaderModel )
{
ClassLoaderModel model = (ClassLoaderModel) other;
- if( getURIs().length != model.getURIs().length )
+ if( getApiURIs().length != model.getApiURIs().length )
+ {
+ return false;
+ }
+ else
+ {
+ URI[] myURIs = getApiURIs();
+ URI[] yourURIs = model.getApiURIs();
+ for( int i=0; i<myURIs.length; i++ )
+ {
+ URI a = myURIs[i];
+ URI b = yourURIs[i];
+ if( !a.equals( b ) )
+ {
+ return false;
+ }
+ }
+ }
+ if( getImplementationURIs().length !=
model.getImplementationURIs().length )
{
return false;
}
else
{
- URI[] myURIs = getURIs();
- URI[] yourURIs = model.getURIs();
+ URI[] myURIs = getImplementationURIs();
+ URI[] yourURIs = model.getImplementationURIs();
for( int i=0; i<myURIs.length; i++ )
{
URI a = myURIs[i];
@@ -89,8 +128,8 @@
return false;
}
}
- return true;
}
+ return true;
}
else
{

Modified:
development/laboratory/plus/api/model/src/test/net/dpml/metro/model/ComponentModelTestCase.java
==============================================================================
---
development/laboratory/plus/api/model/src/test/net/dpml/metro/model/ComponentModelTestCase.java
(original)
+++
development/laboratory/plus/api/model/src/test/net/dpml/metro/model/ComponentModelTestCase.java
Thu Mar 10 17:56:34 2005
@@ -46,7 +46,7 @@
{
final String name = "name";
final String classname = "aaa.bbb.Ccc";
- final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0] );
+ final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0], new URI[0] );
ComponentModel part = new ComponentModel( classname, name,
classloader, new Part[0] );
assertEquals( "classname", classname, part.getClassname() );
}
@@ -55,7 +55,7 @@
{
final String name = "name";
final String classname = "aaa.bbb.Ccc";
- final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0] );
+ final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0], new URI[0] );
ComponentModel part = new ComponentModel( classname, name,
classloader, new Part[0] );
assertEquals( "classloader", classloader, part.getClassLoaderModel()
);
}
@@ -64,7 +64,7 @@
{
try
{
- final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0] );
+ final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0], new URI[0] );
ComponentModel part = new ComponentModel( null, "abc",
classloader, new Part[0] );
fail( "No NPE while setting classname to null." );
}
@@ -91,7 +91,7 @@
{
try
{
- final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0] );
+ final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0], new URI[0] );
ComponentModel part = new ComponentModel( "abc", "abc",
classloader, null );
fail( "No NPE while setting parts to null." );
}
@@ -105,7 +105,7 @@
{
final String name = "name";
final String classname = "aaa.bbb.Ccc";
- final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0] );
+ final ClassLoaderModel classloader = new ClassLoaderModel( new
URI[0], new URI[0] );
ComponentModel model = new ComponentModel( classname, name,
classloader, new Part[0] );

File file = new File( "test.out" );

Modified: development/laboratory/plus/core/build.xml
==============================================================================
--- development/laboratory/plus/core/build.xml (original)
+++ development/laboratory/plus/core/build.xml Thu Mar 10 17:56:34 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<project name="dpml-system-kernel-impl" default="install" basedir="."
+<project name="dpml-metro-kernel-impl" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core">


Modified: development/laboratory/plus/index.xml
==============================================================================
--- development/laboratory/plus/index.xml (original)
+++ development/laboratory/plus/index.xml Thu Mar 10 17:56:34 2005
@@ -185,7 +185,8 @@
</types>
</info>
<dependencies>
- <include key="dpml-test-hello-impl"/>
+ <include key="dpml-test-hello-api" tag="api"/>
+ <include key="dpml-test-hello-impl" tag="impl"/>
<include key="dpml-transit-main" test="true" runtime="false"/>
<include key="dpml-metro-kernel-impl" test="true" runtime="false"/>
<include key="dpml-metro-builder-impl" test="true" runtime="false"/>

Modified: development/laboratory/plus/standard/build.xml
==============================================================================
--- development/laboratory/plus/standard/build.xml (original)
+++ development/laboratory/plus/standard/build.xml Thu Mar 10 17:56:34
2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<project name="dpml-metro" default="default" basedir="."
+<project name="dpml-metro-standard" default="default" basedir="."
xmlns:transit="antlib:net.dpml.transit">

<transit:import uri="artifact:template:dpml/magic/reactor"/>

Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/BuilderComponent.java
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/BuilderComponent.java
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/BuilderComponent.java
Thu Mar 10 17:56:34 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.metro.builder;
+package net.dpml.metro.builder.impl;

import org.apache.tools.ant.ProjectComponent;
import org.apache.tools.ant.Location;

Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilder.java
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilder.java
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilder.java
Thu Mar 10 17:56:34 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.metro.builder;
+package net.dpml.metro.builder.impl;

import java.io.File;
import java.io.FileInputStream;
@@ -27,6 +27,7 @@
import java.io.ObjectOutputStream;
import java.net.URI;
import java.rmi.MarshalledObject;
+import java.util.Arrays;
import java.util.List;
import java.util.LinkedList;
import java.util.ArrayList;
@@ -35,7 +36,6 @@
import net.dpml.metro.model.ClassLoaderModel;

import net.dpml.metro.part.Part;
-import net.dpml.metro.part.PartEnvelope;
import net.dpml.metro.builder.PartBuilder;

import net.dpml.magic.tasks.ProjectTask;
@@ -97,7 +97,7 @@
{
if( null == m_parts )
{
-System.out.println( "creating parts element" );
+System.out.println( "creating parts element in : " + m_name );
m_parts = new PartsDataType( this );
}
return m_parts;
@@ -109,32 +109,76 @@

public Part build() throws Exception
{
-System.out.println( "building part" );
- return buildComponentModel();
+ URI[] uris = new URI[0];
+ return build( uris );
+ }
+
+ public Part build( URI[] uris ) throws Exception
+ {
+System.out.println( "building part: " + m_name );
+ return buildComponentModel( uris );
}

/**
* Return the include directive delegate.
* @return the include delegate
*/
- public ComponentModel buildComponentModel() throws Exception
+ public ComponentModel buildComponentModel( URI[] uris ) throws Exception
{
-System.out.println( "building component model" );
- Part[] parts = createParts().getParts();
- ClassLoaderModel classloader = createClassLoaderModel();
+System.out.println( "building component model in : " + m_name );
+ ClassLoaderModel classloader = createClassLoaderModel( uris );
+ URI[] excludes = combine( classloader.getApiURIs(),
classloader.getImplementationURIs() );
+ Part[] parts = createParts().getParts( excludes );
return new ComponentModel( m_classname, m_name, classloader, parts );
}

- private ClassLoaderModel createClassLoaderModel()
+ private ClassLoaderModel createClassLoaderModel( URI[] established )
{
- URI[] apis = createURISequence( def, ResourceRef.API );
- URI[] spis = createURISequence( def, ResourceRef.SPI );
- URI[] impl = createURISequence( def, ResourceRef.IMPL );
- return new ClassLoaderModel( apis, spis, impl );
+ URI[] apis = createURISequence( ResourceRef.API );
+ URI[] spis = createURISequence( ResourceRef.SPI );
+ URI[] uris = filter( established, combine( apis, spis ) );
+ URI[] unfilteredImpl = filter( established, createURISequence(
ResourceRef.IMPL ) );
+ URI[] impl = filter( uris, unfilteredImpl );
+ return new ClassLoaderModel( uris, impl );
}

- private URI[] createURISequence( Definition def, int category )
+ private URI[] filter( URI[] excludes, URI[] items )
{
+ List result = new ArrayList();
+ List list = Arrays.asList( excludes );
+ for( int i=0; i<items.length; i++ )
+ {
+ URI uri = items[i];
+ if( list.contains( uri ) != true )
+ {
+ result.add( uri );
+ }
+ }
+ return (URI[]) result.toArray( new URI[0] );
+ }
+
+ private URI[] combine( URI[] primary, URI[] secondary )
+ {
+ List list = new ArrayList();
+ for( int i=0; i<primary.length; i++ )
+ {
+ URI uri = primary[i];
+ list.add( uri );
+ }
+ for( int i=0; i<secondary.length; i++ )
+ {
+ URI uri = secondary[i];
+ if( list.contains( uri ) != true )
+ {
+ list.add( uri );
+ }
+ }
+ return (URI[]) list.toArray( new URI[0] );
+ }
+
+ private URI[] createURISequence( int category )
+ {
+ Definition def = getDefinition();
ArrayList list = new ArrayList();
final ResourceRef[] resources =
def.getResourceRefs( getProject(), Policy.RUNTIME, category, true
);
@@ -148,7 +192,6 @@
if( "jar".equals( resource.getInfo().getType() ) )
{
URI uri = resource.getArtifactURI( "jar" );
-System.out.println( "# " + uri );
list.add( uri );
}
}
@@ -156,7 +199,6 @@
return (URI[]) list.toArray( new URI[0] );
}

-
//--------------------------------------------------------------------
// Task
//--------------------------------------------------------------------

Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ConstructionException.java
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ConstructionException.java
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ConstructionException.java
Thu Mar 10 17:56:34 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.metro.builder;
+package net.dpml.metro.builder.impl;

import java.net.URI;


Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/PartsDataType.java
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/PartsDataType.java
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/PartsDataType.java
Thu Mar 10 17:56:34 2005
@@ -16,10 +16,11 @@
* limitations under the License.
*/

-package net.dpml.metro.builder;
+package net.dpml.metro.builder.impl;

import java.util.List;
import java.util.LinkedList;
+import java.net.URI;

import net.dpml.metro.part.Part;
import net.dpml.metro.builder.PartBuilder;
@@ -132,17 +133,15 @@
* Return the set of parts contained within this container.
* @return the contained parts
*/
- public Part[] getParts() throws Exception
+ public Part[] getParts( URI[] uris ) throws Exception
{
-
PartBuilder[] builders = (PartBuilder[]) m_builders.toArray( new
PartBuilder[0] );
Part[] parts = new Part[ builders.length ];
for( int i=0; i<builders.length; i++ )
{
PartBuilder builder = builders[i];
- parts[i] = builder.build();
+ parts[i] = builder.build( uris );
}
return parts;
}
-
}

Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/antlib.xml
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/antlib.xml
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/antlib.xml
Thu Mar 10 17:56:34 2005
@@ -1,5 +1,5 @@
<?xml version="1.0"?>

<antlib>
- <taskdef name="component"
classname="net.dpml.metro.builder.ComponentModelBuilder"/>
+ <taskdef name="component"
classname="net.dpml.metro.builder.impl.ComponentModelBuilder"/>
</antlib>

Modified:
development/laboratory/plus/standard/control/src/main/net/dpml/metro/control/impl/DefaultController.java
==============================================================================
---
development/laboratory/plus/standard/control/src/main/net/dpml/metro/control/impl/DefaultController.java
(original)
+++
development/laboratory/plus/standard/control/src/main/net/dpml/metro/control/impl/DefaultController.java
Thu Mar 10 17:56:34 2005
@@ -16,16 +16,14 @@
* limitations under the License.
*/

-package net.dpml.metro.control;
+package net.dpml.metro.control.impl;

import java.net.URI;

import net.dpml.metro.part.Part;
import net.dpml.metro.kernel.Kernel;
-
-import net.dpml.composition.model.ComponentModel;
-import net.dpml.composition.model.ClassLoaderModel;
-
+import net.dpml.metro.model.ComponentModel;
+import net.dpml.metro.model.ClassLoaderModel;
import net.dpml.metro.control.Controller;
import net.dpml.metro.control.ControlMonitor;

@@ -154,12 +152,19 @@
private void listClassLoader( ComponentModel part, StringBuffer buffer )
{
ClassLoaderModel model = part.getClassLoaderModel();
- URI[] uris = model.getURIs();
- buffer.append( "\nclass loader model entries: " + uris.length );
+ URI[] uris = model.getApiURIs();
+ buffer.append( "\nclass loader model API entries: " + uris.length );
+ for( int i=0; i<uris.length; i++ )
+ {
+ URI uri = uris[i];
+ buffer.append( "\n" + (i + 1) + ". " + uri );
+ }
+ uris = model.getImplementationURIs();
+ buffer.append( "\nclass loader model IMPL entries: " + uris.length );
for( int i=0; i<uris.length; i++ )
{
URI uri = uris[i];
- buffer.append( "\n" + i + " " + uri );
+ buffer.append( "\n" + (i + 1) + ". " + uri );
}
}


Modified: development/laboratory/plus/test/execution/build.xml
==============================================================================
--- development/laboratory/plus/test/execution/build.xml (original)
+++ development/laboratory/plus/test/execution/build.xml Thu Mar 10
17:56:34 2005
@@ -3,30 +3,18 @@
<project name="dpml-test-execution" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core"
- xmlns:m="plugin:dpml/metro/dpml-composition-builder" >
+ xmlns:m="plugin:dpml/metro/dpml-metro-builder-impl" >

<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="init" depends="standard.init">
<filter token="XPATH"
value="target/deliverables/xparts/${project.filename}"/>
- <x:property name="builder.uri" feature="plugin"
key="dpml-composition-builder"/>
+ <x:property name="builder.uri" feature="plugin"
key="dpml-metro-builder-impl"/>
<transit:plugin uri="${builder.uri}"/>
</target>

<target name="package" depends="standard.package">
- <x:path id="test.path"/>
- <pathconvert pathsep="," property="test.path" refid="test.path"/>
- <echo>${test.path}</echo>
- <!--
- <m:component xmlns="plugin:dpml/metro/dpml-composition-builder"
- class="net.dpml.test.hello.impl.HelloComponent" name="hello"/>
- -->
<m:component class="net.dpml.test.hello.impl.HelloComponent"
name="hello">
- <!--
- <dependencies>
- <dependency key="publisher" provider="output"/>
- </dependencies>
- -->
<parts>
<m:component class="net.dpml.test.hello.impl.DefaultOutputHandler"
name="output"/>
</parts>



  • svn commit: r2024 - in development/laboratory/plus: . api/builder/src/main/net/dpml/metro/builder api/model api/model/src/main/net/dpml/metro/model api/model/src/test/net/dpml/metro/model core standard standard/builder/src/main/net/dpml/metro/builder/impl standard/control/src/main/net/dpml/metro/control/impl test/execution, mcconnell, 03/10/2005

Archive powered by MHonArc 2.6.24.

Top of Page