Skip to Content.
Sympa Menu

notify-dpml - r997 - trunk/main/metro/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: r997 - trunk/main/metro/runtime/src/main/net/dpml/metro/runtime
  • Date: Tue, 31 Jan 2006 02:09:43 +0100

Author: mcconnell
Date: 2006-01-31 02:09:36 +0100 (Tue, 31 Jan 2006)
New Revision: 997

Modified:

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
Log:
add support for components that publish services that are not interfaces

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-01-31 00:47:39 UTC (rev 996)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-01-31 01:09:36 UTC (rev 997)
@@ -174,7 +174,14 @@
}
if( isolate )
{
- return m_proxy;
+ if( null != m_proxy )
+ {
+ return m_proxy;
+ }
+ else
+ {
+ return m_value;
+ }
}
else
{
@@ -288,8 +295,15 @@
{
ClassLoader classloader = m_handler.getClassLoader();
Class[] services = m_handler.getServiceClassArray();
- InvocationHandler invocationHandler = new
InstanceInvocationHandler( this );
- m_proxy = Proxy.newProxyInstance( classloader, services,
invocationHandler );
+ if( allClassesAreInterfaces( services ) )
+ {
+ InvocationHandler invocationHandler = new
InstanceInvocationHandler( this );
+ m_proxy = Proxy.newProxyInstance( classloader, services,
invocationHandler );
+ }
+ else
+ {
+ m_proxy = null;
+ }
m_value = m_handler.createNewObject( this );
m_tag = createTag( m_value );
getLogger().debug( m_tag + "activating instance" );
@@ -297,6 +311,19 @@
m_activated = true;
}
}
+
+ private boolean allClassesAreInterfaces( Class[] classes )
+ {
+ for( int i=0; i<classes.length; i++ )
+ {
+ Class c = classes[i];
+ if( !c.isInterface() )
+ {
+ return false;
+ }
+ }
+ return true;
+ }

boolean isAvailable()
{




  • r997 - trunk/main/metro/runtime/src/main/net/dpml/metro/runtime, mcconnell at BerliOS, 01/30/2006

Archive powered by MHonArc 2.6.24.

Top of Page