You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/08/23 08:25:14 UTC
cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource AbstractLifestyleHandler.java DefaultLifestyleManager.java DefaultManager.java DefaultResource.java DeploymentException.java DeploymentHelper.java LifecycleException.java LifecycleHelper.java LifestyleHandler.java LifestyleManager.java PooledLifestyleHandler.java SingletonLifestyleHandler.java ThreadLocalLifestyleHandler.java TransientLifestyleHandler.java
mcconnell 2002/08/22 23:25:14
Modified: assembly build.xml
assembly/src/java/org/apache/excalibur/merlin/assembly
ContainerManager.java ProfileRegistry.java
assembly/src/java/org/apache/excalibur/merlin/kernel
DefaultKernel.java
assembly/src/java/org/apache/excalibur/merlin/model
CategoriesDescriptor.java Category.java
ContainerDescriptor.java ContextDirective.java
Entry.java FilesetDescriptor.java Import.java
KernelDescriptor.java LibraryDescriptor.java
LoggingDescriptor.java Parameter.java Profile.java
Resource.java
assembly/src/java/org/apache/excalibur/merlin/model/verifier
MetaDataVerifier.java
assembly/src/java/org/apache/excalibur/merlin/resource
AbstractLifestyleHandler.java
DefaultLifestyleManager.java DefaultManager.java
DefaultResource.java DeploymentException.java
DeploymentHelper.java LifecycleException.java
LifecycleHelper.java LifestyleHandler.java
LifestyleManager.java PooledLifestyleHandler.java
SingletonLifestyleHandler.java
ThreadLocalLifestyleHandler.java
TransientLifestyleHandler.java
Log:
Lots of checkstyle updates.
Revision Changes Path
1.51 +2 -2 jakarta-avalon-excalibur/assembly/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/build.xml,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- build.xml 22 Aug 2002 13:43:01 -0000 1.50
+++ build.xml 23 Aug 2002 06:25:12 -0000 1.51
@@ -275,8 +275,8 @@
allowProtected="false"
allowPackage="false"
allowNoAuthor="false"
- maxLineLen="100"
- maxMethodLen="100"
+ maxLineLen="200"
+ maxMethodLen="180"
maxConstructorLen="100"
memberPattern="^m_[a-z][a-zA-Z0-9]*$"
staticPattern="^c_[a-z][a-zA-Z0-9]*$"
1.26 +2 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ContainerManager.java
Index: ContainerManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ContainerManager.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- ContainerManager.java 22 Aug 2002 13:43:01 -0000 1.25
+++ ContainerManager.java 23 Aug 2002 06:25:13 -0000 1.26
@@ -301,7 +301,7 @@
// setup the assembly sub-system
//
- m_registry = new ProfileRegistry( this, m_map );
+ m_registry = new ProfileRegistry( this );
m_registry.enableLogging( getLocalLogger().getChildLogger( "assembly") );
//
1.16 +24 -30 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ProfileRegistry.java
Index: ProfileRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ProfileRegistry.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ProfileRegistry.java 22 Aug 2002 13:43:01 -0000 1.15
+++ ProfileRegistry.java 23 Aug 2002 06:25:13 -0000 1.16
@@ -50,14 +50,10 @@
/**
* Creation of a new service registry.
* @param manager the container manager
- * @param map the dependency map
*/
- public ProfileRegistry(
- ContainerManager manager,
- DependencyGraph map )
+ public ProfileRegistry( ContainerManager manager )
{
m_manager = manager;
- m_map = map;
}
//=======================================================================
@@ -98,7 +94,6 @@
{
getLogger().debug("assembly target: " + profile );
assembleProfile( map, profile, context, visited, "" );
- //m_map.add( profile );
map.add( profile );
try
{
@@ -134,7 +129,6 @@
ArrayList visited = new ArrayList();
assembleProfile( map, profile, context, visited, "" );
- //m_map.add( profile );
map.add( profile );
try
@@ -163,22 +157,24 @@
/**
* Returns the set of component types know to the registry that are capable of
- * supporting the supplied phase.
- * @param phase a stage descriptor
+ * supporting the supplied stage.
+ * @param stage a stage descriptor
* @return the set of candidate component types
*/
- Profile[] getProfiles( StageDescriptor phase )
+ Profile[] getProfiles( StageDescriptor stage )
{
- return m_manager.getProfiles( phase );
+ return m_manager.getProfiles( stage );
}
/**
* Assemble a single profile.
+ * @param map the current depedency map to populate
* @param profile the profile to assemble
+ * @param context the assembly context
* @param visited the set of profiles already assessed
- * @param extensions the set of extensions already visited
* @param pad used in formatting log messages
+ * @exception AssemblyException if an assembly related error occurs
*/
private void assembleProfile(
DependencyGraph map, Profile profile, Context context, List visited, String pad )
@@ -264,7 +260,6 @@
}
profile.addProvider( role, resource );
- //m_map.add( supplier );
map.add( supplier );
}
}
@@ -277,40 +272,40 @@
StageDescriptor[] phases = profile.getType().getPhases();
for( int i=0; i<phases.length; i++ )
{
- StageDescriptor phase = phases[i];
- if( profile.getExtension( phase ) == null )
+ StageDescriptor stage = phases[i];
+ if( profile.getExtension( stage ) == null )
{
boolean ok =
- assembleManagers( map, profile, context, phase, visited, pad2 );
+ assembleManagers( map, profile, context, stage, visited, pad2 );
if( !ok )
{
final String message =
- "Could not locate an extension for the phase: "
- + phase.getReference() + ", in profile: " + profile;
+ "Could not locate an extension for the stage: "
+ + stage.getReference() + ", in profile: " + profile;
getLogger().error( pad + " " + message );
profile.setEnabled( false );
final AssemblyException problem = new AssemblyException( message );
- throw new UnresolvedManagerException( phase, problem );
+ throw new UnresolvedManagerException( stage, problem );
}
//
- // select the preferred provider for the phase - the phase
+ // select the preferred provider for the stage - the stage
// argument contains the selection policy to apply
//
- Profile supplier = m_manager.getProfile( phase );
+ Profile supplier = m_manager.getProfile( stage );
if( supplier == null )
{
final String message =
- "Empty selection for a phase extension supporting: "
- + phase.getReference() + " in profile: " + profile;
+ "Empty selection for a stage extension supporting: "
+ + stage.getReference() + " in profile: " + profile;
getLogger().error( pad + " " + message );
profile.setEnabled( false );
final AssemblyException problem =
new AssemblyException( message );
- throw new UnresolvedManagerException( phase, problem );
+ throw new UnresolvedManagerException( stage, problem );
}
//
@@ -331,23 +326,22 @@
+ "' for the profile '" + profile.getName() + "'.";
throw new AssemblyException( error, e );
}
- profile.addExtension( phase, supplier, resource );
- //m_map.add( supplier );
+ profile.addExtension( stage, resource );
map.add( supplier );
}
}
}
private boolean assembleManagers(
- DependencyGraph map, Profile source, Context context, StageDescriptor phase,
+ DependencyGraph map, Profile source, Context context, StageDescriptor stage,
List visited, String pad )
throws AssemblyException
{
boolean ok = false;
- Profile[] profiles = getProfiles( phase );
+ Profile[] profiles = getProfiles( stage );
getLogger().debug(
pad
- + "phase: " + phase.getReference()
+ + "stage: " + stage.getReference()
+ ", [" + profiles.length + "]"
);
1.44 +2 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java
Index: DefaultKernel.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- DefaultKernel.java 22 Aug 2002 13:43:02 -0000 1.43
+++ DefaultKernel.java 23 Aug 2002 06:25:13 -0000 1.44
@@ -345,7 +345,7 @@
DefaultLifestyleManager dlm = new DefaultLifestyleManager();
dlm.enableLogging( getLogger().getChildLogger("lifestyle") );
DefaultContext dlmContext = new DefaultContext();
- dlmContext.put( "pool-manager", m_poolManager );
+ dlmContext.put( LifestyleManager.POOL_MANAGER_KEY, m_poolManager );
dlmContext.makeReadOnly();
dlm.contextualize( dlmContext );
dlm.configure( m_config.getChild("lifestyles") );
1.4 +2 -1 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/CategoriesDescriptor.java
Index: CategoriesDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/CategoriesDescriptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CategoriesDescriptor.java 14 Aug 2002 03:03:35 -0000 1.3
+++ CategoriesDescriptor.java 23 Aug 2002 06:25:13 -0000 1.4
@@ -76,6 +76,7 @@
/**
* Return a named category.
*
+ * @param name the category name
* @return the category declaration
*/
public Category getCategory( String name )
1.5 +23 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Category.java
Index: Category.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Category.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Category.java 2 Aug 2002 06:34:51 -0000 1.4
+++ Category.java 23 Aug 2002 06:25:13 -0000 1.5
@@ -7,7 +7,6 @@
*/
package org.apache.excalibur.merlin.model;
-import java.util.Hashtable;
import java.io.Serializable;
/**
@@ -35,12 +34,34 @@
public class Category implements Serializable
{
+ /**
+ * Constant category priority value for debug mode.
+ */
public static final String DEBUG = "DEBUG";
+
+ /**
+ * Constant category priority value for info mode.
+ */
public static final String INFO = "INFO";
+
+ /**
+ * Constant category priority value for warning mode.
+ */
public static final String WARN = "WARN";
+
+ /**
+ * Constant category priority value for error mode.
+ */
public static final String ERROR = "ERROR";
+ /**
+ * Constant value for the default logging target name.
+ */
public static final String DEFAULT_LOGGING_TARGET = "default";
+
+ /**
+ * Constant value for the default logging priority level.
+ */
public static final String DEFAULT_LOGGING_PRIORITY = INFO;
/**
1.14 +9 -10 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/ContainerDescriptor.java
Index: ContainerDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/ContainerDescriptor.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ContainerDescriptor.java 12 Aug 2002 02:00:10 -0000 1.13
+++ ContainerDescriptor.java 23 Aug 2002 06:25:13 -0000 1.14
@@ -8,13 +8,8 @@
package org.apache.excalibur.merlin.model;
import java.util.ArrayList;
-import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.excalibur.merlin.assembly.ContainerManager;
-import org.apache.excalibur.merlin.model.Profile;
-import org.apache.excalibur.merlin.model.CategoriesDescriptor;
import org.apache.excalibur.meta.info.Type;
@@ -136,7 +131,7 @@
* @param parameters the parameters instance to use during type instantiation
* @param configuration the configuration instance to use during type instantiation
* @param context the context instance to use during type instantiation
- * @param logger the root logger to be used by an instance established from the profile
+ * @param categories the logging categories descriptor
* @param type the type of component that this profile qualifies
* @param enabled the enabled state of the component profile
* @param activation TRUE if activation on startup, FALSE to activate on request
@@ -199,7 +194,9 @@
{
Profile component = components[i];
if( component.isEnabled() == enabled )
- list.add( component );
+ {
+ list.add( component );
+ }
}
return (Profile[] ) list.toArray( new Profile[0] );
}
@@ -247,8 +244,10 @@
{
Profile component = components[i];
if( component.getMode() == mode )
- list.add( component );
- }
+ {
+ list.add( component );
+ }
+ }
return (Profile[] ) list.toArray( new Profile[0] );
}
1.8 +24 -10 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/ContextDirective.java
Index: ContextDirective.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/ContextDirective.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ContextDirective.java 12 Aug 2002 02:00:10 -0000 1.7
+++ ContextDirective.java 23 Aug 2002 06:25:13 -0000 1.8
@@ -7,13 +7,7 @@
*/
package org.apache.excalibur.merlin.model;
-import java.util.Map;
-import java.util.Hashtable;
-import java.lang.reflect.Constructor;
-
import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.DefaultContext;
-import org.apache.avalon.framework.context.ContextException;
/**
@@ -44,6 +38,10 @@
public class ContextDirective
{
+ /**
+ * The default context implementation class to be used if not
+ * no context class is defined.
+ */
public static final String DEFAULT_CONTEXT_CLASS =
"org.apache.avalon.framework.context.DefaultContext";
@@ -58,7 +56,7 @@
private final Import[] m_imports;
/**
- * The set of entry directives.
+ * The context implementation classname.
*/
private final String m_classname;
@@ -105,13 +103,21 @@
return m_entries;
}
+ /**
+ * Return a named entry.
+ * @param key the context entry key
+ * @return the entry corresponding to the supplied key or null if the
+ * key is unknown
+ */
public Entry getEntry( String key )
{
for( int i=0; i<m_entries.length; i++ )
{
Entry entry = m_entries[i];
if( entry.getKey().equals( key ) )
- return entry;
+ {
+ return entry;
+ }
}
return null;
}
@@ -126,13 +132,21 @@
return m_imports;
}
+ /**
+ * Return a named import directive.
+ * @param key the import key
+ * @return the import directive corresponding to the supplied key or null if the
+ * key is unknown
+ */
public Import getImport( String key )
{
for( int i=0; i<m_imports.length; i++ )
{
Import imp = m_imports[i];
if( imp.getKey().equals( key ) )
- return imp;
+ {
+ return imp;
+ }
}
return null;
}
1.4 +8 -6 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Entry.java
Index: Entry.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Entry.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Entry.java 19 Jul 2002 14:08:07 -0000 1.3
+++ Entry.java 23 Aug 2002 06:25:13 -0000 1.4
@@ -42,14 +42,15 @@
* Creation of a new entry directive.
* @param key the entry key
* @param classname the classname of the entry implementation
- * @param parameters implementation class constructor parameter directives
+ * @param value a single constructor argument value
*/
public Entry( final String key, final String classname, final String value )
{
super( classname, value );
if( null == key )
- throw new NullPointerException("key");
-
+ {
+ throw new NullPointerException("key");
+ }
m_key = key;
}
@@ -63,8 +64,9 @@
{
super( classname, parameters );
if( null == key )
- throw new NullPointerException("key");
-
+ {
+ throw new NullPointerException("key");
+ }
m_key = key;
}
1.6 +2 -1 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/FilesetDescriptor.java
Index: FilesetDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/FilesetDescriptor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FilesetDescriptor.java 2 Aug 2002 06:34:51 -0000 1.5
+++ FilesetDescriptor.java 23 Aug 2002 06:25:13 -0000 1.6
@@ -41,6 +41,7 @@
/**
* Create a FilesetDescriptor instance.
*
+ * @param base the base directory path against which includes are evaluated
* @param includes the set of includes to include in the fileset
*/
public FilesetDescriptor( final String base, final IncludeDescriptor[] includes )
1.7 +4 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Import.java
Index: Import.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Import.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Import.java 12 Aug 2002 02:00:10 -0000 1.6
+++ Import.java 23 Aug 2002 06:25:13 -0000 1.7
@@ -57,7 +57,9 @@
public Import( final String key, final String name )
{
if( null == key )
- throw new NullPointerException("key");
+ {
+ throw new NullPointerException("key");
+ }
m_key = key;
if( null == name )
1.10 +4 -10 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/KernelDescriptor.java
Index: KernelDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/KernelDescriptor.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- KernelDescriptor.java 18 Aug 2002 04:12:02 -0000 1.9
+++ KernelDescriptor.java 23 Aug 2002 06:25:13 -0000 1.10
@@ -7,13 +7,6 @@
*/
package org.apache.excalibur.merlin.model;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.excalibur.merlin.assembly.ContainerManager;
-import org.apache.excalibur.merlin.model.ContainerDescriptor;
-import org.apache.excalibur.merlin.model.ClasspathDescriptor;
-import org.apache.excalibur.merlin.model.LibraryDescriptor;
-import org.apache.excalibur.merlin.model.LoggingDescriptor;
-
/**
* Kernel creation directive that includes a root container, an extensions directive,
* common application level classpath directive and logigng category descriptors.
@@ -118,12 +111,13 @@
* Create a KernelDescriptor instance.
*
* @param name the kernel name
- * @param manager the type manager
*/
public KernelDescriptor( final String name )
{
if( name == null )
- throw new NullPointerException("name");
+ {
+ throw new NullPointerException("name");
+ }
m_name = name;
}
1.3 +3 -6 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/LibraryDescriptor.java
Index: LibraryDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/LibraryDescriptor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LibraryDescriptor.java 19 Aug 2002 23:05:06 -0000 1.2
+++ LibraryDescriptor.java 23 Aug 2002 06:25:13 -0000 1.3
@@ -7,8 +7,6 @@
*/
package org.apache.excalibur.merlin.model;
-import java.io.Serializable;
-
/**
* <p>An descriptor that declares a set of directories to be
* referenced as the installed extension directories. An extensions descriptor
@@ -30,8 +28,6 @@
/**
* Create a LibraryDescriptor instance.
- *
- * @param dirs the set of dirsets to include in the classpath
*/
public LibraryDescriptor( )
{
@@ -41,7 +37,8 @@
/**
* Create a LibraryDescriptor instance.
*
- * @param dirs the set of dirsets to include in the classpath
+ * @param base the directory path against which include directives will be evaluated
+ * @param includes the set of include directives
*/
public LibraryDescriptor( final String base, final IncludeDescriptor[] includes )
{
1.10 +2 -5 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/LoggingDescriptor.java
Index: LoggingDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/LoggingDescriptor.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- LoggingDescriptor.java 9 Aug 2002 15:28:04 -0000 1.9
+++ LoggingDescriptor.java 23 Aug 2002 06:25:13 -0000 1.10
@@ -7,9 +7,6 @@
*/
package org.apache.excalibur.merlin.model;
-import java.io.Serializable;
-import org.apache.excalibur.merlin.model.Category;
-
/**
* Description of a top level logging environment.
*
@@ -41,7 +38,7 @@
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public final class LoggingDescriptor extends Category implements Serializable
+public final class LoggingDescriptor extends Category
{
/**
1.8 +30 -8 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Parameter.java
Index: Parameter.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Parameter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Parameter.java 12 Aug 2002 02:00:10 -0000 1.7
+++ Parameter.java 23 Aug 2002 06:25:13 -0000 1.8
@@ -88,9 +88,14 @@
public Parameter( final String classname, final String value )
{
if( null == classname )
- throw new NullPointerException("classname");
+ {
+ throw new NullPointerException("classname");
+ }
+
if( null == value )
- throw new NullPointerException("value");
+ {
+ throw new NullPointerException("value");
+ }
m_parameters = new Parameter[0];
m_classname = classname;
@@ -99,14 +104,15 @@
/**
* Creation of a new entry directive.
- * @param key the entry key
* @param classname the classname of the entry implementation
* @param parameters implementation class constructor parameter directives
*/
public Parameter( final String classname, final Parameter[] parameters )
{
if( null == classname )
- throw new NullPointerException("classname");
+ {
+ throw new NullPointerException("classname");
+ }
m_classname = classname;
m_parameters = parameters;
@@ -123,7 +129,9 @@
/**
* Return the classname of the parameter implementation to use.
- * @return the classname
+ * @param loader the classloader to use
+ * @return the parameter class
+ * @exception ModelException if the parameter class cannot be resolved
*/
Class getParameterClass( ClassLoader loader ) throws ModelException
{
@@ -176,7 +184,7 @@
}
else
{
- throw new ModelRuntimeException(
+ throw new ModelException(
"Could not locate the parameter implemetation for class: '"
+ m_classname + "'.", e );
}
@@ -185,7 +193,10 @@
/**
* Return the derived parameter value.
+ * @param loader the classloader to use
+ * @param map a map of context values from which import directives may be resolved
* @return the value
+ * @exception ModelException if the parameter value cannot be resolved
*/
public Object getValue( ClassLoader loader, Map map ) throws ModelException
{
@@ -376,11 +387,17 @@
{
buffer.append( classes[i].getName() );
if( (i+1)<classes.length )
- buffer.append(",");
+ {
+ buffer.append(",");
+ }
}
return buffer.toString();
}
+ /**
+ * Returns a string representation of the parameter.
+ * @return the parameter as a string
+ */
public String toString()
{
StringBuffer buffer = new StringBuffer();
@@ -388,6 +405,11 @@
return buffer.toString();
}
+ /**
+ * Utility method to build a string buffer of a composite parameter.
+ * @param buffer the string buffer to append information to
+ * @param lead string used for formatting content
+ */
protected void asString( StringBuffer buffer, String lead )
{
buffer.append(
1.24 +41 -52 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Profile.java
Index: Profile.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Profile.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Profile.java 21 Aug 2002 17:00:51 -0000 1.23
+++ Profile.java 23 Aug 2002 06:25:13 -0000 1.24
@@ -10,15 +10,12 @@
import java.io.InputStream;
import java.io.Serializable;
import java.util.Hashtable;
-import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.context.Context;
import org.apache.excalibur.meta.ConfigurationBuilder;
import org.apache.excalibur.meta.info.Type;
import org.apache.excalibur.meta.info.StageDescriptor;
-import org.apache.excalibur.merlin.model.Association;
import org.apache.excalibur.configuration.ConfigurationUtil;
import org.apache.excalibur.configuration.CascadingConfiguration;
import org.xml.sax.InputSource;
@@ -130,12 +127,12 @@
private final Hashtable m_dependencies = new Hashtable();
/**
- * The phase extension resource descriptor keyed by phase.
+ * The stage extension resource descriptor keyed by stage.
*/
private final Hashtable m_managers = new Hashtable();
/**
- * The phase extension profile keyed by phase.
+ * The phase extension profile keyed by stage.
*/
private final Hashtable m_extensions = new Hashtable();
@@ -181,16 +178,12 @@
private final boolean m_activation;
/**
- * Create a Profile instance without parameters.
+ * Create an Profile instance, enabled, lazy activation and explicit
+ * status.
*
- * @param name the abstract name of component meta data instance
- * @param configuration the configuration instance to use during type instantiation
- * @param context the context instance to use during type instantiation
- * @param logger the root logger to be used by an instance established from the profile
+ * @param name the abstract name of the profile
* @param type the type of component that this profile qualifies
- * @param enabled the enabled state of the component profile
- * @param activation TRUE if activation on startup, FALSE to activate on request
- * @param mode the creation mode (either IMPLICIT, PACKAGED, or EXPLICIT)
+ * @param categories the logging categoories descriptor
*/
public Profile( final String name,
final Type type,
@@ -202,10 +195,10 @@
/**
* Create a Profile instance without parameters.
*
- * @param name the abstract name of component meta data instance
+ * @param name the abstract name of the profile
* @param configuration the configuration instance to use during type instantiation
* @param context the context instance to use during type instantiation
- * @param logger the root logger to be used by an instance established from the profile
+ * @param categories the logging categories descriptor
* @param type the type of component that this profile qualifies
* @param enabled the enabled state of the component profile
* @param activation TRUE if activation on startup, FALSE to activate on request
@@ -227,7 +220,7 @@
* Create a Profile instance without parameters.
*
* @param name the abstract name of profile
- * @param profile the profile to use as a template
+ * @param template the profile to use as a template
*/
public Profile( final String name,
final Profile template )
@@ -252,7 +245,7 @@
* @param parameters the parameters instance to use during type instantiation
* @param configuration the configuration instance to use during type instantiation
* @param context the context instance to use during type instantiation
- * @param logger the root logger to be used by an instance established from the profile
+ * @param categories the logging categories descriptor
* @param type the type of component that this profile qualifies
* @param enabled the enabled state of the component profile
* @param activation TRUE if activation on startup, FALSE to activate on request
@@ -285,9 +278,13 @@
}
if( null == type )
+ {
throw new NullPointerException( "type" );
+ }
if( null == categories )
+ {
throw new NullPointerException( "categories" );
+ }
m_parameters = parameters;
m_configuration = configuration;
@@ -397,12 +394,16 @@
* by the attribute <code>src</code> and the default configuration
* is resolved from the <classname>.xconfig resourse.
*
+ * @param classloader the classloader to use
* @return the Configuration for profile.
+ * @exception Exception if an error occurs while resolving the configuration
*/
public Configuration getConfiguration( ClassLoader classloader ) throws Exception
{
if( m_config != null )
- return m_config;
+ {
+ return m_config;
+ }
final Configuration defaults = getType().getConfiguration( classloader );
Configuration base = null;
@@ -457,6 +458,7 @@
/**
* Return the dependency associations for component type with specified role.
*
+ * @param role the dependency role name
* @return the dependency metadata for component with specified role.
*/
public Association getAssociation( final String role )
@@ -475,7 +477,10 @@
/**
* Add an association for a service dependecy.
- * @param association the association representing the provider
+ * @param role the role against which the supplied resource is to be associated
+ * @param resource the resource that will fulfill the provider dependency
+ * @return an association binding the role and provider within the scope of the
+ * profile's set of service depedencies
*/
public Association addProvider( String role, Resource resource )
{
@@ -485,52 +490,36 @@
}
/**
- * Add a lifecycle phase extension.
- * @param phase the identifier of the phase to assign the manager to
+ * Add a lifecycle stage extension.
+ * @param stage the identifier of the stage to assign the manager to
* @param resource the reference to the manager
*/
- public void addExtension( StageDescriptor phase, Profile profile, Resource resource )
+ public void addExtension( StageDescriptor stage, Resource resource )
{
- m_managers.put( phase, resource );
- m_extensions.put( phase, profile );
+ m_managers.put( stage, resource );
+ m_extensions.put( stage, resource.getProfile() );
}
/**
- * Return a reference to the lifecycle phase extension assigned to handle
- * the components custom phase.
- * @param phase the lifecycle phase specification
- * @return a reference to the phase extension
+ * Return a reference to the lifecycle stage extension assigned to handle
+ * the components custom stage.
+ * @param stage the lifecycle stage specification
+ * @return a reference to the stage extension
*/
- public Resource getExtension( StageDescriptor phase )
+ public Resource getExtension( StageDescriptor stage )
{
- return (Resource) m_managers.get( phase );
+ return (Resource) m_managers.get( stage );
}
/**
- * Return the type associated as the phase provider.
- * @param phase the lifecycle phase specification
- * @return a reference to the phase extension
+ * Return the profile associated as the stage provider.
+ * @param stage the lifecycle stage specification
+ * @return a reference to the stage extension
*/
- public Type getFacility( StageDescriptor phase )
+ public Profile getExtensionProfile( StageDescriptor stage )
{
- Profile profile = getExtensionProfile( phase );
- if( profile != null )
- {
- return (Type) profile.getType();
- }
- return null;
+ return (Profile) m_extensions.get( stage );
}
-
- /**
- * Return the profile associated as the phase provider.
- * @param phase the lifecycle phase specification
- * @return a reference to the phase extension
- */
- public Profile getExtensionProfile( StageDescriptor phase )
- {
- return (Profile) m_extensions.get( phase );
- }
-
/**
* Return the activation policy for the component. If TRUE, activation
1.7 +4 -4 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Resource.java 14 Aug 2002 10:46:29 -0000 1.6
+++ Resource.java 23 Aug 2002 06:25:13 -0000 1.7
@@ -8,7 +8,6 @@
package org.apache.excalibur.merlin.model;
import org.apache.excalibur.meta.info.ServiceDescriptor;
-import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.activity.Disposable;
/**
@@ -52,13 +51,14 @@
* Return the resource instance.
*
* @return an instance of the type defined by the profile
+ * @exception Exception if an access error occurs
*/
Object access() throws Exception;
/**
* Release the service instance.
+ * @param instance the instance to release
*/
- public void release( Object instance ) throws Exception;
-
+ void release( Object instance );
}
1.6 +50 -44 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/verifier/MetaDataVerifier.java
Index: MetaDataVerifier.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/verifier/MetaDataVerifier.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MetaDataVerifier.java 21 Aug 2002 17:00:52 -0000 1.5
+++ MetaDataVerifier.java 23 Aug 2002 06:25:13 -0000 1.6
@@ -64,6 +64,7 @@
/**
* Create an AssemblyVerifier using specified Component ComponentVerifier.
+ * @param verifier the component verifier used by the meta-data verifier
*/
public MetaDataVerifier( final ComponentVerifier verifier )
{
@@ -75,6 +76,10 @@
m_verifier = verifier;
}
+ /**
+ * Assign a logging channel to the verifier.
+ * @param logger the logging channel
+ */
public void enableLogging( final Logger logger )
{
super.enableLogging( logger );
@@ -82,60 +87,61 @@
}
/**
* Verfiy that specified components designate classes that implement the
- * advertised interfaces. And confrorm to expectations of MetaData.
+ * advertised interfaces. And conforms to expectations of MetaData.
*
- * @param component the Profile object for the components
- * @param classLoader the ClassLoader to load component from
+ * @param profile the Profile object for the components
+ * @param classLoader the ClassLoader to load profile from
* @throws VerifyException if an error occurs
*/
- public void verifyType( final Profile component,
+ public void verifyType( final Profile profile,
final ClassLoader classLoader )
throws VerifyException
{
- final Class clazz = getClass( classLoader, component );
- verifyType( component, clazz );
+ final Class clazz = getClass( classLoader, profile );
+ verifyType( profile, clazz );
}
/**
* Verfiy that specified components designate classes that implement the
* advertised interfaces. And confrorm to expectations of MetaData.
*
- * @param component the Profile object for the components
+ * @param profile the Profile object for the components
+ * @param clazz the implemetation class
* @throws VerifyException if an error occurs
*/
- public void verifyType( final Profile component,
+ public void verifyType( final Profile profile,
final Class clazz )
throws VerifyException
{
- final String name = component.getName();
+ final String name = profile.getName();
final Class[] interfaces =
getServiceClasses( name,
- component.getType().getServices(),
+ profile.getType().getServices(),
clazz.getClassLoader() );
final Class[] phases =
getPhaseClasses( name,
- component.getType().getPhases(),
+ profile.getType().getPhases(),
clazz.getClassLoader() );
m_verifier.verifyType( name, clazz, interfaces, phases );
- verifyDependencyPresence( component, clazz );
- verifyContextPresence( component, clazz );
+ verifyDependencyPresence( profile, clazz );
+ verifyContextPresence( profile, clazz );
}
/**
- * Verify that the if the component is not Contextualizable that it
- * does not declare Context Entrys.
+ * Verify that the component does not include redundant context entries
+ * and implemets Contextulizable
*
- * @param component the component metadata
- * @param clazz the class implementing component
+ * @param profile the profile metadata
+ * @param clazz the class implementing profile
* @throws VerifyException if fails verification check
*/
- protected void verifyContextPresence( final Profile component,
+ protected void verifyContextPresence( final Profile profile,
final Class clazz )
throws VerifyException
{
- final Type info = component.getType();
+ final Type info = profile.getType();
final ContextDescriptor context = info.getContext();
final int count = context.getEntrys().length;
@@ -145,29 +151,29 @@
{
final String message =
REZ.getString( "metadata.declare-uneeded-entrys.error",
- component.getName(),
- getClassname( component ) );
+ profile.getName(),
+ getClassname( profile ) );
throw new VerifyException( message );
}
}
}
/**
- * Verify the component assembly logic.
- * The implications verifies that the component:
+ * Verify the profile assembly logic.
+ * The implications verifies that the profile:
* <p>Is not Composable/Serviceable and does not declare dependencys</p>
* <p>or</p>
* <p>Is Composable/Serviceable and does declare dependencys</p>
*
- * @param component the component metadata
- * @param clazz the class implementing component
+ * @param profile the profile metadata
+ * @param clazz the class implementing profile
* @throws VerifyException if fails verification check
*/
- protected void verifyDependencyPresence( final Profile component,
+ protected void verifyDependencyPresence( final Profile profile,
final Class clazz )
throws VerifyException
{
- final int count = component.getAssociations().length;
+ final int count = profile.getAssociations().length;
final boolean aquiresServices =
Composable.class.isAssignableFrom( clazz ) ||
Serviceable.class.isAssignableFrom( clazz );
@@ -177,8 +183,8 @@
{
final String message =
REZ.getString( "metadata.declare-uneeded-deps.error",
- component.getName(),
- getClassname( component ) );
+ profile.getName(),
+ getClassname( profile ) );
throw new VerifyException( message );
}
}
@@ -189,8 +195,8 @@
* offers. This method also makes sure all services offered are
* interfaces.
*
- * @param name the name of component
- * @param services the services the component offers
+ * @param name the name of profile
+ * @param services the services the profile offers
* @param classLoader the classLoader
* @return an array of Classes for all the services
* @throws VerifyException if an error occurs
@@ -227,8 +233,8 @@
* Retrieve an array of Classes for all the phases that a Component
* is depenent on.
*
- * @param name the name of component
- * @param services the services the component offers
+ * @param name the name of profile
+ * @param phases the set of stage depedencies
* @param classLoader the classLoader
* @return an array of Classes for all the services
* @throws VerifyException if an error occurs
@@ -265,25 +271,25 @@
* Load class object for specified Profile.
*
* @param classLoader the ClassLoader to use
- * @param component the meta data associate with component
+ * @param profile the meta data associate with profile
* @return the Class object
* @throws VerifyException if unable to aquire class object
*/
private Class getClass( final ClassLoader classLoader,
- final Profile component )
+ final Profile profile )
throws VerifyException
{
Class clazz = null;
try
{
- clazz = classLoader.loadClass( getClassname( component ) );
+ clazz = classLoader.loadClass( getClassname( profile ) );
}
catch( final Exception e )
{
final String message =
REZ.getString( "assembly.bad-class.error",
- component.getName(),
- getClassname( component ),
+ profile.getName(),
+ getClassname( profile ),
e.toString() );
throw new VerifyException( message );
}
@@ -291,13 +297,13 @@
}
/**
- * Utility method to aquire classname for component.
+ * Utility method to aquire classname for profile.
*
- * @param component the component
- * @return the classname for component
+ * @param profile the profile
+ * @return the classname for profile
*/
- private String getClassname( final Profile component )
+ private String getClassname( final Profile profile )
{
- return component.getType().getInfo().getImplementationKey();
+ return profile.getType().getInfo().getImplementationKey();
}
}
1.8 +46 -32 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/AbstractLifestyleHandler.java
Index: AbstractLifestyleHandler.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/AbstractLifestyleHandler.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AbstractLifestyleHandler.java 21 Aug 2002 17:00:52 -0000 1.7
+++ AbstractLifestyleHandler.java 23 Aug 2002 06:25:13 -0000 1.8
@@ -10,24 +10,15 @@
package org.apache.excalibur.merlin.resource;
import java.util.Map;
-import java.util.ArrayList;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.context.Context;
-import org.apache.excalibur.container.lifecycle.Creator;
import org.apache.excalibur.container.lifecycle.Accessor;
import org.apache.excalibur.merlin.assembly.ContainerManager;
-import org.apache.excalibur.merlin.resource.ResourceException;
import org.apache.excalibur.merlin.model.Profile;
import org.apache.excalibur.merlin.model.Resource;
import org.apache.excalibur.meta.info.StageDescriptor;
-import org.apache.excalibur.meta.info.ExtensionDescriptor;
-import org.apache.excalibur.meta.info.Type;
-import org.apache.excalibur.meta.info.LoggerDescriptor;
-import org.apache.excalibur.merlin.model.CategoriesDescriptor;
-import org.apache.excalibur.merlin.model.Category;
/**
* Lifestyle implementation that provides suppport for the singleton
@@ -49,14 +40,18 @@
private Class m_class;
private boolean m_initialized = false;
- protected boolean m_disposed = false;
+
+ /**
+ * Flag indicating the disposed state of the handler.
+ */
+ private boolean m_disposed = false;
/**
* Creation of a new singleton lifecycle manager.
* @param manager the type manager
- * @param provider the resource provider
+ * @param deployment the deployment helper
* @param helper the lifecycle helper
- * @param profile the profile defining the object type
+ * @param profile the profile defining the object instantiation criteria
* @param context the establishment context
*/
public AbstractLifestyleHandler(
@@ -67,19 +62,27 @@
final Context context )
{
if( manager == null )
- throw new NullPointerException("manager");
-
+ {
+ throw new NullPointerException("manager");
+ }
if( deployment == null )
- throw new NullPointerException("deployment");
-
+ {
+ throw new NullPointerException("deployment");
+ }
if( helper == null )
- throw new NullPointerException("helper");
+ {
+ throw new NullPointerException("helper");
+ }
if( profile == null )
- throw new NullPointerException("profile");
+ {
+ throw new NullPointerException("profile");
+ }
if( context == null )
- throw new NullPointerException("context");
+ {
+ throw new NullPointerException("context");
+ }
m_profile = profile;
m_manager = manager;
@@ -89,6 +92,15 @@
}
/**
+ * Returns the disposed state of the handler.
+ * @return TRUE if this handler has been disposed
+ */
+ protected boolean isDisposed()
+ {
+ return m_disposed;
+ }
+
+ /**
* Returns the service class.
*
* @return the service class
@@ -96,7 +108,9 @@
public Class getImplementationClass()
{
if( m_class != null )
- return m_class;
+ {
+ return m_class;
+ }
try
{
m_class = m_deployment.createImplementationClass( m_profile );
@@ -115,6 +129,7 @@
* manager to the client.
*
* @return an instance of the type defined by the profile
+ * @exception Exception if an error occurs while attemping to aquire the object
*/
public abstract Object get() throws Exception;
@@ -125,12 +140,12 @@
*
* @param object the object to return
*/
- public abstract void put( Object object ) throws Exception;
+ public abstract void put( Object object );
/**
* Handle the access phase extensions as declared by the profile type.
* @param object the object to process
- * @param Exception if a stage procesing exception occurs
+ * @exception Exception if a stage procesing exception occurs
*/
protected void processAccessStage( Object object ) throws Exception
{
@@ -146,7 +161,6 @@
/**
* Handle the access phase extensions as declared by the profile type.
* @param object the object to process
- * @param Exception if a stage procesing exception occurs
*/
protected void processReleaseStage( Object object )
{
@@ -170,10 +184,9 @@
/**
* Invoke an extension handler for a lifecycle stage.
*
- * @param stage the lifecycle stage (one of ACCESS or RELEASE )
- * @param phase the phase descriptor describing the stage dependency
+ * @param stage the stage descriptor describing the stage dependency
* @param object the object to be processed
- * @param context the extension context
+ * @param access TRUE if this is ACCESS otherwise its RELEASE mode
*
* @exception Exception if an error occurs during stage execution
*/
@@ -217,6 +230,7 @@
* advance of instance creation.
*
* @return an instance of the type defined by the profile
+ * @exception Exception if an instantiation error occurs
* @see DeploymentHelper
*/
protected Object createInstance() throws Exception
@@ -262,10 +276,13 @@
public void handleShutdown( Object object )
{
if( object == null )
- throw new NullPointerException("object");
-
+ {
+ throw new NullPointerException("object");
+ }
if( m_provider == null )
- throw new NullPointerException("provider");
+ {
+ throw new NullPointerException("provider");
+ }
final String path = m_manager.getPath() + "/" + m_profile.getName();
try
@@ -285,9 +302,6 @@
*/
public void dispose()
{
- if( m_disposed )
- throw new IllegalStateException("disposed");
-
m_profile = null;
m_manager = null;
m_provider = null;
1.6 +27 -10 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultLifestyleManager.java
Index: DefaultLifestyleManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultLifestyleManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultLifestyleManager.java 16 Aug 2002 03:09:24 -0000 1.5
+++ DefaultLifestyleManager.java 23 Aug 2002 06:25:13 -0000 1.6
@@ -15,7 +15,6 @@
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.excalibur.merlin.assembly.ContainerManager;
import org.apache.excalibur.merlin.model.Profile;
@@ -30,19 +29,42 @@
public class DefaultLifestyleManager extends AbstractLogEnabled
implements LifestyleManager, Configurable, Contextualizable, Initializable
{
+ /**
+ * The supplied configuration.
+ */
private Configuration m_config;
+
+ /**
+ * The pool manager aquired via the supplied context.
+ */
private PoolManager m_poolManager;
+ /**
+ * Configuration of the lifestyle manager (not used at this time)
+ * @param config the supplied configuration
+ */
public void configure( Configuration config )
{
m_config = config;
}
+ /**
+ * Contextualization of the lifestyle manager.
+ * @param context the context value containing a {@link PoolManager}
+ * under the context key {@link LifestyleManager#POOL_MANAGER_KEY}
+ * @exception ContextException if the context argument does not contain
+ * a pool manager under key {@link LifestyleManager#POOL_MANAGER_KEY}
+ * @see PoolManager
+ */
public void contextualize( Context context ) throws ContextException
{
- m_poolManager = (PoolManager) context.get("pool-manager");
+ m_poolManager = (PoolManager) context.get( POOL_MANAGER_KEY );
}
+ /**
+ * Initialization of the manager.
+ * @exception Exception if an initialization error occurs
+ */
public void initialize() throws Exception
{
}
@@ -68,18 +90,14 @@
* by the lifestyle handler</p></td></tr>
* <tr><td><p>transient</p></td><td>
* <p>new instances are created per request</p></td></tr>
- * <tr><td><p>custom</p></td><td>
- * <p>the handler policy is defined by a custom implementation
- * class declared under the attribute key
- * <strong>avalon:lifestyle.class</strong></p></td></tr>
* </table>
*
*
* @param manager the container type manager
+ * @param deployment a deployment helper
* @param helper a lifecycle helper
- * @param provider a resource provider
* @param profile the profies containing the lifestyle policy
- *
+ * @param context the deployment context
* @return a lifecycle handler supporting the requested policy
* @exception Exception if an error occurs during handler establishment
*/
@@ -91,9 +109,8 @@
Context context )
throws Exception
{
-
final String policy =
- profile.getType().getInfo().getAttribute("avalon:lifestyle", "singleton" );
+ profile.getType().getInfo().getAttribute( AVALON_LIFESTYLE_KEY , "singleton" );
if( policy.equalsIgnoreCase( "singleton" ) )
{
1.3 +1 -3 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultManager.java
Index: DefaultManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultManager.java 12 Aug 2002 17:36:16 -0000 1.2
+++ DefaultManager.java 23 Aug 2002 06:25:13 -0000 1.3
@@ -11,14 +11,12 @@
import java.util.Map;
import java.util.Hashtable;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.excalibur.merlin.model.Resource;
/**
* Internal helper class the handles the functional requirements of
- * both ComponetManager and ComponentLocator.
+ * both ComponentManager and ComponentLocator.
* @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
*/
class DefaultManager
1.6 +21 -9 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultResource.java
Index: DefaultResource.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultResource.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultResource.java 21 Aug 2002 17:00:52 -0000 1.5
+++ DefaultResource.java 23 Aug 2002 06:25:13 -0000 1.6
@@ -7,18 +7,13 @@
*/
package org.apache.excalibur.merlin.resource;
-import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.activity.Disposable;
-import org.apache.excalibur.merlin.resource.LifecycleHelper;
-import org.apache.excalibur.merlin.resource.LifestyleHandler;
import org.apache.excalibur.merlin.model.Profile;
import org.apache.excalibur.merlin.model.Resource;
import org.apache.excalibur.meta.info.ServiceDescriptor;
-import org.apache.excalibur.meta.info.StageDescriptor;
-import org.apache.excalibur.meta.info.ExtensionDescriptor;
+
/**
* Opaque type that maps a path to a profile.
@@ -29,6 +24,9 @@
public class DefaultResource extends AbstractLogEnabled implements Resource
{
+ /**
+ * Resource path header element.
+ */
public static final String HEADER = "service:";
/**
@@ -57,7 +55,7 @@
* @param path the container path
* @param profile the resource's profile
* @param context the deployment context
- * @param factory the lifestyle manager
+ * @param handler the lifestyle handler
*/
public DefaultResource( final String path,
final Profile profile,
@@ -65,16 +63,24 @@
final LifestyleHandler handler )
{
if( null == path )
+ {
throw new NullPointerException( "path" );
+ }
if( null == profile )
+ {
throw new NullPointerException( "profile" );
+ }
if( null == context )
+ {
throw new NullPointerException( "context" );
+ }
if( null == handler )
+ {
throw new NullPointerException( "handler" );
+ }
m_path = path;
m_profile = profile;
@@ -126,8 +132,9 @@
/**
* Release a service instance.
+ * @param object the object to release
*/
- public void release( Object object ) throws Exception
+ public void release( Object object )
{
getLogger().debug("release");
m_handler.put( object );
@@ -155,6 +162,11 @@
return m_profile;
}
+ /**
+ * Returns a string representation of the resoruce.
+ *
+ * @return a string describing the resource
+ */
public String toString()
{
return "DefaultResource - profile:" + m_profile;
1.2 +1 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DeploymentException.java
Index: DeploymentException.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DeploymentException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeploymentException.java 14 Aug 2002 03:03:35 -0000 1.1
+++ DeploymentException.java 23 Aug 2002 06:25:13 -0000 1.2
@@ -8,7 +8,6 @@
package org.apache.excalibur.merlin.resource;
import org.apache.avalon.framework.CascadingException;
-import org.apache.excalibur.meta.verifier.VerifyException;
/**
* Exception to indicate error during the deployment of a profile.
1.4 +52 -45 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DeploymentHelper.java
Index: DeploymentHelper.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DeploymentHelper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DeploymentHelper.java 21 Aug 2002 17:00:52 -0000 1.3
+++ DeploymentHelper.java 23 Aug 2002 06:25:13 -0000 1.4
@@ -15,33 +15,21 @@
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.parameters.Parameterizable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
import org.apache.excalibur.merlin.assembly.KernelManager;
import org.apache.excalibur.merlin.assembly.ContainerManager;
import org.apache.excalibur.merlin.assembly.DefaultLoggerManager;
-import org.apache.excalibur.merlin.container.Container;
import org.apache.excalibur.merlin.model.Profile;
-import org.apache.excalibur.merlin.model.Resource;
import org.apache.excalibur.merlin.model.ContextDirective;
import org.apache.excalibur.merlin.model.CategoriesDescriptor;
import org.apache.excalibur.merlin.model.Category;
@@ -51,7 +39,6 @@
import org.apache.excalibur.meta.info.DependencyDescriptor;
import org.apache.excalibur.meta.info.ContextDescriptor;
import org.apache.excalibur.meta.info.EntryDescriptor;
-import org.apache.excalibur.meta.info.ContextDescriptor;
import org.apache.excalibur.meta.info.StageDescriptor;
import org.apache.excalibur.meta.info.ExtensionDescriptor;
import org.apache.excalibur.meta.info.LoggerDescriptor;
@@ -97,14 +84,18 @@
/**
* Utility class supporting deployment of a profile.
* @param logging the logging system
+ * @param manager the container manager
*/
public DeploymentHelper( DefaultLoggerManager logging, ContainerManager manager )
{
if( logging == null )
- throw new NullPointerException("logging");
-
+ {
+ throw new NullPointerException("logging");
+ }
if( manager == null )
- throw new NullPointerException("manager");
+ {
+ throw new NullPointerException("manager");
+ }
m_logging = logging;
m_manager = manager;
@@ -118,7 +109,7 @@
* Returns the implememntation class for the type.
*
* @param profile the profile
- *
+ * @return the implemenetation class
* @throws DeploymentException if an errors
*/
public Class createImplementationClass( final Profile profile )
@@ -147,15 +138,15 @@
* declared under the profile categories descriptor.
*
* @param profile the profile to deploy
- * @param context the deployment context
- *
- * @throws DeploymentException if an error during deployment
+ * @exception DeploymentException if an error during deployment
*/
public void createLoggingCategories( final Profile profile )
throws DeploymentException
{
if( profile == null )
- throw new NullPointerException("profile");
+ {
+ throw new NullPointerException("profile");
+ }
getLogger().info("deployment initiated for '" + profile.getName() + "'." );
@@ -205,6 +196,7 @@
list.add( new Category( name ) );
}
}
+
return new CategoriesDescriptor(
categories.getName(),
categories.getPriority(),
@@ -214,12 +206,14 @@
}
/**
- * Handles creation of a map of context entries keyed by phase. Context
+ * Handles creation of a map of context entries keyed by extension stage. Context
* entries are built using the supplied deployment context argument together
* with profile directives relative to type constraints.
*
* @param profile the profile
* @param context the deployment context
+ * @return the map of context entries keyed by stage
+ * @exception DeploymentException if an error occurs while preparing the map
*/
public Map createExtensionContextMap( Profile profile, Context context )
throws DeploymentException
@@ -233,11 +227,13 @@
for( int i=0; i<stages.length; i++ )
{
StageDescriptor stage = stages[i];
- Type type = profile.getFacility( stage );
-
- if( type == null )
- throw new NullPointerException("extension");
+ Profile extensionProfile = profile.getExtensionProfile( stage );
+ if( extensionProfile == null )
+ {
+ throw new NullPointerException("extension-profile");
+ }
+ Type type = extensionProfile.getType();
final ExtensionDescriptor ext = type.getExtension( stage );
try
{
@@ -260,7 +256,7 @@
* Create a new Context for component.
*
* @param profile the profile
- * @param a supplimentary context usable during import resolution
+ * @param context a supplimentary context usable during import resolution
* @return a new Context for service
* @throws DeploymentException if an error occurs in standard
* context creation
@@ -284,8 +280,8 @@
/**
* Create a new Context for an extension.
*
- * @param profile the profile
- * @param a supplimentary context usable during import resolution
+ * @param extension the extension descriptor
+ * @param context a supplimentary context used during import resolution
* @return a new Context for service
* @throws Exception if unable to create context
*/
@@ -300,7 +296,7 @@
* Internal utility to construct a context instance using a descriptor, directive and source
* context instances.
*
- * @param descriptor the descriptor containing the context dependency declarations
+ * @param descriptors the descriptor containing the context dependency declarations
* @param directive an optional context directive containing import and context value
* creation parameters
* @param context a supplimentary context object to used during value resolution
@@ -470,7 +466,11 @@
*/
private Object getContextValue( Context context, String key )
{
- if( context == null ) return null;
+ if( context == null )
+ {
+ return null;
+ }
+
try
{
return context.get( key );
@@ -492,10 +492,14 @@
throws ClassNotFoundException
{
if( type == null )
- throw new NullPointerException("type");
+ {
+ throw new NullPointerException("type");
+ }
if( value == null )
- throw new NullPointerException("value");
+ {
+ throw new NullPointerException("value");
+ }
final Class clazz = value.getClass();
final Class typeClass = m_manager.loadClass( type );
@@ -541,11 +545,11 @@
}
/**
- * Create a new ServiceManager for component.
+ * Create a new ServiceManager for a given profile.
*
- * @param entry the entry
- * @return a new ServiceManager for component
- * @throws Exception if unable to create resource
+ * @param profile the profile
+ * @return the new ServiceManager
+ * @throws Exception if unable to create the service manager
*/
public ServiceManager createServiceManager( Profile profile )
throws Exception
@@ -556,9 +560,9 @@
}
/**
- * Create a new Configuration object for component.
+ * Create a new Configuration object for a profile.
*
- * @param entry the entry
+ * @param profile the profile
* @return a new Configuration object for component
* @throws Exception if unable to create resource
*/
@@ -566,17 +570,19 @@
throws Exception
{
Configuration config = profile.getConfiguration( m_manager );
- if( config == null )
- config = new DefaultConfiguration("configuration", null );
+ if( config == null )
+ {
+ config = new DefaultConfiguration("configuration", null );
+ }
return config;
}
/**
- * Create a new Parameters object for component.
+ * Create a new Parameters object for a profile.
*
- * @param entry the entry
- * @return a new Parameters object for component
- * @throws Exception if unable to create resource
+ * @param profile the profile
+ * @return a new Parameters object for the profile
+ * @throws Exception if unable to create the parameters object
*/
public Parameters createParameters( Profile profile )
throws Exception
@@ -597,6 +603,7 @@
* Prepare a map of the dependent services keyed by role name.
* @param profile the profile referencing a type declaring dependecies
* @return a map of the services
+ * @exception Exception if unable to locate a required service provider
*/
private Map getServices( Profile profile ) throws Exception
{
1.3 +1 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifecycleException.java
Index: LifecycleException.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifecycleException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LifecycleException.java 14 Aug 2002 03:03:35 -0000 1.2
+++ LifecycleException.java 23 Aug 2002 06:25:13 -0000 1.3
@@ -8,7 +8,6 @@
package org.apache.excalibur.merlin.resource;
import org.apache.avalon.framework.CascadingException;
-import org.apache.excalibur.meta.verifier.VerifyException;
/**
* Exception to indicate error processing a component through its lifecycle.
1.8 +14 -16 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifecycleHelper.java
Index: LifecycleHelper.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifecycleHelper.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LifecycleHelper.java 21 Aug 2002 17:00:52 -0000 1.7
+++ LifecycleHelper.java 23 Aug 2002 06:25:13 -0000 1.8
@@ -7,8 +7,6 @@
*/
package org.apache.excalibur.merlin.resource;
-import java.util.Map;
-
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.activity.Disposable;
@@ -21,7 +19,6 @@
import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
@@ -31,15 +28,10 @@
import org.apache.avalon.framework.service.Serviceable;
import org.apache.excalibur.container.lifecycle.Creator;
-import org.apache.excalibur.container.lifecycle.Accessor;
import org.apache.excalibur.merlin.container.Container;
import org.apache.excalibur.merlin.model.Profile;
import org.apache.excalibur.merlin.model.Resource;
-import org.apache.excalibur.merlin.model.ContextDirective;
-import org.apache.excalibur.meta.info.ContextDescriptor;
import org.apache.excalibur.meta.info.StageDescriptor;
-import org.apache.excalibur.meta.info.ExtensionDescriptor;
-import org.apache.excalibur.meta.info.Type;
/**
* This is a class to help an Application manage the lifecycle of a component.
@@ -91,16 +83,21 @@
{
if( object == null )
- throw new NullPointerException("object");
-
+ {
+ throw new NullPointerException("object");
+ }
if( path == null )
- throw new NullPointerException("path");
-
+ {
+ throw new NullPointerException("path");
+ }
if( profile == null )
- throw new NullPointerException("profile");
-
+ {
+ throw new NullPointerException("profile");
+ }
if( provider == null )
- throw new NullPointerException("provider");
+ {
+ throw new NullPointerException("provider");
+ }
getLogger().info("startup initiated for '" + path + "'." );
@@ -208,7 +205,8 @@
* @param name the name of the component
* @param profile the profile used to establish the object
* @param object the object to process through the shutdown phase
- * @param map the set of context entries for extension stages
+ * @param provider the resource provider
+ * @exception LifecycleException if an error occurs during shutdown
*/
public void shutdown( final String name,
final Profile profile,
1.3 +1 -9 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifestyleHandler.java
Index: LifestyleHandler.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifestyleHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LifestyleHandler.java 14 Aug 2002 10:46:29 -0000 1.2
+++ LifestyleHandler.java 23 Aug 2002 06:25:13 -0000 1.3
@@ -9,13 +9,6 @@
*/
package org.apache.excalibur.merlin.resource;
-import java.util.Map;
-import java.util.Hashtable;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.excalibur.merlin.model.Resource;
-
-
/**
* Interface implemented by a component lifestyle handler.
*
@@ -44,8 +37,7 @@
* supplied by a manager implementation.
*
* @param object the object to return
- * @exception Exception if an error occurs during object release
*/
- void put( Object object ) throws Exception;
+ void put( Object object );
}
1.4 +12 -4 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifestyleManager.java
Index: LifestyleManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifestyleManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LifestyleManager.java 14 Aug 2002 10:46:29 -0000 1.3
+++ LifestyleManager.java 23 Aug 2002 06:25:13 -0000 1.4
@@ -10,10 +10,6 @@
package org.apache.excalibur.merlin.resource;
import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.activity.Initializable;
import org.apache.excalibur.merlin.model.Profile;
import org.apache.excalibur.merlin.assembly.ContainerManager;
@@ -27,6 +23,17 @@
{
/**
+ * Constant context key used to locate the pool manager.
+ */
+ static final String POOL_MANAGER_KEY = "pool-manager";
+
+ /**
+ * Constant component attribute key used to locate a lifestyle policy.
+ */
+ static final String AVALON_LIFESTYLE_KEY = "avalon:lifestyle";
+
+
+ /**
* <p>Returns a lifestyle handler implementation based on a supplied
* profile. The implementation recognizes the following lifestyle
* policy declarations supplied as values against the component
@@ -78,6 +85,7 @@
* @param deployment a profile deployment helper
* @param helper a lifecycle helper
* @param profile the profies containing the lifestyle policy
+ * @param context the deployment context
*
* @return a lifecycle handler supporting the requested policy
* @exception Exception if an error occurs during handler establishment
1.3 +27 -8 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/PooledLifestyleHandler.java
Index: PooledLifestyleHandler.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/PooledLifestyleHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PooledLifestyleHandler.java 21 Aug 2002 17:00:52 -0000 1.2
+++ PooledLifestyleHandler.java 23 Aug 2002 06:25:13 -0000 1.3
@@ -4,8 +4,6 @@
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.TXT file.
- *
- * Original contribution by OSM SARL, http://www.osm.net
*/
package org.apache.excalibur.merlin.resource;
@@ -72,8 +70,10 @@
*/
public Object get() throws Exception
{
- if( m_disposed )
- throw new IllegalStateException("disposed");
+ if( isDisposed() )
+ {
+ throw new IllegalStateException("disposed");
+ }
getLogger().debug("get");
@@ -90,15 +90,20 @@
* object may be used across an arbitary number of clients.
*
* @param object the object to return
+ * @exception IllegalStateException if the hanlder has been disposed of
*/
- public void put( Object object ) throws Exception
+ public void put( Object object ) throws IllegalStateException
{
- if( m_disposed )
- throw new IllegalStateException("disposed");
+ if( isDisposed() )
+ {
+ throw new IllegalStateException("disposed");
+ }
getLogger().debug("put");
if( object == null )
- return;
+ {
+ return;
+ }
if( object.getClass().equals( getCreatedClass() ) )
{
@@ -113,16 +118,30 @@
}
}
+ /**
+ * Return a new instance.
+ * @return the new instance
+ * @exception if an instantiation error occurs
+ */
public Object newInstance() throws Exception
{
return createInstance();
}
+ /**
+ * Handle disposal of the supplied object.
+ * @param object the object to dispose of
+ * @exception if an error in disposal occurs
+ */
public void dispose( Object object ) throws Exception
{
handleShutdown( object );
}
+ /**
+ * Returns the implementation class managed by the pool.
+ * @return the implementation class
+ */
public Class getCreatedClass()
{
return getImplementationClass();
1.6 +14 -9 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/SingletonLifestyleHandler.java
Index: SingletonLifestyleHandler.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/SingletonLifestyleHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SingletonLifestyleHandler.java 21 Aug 2002 17:00:52 -0000 1.5
+++ SingletonLifestyleHandler.java 23 Aug 2002 06:25:13 -0000 1.6
@@ -62,15 +62,18 @@
*/
public Object get() throws Exception
{
- if( m_disposed )
- throw new IllegalStateException("disposed");
+ if( isDisposed() )
+ {
+ throw new IllegalStateException("disposed");
+ }
getLogger().debug("get");
if( m_object == null )
+ {
m_object = super.createInstance();
+ }
super.processAccessStage( m_object );
return m_object;
-
}
/**
@@ -80,14 +83,18 @@
*
* @param object the object to return
*/
- public void put( Object object ) throws Exception
+ public void put( Object object )
{
- if( m_disposed )
- throw new IllegalStateException("disposed");
+ if( isDisposed() )
+ {
+ throw new IllegalStateException("disposed");
+ }
getLogger().debug("put");
if( object == null )
- return;
+ {
+ return;
+ }
if( object.equals( m_object ))
{
@@ -118,7 +125,5 @@
m_manager = null;
super.dispose();
-
-
}
}
1.3 +13 -9 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/ThreadLocalLifestyleHandler.java
Index: ThreadLocalLifestyleHandler.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/ThreadLocalLifestyleHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ThreadLocalLifestyleHandler.java 21 Aug 2002 17:00:52 -0000 1.2
+++ ThreadLocalLifestyleHandler.java 23 Aug 2002 06:25:13 -0000 1.3
@@ -68,8 +68,10 @@
*/
public Object get() throws Exception
{
- if( m_disposed )
- throw new IllegalStateException("disposed");
+ if( isDisposed() )
+ {
+ throw new IllegalStateException("disposed");
+ }
getLogger().debug("get");
@@ -77,7 +79,6 @@
super.processAccessStage( object );
return object;
-
}
/**
@@ -86,15 +87,20 @@
* object may be used across an arbitary number of clients.
*
* @param object the object to return
+ * @exception IllegalStateException if the handler has been disposed of
*/
- public void put( Object object ) throws Exception
+ public void put( Object object ) throws IllegalStateException
{
- if( m_disposed )
- throw new IllegalStateException("disposed");
+ if( isDisposed() )
+ {
+ throw new IllegalStateException("disposed");
+ }
getLogger().debug("put");
if( object == null )
- return;
+ {
+ return;
+ }
if( object.equals( m_instance.get() ) )
{
@@ -123,8 +129,6 @@
m_manager = null;
super.dispose();
-
-
}
private static final class ThreadLocalComponent extends ThreadLocal
1.5 +1 -1 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/TransientLifestyleHandler.java
Index: TransientLifestyleHandler.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/TransientLifestyleHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TransientLifestyleHandler.java 21 Aug 2002 17:00:52 -0000 1.4
+++ TransientLifestyleHandler.java 23 Aug 2002 06:25:13 -0000 1.5
@@ -78,7 +78,7 @@
*
* @param object the object to return
*/
- public void put( Object object ) throws Exception
+ public void put( Object object )
{
getLogger().debug("put");
if( m_objects.contains( object ) )
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>