mcconnell 2002/12/16 20:54:07
Modified: assembly/src/java/org/apache/avalon/assembly/engine
AssemblyService.java DefaultAssemblyService.java
Log:
Added disassembly functionality.
Revision Changes Path
1.2 +7 -1
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/AssemblyService.java
Index: AssemblyService.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/AssemblyService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AssemblyService.java 14 Dec 2002 21:04:40 -0000 1.1
+++ AssemblyService.java 17 Dec 2002 04:54:07 -0000 1.2
@@ -69,4 +69,10 @@
*/
void assemble( Appliance appliance ) throws AssemblyException;
+ /**
+ * Disassemble the supplied appliance.
+ * @param appliance the object to disassemble
+ */
+ void disassemble( Appliance appliance );
+
}
1.2 +28 -11
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/DefaultAssemblyService.java
Index: DefaultAssemblyService.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/DefaultAssemblyService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultAssemblyService.java 14 Dec 2002 21:04:40 -0000 1.1
+++ DefaultAssemblyService.java 17 Dec 2002 04:54:07 -0000 1.2
@@ -76,7 +76,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development
Team</a>
* @version $Revision$ $Date$
*/
-class DefaultAssemblyService extends AbstractLogEnabled implements AssemblyService,
Contextualizable, Serviceable, Initializable
+public class DefaultAssemblyService extends AbstractLogEnabled implements
AssemblyService, Contextualizable, Serviceable, Initializable
{
//==============================================================
// static
@@ -192,6 +192,25 @@
}
/**
+ * Disassemble the supplied appliance.
+ * @param appliance the object to disassemble
+ */
+ public void disassemble( Appliance appliance )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug("dissasemble: " + appliance );
+ }
+ Appliance[] consumers = m_map.getConsumerGraph( appliance );
+ for( int i=0; i<consumers.length; i++ )
+ {
+ Appliance consumer = consumers[i];
+ consumer.terminate();
+ m_map.remove( consumer );
+ }
+ }
+
+ /**
* Utility to get the engine from the service manager. This operation
* should not be invoked before completion of initialization.
* @return the engine
@@ -262,7 +281,7 @@
if( appliance.getServiceProvider( role ) == null )
{
- getLogger().debug( "resolving role: " + role + " on " + name );
+ getLogger().debug( "resolving role: [" + role + "] on [" + name +
"]");
//
// select the preferred provider for the dependency - the dependency
@@ -273,15 +292,13 @@
try
{
- supplier = getEngine().resolve( dependency );
+ supplier = getEngine().resolve( dependency,
appliance.getPartitionName() );
}
catch( Throwable e )
{
final String error =
- "Unable to deploy a supplier for a service dependency: '"
- + supplier
- + "' within the appliance '"
- + appliance + "'.";
+ "Unable to deploy a supplier for a service dependency: "
+ + dependency;
throw new AssemblyException( error, e );
}
@@ -329,7 +346,7 @@
try
{
- supplier = getEngine().resolve( stage );
+ supplier = getEngine().resolve( stage,
appliance.getPartitionName() );
}
catch( Throwable e )
{
@@ -377,7 +394,7 @@
Appliance provider;
try
{
- provider = getEngine().resolve( stage );
+ provider = getEngine().resolve( stage, appliance.getPartitionName() );
}
catch( Throwable e )
{
@@ -403,7 +420,7 @@
Appliance provider;
try
{
- provider = getEngine().resolve( dependency );
+ provider = getEngine().resolve( dependency,
appliance.getPartitionName() );
}
catch( Throwable e )
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>