Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2678 - in development/main: metro/composition/control/src/main/net/dpml/composition/control transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/artifact transit/core/handler/src/main/net/dpml/transit/repository transit/core/tools/src/main/net/dpml/transit/tools

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: r2678 - in development/main: metro/composition/control/src/main/net/dpml/composition/control transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/artifact transit/core/handler/src/main/net/dpml/transit/repository transit/core/tools/src/main/net/dpml/transit/tools
  • Date: Mon, 30 May 2005 12:03:57 -0400

Author: mcconnell AT dpml.net
Date: Mon May 30 12:03:57 2005
New Revision: 2678

Modified:

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

development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java

development/main/transit/core/handler/src/main/net/dpml/transit/artifact/Handler.java

development/main/transit/core/handler/src/main/net/dpml/transit/repository/StandardLoader.java

development/main/transit/core/tools/src/main/net/dpml/transit/tools/MainTask.java

development/main/transit/core/tools/src/main/net/dpml/transit/tools/PluginTask.java
Log:
Change the Transit.getInstance() static operation to throw a
TrunsitRuntimeException in preference to a TransitException as this is a
non-recoverable initialization condition.

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionPartHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionPartHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionPartHandler.java
Mon May 30 12:03:57 2005
@@ -38,9 +38,9 @@
import net.dpml.composition.info.Type;
import net.dpml.composition.info.TypeHolder;

-import net.dpml.transit.TransitException;
+import net.dpml.transit.Transit;
import net.dpml.transit.artifact.Handler;
-import net.dpml.transit.repository.StandardLoader;
+import net.dpml.transit.repository.Repository;

/**
* Composition part handler.
@@ -60,20 +60,11 @@
/**
* Transit repository handler used for resolving foreign handlers.
*/
- private final StandardLoader m_loader;
+ private final Repository m_loader;

public CompositionPartHandler()
{
- try
- {
- m_loader = new StandardLoader();
- }
- catch( TransitException e )
- {
- final String error =
- "Internal error during handler initialization.";
- throw new PartHandlerRuntimeException( error, e );
- }
+ m_loader = Transit.getInstance().getRepository();
}

/**

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
Mon May 30 12:03:57 2005
@@ -143,16 +143,25 @@
* @exception TransitException if an error occurs during establishment
*/
public static Transit getInstance()
- throws TransitException, NullArgumentException
+ throws TransitRuntimeException, NullArgumentException
{
synchronized( Transit.class )
{
if( m_INSTANCE == null )
{
- Logger logger = new LoggingAdapter();
- Preferences prefs = Preferences.userNodeForPackage(
Transit.class );
- TransitModel model = new TransitManager( logger, prefs );
- return getInstance( model );
+ try
+ {
+ Logger logger = new LoggingAdapter();
+ Preferences prefs = Preferences.userNodeForPackage(
Transit.class );
+ TransitModel model = new TransitManager( logger, prefs
);
+ return getInstance( model );
+ }
+ catch( TransitException e )
+ {
+ String message = e.getMessage();
+ Throwable cause = e.getCause();
+ throw new TransitRuntimeException( message, cause );
+ }
}
else
{

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/Handler.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/Handler.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/Handler.java
Mon May 30 12:03:57 2005
@@ -28,6 +28,7 @@

import net.dpml.transit.Transit;
import net.dpml.transit.TransitException;
+import net.dpml.transit.TransitRuntimeException;
import net.dpml.transit.SecuredTransitContext;

/**
@@ -69,11 +70,6 @@
Transit.getInstance();
m_context = SecuredTransitContext.getInstance();
}
- catch( TransitException e )
- {
- e.printStackTrace();
- throw e;
- }
catch( RuntimeException e )
{
e.printStackTrace();
@@ -273,7 +269,7 @@
log.println(
"---------------------------------------------------" );
e.printStackTrace( log );
}
- catch( TransitException f )
+ catch( TransitRuntimeException f )
{
// Panic!!!! Should not happen.
f.printStackTrace();

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/repository/StandardLoader.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/repository/StandardLoader.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/repository/StandardLoader.java
Mon May 30 12:03:57 2005
@@ -50,42 +50,10 @@
implements Repository
{
//
------------------------------------------------------------------------
- // state
- //
------------------------------------------------------------------------
-
- /**
- * The repository monitor.
- */
- private final RepositoryMonitorRouter m_monitor;
-
- //
------------------------------------------------------------------------
- // constructor
- //
------------------------------------------------------------------------
-
- /**
- * Creation of a new loader using the supplied initial context.
- * @exception TransitException if a bootstrapping error occurs
- */
- public StandardLoader()
- throws TransitException
- {
- m_monitor = Transit.getInstance().getRepositoryMonitorRouter();
- }
-
- //
------------------------------------------------------------------------
// Repository
//
------------------------------------------------------------------------

/**
- * Return the repository monitor router.
- * @return the router
- */
- public RepositoryMonitorRouter getRepositoryMonitorRouter()
- {
- return m_monitor;
- }
-
- /**
* Get a plugin classloader relative to a supplied uri.
*
* @param parent the parent classloader
@@ -177,15 +145,10 @@
{
throw new NullArgumentException( "parent" );
}
- if( m_monitor != null )
- {
- m_monitor.getPluginRequested( parent, uri, args );
- }
-
try
{
Plugin descriptor = getPluginDescriptor( uri );
- m_monitor.sequenceInfo( "building classload stack" );
+ getMonitor().sequenceInfo( "building classload stack" );
ClassLoader classloader = createClassLoader( parent, descriptor
);
String classname = descriptor.getClassname();
if( null == classname )
@@ -197,13 +160,13 @@
throw new IOException( error );
}
Class clazz = loadPluginClass( classloader, classname );
- m_monitor.establishedPluginClass( clazz );
+ getMonitor().establishedPluginClass( clazz );
return createPlugin( classloader, descriptor, clazz, args );
}
catch( Exception ce )
{
String error = "Unable to create a plugin using [" + uri + "].";
- m_monitor.exceptionOccurred( "getPlugin", ce );
+ getMonitor().exceptionOccurred( "getPlugin", ce );
throw new RepositoryException( error, ce );
}
}
@@ -455,10 +418,7 @@
try
{
Object instance = constructor.newInstance( arguments );
- if( m_monitor != null )
- {
- m_monitor.pluginInstantiated( instance );
- }
+ getMonitor().pluginInstantiated( instance );
return instance;
}
catch( InvocationTargetException e )
@@ -634,10 +594,7 @@
else
{
ClassLoader loader = new StandardClassLoader( type, qualified,
parent );
- if( m_monitor != null )
- {
- m_monitor.classloaderConstructed( type.toString(), loader );
- }
+ getMonitor().classloaderConstructed( type.toString(), loader );
return loader;
}
}
@@ -802,4 +759,10 @@
return base;
}
}
+
+ private RepositoryMonitorRouter getMonitor()
+ {
+ return Transit.getInstance().getRepositoryMonitorRouter();
+ }
+
}

Modified:
development/main/transit/core/tools/src/main/net/dpml/transit/tools/MainTask.java
==============================================================================
---
development/main/transit/core/tools/src/main/net/dpml/transit/tools/MainTask.java
(original)
+++
development/main/transit/core/tools/src/main/net/dpml/transit/tools/MainTask.java
Mon May 30 12:03:57 2005
@@ -176,7 +176,7 @@
instance.getNetworkMonitorRouter().addMonitor(
new NetworkMonitorAdapter( adapter ) );
}
- catch( TransitException e )
+ catch( Throwable e )
{
final String error =
"Failed to initialize Transit.";

Modified:
development/main/transit/core/tools/src/main/net/dpml/transit/tools/PluginTask.java
==============================================================================
---
development/main/transit/core/tools/src/main/net/dpml/transit/tools/PluginTask.java
(original)
+++
development/main/transit/core/tools/src/main/net/dpml/transit/tools/PluginTask.java
Mon May 30 12:03:57 2005
@@ -553,7 +553,7 @@
{
return new StandardLoader();
}
- catch( TransitException e )
+ catch( Throwable e )
{
final String error =
"Internal error while attemting to resolve Transit
repository.";



  • svn commit: r2678 - in development/main: metro/composition/control/src/main/net/dpml/composition/control transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/artifact transit/core/handler/src/main/net/dpml/transit/repository transit/core/tools/src/main/net/dpml/transit/tools, mcconnell, 05/30/2005

Archive powered by MHonArc 2.6.24.

Top of Page