mcconnell 2002/12/27 08:41:07
Modified: merlin/src/java/org/apache/avalon/merlin/container
Container.java DefaultContainer.java
Log:
Enhanced method signatures and moved some protected operations to private scope.
Revision Changes Path
1.3 +4 -4
avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/Container.java
Index: Container.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/Container.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Container.java 17 Dec 2002 04:46:04 -0000 1.2
+++ Container.java 27 Dec 2002 16:41:06 -0000 1.3
@@ -56,13 +56,12 @@
package org.apache.avalon.merlin.container;
import org.apache.avalon.framework.Version;
+import org.apache.avalon.assembly.lifecycle.AssemblyException;
/**
* <p>A container is node in a containment heirachy. It defines a scope
* scope of execution for the components contained within it.</p>
*
- * @see org.apache.excalibur.merlin.model.ContainerDecriptor
- *
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
@@ -70,13 +69,14 @@
{
public static final String KEY = Container.class.getName();
public static final Version VERSION = Version.getVersion( "1.0" );
+ public static final String PATH_SEPERATOR = "/";
/**
* Assemble all of the componets in this container and invoke assembly on
* all subsidiary containers.
* @exception Exception if a assembly error occurs
*/
- void assemble() throws Exception;
+ void assemble() throws AssemblyException;
/**
* Startup the components in this container and startup all subsidiary
1.9 +22 -17
avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/DefaultContainer.java
Index: DefaultContainer.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/DefaultContainer.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultContainer.java 21 Dec 2002 09:27:01 -0000 1.8
+++ DefaultContainer.java 27 Dec 2002 16:41:06 -0000 1.9
@@ -66,6 +66,7 @@
import org.apache.avalon.assembly.appliance.ApplianceContext;
import org.apache.avalon.assembly.appliance.DefaultApplianceContext;
import org.apache.avalon.assembly.appliance.ApplianceException;
+import org.apache.avalon.assembly.lifecycle.AssemblyException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.Contextualizable;
@@ -78,10 +79,8 @@
import org.apache.avalon.meta.model.Profile;
/**
- * <p>A container is node in a containment heirachy. It defines a scope
- * scope of execution for the components contained within it.</p>
- *
- * @see org.apache.excalibur.merlin.model.ContainerDecriptor
+ * <p>Default implementation of a container model within which a set
+ * of components and subsidiary containers are managed.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
@@ -181,16 +180,21 @@
m_path = m_descriptor.getName() + "/";
}
+ Profile[] profiles = m_descriptor.getComponents();
if( getLogger().isDebugEnabled() )
{
- getLogger().debug( "initialization: " + m_path );
+ getLogger().debug( "initialization: " + m_path + " (" + profiles.length
+ ")" );
}
- Profile[] profiles = m_descriptor.getComponents();
for( int i=0; i<profiles.length; i++ )
{
Profile profile = profiles[i];
- getLogger().debug( "creating appliance: " + profile );
+ if( getLogger().isDebugEnabled() )
+ {
+ final String message =
+ "appliance appliance: " + profile;
+ getLogger().debug( message );
+ }
DefaultApplianceContext context = new DefaultApplianceContext( profile
);
context.setPartitionName( m_path );
context.makeReadOnly();
@@ -251,12 +255,13 @@
* all subsidiary containers.
* @exception Exception if a assembly error occurs
*/
- public void assemble() throws Exception
+ public void assemble() throws AssemblyException
{
if( getLogger().isDebugEnabled() )
{
getLogger().debug( "assembly" );
}
+
assembleComponents();
assembleContainers();
}
@@ -265,7 +270,7 @@
* Startup the components in this container.
* @exception Exception if a startup error occurs
*/
- protected void assembleComponents() throws Exception
+ private void assembleComponents() throws AssemblyException
{
Iterator iterator = m_components.iterator();
while( iterator.hasNext() )
@@ -279,7 +284,7 @@
* Invoke assembly on the nested containers in this container.
* @exception Exception if an assembly error occurs
*/
- protected void assembleContainers() throws Exception
+ private void assembleContainers() throws AssemblyException
{
Iterator iterator = m_containers.iterator();
while( iterator.hasNext() )
@@ -309,7 +314,7 @@
* Startup the components in this container.
* @exception Exception if a startup error occurs
*/
- protected void startupComponents() throws Exception
+ private void startupComponents() throws Exception
{
Iterator iterator = m_components.iterator();
while( iterator.hasNext() )
@@ -343,7 +348,7 @@
* Startup the containers in this container.
* @exception Exception if a startup error occurs
*/
- protected void startupContainers() throws Exception
+ private void startupContainers() throws Exception
{
Iterator iterator = m_containers.iterator();
while( iterator.hasNext() )
@@ -383,7 +388,7 @@
* Shutdown all subsidiary containers and all components in this container.
* @exception Exception if a shutdown error occurs
*/
- protected void shutdownComponents() throws Exception
+ private void shutdownComponents() throws Exception
{
Iterator iterator = m_components.iterator();
while( iterator.hasNext() )
@@ -414,7 +419,7 @@
* Shutdown the containers in this container.
* @exception Exception if a startup error occurs
*/
- protected void shutdownContainers() throws Exception
+ private void shutdownContainers() throws Exception
{
Iterator iterator = m_containers.iterator();
while( iterator.hasNext() )
@@ -466,7 +471,7 @@
/**
* Release all of the components in this container.
*/
- protected void disposeComponents()
+ private void disposeComponents()
{
Iterator iterator = m_components.iterator();
while( iterator.hasNext() )
@@ -493,7 +498,7 @@
* Shutdown the containers in this container.
* @exception Exception if a startup error occurs
*/
- protected void disposeContainers()
+ private void disposeContainers()
{
Iterator iterator = m_containers.iterator();
while( iterator.hasNext() )
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>