mcconnell 2002/07/30 07:34:04
Modified: assembly/src/java/org/apache/excalibur/merlin/assembly
ProfileManager.java
assembly/src/java/org/apache/excalibur/merlin/assembly/resource
DefaultManager.java ProfileDesignator.java
assembly/src/java/org/apache/excalibur/merlin/model
Resource.java
assembly/src/java/org/apache/excalibur/meta/info
ExtensionDescriptor.java
Log:
more refinements in preparation for pluggable factories
Revision Changes Path
1.4 +5 -3
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ProfileManager.java
Index: ProfileManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ProfileManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProfileManager.java 30 Jul 2002 13:49:07 -0000 1.3
+++ ProfileManager.java 30 Jul 2002 14:34:04 -0000 1.4
@@ -482,8 +482,10 @@
if(( resource == null ) && create )
{
final String name = getPath() + DELIMITER + profile.getName();
- resource = new ProfileDesignator( name, profile, m_helper,
m_provider );
- m_resources.put( profile, resource );
+ ProfileDesignator designator = new ProfileDesignator( name,
profile, m_helper, m_provider );
+ designator.enableLogging( getLogger().getChildLogger( "resource" )
);
+ m_resources.put( profile, designator );
+ resource = designator;
}
return resource;
}
1.3 +7 -3
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/resource/DefaultManager.java
Index: DefaultManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/resource/DefaultManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultManager.java 30 Jul 2002 13:49:07 -0000 1.2
+++ DefaultManager.java 30 Jul 2002 14:34:04 -0000 1.3
@@ -68,7 +68,9 @@
{
try
{
- return resource.access();
+ Object object = resource.access();
+ m_mapping.put( object, resource );
+ return object;
}
catch( Throwable e )
{
@@ -83,9 +85,11 @@
* Release a pooled object.
* @param object a pooled object
*/
- public void put( Object object )
+ public void put( Object object )
{
- // nothing to do in a singleton
+ final Resource resource = (Resource) m_mapping.get( object );
+ resource.release( object );
+ m_mapping.remove( object );
}
}
1.4 +20 -10
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/resource/ProfileDesignator.java
Index: ProfileDesignator.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/resource/ProfileDesignator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProfileDesignator.java 30 Jul 2002 13:49:07 -0000 1.3
+++ ProfileDesignator.java 30 Jul 2002 14:34:04 -0000 1.4
@@ -25,7 +25,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public class ProfileDesignator implements Resource
+public class ProfileDesignator extends AbstractLogEnabled implements Resource
{
// ########################### SINGELTON ONLY ############################
@@ -70,8 +70,8 @@
/**
* Create a profile designator instance.
*
- * @param path the path of the profile designator
- * @param profile the profile
+ * @param path the resource path
+ * @param profile the resource's profile
* @param helper the lifecycle helper
* @param provider the resource provider
*/
@@ -124,7 +124,7 @@
}
/**
- * Get the resource instance.
+ * Creation of a new instance of the coponent instance.
*
* @return the service instance.
* @exception LifecycleException if an error occurs while establishing the
object
@@ -139,7 +139,7 @@
}
/**
- * Get the resource instance.
+ * Access an established resource instance.
*
* @return the service instance.
* @exception LifecycleException if an error occurs while establishing the
object
@@ -155,16 +155,26 @@
}
/**
- * Release the service instance.
+ * Release an established service instance.
*/
- public void release( Object object ) throws Exception
+ public void release( Object object )
{
if( !m_released )
- handleExtensions( ExtensionDescriptor.RELEASE, object );
+ {
+ try
+ {
+ handleExtensions( ExtensionDescriptor.RELEASE, object );
+ }
+ catch( Throwable e )
+ {
+ final String error = "Release inconsitency - extension handler
throw and exception.";
+ getLogger().error( error, e );
+ }
+ }
}
/**
- * Destroy the service instance.
+ * Destroy the service.
*/
public void destroy() throws Exception
{
1.2 +2 -2
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Resource.java
Index: Resource.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Resource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Resource.java 30 Jul 2002 13:52:04 -0000 1.1
+++ Resource.java 30 Jul 2002 14:34:04 -0000 1.2
@@ -67,7 +67,7 @@
/**
* Release the service instance.
*/
- public void release( Object instance ) throws Exception;
+ public void release( Object instance );
/**
* Destroy the resource.
1.4 +2 -2
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/ExtensionDescriptor.java
Index: ExtensionDescriptor.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/ExtensionDescriptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExtensionDescriptor.java 30 Jul 2002 13:49:08 -0000 1.3
+++ ExtensionDescriptor.java 30 Jul 2002 14:34:04 -0000 1.4
@@ -99,7 +99,7 @@
/**
* Return the lifecycle stage that this phase is to be applied under.
*
- * @return one of the phase values {@link #CREATE}, {@link #ACCESS}, {@link
#RELEASE}, {@link #DESTORY},
+ * @return one of the phase values {@link #CREATE}, {@link #ACCESS}, {@link
#RELEASE}, {@link #DESTROY},
* {@link #INNER}, {@link #OUTER}, or {@link #ALL}.
*/
public int getStage()
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>