Skip to Content.
Sympa Menu

notify-dpml - r1533 - in trunk/main/metro: component/src/main/net/dpml/component runtime/src/main/net/dpml/metro/runtime

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: r1533 - in trunk/main/metro: component/src/main/net/dpml/component runtime/src/main/net/dpml/metro/runtime
  • Date: Mon, 3 Jul 2006 06:21:56 +0200

Author: mcconnell
Date: 2006-07-03 06:21:51 +0200 (Mon, 03 Jul 2006)
New Revision: 1533

Modified:
trunk/main/metro/component/src/main/net/dpml/component/Component.java

trunk/main/metro/component/src/main/net/dpml/component/ControlException.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
Log:
add runtime support for inclusion of parts via reference to a component part
definition

Modified:
trunk/main/metro/component/src/main/net/dpml/component/Component.java
===================================================================
--- trunk/main/metro/component/src/main/net/dpml/component/Component.java
2006-07-03 03:42:12 UTC (rev 1532)
+++ trunk/main/metro/component/src/main/net/dpml/component/Component.java
2006-07-03 04:21:51 UTC (rev 1533)
@@ -18,6 +18,7 @@

package net.dpml.component;

+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.rmi.Remote;
import java.rmi.RemoteException;
@@ -37,7 +38,7 @@
* @exception ControlException if a controller related error occurs
* @exception RemoteException if a remote exception occurs
*/
- Provider getProvider() throws ControlException,
InvocationTargetException, RemoteException;
+ Provider getProvider() throws IOException, InvocationTargetException;

/**
* Return true if this handler is a candidate for the supplied service
definition.

Modified:
trunk/main/metro/component/src/main/net/dpml/component/ControlException.java
===================================================================
---
trunk/main/metro/component/src/main/net/dpml/component/ControlException.java
2006-07-03 03:42:12 UTC (rev 1532)
+++
trunk/main/metro/component/src/main/net/dpml/component/ControlException.java
2006-07-03 04:21:51 UTC (rev 1533)
@@ -18,6 +18,7 @@

package net.dpml.component;

+import java.io.IOException;
import java.net.URI;

/**
@@ -26,7 +27,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public class ControlException extends Exception
+public class ControlException extends IOException
{
/**
* Serial version identifier.
@@ -53,7 +54,8 @@
*/
public ControlException( URI uri, String message, Throwable cause )
{
- super( message, cause );
+ super( message );
+ super.initCause( cause );
m_uri = uri;
}


Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
2006-07-03 03:42:12 UTC (rev 1532)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
2006-07-03 04:21:51 UTC (rev 1533)
@@ -19,6 +19,7 @@
package net.dpml.metro.runtime;

import java.io.File;
+import java.io.IOException;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.ref.Reference;
@@ -315,7 +316,7 @@
* or activation
* @exception ControlException if a control related error occurs
*/
- public Provider getProvider() throws InvocationTargetException,
ControlException
+ public Provider getProvider() throws InvocationTargetException,
IOException
{
commission();
return m_holder.getProvider();
@@ -752,7 +753,7 @@
* @exception InvocationTargetException if a error was raised by the
external implementation
*/
private DefaultProvider createDefaultProvider()
- throws InvocationTargetException, ControlException
+ throws InvocationTargetException, IOException
{
if( getLogger().isTraceEnabled() )
{
@@ -786,7 +787,7 @@
* @exception ControlException of a controller error occurs
* @exception InvocationTargetException if a client implementation
error occurs
*/
- abstract DefaultProvider getProvider() throws ControlException,
InvocationTargetException;
+ abstract DefaultProvider getProvider() throws IOException,
InvocationTargetException;

/**
* Return the number of instances handled by the holder.
@@ -872,7 +873,7 @@
m_reference = createReference( null );
}

- DefaultProvider getProvider() throws ControlException,
InvocationTargetException
+ DefaultProvider getProvider() throws IOException,
InvocationTargetException
{
DefaultProvider provider = (DefaultProvider) m_reference.get();
if( null == provider )
@@ -955,7 +956,7 @@
{
private final WeakHashMap m_providers = new WeakHashMap(); //
transients

- DefaultProvider getProvider() throws ControlException,
InvocationTargetException
+ DefaultProvider getProvider() throws IOException,
InvocationTargetException
{
DefaultProvider provider = createDefaultProvider();
m_providers.put( provider, null );
@@ -1002,7 +1003,7 @@
{
private final ThreadLocalHolder m_threadLocalHolder = new
ThreadLocalHolder();

- DefaultProvider getProvider() throws ControlException,
InvocationTargetException
+ DefaultProvider getProvider() throws IOException,
InvocationTargetException
{
return (DefaultProvider) m_threadLocalHolder.get();
}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-07-03 03:42:12 UTC (rev 1532)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-07-03 04:21:51 UTC (rev 1533)
@@ -18,11 +18,13 @@

package net.dpml.metro.runtime;

+import java.io.IOException;
import java.rmi.RemoteException;
import java.util.Map;
import java.util.ArrayList;
import java.util.Hashtable;
import java.lang.reflect.InvocationTargetException;
+import java.net.URI;

import net.dpml.component.ActivationPolicy;
import net.dpml.component.ControlException;
@@ -31,9 +33,11 @@
import net.dpml.component.Service;
import net.dpml.component.Directive;
import net.dpml.component.Disposable;
+import net.dpml.component.Composition;

import net.dpml.lang.Classpath;
import net.dpml.lang.UnknownKeyException;
+import net.dpml.lang.Part;
import net.dpml.lang.Version;

import net.dpml.metro.PartsManager;
@@ -42,6 +46,7 @@
import net.dpml.metro.ComponentModel;
import net.dpml.metro.info.PartReference;
import net.dpml.metro.data.ComponentDirective;
+import net.dpml.metro.data.ImportDirective;

import net.dpml.util.Logger;

@@ -59,7 +64,7 @@

private boolean m_commissioned;

- DefaultPartsManager( DefaultProvider provider ) throws RemoteException
+ DefaultPartsManager( DefaultProvider provider ) throws RemoteException,
IOException, ControlException
{
m_provider = provider;

@@ -110,12 +115,38 @@
throw new ControllerRuntimeException( error, e );
}
}
+ else if( part instanceof ImportDirective )
+ {
+ ImportDirective importDirective = (ImportDirective) part;
+ URI uri = importDirective.getURI();
+ Part p = Part.load( uri, false );
+ if( p instanceof Composition )
+ {
+ Composition composition = (Composition) p;
+ ComponentDirective directive = (ComponentDirective)
composition.getDirective();
+ Classpath classpath = composition.getClasspath();
+ ComponentController controller =
handler.getComponentController();
+ ComponentModel manager =
+ controller.createComponentModel( classloader,
classpath, base, directive );
+ ComponentHandler component =
+ controller.createDefaultComponentHandler( m_provider,
classloader, manager, true );
+ m_components[i] = component;
+ }
+ else
+ {
+ final String error =
+ "Part class ["
+ + part.getClass().getName()
+ + "] not recognized.";
+ throw new ControllerException( error );
+ }
+ }
else
{
final String error =
- "Foreign part ["
+ "Component directive class ["
+ part.getClass()
- + "] not supported.";
+ + "] not recognized.";
throw new UnsupportedOperationException( error );
}
}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-07-03 03:42:12 UTC (rev 1532)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-07-03 04:21:51 UTC (rev 1533)
@@ -18,6 +18,7 @@

package net.dpml.metro.runtime;

+import java.io.IOException;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.lang.reflect.InvocationHandler;
@@ -117,7 +118,7 @@
* @param logger the logging channel
*/
DefaultProvider( EventQueue queue, DefaultComponentHandler handler,
Logger logger )
- throws RemoteException, ControlException, InvocationTargetException
+ throws InvocationTargetException, IOException
{
super( queue, logger );





  • r1533 - in trunk/main/metro: component/src/main/net/dpml/component runtime/src/main/net/dpml/metro/runtime, mcconnell at BerliOS, 07/03/2006

Archive powered by MHonArc 2.6.24.

Top of Page