Skip to Content.
Sympa Menu

notify-dpml - r1524 - in trunk/main/metro: runtime/src/main/net/dpml/metro/runtime tools/src/main/net/dpml/metro/tools

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: r1524 - in trunk/main/metro: runtime/src/main/net/dpml/metro/runtime tools/src/main/net/dpml/metro/tools
  • Date: Tue, 20 Jun 2006 09:55:23 +0200

Author: mcconnell
Date: 2006-06-20 09:55:19 +0200 (Tue, 20 Jun 2006)
New Revision: 1524

Modified:

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

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultStateMachine.java
trunk/main/metro/tools/src/main/net/dpml/metro/tools/StateTask.java
Log:
improve state transition log messages

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-06-20 06:31:32 UTC (rev 1523)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-06-20 07:55:19 UTC (rev 1524)
@@ -544,66 +544,16 @@
return m_handler;
}

- /*
- void addPropertyChangeListener( PropertyChangeListener listener )
+ static String createTag( Object instance )
{
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "adding property change listener to " + m_tag
);
- }
- m_machine.addPropertyChangeListener( listener );
- m_handler.addPropertyChangeListener( listener );
- }
-
- void removePropertyChangeListener( PropertyChangeListener listener )
- {
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "removing property change listener from " +
m_tag );
- }
- m_machine.removePropertyChangeListener( listener );
- m_handler.removePropertyChangeListener( listener );
- }
- */
-
- private String createTag( Object instance )
- {
String tag =
"["
+ System.identityHashCode( instance )
+ " ";
return tag.substring( 0, 10 ) + "] ";
}
-
+
/**
- * State event propergator implementation.
- */
- //private final class StateEventPropergator implements
PropertyChangeListener
- //{
- // /**
- // * Handle a property change notification.
- // * @param event the property change event
- // */
- // public void propertyChange( PropertyChangeEvent event )
- // {
- // //
- // // fire a state change event to remote listeners
- // //
- //
- // State oldState = (State) event.getOldValue();
- // State newState = (State) event.getNewValue();
- // fireStateEvent( oldState, newState );
- // }
- //}
-
- //private void fireStateEvent( State oldState, State newState )
- //{
- // getLogger().debug( "state changing from: " + oldState + " to: " +
newState + " in " + m_tag );
- // StateEvent event = new StateEvent( this, oldState, newState );
- // enqueueEvent( event );
- //}
-
- /**
* Invoke the specified method on underlying object.
* This is called by the proxy object.
*

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultStateMachine.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultStateMachine.java
2006-06-20 06:31:32 UTC (rev 1523)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultStateMachine.java
2006-06-20 07:55:19 UTC (rev 1524)
@@ -79,8 +79,6 @@

//-------------------------------------------------------------------------------
// state

//-------------------------------------------------------------------------------
-
- //private final PropertyChangeSupport m_support;

private State m_state;
private boolean m_active = false;
@@ -93,7 +91,7 @@
private final WeakHashMap m_listeners = new WeakHashMap();

private final Logger m_logger;
-
+

//-------------------------------------------------------------------------------
// constructor

//-------------------------------------------------------------------------------
@@ -159,7 +157,6 @@

private StateListener[] getStateListeners()
{
- checkDisposed();
synchronized( m_lock )
{
return (StateListener[]) m_listeners.keySet().toArray( new
StateListener[0] );
@@ -498,6 +495,11 @@
// implementation

//-------------------------------------------------------------------------------

+ private String getTag( final Object object )
+ {
+ return DefaultProvider.createTag( object );
+ }
+
private State initialize( List list, Object object ) throws Exception
{
Action action = getInitializationAction();
@@ -617,7 +619,7 @@
{
execute( operation, object, new Object[0] ); // TODO: add
resolved values as args
}
- setState( state );
+ setState( object, state );
return state;
}
}
@@ -656,7 +658,7 @@
}
}

- private void setState( final State state )
+ private void setState( final Object object, final State state )
{
synchronized( m_state )
{
@@ -665,6 +667,18 @@
final State oldState = m_state;
m_state = state;

+ if( getLogger().isTraceEnabled() )
+ {
+ String tag = getTag( object );
+ getLogger().trace(
+ "transitioning from ["
+ + oldState
+ + "] to ["
+ + state
+ + "] in "
+ + tag );
+ }
+
final StateEvent event = new StateEvent( this, oldState,
state );
m_queue.enqueueEvent( event );
}

Modified: trunk/main/metro/tools/src/main/net/dpml/metro/tools/StateTask.java
===================================================================
--- trunk/main/metro/tools/src/main/net/dpml/metro/tools/StateTask.java
2006-06-20 06:31:32 UTC (rev 1523)
+++ trunk/main/metro/tools/src/main/net/dpml/metro/tools/StateTask.java
2006-06-20 07:55:19 UTC (rev 1524)
@@ -40,6 +40,7 @@
private static final StateEncoder STATE_ENCODER = new StateEncoder();

private File m_output;
+ private String m_classname;
private StateDataType m_data;

StateDataType getData()
@@ -62,6 +63,16 @@
}

/**
+ * Override the class as the colocated destination.
+ *
+ * @param classname the classname of the target component.
+ */
+ public void setClass( String classname )
+ {
+ m_classname = classname;
+ }
+
+ /**
* Set the state name.
* @param name the cname of the state
*/
@@ -186,6 +197,13 @@
{
return m_output;
}
+ else if( null != m_classname )
+ {
+ File classes = getContext().getTargetClassesMainDirectory();
+ String path = m_classname.replace( '.', '/' );
+ String filename = path + ".xgraph";
+ return new File( classes, filename );
+ }
else
{
return getDefaultOutputFile();




  • r1524 - in trunk/main/metro: runtime/src/main/net/dpml/metro/runtime tools/src/main/net/dpml/metro/tools, mcconnell at BerliOS, 06/20/2006

Archive powered by MHonArc 2.6.24.

Top of Page