notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2397 - in development/main/metro/composition: builder/src/main/net/dpml/composition/builder control/src/main/net/dpml/composition/control testing/test/src/main/net/dpml/test/state
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2397 - in development/main/metro/composition: builder/src/main/net/dpml/composition/builder control/src/main/net/dpml/composition/control testing/test/src/main/net/dpml/test/state
- Date: Sun, 24 Apr 2005 20:43:41 -0400
Author: mcconnell AT dpml.net
Date: Sun Apr 24 20:43:36 2005
New Revision: 2397
Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilderTask.java
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
development/main/metro/composition/testing/test/src/main/net/dpml/test/state/ManagedComponent.java
Log:
committing before surgery
Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilderTask.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilderTask.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilderTask.java
Sun Apr 24 20:43:36 2005
@@ -620,8 +620,12 @@
for( int i=0; i<methods.length; i++ )
{
Method method = methods[i];
- EntryDescriptor descriptor = createEntryDescriptor( method );
- list.add( descriptor );
+ String name = method.getName();
+ if( false == "addObserver".equals( name ) )
+ {
+ EntryDescriptor descriptor = createEntryDescriptor(
method );
+ list.add( descriptor );
+ }
}
return (EntryDescriptor[]) list.toArray( new EntryDescriptor[0]
);
}
Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
Sun Apr 24 20:43:36 2005
@@ -18,6 +18,7 @@
package net.dpml.composition.control;
+import java.util.Observer;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
@@ -101,9 +102,22 @@
else
{
String name = method.getName();
- String key = getKeyFromMethod( method );
- Holder.ContextMap map = getHolder().getContextMap();
- return map.getValue( key, args );
+ if( Void.TYPE.equals( method.getReturnType() )
+ && ( null != args )
+ && ( args.length == 1 )
+ && "addObserver".equals( name )
+ && ( args[0] instanceof Observer ) )
+ {
+ Observer observer = (Observer) args[0];
+ getHolder().addObserver( observer );
+ return null;
+ }
+ else
+ {
+ String key = getKeyFromMethod( method );
+ Holder.ContextMap map = getHolder().getContextMap();
+ return map.getValue( key, args );
+ }
}
}
Modified:
development/main/metro/composition/testing/test/src/main/net/dpml/test/state/ManagedComponent.java
==============================================================================
---
development/main/metro/composition/testing/test/src/main/net/dpml/test/state/ManagedComponent.java
(original)
+++
development/main/metro/composition/testing/test/src/main/net/dpml/test/state/ManagedComponent.java
Sun Apr 24 20:43:36 2005
@@ -21,6 +21,8 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.logging.Logger;
+import java.util.Observer;
+import java.util.Observable;
import javax.swing.event.ChangeListener;
@@ -33,7 +35,7 @@
*
* @author <a href="mailto:info AT dpml.net";>The Digital Product Meta
Library</a>
*/
-public class ManagedComponent
+public class ManagedComponent implements Observer
{
// ------------------------------------------------------------------
// static
@@ -56,9 +58,15 @@
*
* @param logger the logging channel assigned by the container
*/
- public ManagedComponent( final Logger logger )
+ public ManagedComponent( final Logger logger, Context context )
{
m_logger = logger;
+ context.addObserver( this );
+ }
+
+ public void update( Observable observable, Object event )
+ {
+ m_logger.info( "# event: " + event );
}
// ------------------------------------------------------------------
@@ -84,6 +92,11 @@
}
}
+ public interface Context
+ {
+ void addObserver( Observer observer );
+ }
+
// ------------------------------------------------------------------
// implementation
// ------------------------------------------------------------------
- svn commit: r2397 - in development/main/metro/composition: builder/src/main/net/dpml/composition/builder control/src/main/net/dpml/composition/control testing/test/src/main/net/dpml/test/state, mcconnell, 04/24/2005
Archive powered by MHonArc 2.6.24.