Skip to Content.
Sympa Menu

notify-dpml - r1520 - in trunk/main/metro: model/src/main/net/dpml/metro/info state

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: r1520 - in trunk/main/metro: model/src/main/net/dpml/metro/info state
  • Date: Tue, 20 Jun 2006 08:21:10 +0200

Author: mcconnell
Date: 2006-06-20 08:21:08 +0200 (Tue, 20 Jun 2006)
New Revision: 1520

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/info/Type.java
trunk/main/metro/state/
Log:
housekeeping

Modified: trunk/main/metro/model/src/main/net/dpml/metro/info/Type.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/info/Type.java
2006-06-20 06:01:51 UTC (rev 1519)
+++ trunk/main/metro/model/src/main/net/dpml/metro/info/Type.java
2006-06-20 06:21:08 UTC (rev 1520)
@@ -22,8 +22,12 @@
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URL;

import net.dpml.state.State;
+import net.dpml.state.StateDecoder;
+import net.dpml.state.StateBuilderRuntimeException;

/**
* This class contains the meta information about a particular
@@ -47,6 +51,8 @@
{
static final long serialVersionUID = 1L;

+ private static final StateDecoder STATE_DECODER = new StateDecoder();
+
private final InfoDescriptor m_info;
private final CategoryDescriptor[] m_categories;
private final ContextDescriptor m_context;
@@ -309,7 +315,8 @@
new ServiceDescriptor( subject.getName() )
};
final PartReference[] parts = new PartReference[0];
- return new Type( info, loggers, context, services, parts,
State.NULL_STATE );
+ State state = loadStateFromResource( subject );
+ return new Type( info, loggers, context, services, parts, state );
}

private static ContextDescriptor createContextDescriptor( Class subject
)
@@ -461,4 +468,30 @@
}
return null;
}
+
+ private static State loadStateFromResource( Class subject )
+ {
+ String resource = subject.getName().replace( '.', '/' ) + ".xgraph";
+ try
+ {
+ URL url = subject.getClassLoader().getResource( resource );
+ if( null == url )
+ {
+ return State.NULL_STATE;
+ }
+ else
+ {
+ URI uri = new URI( url.toString() );
+ return STATE_DECODER.loadState( uri );
+ }
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Internal error while attempting to load component state graph
resource ["
+ + resource
+ + "].";
+ throw new StateBuilderRuntimeException( error, e );
+ }
+ }
}


Property changes on: trunk/main/metro/state
___________________________________________________________________
Name: svn:ignore
+ target





  • r1520 - in trunk/main/metro: model/src/main/net/dpml/metro/info state, mcconnell at BerliOS, 06/20/2006

Archive powered by MHonArc 2.6.24.

Top of Page