Skip to Content.
Sympa Menu

notify-dpml - r1934 - in trunk/main: depot/tools/src/main/dpml/tools/tasks metro/appliance/src/main/dpml/station/info metro/part/src/main/net/dpml/lang metro/part/src/main/net/dpml/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: r1934 - in trunk/main: depot/tools/src/main/dpml/tools/tasks metro/appliance/src/main/dpml/station/info metro/part/src/main/net/dpml/lang metro/part/src/main/net/dpml/runtime
  • Date: Mon, 26 Mar 2007 06:29:39 +0200

Author: mcconnell
Date: 2007-03-26 06:29:36 +0200 (Mon, 26 Mar 2007)
New Revision: 1934

Modified:
trunk/main/depot/tools/src/main/dpml/tools/tasks/PackageTask.java

trunk/main/metro/appliance/src/main/dpml/station/info/ApplianceDescriptor.java
trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategyHandler.java
trunk/main/metro/part/src/main/net/dpml/lang/PartContentHandler.java
trunk/main/metro/part/src/main/net/dpml/lang/StrategyHandler.java

trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategyHandler.java
trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
trunk/main/metro/part/src/main/net/dpml/runtime/PartsDirective.java
Log:
updates to provide support for optional checking of context integrity (needed
when we are building a part definition where some non-optional context
entries are undefined

Modified: trunk/main/depot/tools/src/main/dpml/tools/tasks/PackageTask.java
===================================================================
--- trunk/main/depot/tools/src/main/dpml/tools/tasks/PackageTask.java
2007-03-25 04:23:42 UTC (rev 1933)
+++ trunk/main/depot/tools/src/main/dpml/tools/tasks/PackageTask.java
2007-03-26 04:29:36 UTC (rev 1934)
@@ -280,7 +280,7 @@

ClassLoader parent = ClassLoader.getSystemClassLoader();
ClassLoader classloader = getRuntimeClassLoader( parent,
resource );
- Strategy strategy = handler.build( classloader, root,
resource, null, null );
+ Strategy strategy = handler.build( classloader, root,
resource, null, null, false ); /// need validation flag
Part part = new Part( info, classpath, strategy );
File file = type.getFile( true );
File dir = file.getParentFile();

Modified:
trunk/main/metro/appliance/src/main/dpml/station/info/ApplianceDescriptor.java
===================================================================
---
trunk/main/metro/appliance/src/main/dpml/station/info/ApplianceDescriptor.java
2007-03-25 04:23:42 UTC (rev 1933)
+++
trunk/main/metro/appliance/src/main/dpml/station/info/ApplianceDescriptor.java
2007-03-26 04:29:36 UTC (rev 1934)
@@ -59,16 +59,6 @@
m_profile = new ProcessDescriptor( process, resolver );
}

- /*
- public ApplianceDescriptor( InfoDescriptor info, ProcessDescriptor
profile, URI codebase )
- {
- m_info = info;
- m_profile = profile;
- m_codebase = codebase;
- m_element = null;
- }
- */
-
/**
* Return the element defining the scenario descriptor.
* @return the defining element

Modified:
trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategyHandler.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategyHandler.java
2007-03-25 04:23:42 UTC (rev 1933)
+++ trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategyHandler.java
2007-03-26 04:29:36 UTC (rev 1934)
@@ -70,7 +70,8 @@
* @exception IOException if an I/O error occurs
*/
public Strategy build(
- ClassLoader classloader, Element element, Resolver resolver, String
partition, String query ) throws IOException
+ ClassLoader classloader, Element element, Resolver resolver, String
partition,
+ String query, boolean validate ) throws IOException
{
String urn = ElementHelper.getAttribute( element, "urn", null,
resolver );
String path = ElementHelper.getAttribute( element, "path", null,
resolver );

Modified: trunk/main/metro/part/src/main/net/dpml/lang/PartContentHandler.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/PartContentHandler.java
2007-03-25 04:23:42 UTC (rev 1933)
+++ trunk/main/metro/part/src/main/net/dpml/lang/PartContentHandler.java
2007-03-26 04:29:36 UTC (rev 1934)
@@ -453,7 +453,7 @@
{
// otherwise we need to build it

- part = buildPart( classloader, connection, name );
+ part = buildPart( classloader, connection, name, true );
//if( part instanceof PartManager )
//{
// // register it with the mbean server
@@ -477,7 +477,7 @@
{
LOGGER.trace( "building new part: " + url );
}
- return buildPart( classloader, connection, name );
+ return buildPart( classloader, connection, name, true );
}
}
catch( IOException e )
@@ -501,7 +501,8 @@
}
}

- private static Part buildPart( ClassLoader anchor, URLConnection
connection, String name ) throws Exception
+ private static Part buildPart(
+ ClassLoader anchor, URLConnection connection, String name, boolean
validate ) throws Exception
{
URL url = connection.getURL();
if( LOGGER.isTraceEnabled() )
@@ -532,7 +533,7 @@
Element elem = getStrategyElement( element );
StrategyHandler handler = getStrategyHandler( elem );
String query = url.getQuery();
- Strategy strategy = handler.build( classloader, elem,
resolver, name, query );
+ Strategy strategy = handler.build( classloader, elem,
resolver, name, query, validate );
if( LOGGER.isTraceEnabled() )
{
LOGGER.trace(

Modified: trunk/main/metro/part/src/main/net/dpml/lang/StrategyHandler.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/StrategyHandler.java
2007-03-25 04:23:42 UTC (rev 1933)
+++ trunk/main/metro/part/src/main/net/dpml/lang/StrategyHandler.java
2007-03-26 04:29:36 UTC (rev 1934)
@@ -58,9 +58,11 @@
* @param resolver symbolic property resolver
* @param partition the assigned partition
* @param query the query
+ * @param validate if true validate the strategy integrity
* @return the strategy
* @exception IOException if an I/O error occurs
*/
Strategy build(
- ClassLoader classloader, Element element, Resolver resolver, String
partition, String query ) throws IOException;
+ ClassLoader classloader, Element element, Resolver resolver, String
partition,
+ String query, boolean validate ) throws IOException;
}

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategyHandler.java
===================================================================
---
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategyHandler.java
2007-03-25 04:23:42 UTC (rev 1933)
+++
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategyHandler.java
2007-03-26 04:29:36 UTC (rev 1934)
@@ -69,7 +69,7 @@
{
String spec = getComponentName( c, name );
Profile profile = new Profile( c, spec, null );
- ContextModel context = getContextModel( null, c, spec, profile,
null, null, null );
+ ContextModel context = getContextModel( null, c, spec, profile,
null, null, null, true );
PartsDirective parts = profile.getPartsDirective();
return new ComponentStrategy(
null, spec, 0, c, ActivationPolicy.SYSTEM, LifestylePolicy.THREAD,
@@ -92,7 +92,8 @@
* @exception IOException if an I/O error occurs
*/
public Strategy build(
- ClassLoader classloader, Element element, Resolver resolver, String
partition, String query ) throws IOException
+ ClassLoader classloader, Element element, Resolver resolver, String
partition,
+ String query, boolean validate ) throws IOException
{
Class c = loadComponentClass( classloader, element, resolver );
String name = getComponentName( c, element, resolver );
@@ -102,7 +103,9 @@

Query q = new Query( query );
Element contextElement = ElementHelper.getChild( element, "context"
);
- ContextModel context = getContextModel( classloader, c, path,
profile, contextElement, resolver, q );
+ ContextModel context =
+ getContextModel(
+ classloader, c, path, profile, contextElement, resolver, q,
validate );
ActivationPolicy activation = getActivationPolicy( element, profile,
c );
LifestylePolicy lifestyle = getLifestylePolicy( element, profile, c
);
CollectionPolicy collection = getCollectionPolicy( element, profile,
c );
@@ -397,14 +400,15 @@

private static ContextModel getContextModel(
ClassLoader classloader, Class clazz, String path,
- Profile profile, Element element, Resolver resolver, Query query )
throws IOException
+ Profile profile, Element element, Resolver resolver, Query query,
+ boolean validate ) throws IOException
{
boolean policy = getContextHandlingPolicy( clazz );
Constructor constructor = getSingleConstructor( clazz );
Class subject = getContextClass( constructor, policy );
ContextDirective bundled = profile.getContextDirective();
ContextDirective declared = new ContextDirective( classloader,
element, resolver );
- return new ContextModel( clazz, path, subject, policy, bundled,
declared, query );
+ return new ContextModel( clazz, path, subject, policy, bundled,
declared, query, validate );
}

private static boolean getContextHandlingPolicy( Class c )

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
2007-03-25 04:23:42 UTC (rev 1933)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
2007-03-26 04:29:36 UTC (rev 1934)
@@ -43,14 +43,14 @@

ContextModel(
Class clazz, String path, Class subject, boolean policy,
- ContextDirective bundled, ContextDirective directive, Query query )
throws IOException
+ ContextDirective bundled, ContextDirective directive, Query query,
boolean validate ) throws IOException
{
- this( clazz, path, subject, policy, null, bundled, directive, query
);
+ this( clazz, path, subject, policy, null, bundled, directive, query,
validate );
}

private ContextModel(
Class clazz, String path, Class subject, boolean policy, String
keyPath,
- ContextDirective bundled, ContextDirective directive, Query query )
throws IOException
+ ContextDirective bundled, ContextDirective directive, Query query,
boolean validate ) throws IOException
{
m_directive = directive;

@@ -70,7 +70,8 @@
ContextDirective nested = getContextDirective(
directive, key );
try
{
- ContextModel model = new ContextModel( clazz, path,
c, policy, key, parent, nested, query );
+ ContextModel model =
+ new ContextModel( clazz, path, c, policy, key,
parent, nested, query, validate );
if( !optional || ( model.size() > 0 ) )
{
value = model;
@@ -90,7 +91,14 @@
+ "] within the component model ["
+ path
+ "] could not be created.";
- throw new ComponentException( error );
+ if( validate )
+ {
+ throw new ComponentException( error );
+ }
+ else
+ {
+ // m_logger.warn( error );
+ }
}
}
}
@@ -126,7 +134,14 @@
+ "] within the component model ["
+ path
+ "].";
- throw new MissingContextEntryException( error );
+ if( validate )
+ {
+ throw new MissingContextEntryException( error );
+ }
+ else
+ {
+ // m_logger.validate( error );
+ }
}
}
}

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/PartsDirective.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/PartsDirective.java
2007-03-25 04:23:42 UTC (rev 1933)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/PartsDirective.java
2007-03-26 04:29:36 UTC (rev 1934)
@@ -118,7 +118,7 @@
try
{
StrategyHandler handler = PartContentHandler.getStrategyHandler(
element );
- return handler.build( classloader, element, resolver, partition,
null );
+ return handler.build( classloader, element, resolver, partition,
null, true );
}
catch( DecodingException e )
{




  • r1934 - in trunk/main: depot/tools/src/main/dpml/tools/tasks metro/appliance/src/main/dpml/station/info metro/part/src/main/net/dpml/lang metro/part/src/main/net/dpml/runtime, mcconnell at BerliOS, 03/26/2007

Archive powered by MHonArc 2.6.24.

Top of Page