Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2301 - in development/main/metro: . composition/control/src/main/net/dpml/composition/control composition/testing/activity state state/api state/api/src state/impl state/impl/src state/impl/src/main state/impl/src/main/net state/impl/src/main/net/dpml state/impl/src/main/net/dpml/state state/impl/src/main/net/dpml/state/impl state/src

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: r2301 - in development/main/metro: . composition/control/src/main/net/dpml/composition/control composition/testing/activity state state/api state/api/src state/impl state/impl/src state/impl/src/main state/impl/src/main/net state/impl/src/main/net/dpml state/impl/src/main/net/dpml/state state/impl/src/main/net/dpml/state/impl state/src
  • Date: Sun, 17 Apr 2005 21:10:19 -0400

Author: mcconnell AT dpml.net
Date: Sun Apr 17 21:10:19 2005
New Revision: 2301

Added:
development/main/metro/state/api/build.xml
- copied unchanged from r2299, development/main/metro/state/build.xml
development/main/metro/state/api/src/
- copied from r2299, development/main/metro/state/src/
development/main/metro/state/impl/
development/main/metro/state/impl/build.xml
development/main/metro/state/impl/src/
development/main/metro/state/impl/src/main/
development/main/metro/state/impl/src/main/net/
development/main/metro/state/impl/src/main/net/dpml/
development/main/metro/state/impl/src/main/net/dpml/state/
development/main/metro/state/impl/src/main/net/dpml/state/impl/
Removed:
development/main/metro/state/build.xml
development/main/metro/state/src/
Modified:

development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/StateInvocationHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/StateManagerInvocationHandler.java
development/main/metro/composition/testing/activity/build.xml
development/main/metro/index.xml
Log:
fiddling with states

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
Sun Apr 17 21:10:19 2005
@@ -280,6 +280,10 @@
{
return new
StateManagerInvocationHandler.SimpleStateManager( holder.getValue() );
}
+ else if( StateManager.class.isAssignableFrom(
manager.getClass() ) )
+ {
+ return manager;
+ }
else
{
ClassLoader classloader = model.getClassLoader();

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/StateInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/StateInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/StateInvocationHandler.java
Sun Apr 17 21:10:19 2005
@@ -130,7 +130,7 @@
String name = method.getName();
Class returnType = method.getReturnType();
Class[] params = method.getParameterTypes();
- if(( null != returnType ) && ( params.length == 1 ) &&
!name.startsWith( "get" ) )
+ if(( null != returnType ) && ( params.length < 2 ) &&
!name.startsWith( "get" ) )
{
String transition = method.getName();
list.add( transition );
@@ -161,7 +161,27 @@
}
catch( NoSuchMethodException e )
{
- throw new NoSuchTransitionException( key );
+ try
+ {
+ Method method = state.getMethod( key, new Class[]{} );
+ String name = method.getName();
+ if( name.startsWith( "get" ) )
+ {
+ throw new NoSuchTransitionException( key );
+ }
+ else if( null == method.getReturnType() )
+ {
+ throw new NoSuchTransitionException( key );
+ }
+ else
+ {
+ return method;
+ }
+ }
+ catch( NoSuchMethodException ee )
+ {
+ throw new NoSuchTransitionException( key );
+ }
}
}


Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/StateManagerInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/StateManagerInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/StateManagerInvocationHandler.java
Sun Apr 17 21:10:19 2005
@@ -83,71 +83,6 @@
// implementation
//-------------------------------------------------------------------

- private Class getControlClass()
- {
- return m_class;
- }
-
- private Method getInitializeMethod()
- {
- return getMethod( "initialize" );
- }
-
- private Method getTerminateMethod()
- {
- return getMethod( "terminate" );
- }
-
- private Method getStateMethod()
- {
- return getMethod( "getState" );
- }
-
- private Method getMethod( String name )
- {
- Class base = getControlClass();
- if( null == base )
- {
- return null;
- }
- else
- {
- return getMethod( base, name );
- }
- }
-
- private Method getMethod( Class base, String name )
- {
- if( null == base )
- {
- throw new NullPointerException( "base" );
- }
- if( null == name )
- {
- throw new NullPointerException( "name" );
- }
- try
- {
- return base.getMethod( name, new Class[0] );
- }
- catch( NoSuchMethodException e )
- {
- return null;
- }
- }
-
- private Object getStateObject( Method method ) throws Exception
- {
- Method getState = getStateMethod();
- if( null == getState )
- {
- return null;
- }
- else
- {
- return getState.invoke( m_control, new Object[0] );
- }
- }

/**
* Invoke the specified method on underlying object.
@@ -197,7 +132,7 @@
}
else if( "getState".equals( name ) )
{
- Object state = getStateObject( method );
+ Object state = getStateObject();
if( null != state )
{
Class c = state.getClass();
@@ -243,7 +178,8 @@
}

String key = (String) arg;
- Object state = getStateObject( method );
+ Object state = getStateObject();
+System.out.println( "# getState() return null in " + m_class );
if( null != state )
{
final String error =
@@ -278,6 +214,75 @@
}
}

+ private Class getControlClass()
+ {
+ return m_class;
+ }
+
+ private Method getInitializeMethod()
+ {
+ return getMethod( "initialize" );
+ }
+
+ private Method getTerminateMethod()
+ {
+ return getMethod( "terminate" );
+ }
+
+ private Method getMethod( String name )
+ {
+ Class base = getControlClass();
+ if( null == base )
+ {
+ return null;
+ }
+ else
+ {
+ return getMethod( base, name );
+ }
+ }
+
+ private Method getMethod( Class base, String name )
+ {
+ if( null == base )
+ {
+ throw new NullPointerException( "base" );
+ }
+ if( null == name )
+ {
+ throw new NullPointerException( "name" );
+ }
+ try
+ {
+ return base.getMethod( name, new Class[0] );
+ }
+ catch( NoSuchMethodException e )
+ {
+ return null;
+ }
+ }
+
+ private Object getStateObject() throws Exception
+ {
+ Method getStateMethod = getStateMethod();
+ if( null == getStateMethod )
+ {
+System.out.println( "Missing getState() method on controller class: " +
m_class );
+ return null;
+ }
+ else
+ {
+System.out.println( "Invoking getState(): " + m_class );
+ return getStateMethod.invoke( m_control, new Object[0] );
+ }
+ }
+
+ private Method getStateMethod()
+ {
+ return getMethod( "getState" );
+ }
+
+
public static class Available implements State
{
public String getName()

Modified: development/main/metro/composition/testing/activity/build.xml
==============================================================================
--- development/main/metro/composition/testing/activity/build.xml
(original)
+++ development/main/metro/composition/testing/activity/build.xml Sun
Apr 17 21:10:19 2005
@@ -11,6 +11,8 @@
<types xmlns="plugin:dpml/composition/dpml-composition-builder">
<type class="net.dpml.test.Component"/>
<type class="net.dpml.test.Container"/>
+ <type class="net.dpml.demo.Component"/>
+ <type class="net.dpml.demo.Container"/>
</types>

<!-- creation of a component for reference by uri -->
@@ -37,6 +39,15 @@
</parts>
</component>

+ <!-- creation of the container part for local testing -->
+ <component xmlns="plugin:dpml/composition/dpml-composition-builder"
+ dest="target/test/demo.part"
+ name="container"
+ type="net.dpml.demo.Container">
+ <parts>
+ <component key="test" type="net.dpml.demo.Component"/>
+ </parts>
+ </component>
</target>

</project>

Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Sun Apr 17 21:10:19 2005
@@ -23,9 +23,9 @@
</dependencies>
</project>

- <!-- State -->
+ <!-- State (experimental) -->

- <project basedir="state">
+ <project basedir="state/api">
<info>
<group>dpml/metro/public</group>
<name>dpml-state-api</name>
@@ -37,6 +37,18 @@
</info>
</project>

+ <project basedir="state/impl">
+ <info>
+ <group>dpml/metro/public</group>
+ <name>dpml-state-impl</name>
+ <version>1.0.0</version>
+ <status>SNAPSHOT</status>
+ <types>
+ <type>jar</type>
+ </types>
+ </info>
+ </project>
+
<!-- Automation -->

<project basedir="automation/control">

Added: development/main/metro/state/impl/build.xml
==============================================================================
--- (empty file)
+++ development/main/metro/state/impl/build.xml Sun Apr 17 21:10:19 2005
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="dpml-state-impl" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit">
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+
+</project>



  • svn commit: r2301 - in development/main/metro: . composition/control/src/main/net/dpml/composition/control composition/testing/activity state state/api state/api/src state/impl state/impl/src state/impl/src/main state/impl/src/main/net state/impl/src/main/net/dpml state/impl/src/main/net/dpml/state state/impl/src/main/net/dpml/state/impl state/src, mcconnell, 04/17/2005

Archive powered by MHonArc 2.6.24.

Top of Page