Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2000 - in development/laboratory/plus: common/kernel/api common/kernel/api/src common/kernel/api/src/main common/kernel/api/src/main/net common/kernel/api/src/main/net/dpml common/kernel/api/src/main/net/dpml/metro common/kernel/api/src/main/net/dpml/metro/kernel common/kernel/impl common/kernel/src/main/net/dpml/metro/kernel common/kernel/src/main/net/dpml/metro/kernel/impl common/part/src/main/net/dpml/metro/part composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/controller composition/model/src/main/net/dpml/composition/model composition/model/src/test/net/dpml/composition/model

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: r2000 - in development/laboratory/plus: common/kernel/api common/kernel/api/src common/kernel/api/src/main common/kernel/api/src/main/net common/kernel/api/src/main/net/dpml common/kernel/api/src/main/net/dpml/metro common/kernel/api/src/main/net/dpml/metro/kernel common/kernel/impl common/kernel/src/main/net/dpml/metro/kernel common/kernel/src/main/net/dpml/metro/kernel/impl common/part/src/main/net/dpml/metro/part composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/controller composition/model/src/main/net/dpml/composition/model composition/model/src/test/net/dpml/composition/model
  • Date: Wed, 09 Mar 2005 15:57:59 -0500

Author: mcconnell AT dpml.net
Date: Wed Mar 9 15:57:59 2005
New Revision: 2000

Added:
development/laboratory/plus/common/kernel/api/
development/laboratory/plus/common/kernel/api/build.xml
development/laboratory/plus/common/kernel/api/src/
development/laboratory/plus/common/kernel/api/src/main/
development/laboratory/plus/common/kernel/api/src/main/net/
development/laboratory/plus/common/kernel/api/src/main/net/dpml/
development/laboratory/plus/common/kernel/api/src/main/net/dpml/metro/

development/laboratory/plus/common/kernel/api/src/main/net/dpml/metro/kernel/

development/laboratory/plus/common/kernel/api/src/main/net/dpml/metro/kernel/Kernel.java
development/laboratory/plus/common/kernel/impl/

development/laboratory/plus/common/kernel/src/main/net/dpml/metro/kernel/impl/
Removed:

development/laboratory/plus/common/part/src/main/net/dpml/metro/part/Part.java

development/laboratory/plus/composition/control/src/main/net/dpml/composition/controller/
Modified:

development/laboratory/plus/common/kernel/src/main/net/dpml/metro/kernel/DefaultKernel.java

development/laboratory/plus/common/part/src/main/net/dpml/metro/part/PartEnvelope.java

development/laboratory/plus/composition/control/src/main/net/dpml/composition/control/DefaultController.java

development/laboratory/plus/composition/model/src/main/net/dpml/composition/model/ComponentModel.java

development/laboratory/plus/composition/model/src/main/net/dpml/composition/model/PartModel.java

development/laboratory/plus/composition/model/src/test/net/dpml/composition/model/ComponentModelTestCase.java

development/laboratory/plus/composition/model/src/test/net/dpml/composition/model/PartModelTestCase.java
Log:


Added: development/laboratory/plus/common/kernel/api/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/plus/common/kernel/api/build.xml Wed Mar 9
15:57:59 2005
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="dpml-metro-kernel" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="plugin:dpml/magic/dpml-magic-core">
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+
+</project>
+

Added:
development/laboratory/plus/common/kernel/api/src/main/net/dpml/metro/kernel/Kernel.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/common/kernel/api/src/main/net/dpml/metro/kernel/Kernel.java
Wed Mar 9 15:57:59 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 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.metro.kernel;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import net.dpml.metro.control.Controller;
+
+/**
+ * The contract for the kernel.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public interface Kernel
+{
+ void loadPart( InputStream input ) throws IOException,
ClassNotFoundException;
+
+ Controller getPartController( Class partClass );
+
+}

Modified:
development/laboratory/plus/common/kernel/src/main/net/dpml/metro/kernel/DefaultKernel.java
==============================================================================
---
development/laboratory/plus/common/kernel/src/main/net/dpml/metro/kernel/DefaultKernel.java
(original)
+++
development/laboratory/plus/common/kernel/src/main/net/dpml/metro/kernel/DefaultKernel.java
Wed Mar 9 15:57:59 2005
@@ -25,7 +25,6 @@
import java.rmi.MarshalledObject;
import java.net.URI;

-import net.dpml.metro.part.Part;
import net.dpml.metro.part.PartEnvelope;
import net.dpml.metro.control.Controller;
import net.dpml.metro.control.ControlMonitor;
@@ -44,13 +43,19 @@
ObjectInputStream stream = new ObjectInputStream( input );
MarshalledObject marshalled = (MarshalledObject) stream.readObject();
PartEnvelope envelope = (PartEnvelope) marshalled.get();
- Serializable part = envelope.getPart();
+ Object part = envelope.getPart();
URI uri = envelope.getControllerURI();
+ ClassLoader classloader = part.getClass().getClassLoader();
StandardLoader loader = new StandardLoader();
- ClassLoader classloader = Part.class.getClassLoader();
ControlMonitor monitor = new DefaultControlMonitor();
monitor.info( "loading controller uri: " + uri );
loader.getPlugin( classloader, uri, new Object[]{ monitor, part } );
+ monitor.info( "done" );
+ }
+
+ public Controller getPartController( Class partClass )
+ {
+ return null;
}

private static class DefaultControlMonitor implements ControlMonitor

Modified:
development/laboratory/plus/common/part/src/main/net/dpml/metro/part/PartEnvelope.java
==============================================================================
---
development/laboratory/plus/common/part/src/main/net/dpml/metro/part/PartEnvelope.java
(original)
+++
development/laboratory/plus/common/part/src/main/net/dpml/metro/part/PartEnvelope.java
Wed Mar 9 15:57:59 2005
@@ -76,7 +76,7 @@
* Return the serializable part.
* @return the part
*/
- public Serializable getPart()
+ public Object getPart()
{
return m_part;
}

Modified:
development/laboratory/plus/composition/control/src/main/net/dpml/composition/control/DefaultController.java
==============================================================================
---
development/laboratory/plus/composition/control/src/main/net/dpml/composition/control/DefaultController.java
(original)
+++
development/laboratory/plus/composition/control/src/main/net/dpml/composition/control/DefaultController.java
Wed Mar 9 15:57:59 2005
@@ -22,7 +22,6 @@

import net.dpml.composition.model.ComponentModel;

-import net.dpml.metro.part.Part;
import net.dpml.metro.control.Controller;
import net.dpml.metro.control.ControlMonitor;

@@ -88,8 +87,37 @@
buffer.append( "\nModel Listing" );
buffer.append( "\nname:" + getModel().getName() );
buffer.append( "\nclassname:" + getModel().getClassname() );
- Part[] parts = getModel().getParts();
+ Object[] parts = getModel().getParts();
buffer.append( "\nparts:" + parts.length );
getMonitor().info( buffer.toString() );
}
+
+ private void listModel( Object part )
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( LINE );
+ buffer.append( "\nModel Listing" );
+ buffer.append( "\nmodel class:" + part.getClass().getName() );
+ if( part instanceof ComponentModel )
+ {
+ ComponentModel model = (ComponentModel) part;
+ buffer.append( "\nname:" + model.getName() );
+ buffer.append( "\nclassname:" + model.getClassname() );
+ Object[] parts = model.getParts();
+ buffer.append( "\nparts:" + parts.length );
+ getMonitor().info( buffer.toString() );
+ }
+ else
+ {
+ //
+ // we need a hook back to the kernel to request a
+ // controller for the type of part we have just encountered
+ //
+
+ getMonitor().info( "unknown part" );
+
+ }
+ }
+
+
}

Modified:
development/laboratory/plus/composition/model/src/main/net/dpml/composition/model/ComponentModel.java
==============================================================================
---
development/laboratory/plus/composition/model/src/main/net/dpml/composition/model/ComponentModel.java
(original)
+++
development/laboratory/plus/composition/model/src/main/net/dpml/composition/model/ComponentModel.java
Wed Mar 9 15:57:59 2005
@@ -18,7 +18,8 @@

package net.dpml.composition.model;

-import net.dpml.metro.part.Part;
+import java.io.Serializable;
+

/**
* The part directive is a directive that can be handled as a part within a
@@ -30,9 +31,9 @@
public class ComponentModel extends PartModel
{
private String m_classname;
- private Part[] m_parts;
+ private Serializable[] m_parts;

- public ComponentModel( String classname, String name, Part[] parts )
+ public ComponentModel( String classname, String name, Serializable[]
parts )
{
super( name );
if( null == classname )
@@ -48,20 +49,6 @@
}

/**
- * Set the name of the component implementation class.
- * @param classname the component implementation clasname
- * @exception NullPointerException if the supplied classname is null
- */
- //public void setClassname( String classname )
- //{
- // if( null == classname )
- // {
- // throw new NullPointerException( "classname" );
- // }
- // m_classname = classname;
- //}
-
- /**
* Return the name of the part.
* @return the part name
*/
@@ -74,14 +61,13 @@
* Return the set of parts within this component.
* @return the parts
*/
- public Part[] getParts()
+ public Object[] getParts()
{
return m_parts;
}

public int hashCode()
{
- //validate();
int hash = super.hashCode();
hash ^= m_classname.hashCode();
return hash;
@@ -95,7 +81,6 @@
}
else if( other instanceof ComponentModel )
{
- //validate();
ComponentModel part = (ComponentModel) other;
if( !super.equals( part ) )
{
@@ -111,12 +96,12 @@
}
else
{
- Part[] myParts = getParts();
- Part[] yourParts = part.getParts();
+ Object[] myParts = getParts();
+ Object[] yourParts = part.getParts();
for( int i=0; i<myParts.length; i++ )
{
- Part p = myParts[i];
- Part q = yourParts[i];
+ Object p = myParts[i];
+ Object q = yourParts[i];
if( !p.equals( q ) )
{
return false;
@@ -130,12 +115,4 @@
return false;
}
}
-
- protected void validate() throws IllegalStateException
- {
- if( null == m_classname )
- {
- throw new IllegalStateException( "classname" );
- }
- }
}

Modified:
development/laboratory/plus/composition/model/src/main/net/dpml/composition/model/PartModel.java
==============================================================================
---
development/laboratory/plus/composition/model/src/main/net/dpml/composition/model/PartModel.java
(original)
+++
development/laboratory/plus/composition/model/src/main/net/dpml/composition/model/PartModel.java
Wed Mar 9 15:57:59 2005
@@ -18,8 +18,6 @@

package net.dpml.composition.model;

-import net.dpml.metro.part.Part;
-
/**
* The part directive is a directive that can be handled as a part within a
* component model.
@@ -27,7 +25,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class PartModel implements Part, Model
+public class PartModel implements Model
{
private String m_name;

@@ -41,20 +39,6 @@
}

/**
- * Set the name of the part.
- * @param name the part name
- * @exception NullPointerException if the supplied name argument is null
- */
- //public void setName( String name )
- //{
- // if( null == name )
- // {
- // throw new NullPointerException( "name" );
- // }
- // m_name = name;
- //}
-
- /**
* Return the name of the part.
* @return the part name
*/
@@ -65,7 +49,6 @@

public int hashCode()
{
- //validate();
return getName().hashCode();
}

@@ -77,18 +60,9 @@
}
if( other instanceof PartModel )
{
- //validate();
PartModel part = (PartModel) other;
return getName().equals( part.getName() );
}
return false;
}
-
- //protected void validate() throws IllegalStateException
- //{
- // if( null == m_name )
- // {
- // throw new IllegalStateException( "name" );
- // }
- //}
}

Modified:
development/laboratory/plus/composition/model/src/test/net/dpml/composition/model/ComponentModelTestCase.java
==============================================================================
---
development/laboratory/plus/composition/model/src/test/net/dpml/composition/model/ComponentModelTestCase.java
(original)
+++
development/laboratory/plus/composition/model/src/test/net/dpml/composition/model/ComponentModelTestCase.java
Wed Mar 9 15:57:59 2005
@@ -24,12 +24,11 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.net.URI;

import junit.framework.TestCase;

-import net.dpml.metro.part.Part;
-

/**
* The part directive is a directive that can be handled as a part within a
@@ -45,7 +44,7 @@
{
final String name = "name";
final String classname = "aaa.bbb.Ccc";
- ComponentModel part = new ComponentModel( classname, name, new
Part[0] );
+ ComponentModel part = new ComponentModel( classname, name, new
Serializable[0] );
assertEquals( "classname", classname, part.getClassname() );
}

@@ -53,7 +52,7 @@
{
try
{
- ComponentModel part = new ComponentModel( null, "abc", new
Part[0] );
+ ComponentModel part = new ComponentModel( null, "abc", new
Serializable[0] );
fail( "No NPE while setting classname to null." );
}
catch( NullPointerException npe )
@@ -79,7 +78,7 @@
{
final String name = "name";
final String classname = "aaa.bbb.Ccc";
- ComponentModel model = new ComponentModel( classname, name, new
Part[0] );
+ ComponentModel model = new ComponentModel( classname, name, new
Serializable[0] );

File file = new File( "test.out" );
ObjectOutputStream oos = new ObjectOutputStream( new
FileOutputStream( file ) );

Modified:
development/laboratory/plus/composition/model/src/test/net/dpml/composition/model/PartModelTestCase.java
==============================================================================
---
development/laboratory/plus/composition/model/src/test/net/dpml/composition/model/PartModelTestCase.java
(original)
+++
development/laboratory/plus/composition/model/src/test/net/dpml/composition/model/PartModelTestCase.java
Wed Mar 9 15:57:59 2005
@@ -18,7 +18,7 @@

package net.dpml.composition.model;

-import net.dpml.metro.part.Part;
+import java.io.Serializable;

import junit.framework.TestCase;

@@ -52,9 +52,9 @@
}
}

- public void testImplementsPart()
+ public void testImplementsSerializable()
{
- assertTrue( "implements Part", ( new PartModel( "abc" ) instanceof
Part ) );
+ assertTrue( "implements Part", ( new PartModel( "abc" ) instanceof
Serializable ) );
}

}



  • svn commit: r2000 - in development/laboratory/plus: common/kernel/api common/kernel/api/src common/kernel/api/src/main common/kernel/api/src/main/net common/kernel/api/src/main/net/dpml common/kernel/api/src/main/net/dpml/metro common/kernel/api/src/main/net/dpml/metro/kernel common/kernel/impl common/kernel/src/main/net/dpml/metro/kernel common/kernel/src/main/net/dpml/metro/kernel/impl common/part/src/main/net/dpml/metro/part composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/controller composition/model/src/main/net/dpml/composition/model composition/model/src/test/net/dpml/composition/model, mcconnell, 03/09/2005

Archive powered by MHonArc 2.6.24.

Top of Page