bloritsch 2002/06/18 07:25:49
Modified: component/src/java/org/apache/avalon/excalibur/component
ExcaliburComponentManager.java
ExcaliburComponentSelector.java
fortress/src/java/org/apache/excalibur/fortress
AbstractContainer.java
instrument-manager/src/java/org/apache/avalon/excalibur/instrument/manager
DefaultInstrumentManager.java
merlin/src/java/org/apache/excalibur/merlin
DefaultComponentManager.java
Log:
add support for new role passing
Revision Changes Path
1.8 +13 -9
jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java
Index: ExcaliburComponentManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ExcaliburComponentManager.java 13 Jun 2002 17:24:50 -0000 1.7
+++ ExcaliburComponentManager.java 18 Jun 2002 14:25:47 -0000 1.8
@@ -258,7 +258,7 @@
{
getLogger().error( message );
}
- throw new ComponentException( message );
+ throw new ComponentException( role, message );
}
ComponentHandler handler =
(ComponentHandler)m_componentHandlers.get( role );
@@ -319,7 +319,7 @@
{
getLogger().debug( message + " for role: " +
role, e );
}
- throw new ComponentException( message, e );
+ throw new ComponentException( role, message, e );
}
m_componentHandlers.put( role, handler );
@@ -338,7 +338,7 @@
{
getLogger().debug( message + " for role: " + role );
}
- throw new ComponentException( message );
+ throw new ComponentException( role, message );
}
Component component = null;
@@ -354,6 +354,11 @@
handler.initialize();
component = handler.get();
}
+ catch( final ComponentException ce )
+ {
+ // Rethrow instead of wrapping a ComponentException with
another one
+ throw ce;
+ }
catch( final Exception e )
{
final String message = "Could not access the Component";
@@ -362,7 +367,7 @@
getLogger().debug( message + " for role: " + role, e );
}
- throw new ComponentException( message, e );
+ throw new ComponentException( role, message, e );
}
}
catch( final Exception e )
@@ -373,7 +378,7 @@
getLogger().debug( message + " for role: " + role, e );
}
- throw new ComponentException( message, e );
+ throw new ComponentException( role, message, e );
}
// Add a mapping between the component and its handler.
@@ -616,7 +621,7 @@
{
if( m_initialized )
{
- throw new ComponentException( "Cannot add components to an
initialized ComponentLocator", null );
+ throw new ComponentException( role, "Cannot add components to an
initialized ComponentLocator" );
}
try
@@ -643,8 +648,7 @@
}
catch( final Exception e )
{
- throw new ComponentException( "Could not set up Component for
role: " +
- role, e );
+ throw new ComponentException( role, "Could not set up
Component.", e );
}
}
1.8 +12 -7
jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java
Index: ExcaliburComponentSelector.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ExcaliburComponentSelector.java 13 Jun 2002 17:24:50 -0000 1.7
+++ ExcaliburComponentSelector.java 18 Jun 2002 14:25:48 -0000 1.8
@@ -254,7 +254,7 @@
getLogger().error( message );
}
- throw new ComponentException( message );
+ throw new ComponentException( hint.toString(), message );
}
ComponentHandler handler =
(ComponentHandler)m_componentHandlers.get( hint );
@@ -267,7 +267,7 @@
{
getLogger().debug( message );
}
- throw new ComponentException( message );
+ throw new ComponentException( hint.toString(), message );
}
Component component = null;
@@ -276,6 +276,11 @@
{
component = handler.get();
}
+ catch( final ComponentException ce )
+ {
+ //rethrow
+ throw ce;
+ }
catch( final Exception e )
{
final String message = getName() + ": ComponentSelector could
not access the Component for hint: " + hint;
@@ -284,7 +289,7 @@
{
getLogger().debug( message, e );
}
- throw new ComponentException( message, e );
+ throw new ComponentException( hint.toString(), message, e );
}
if( null == component )
@@ -294,7 +299,7 @@
{
getLogger().debug( message );
}
- throw new ComponentException( message );
+ throw new ComponentException( hint.toString(), message );
}
m_componentMapping.put( component, handler );
@@ -515,7 +520,7 @@
{
if( m_initialized )
{
- throw new ComponentException( "Cannot add components to an
initialized ComponentSelector", null );
+ throw new ComponentException( hint.toString(), "Cannot add
components to an initialized ComponentSelector", null );
}
try
@@ -546,7 +551,7 @@
getLogger().error( message, e );
}
- throw new ComponentException( message, e );
+ throw new ComponentException( hint.toString(), message, e );
}
}
1.39 +15 -7
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/AbstractContainer.java
Index: AbstractContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/AbstractContainer.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- AbstractContainer.java 17 Jun 2002 18:50:33 -0000 1.38
+++ AbstractContainer.java 18 Jun 2002 14:25:49 -0000 1.39
@@ -322,7 +322,7 @@
if( null == hintMap )
{
- throw new ComponentException( "Component does not exist" );
+ throw new ComponentException( role + "/" + hint.toString(),
"Component does not exist" );
}
if( null == hint )
@@ -341,7 +341,7 @@
if( null == value )
{
- throw new ComponentException( "Component does not exist" );
+ throw new ComponentException( role + "/" + hint.toString(),
"Component does not exist" );
}
return value;
@@ -551,7 +551,7 @@
if( !( temp instanceof ComponentHandler ) )
{
- throw new ComponentException( "Invalid entry in component
manager" );
+ throw new ComponentException( role, "Invalid entry in
component manager" );
}
ComponentHandler handler = (ComponentHandler)temp;
@@ -567,9 +567,13 @@
component = handler.get();
}
+ catch( ComponentException ce )
+ {
+ throw ce; // rethrow
+ }
catch( Exception e )
{
- throw new ComponentException( "Could not return a reference
to the Component", e );
+ throw new ComponentException( role, "Could not return a
reference to the Component", e );
}
m_used.put( component, handler );
@@ -636,7 +640,7 @@
if( null == handler )
{
- throw new ComponentException( "The hint does not exist in
the ComponentSelector" );
+ throw new ComponentException( m_role + "/" +
hint.toString(), "The hint does not exist in the ComponentSelector" );
}
final Component component;
@@ -650,9 +654,13 @@
component = handler.get();
}
+ catch( ComponentException ce )
+ {
+ throw ce; // rethrow
+ }
catch( Exception e )
{
- throw new ComponentException( "Could not return a reference
to the Component", e );
+ throw new ComponentException( m_role + "/" +
hint.toString(), "Could not return a reference to the Component", e );
}
m_used.put( component, handler );
1.8 +7 -7
jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/avalon/excalibur/instrument/manager/DefaultInstrumentManager.java
Index: DefaultInstrumentManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/avalon/excalibur/instrument/manager/DefaultInstrumentManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DefaultInstrumentManager.java 29 Apr 2002 16:58:59 -0000 1.7
+++ DefaultInstrumentManager.java 18 Jun 2002 14:25:49 -0000 1.8
@@ -870,7 +870,7 @@
}
else
{
- throw new ComponentException( "Encountered an unknown
Instrument type for " +
+ throw new ComponentException( profilePointName,
"Encountered an unknown Instrument type for " +
"the Instrument with key,
" + profilePointName + ": " +
profilePoint.getClass().getName() );
}
@@ -903,7 +903,7 @@
break;
default:
- throw new ComponentException(
+ throw new ComponentException( profilePointName,
"Instruments of more than one type are
assigned to name: " +
profilePointName );
}
@@ -927,14 +927,14 @@
break;
default:
- throw new ComponentException(
+ throw new ComponentException( profilePointName,
"Instruments of more than one type are
assigned to name: " +
profilePointName );
}
}
else
{
- throw new ComponentException( "Encountered an unknown
Instrument type for " +
+ throw new ComponentException( profilePointName,
"Encountered an unknown Instrument type for " +
"the Instrument with name,
" + profilePointName + ": " +
profilePoint.getClass().getName() );
}
@@ -948,10 +948,10 @@
// Make sure that the child instrumentable name is set.
if( childInstrumentables[ i ].getInstrumentableName() == null )
{
- String msg = "The getInstrumentableNAme of a child
Instrumentable returned null. " +
+ String msg = "The getInstrumentableName of a child
Instrumentable returned null. " +
"Instance of " + instrumentable.getClass().getName();
getLogger().debug( msg );
- throw new ComponentException( msg );
+ throw new ComponentException(
instrumentable.getClass().getName(), msg );
}
String instrumentableChildName = instrumentableName + "." +
1.5 +2 -2
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/DefaultComponentManager.java
Index: DefaultComponentManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/DefaultComponentManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultComponentManager.java 13 Jun 2002 17:24:51 -0000 1.4
+++ DefaultComponentManager.java 18 Jun 2002 14:25:49 -0000 1.5
@@ -43,7 +43,7 @@
catch( Throwable e )
{
final String error = "Provider related error during service
resolution.";
- throw new ComponentException( error, e );
+ throw new ComponentException( role, error, e );
}
finally
{
@@ -51,7 +51,7 @@
{
return (Component)object;
}
- throw new ComponentException( "Service provider returned a
non-Component." );
+ throw new ComponentException( role, "Service provider returned a
non-Component." );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>