Skip to Content.
Sympa Menu

notify-dpml - r1328 - in trunk/main: lang/component/etc lang/part/etc metro/component/src/main/net/dpml/component metro/model/src/main/net/dpml/metro metro/runtime station station/exec/src/main/net/dpml/station/exec transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/util

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: r1328 - in trunk/main: lang/component/etc lang/part/etc metro/component/src/main/net/dpml/component metro/model/src/main/net/dpml/metro metro/runtime station station/exec/src/main/net/dpml/station/exec transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/util
  • Date: Thu, 6 Apr 2006 19:21:15 +0200

Author: mcconnell
Date: 2006-04-06 19:21:00 +0200 (Thu, 06 Apr 2006)
New Revision: 1328

Removed:
trunk/main/station/exec/src/main/net/dpml/station/exec/AbstractAdapter.java

trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
Modified:
trunk/main/lang/component/etc/component.xsd
trunk/main/lang/part/etc/part.xsd
trunk/main/metro/component/src/main/net/dpml/component/Model.java
trunk/main/metro/model/src/main/net/dpml/metro/ComponentModelManager.java
trunk/main/metro/runtime/build.xml

trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
trunk/main/station/module.xml
trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
trunk/main/transit/core/src/main/net/dpml/util/StandardFormatter.java
Log:
resolve duplicate classloading issue in station/exec

Modified: trunk/main/lang/component/etc/component.xsd
===================================================================
--- trunk/main/lang/component/etc/component.xsd 2006-04-06 08:11:05 UTC (rev
1327)
+++ trunk/main/lang/component/etc/component.xsd 2006-04-06 17:21:00 UTC (rev
1328)
@@ -16,7 +16,6 @@
<element name="categories" type="this:CategoriesType"
substitutionGroup="this:category"/>
<element name="entry" type="this:EntryType"/>
<element name="param" type="part:ValueType"
substitutionGroup="part:param"/>
- <!--<element name="part" type="this:TaggedComponent"/>-->
<element name="parts" type="this:parts"/>

<complexType name="strategy">
@@ -43,6 +42,7 @@
<attribute name="lifestyle" type="this:lifestyle"/>
<attribute name="collection" type="this:collection"/>
<attribute name="activation" type="this:activation"/>
+ <attribute name="handler" type="part:URI"
default="link:part:dpml/metro/dpml-metro-runtime"/>
</extension>
</complexContent>
</complexType>

Modified: trunk/main/lang/part/etc/part.xsd
===================================================================
--- trunk/main/lang/part/etc/part.xsd 2006-04-06 08:11:05 UTC (rev 1327)
+++ trunk/main/lang/part/etc/part.xsd 2006-04-06 17:21:00 UTC (rev 1328)
@@ -101,6 +101,11 @@
</extension>
</complexContent>
</complexType>
+
+ <simpleType name="URI">
+ <restriction base="anyURI"/>
+ </simpleType>
+

</schema>


Modified: trunk/main/metro/component/src/main/net/dpml/component/Model.java
===================================================================
--- trunk/main/metro/component/src/main/net/dpml/component/Model.java
2006-04-06 08:11:05 UTC (rev 1327)
+++ trunk/main/metro/component/src/main/net/dpml/component/Model.java
2006-04-06 17:21:00 UTC (rev 1328)
@@ -61,6 +61,13 @@
ActivationPolicy getActivationPolicy() throws RemoteException;

/**
+ * Set the component activation policy to the supplied value.
+ * @param policy the new activation policy
+ * @exception RemoteException if a remote I/O error occurs
+ */
+ void setActivationPolicy( ActivationPolicy policy ) throws
RemoteException;
+
+ /**
* Add a listener to the component model.
* @param listener the model listener
* @exception RemoteException if a remote exception occurs

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/ComponentModelManager.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/ComponentModelManager.java
2006-04-06 08:11:05 UTC (rev 1327)
+++ trunk/main/metro/model/src/main/net/dpml/metro/ComponentModelManager.java
2006-04-06 17:21:00 UTC (rev 1328)
@@ -61,13 +61,6 @@
throws UnknownKeyException, RemoteException;

/**
- * Set the component activation policy to the supplied value.
- * @param policy the new activation policy
- * @exception RemoteException if a remote I/O error occurs
- */
- void setActivationPolicy( ActivationPolicy policy ) throws
RemoteException;
-
- /**
* Override the assigned collection policy.
* @param policy the collection policy value
* @exception RemoteException if a remote I/O error occurs

Modified: trunk/main/metro/runtime/build.xml
===================================================================
--- trunk/main/metro/runtime/build.xml 2006-04-06 08:11:05 UTC (rev 1327)
+++ trunk/main/metro/runtime/build.xml 2006-04-06 17:21:00 UTC (rev 1328)
@@ -45,11 +45,13 @@
</rmic>
</target>

+ <!--
<target name="install" depends="standard.install">
<x:property feature="uri" type="part" name="builder.uri"/>
<mkdir dir="${dpml.cache}/dpml/lang/parts"/>
<echo file="${dpml.cache}/dpml/lang/parts/dpml-component.part.link"
message="${builder.uri}"/>
</target>
+ -->

</project>


Deleted:
trunk/main/station/exec/src/main/net/dpml/station/exec/AbstractAdapter.java
===================================================================
---
trunk/main/station/exec/src/main/net/dpml/station/exec/AbstractAdapter.java
2006-04-06 08:11:05 UTC (rev 1327)
+++
trunk/main/station/exec/src/main/net/dpml/station/exec/AbstractAdapter.java
2006-04-06 17:21:00 UTC (rev 1328)
@@ -1,177 +0,0 @@
-/*
- * Copyright 2005 Stephen McConnell
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.station.exec;
-
-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
-import java.lang.reflect.InvocationTargetException;
-
-import net.dpml.component.Component;
-import net.dpml.component.ControlException;
-import net.dpml.component.Provider;
-import net.dpml.component.Service;
-import net.dpml.component.ServiceNotFoundException;
-import net.dpml.component.ActivationPolicy;
-
-import net.dpml.util.Logger;
-
-/**
- * The AbstractAdapter class is a minimalistic implementation of a part
- * handler.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class AbstractAdapter extends UnicastRemoteObject implements Component
-{
-
//------------------------------------------------------------------------------
- // state
-
//------------------------------------------------------------------------------
-
- private final Logger m_logger;
-
- private boolean m_activated = false;
-
-
//------------------------------------------------------------------------------
- // constructor
-
//------------------------------------------------------------------------------
-
- /**
- * Creation of a new abstract handler.
- * @param logger the assigned logging channel
- * @exception RemoteException if a remote exception occurs
- */
- public AbstractAdapter( Logger logger ) throws RemoteException
- {
- super();
- m_logger = logger;
- }
-
-
//------------------------------------------------------------------------------
- // Component
-
//------------------------------------------------------------------------------
-
- /**
- * Get the activation policy. If the activation policy is STARTUP, an
implementation
- * a handler shall immidiately activation a runtime instance. If the
policy is on DEMAND
- * an implementation shall defer activiation until an explicit request is
received. If
- * the policy if SYSTEM activation may occur at the discretion of an
implementation.
- *
- * @return the activation policy
- * @exception RemoteException if a remote exception occurs
- * @see ActivationPolicy#SYSTEM
- * @see ActivationPolicy#STARTUP
- * @see ActivationPolicy#DEMAND
- */
- public ActivationPolicy getActivationPolicy() throws RemoteException
- {
- return ActivationPolicy.SYSTEM;
- }
-
- /**
- * Return a handler capable of supporting the requested service.
- * @param service the service descriptor
- * @return a component matching the requested service
- * @exception ServiceNotFoundException if the request service cannot be
resolved
- * @exception RemoteException if a remote exception occurs
- */
- public Component lookup( Service service ) throws
ServiceNotFoundException, RemoteException
- {
- throw new UnsupportedOperationException( "lookup/1" );
- }
-
- /**
- * Initiate activation of the runtime handler.
- * @exception ControlException if an activation error occurs
- * @exception InvocationTargetException if the component declares
activation on startup
- * and a implementation instantiation exception occurs
- * @exception RemoteException if a remote exception occurs
- */
- public void commission() throws ControlException,
InvocationTargetException, RemoteException
- {
- m_activated = true;
- }
-
- /**
- * Returns the active status of the handler.
- * @return TRUE if the handler has been activated otherwise FALSE
- * @exception RemoteException if a remote exception occurs
- */
- public boolean isActive() throws RemoteException
- {
- return m_activated;
- }
-
- /**
- * Return the number of instances currently under management.
- * @return the instance count.
- * @exception RemoteException if a remote exception occurs
- */
- public int size() throws RemoteException
- {
- return 0;
- }
-
- /**
- * Return a reference to a instance of the component handled by the
handler.
- * @return the instance manager
- * @exception InvocationTargetException if the component instantiation
process
- * is on demand and an target invocation error occurs
- * @exception ControlException if the component could not be established
due to a handler
- * related error
- * @exception RemoteException if a remote exception occurs
- */
- public Provider getProvider() throws ControlException,
InvocationTargetException, RemoteException
- {
- throw new UnsupportedOperationException( "getProvider/0" );
- }
-
- /**
- * Deactivate the handler.
- * @exception RemoteException if a remote exception occurs
- */
- public void decommission() throws RemoteException
- {
- m_activated = false;
- }
-
- /**
- * Test is this component can provide the requested service.
- * @param service the service defintion
- * @return true if the handler supports the requested service
- * @exception RemoteException if a remote exception occurs
- */
- public boolean isaCandidate( Service service ) throws RemoteException
- {
- throw new UnsupportedOperationException( "isaCandidate/1" );
- }
-
-
//------------------------------------------------------------------------------
- // internals
-
//------------------------------------------------------------------------------
-
- /**
- * Return the assigned logging channel.
- * @return the logging channel
- */
- protected Logger getLogger()
- {
- return m_logger;
- }
-}

Modified:
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
===================================================================
---
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
2006-04-06 08:11:05 UTC (rev 1327)
+++
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
2006-04-06 17:21:00 UTC (rev 1328)
@@ -27,6 +27,9 @@
import java.util.Set;

import net.dpml.component.Component;
+import net.dpml.component.Model;
+import net.dpml.component.Composition;
+import net.dpml.component.ActivationPolicy;

import net.dpml.station.Station;
import net.dpml.station.Callback;
@@ -36,6 +39,8 @@
import net.dpml.util.PropertyResolver;

import net.dpml.lang.PID;
+import net.dpml.lang.Part;
+
import net.dpml.util.Logger;

import net.dpml.cli.Option;
@@ -113,7 +118,7 @@
super();
m_logger = logger;

- Thread.currentThread().setContextClassLoader(
getClass().getClassLoader() );
+ Thread.currentThread().setContextClassLoader(
Composition.class.getClassLoader() );

if( logger.isDebugEnabled() )
{
@@ -220,7 +225,15 @@
String type = artifact.getType();
if( type.equals( "part" ) )
{
- return new ComponentAdapter( logger, partition, uri, config,
params, categories, properties );
+ Part part = Part.load( uri );
+ if( part instanceof Composition )
+ {
+ Composition composition = (Composition) part;
+ Model model = composition.getModel();
+ model.setActivationPolicy( ActivationPolicy.STARTUP );
+ return composition.newComponent();
+ }
+ //return new ComponentAdapter( logger, partition, uri,
config, params, categories, properties );
}
}


Deleted:
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
===================================================================
---
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
2006-04-06 08:11:05 UTC (rev 1327)
+++
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
2006-04-06 17:21:00 UTC (rev 1328)
@@ -1,289 +0,0 @@
-/*
- * Copyright 2005 Stephen McConnell
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.station.exec;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Properties;
-import java.util.Enumeration;
-
-import net.dpml.station.ApplicationException;
-
-import net.dpml.metro.ComponentModelManager;
-import net.dpml.metro.ContextModelManager;
-import net.dpml.metro.info.EntryDescriptor;
-import net.dpml.metro.data.ValueDirective;
-
-import net.dpml.component.ActivationPolicy;
-import net.dpml.component.ControlException;
-import net.dpml.component.ServiceNotFoundException;
-import net.dpml.component.Controller;
-import net.dpml.component.ControllerContext;
-import net.dpml.component.InitialContext;
-import net.dpml.component.Component;
-import net.dpml.component.Provider;
-import net.dpml.component.Model;
-import net.dpml.component.Service;
-
-import net.dpml.configuration.Configurable;
-import net.dpml.configuration.Configuration;
-import net.dpml.configuration.impl.DefaultConfigurationBuilder;
-
-import net.dpml.util.Logger;
-
-import net.dpml.lang.Part;
-import net.dpml.lang.Plugin;
-
-/**
- * The ComponentAdapter provides support for the establishment of a part
- * controller and delegation of handler requests to the part handler
- * resolved from its associated controller.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class ComponentAdapter extends AbstractAdapter
-{
-
//------------------------------------------------------------------------------
- // immutable state
-
//------------------------------------------------------------------------------
-
- private final URI m_codebase;
-
- private final Controller m_controller;
-
-
//------------------------------------------------------------------------------
- // state
-
//------------------------------------------------------------------------------
-
- private Component m_component;
- private Object m_object;
- private Provider m_instance;
-
-
//------------------------------------------------------------------------------
- // constructor
-
//------------------------------------------------------------------------------
-
- /**
- * Creation of a new component adapter.
- * @param logger the assigned logging channel
- * @param partition the partition name
- * @param codebase the codebase uri
- * @param config a configuration uri
- * @param params a parameters uri
- * @param categories a categories uri
- * @param properties context override properties
- * @exception Exception if an error occurs
- */
- public ComponentAdapter(
- Logger logger, String partition, URI codebase, URI config, URI params,
- URI categories, Properties properties ) throws Exception
- {
- super( logger );
-
- m_codebase = codebase;
-
- try
- {
- ClassLoader classloader = Controller.class.getClassLoader();
- URI uri = new URI( "@COMPOSITION-CONTROLLER-URI@" );
- Part part = Part.load( uri );
- InitialContext context = new InitialContext( partition );
- if( part instanceof Plugin )
- {
- Plugin plugin = (Plugin) part;
- Class c = plugin.getPluginClass();
- Constructor constructor = c.getConstructor( new
Class[]{ControllerContext.class} );
- m_controller = (Controller) constructor.newInstance( new
Object[]{context} );
- }
- else
- {
- m_controller = (Controller) part.instantiate( new
Object[]{context} );
- }
- }
- catch( Exception e )
- {
- final String error =
- "Internal error while attempting to establish the standard
part controller.";
- throw new ApplicationException( error, e );
- }
-
- logger.debug( "loading component model" );
- Model model = m_controller.createModel( codebase );
-
- logger.debug( "loading component manager" );
- m_component = m_controller.createComponent( model );
-
- logger.debug( "handling configuration" );
- if( null != config )
- {
- if( model instanceof Configurable )
- {
- logger.info( "applying configuration: " + config );
- try
- {
- DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
- URL url = config.toURL();
- InputStream input = url.openStream();
- Configuration configuration = builder.build( input );
- Configurable configurable = (Configurable) model;
- configurable.configure( configuration );
- }
- catch( Exception e )
- {
- final String error =
- "Error loading configuration: " + config;
- throw new ApplicationException( error, e );
- }
- }
- else
- {
- final String error =
- "Cannot apply a configuration to a non-configurable
managment context."
- + "\nManagement Context: " + model.getClass().getName();
- throw new ApplicationException( error );
- }
- }
-
- if( null != params )
- {
- throw new UnsupportedOperationException( "Parameters not
currently supported." );
- }
-
- if( model instanceof ComponentModelManager )
- {
- ComponentModelManager componentModel = (ComponentModelManager)
model;
- ContextModelManager cm = componentModel.getContextManager();
- Enumeration names = properties.propertyNames();
- while( names.hasMoreElements() )
- {
- String key = (String) names.nextElement();
- String value = properties.getProperty( key );
- EntryDescriptor entry = cm.getEntryDescriptor( key );
- String classname = entry.getClassname();
- ValueDirective v = new ValueDirective( classname, value );
- cm.setEntryDirective( key, v );
- }
- }
- else
- {
- final String error =
- "Context class not recognized: "
- + model.getClass().getName();
- throw new UnsupportedOperationException( error );
- }
- logger.debug( "ready" );
- }
-
-
//------------------------------------------------------------------------------
- // Component
-
//------------------------------------------------------------------------------
-
- /**
- * Get the activation policy. If the activation policy is STARTUP, an
implementation
- * a handler shall immidiately activation a runtime instance. If the
policy is on DEMAND
- * an implementation shall defer activiation until an explicit request is
received. If
- * the policy if SYSTEM activation may occur at the discretion of an
implementation.
- *
- * @return the activation policy
- * @exception RemoteException if a remote exception occurs
- * @see ActivationPolicy#SYSTEM
- * @see ActivationPolicy#STARTUP
- * @see ActivationPolicy#DEMAND
- */
- public ActivationPolicy getActivationPolicy() throws RemoteException
- {
- return m_component.getActivationPolicy();
- }
-
- /**
- * Return a handler capable of supporting the requested service.
- * @param service the service descriptor
- * @return a component matchi9ng the requested service
- * @exception ServiceNotFoundException if the service could not be
resolved
- * @exception RemoteException if a remote exception occurs
- */
- public Component lookup( Service service ) throws
ServiceNotFoundException, RemoteException
- {
- return m_component.lookup( service );
- }
-
- /**
- * Initiate activation of a runtime handler.
- * @exception ControlException if an activation error occurs
- * @exception InvocationTargetException if the component declares
activation on startup
- * and a implementation source exception occured
- * @exception RemoteException if a remote exception occurs
- */
- public void commission() throws ControlException,
InvocationTargetException, RemoteException
- {
- m_component.decommission();
- m_instance = m_component.getProvider();
- m_object = m_component.getProvider().getValue( false );
- }
-
- /**
- * Return the number of instances currently under management.
- * @return the instance count.
- * @exception RemoteException if a remote exception occurs
- */
- public int size() throws RemoteException
- {
- return m_component.size();
- }
-
- /**
- * Return a reference to a instance of the component handled by the
handler.
- * @return the instance holder
- * @exception InvocationTargetException if the component instantiation
process
- * is on demand and an target invocation error occurs
- * @exception ControlException if the component could not be established
due to a handler
- * related error
- * @exception RemoteException if a remote exception occurs
- */
- public Provider getProvider() throws ControlException,
InvocationTargetException, RemoteException
- {
- return m_component.getProvider();
- }
-
- /**
- * Deactivate the handler.
- * @exception RemoteException if a remote exception occurs
- */
- public void decommission() throws RemoteException
- {
- m_component.decommission();
- }
-
- /**
- * Return true if this handler is a candidate for the supplied service
defintion.
- * @param service the service definition
- * @return true if this is a candidate
- * @exception RemoteException if a remote exception occurs
- */
- public boolean isaCandidate( Service service ) throws RemoteException
- {
- return m_component.isaCandidate( service );
- }
-
-}

Modified: trunk/main/station/module.xml
===================================================================
--- trunk/main/station/module.xml 2006-04-06 08:11:05 UTC (rev 1327)
+++ trunk/main/station/module.xml 2006-04-06 17:21:00 UTC (rev 1328)
@@ -25,13 +25,14 @@
<include ref="dpml/metro/dpml-metro-runtime"/>
</dependencies>
<dependencies>
+ <include ref="dpml/util/dpml-configuration-api" tag="public"/>
+ <include ref="dpml/transit/dpml-transit-main" tag="public"/>
+ <include ref="dpml/metro/dpml-metro-component" tag="public"/>
+ <include ref="dpml/metro/dpml-metro-model" tag="public"/>
+ <include ref="dpml/station/dpml-station-api" tag="public"/>
+ <include ref="dpml/util/dpml-logging-api" tag="public"/>
+ <include ref="dpml/util/dpml-configuration-impl"/>
<include ref="dpml/util/dpml-util-cli"/>
- <include ref="dpml/util/dpml-configuration-api"/>
- <include ref="dpml/util/dpml-configuration-impl"/>
- <include ref="dpml/transit/dpml-transit-main"/>
- <include ref="dpml/metro/dpml-metro-component"/>
- <include ref="dpml/metro/dpml-metro-model"/>
- <include ref="dpml/station/dpml-station-api"/>
</dependencies>
</project>


Modified: trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-04-06 08:11:05 UTC (rev 1327)
+++ trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-04-06 17:21:00 UTC (rev 1328)
@@ -34,6 +34,7 @@
import net.dpml.util.ElementHelper;
import net.dpml.util.DOM3DocumentBuilder;
import net.dpml.util.Decoder;
+import net.dpml.util.DecoderFactory;
import net.dpml.util.DecodingException;

import org.w3c.dom.Document;
@@ -220,7 +221,7 @@

try
{
- URI uri = getDecoderURIFromNamespaceURI( strategy, namespace
);
+ URI uri = getDecoderURI( strategy );
Builder builder = loadForeignBuilder( uri );
return builder.build( information, classpath, strategy );
}
@@ -232,40 +233,53 @@
}
}
}
-
+
/**
- * Get the assigned logging channel.
- * @return the logging channel
+ * Resolve the element decoder uri.
+ *
+ * @param element the DOM element
+ * @return the decoder uri
+ * @exception DecodingException if an error occurs
*/
- protected Logger getLogger()
+ public URI getDecoderURI( Element element ) throws DecodingException
{
- return m_logger;
- }
-
- private URI getDecoderURIFromNamespaceURI( Element element, String urn )
throws DecodingException
- {
+ String uri = ElementHelper.getAttribute( element, "handler" );
+ if( null != uri )
+ {
+ try
+ {
+ return new URI( uri );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Internal error while resolving handler attribute
(expecting uri value)";
+ throw new DecodingException( element, error, e );
+ }
+ }
+ TypeInfo info = element.getSchemaTypeInfo();
+ String namespace = info.getTypeNamespace();
try
{
- URI raw = new URI( urn );
- Artifact artifact = Artifact.createArtifact( raw );
- String scheme = artifact.getScheme();
- String group = artifact.getGroup();
- String name = artifact.getName();
- String type = artifact.getType();
- String version = artifact.getVersion();
- String path = "link:part:" + group + "/" + name;
- Artifact link = Artifact.createArtifact( path );
- return link.toURI();
+ return DecoderFactory.getDecoderURIFromNamespaceURI( namespace );
}
- catch( Throwable e )
+ catch( Exception e )
{
final String error =
- "Unexpected error while resolving builder uri. "
- + "\nNamespace: " + urn;
+ "Internal error while attempting to resolve default decoder
uri.";
throw new DecodingException( element, error, e );
}
}

+ /**
+ * Get the assigned logging channel.
+ * @return the logging channel
+ */
+ protected Logger getLogger()
+ {
+ return m_logger;
+ }
+
private Builder loadForeignBuilder( URI uri ) throws DecodingException,
Exception
{
Part part = loadPart( uri );

Modified: trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
2006-04-06 08:11:05 UTC (rev 1327)
+++ trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
2006-04-06 17:21:00 UTC (rev 1328)
@@ -78,7 +78,7 @@
* a part implemenation will be available.
*
* @param element the DOM element
- * @return the associated helper instance
+ * @return the decoder
* @exception Exception if an eror occurs
*/
public Decoder loadDecoder( Element element ) throws Exception
@@ -91,20 +91,36 @@
}
else
{
- URI uri = getDecoderURI( namespace );
+ URI uri = getDecoderURI( element );
return new DelegatingDecoder( this, uri );
}
}

/**
- * Resolve the element helper uri from a supplied element.
+ * Resolve the decoder uri from a supplied element.
*
- * @param namespace the DOM element namespace
- * @return the builder uri
+ * @param element the DOM element
+ * @return the decoder uri
* @exception Exception if an error occurs
*/
- public URI getDecoderURI( String namespace ) throws Exception
+ public URI getDecoderURI( Element element ) throws Exception
{
+ String uri = ElementHelper.getAttribute( element, "handler" );
+ if( null != uri )
+ {
+ try
+ {
+ return new URI( uri );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Internal error while resolving handler attribute
(expecting uri value)";
+ throw new DecodingException( element, error, e );
+ }
+ }
+ TypeInfo info = element.getSchemaTypeInfo();
+ String namespace = info.getTypeNamespace();
if( m_map.containsKey( namespace ) )
{
return (URI) m_map.get( namespace );
@@ -115,7 +131,10 @@
}
}

- private URI getDecoderURIFromNamespaceURI( String urn ) throws Exception
+ /**
+ * Resolve the part handler given an element namespace.
+ */
+ public static URI getDecoderURIFromNamespaceURI( String urn ) throws
Exception
{
URI raw = new URI( urn );
Artifact artifact = Artifact.createArtifact( raw );
@@ -124,7 +143,6 @@
String name = artifact.getName();
String type = artifact.getType();
String version = artifact.getVersion();
-
String path = "link:part:" + group + "/" + name;
Artifact link = Artifact.createArtifact( path );
return link.toURI();

Modified:
trunk/main/transit/core/src/main/net/dpml/util/StandardFormatter.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/StandardFormatter.java
2006-04-06 08:11:05 UTC (rev 1327)
+++ trunk/main/transit/core/src/main/net/dpml/util/StandardFormatter.java
2006-04-06 17:21:00 UTC (rev 1328)
@@ -47,6 +47,10 @@
*/
public synchronized String format( LogRecord record )
{
+ if( null == record )
+ {
+ return "";
+ }
String process = getProcessHeader( record );
StringBuffer buffer = new StringBuffer( process );
String header = getLogHeader( record );
@@ -74,7 +78,7 @@
private String getFormattedMessage( LogRecord record )
{
String message = formatMessage( record );
- if( message.startsWith( "$[" ) )
+ if( ( null != message ) && message.startsWith( "$[" ) )
{
int n = message.indexOf( "] " );
return message.substring( n + 2 );
@@ -100,7 +104,7 @@
StringBuffer buffer = new StringBuffer();
buffer.append( "[" );
String message = record.getMessage();
- if( message.startsWith( "$[" ) )
+ if( ( null != message ) && ( message.startsWith( "$[" ) ) )
{
int n = message.indexOf( "] " );
String id = message.substring( 2, n );




  • r1328 - in trunk/main: lang/component/etc lang/part/etc metro/component/src/main/net/dpml/component metro/model/src/main/net/dpml/metro metro/runtime station station/exec/src/main/net/dpml/station/exec transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/util, mcconnell at BerliOS, 04/06/2006

Archive powered by MHonArc 2.6.24.

Top of Page