org.apache.avalon.activation.appliance.impl
Class DefaultBlock

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.activation.appliance.impl.AbstractAppliance
          extended byorg.apache.avalon.activation.appliance.impl.DefaultBlock
All Implemented Interfaces:
Appliance, Block, Composite, Deployable, Disposable, Engine, Home, LogEnabled

public class DefaultBlock
extends AbstractAppliance
implements Block, Composite

The DefaultBlock is responsible for the management of the assembly of the subsidiary appliances, the coordination of the deployment, decommissioning and eventual dissassembly of contained appliances, and the overall management of a containment context.

Version:
$Revision: 1.1.1.1 $ $Date: 2003/09/10 08:56:29 $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.avalon.activation.appliance.Appliance
MBEAN_SERVER_KEY
 
Method Summary
 void assemble()
          Assemble the appliance.
 Appliance createAppliance(Model model)
          Create a new appliance.
static Block createRootBlock(ServiceContext context, ContainmentModel model)
          Create a root containment block.
 void decommission()
          Decommission the block.
 void deploy()
          Deploy the appliance.
 void disassemble()
          Disassemble the appliance.
 void dispose()
           
 Appliance[] getProviders()
          Returns the set of appliances instances that provide services to the set of appliances managed by this container.
 boolean isAssembled()
          Returns the assembled state of the appliance.
 void release(Object source, Object instance)
          Release an object
 Object resolve(Object consumer)
          Resolve a object to a value.
 Object resolve(Object source, Class[] ref)
          Resolve a object to a value qualified by a supplied service reference.
 Appliance resolveAppliance(DependencyDescriptor dependency)
          Return an appliance relative to a supplied dependency descriptor.
 Appliance resolveAppliance(DependencyModel dependency)
          Return an appliance relative to a supplied dependency model.
 Appliance resolveAppliance(StageDescriptor stage)
          Return an appliance relative to a supplied stage descriptor.
 Appliance resolveAppliance(StageModel stage)
          Return an appliance relative to a supplied stage model.
 Appliance resolveAppliance(String source)
          Return an appliance relative to a specific path.
 String toString()
           
 
Methods inherited from class org.apache.avalon.activation.appliance.impl.AbstractAppliance
getModel, isEnabled
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.activation.appliance.Appliance
getModel, isEnabled
 

Method Detail

createRootBlock

public static Block createRootBlock(ServiceContext context,
                                    ContainmentModel model)
                             throws Exception
Create a root containment block.

Parameters:
context - the service context
model - the root containment model
Returns:
the appliance
Throws:
Exception

resolveAppliance

public Appliance resolveAppliance(DependencyModel dependency)
                           throws Exception
Return an appliance relative to a supplied dependency model.

Specified by:
resolveAppliance in interface Engine
Parameters:
dependency - the dependency model
Returns:
the appliance
Throws:
Exception

resolveAppliance

public Appliance resolveAppliance(DependencyDescriptor dependency)
                           throws Exception
Return an appliance relative to a supplied dependency descriptor.

Specified by:
resolveAppliance in interface Engine
Parameters:
dependency - the dependency descriptor
Returns:
the appliance
Throws:
NoProviderDefinitionException - if no provider an be found for the supplied dependency
Exception - if an error occurs

resolveAppliance

public Appliance resolveAppliance(StageModel stage)
                           throws Exception
Return an appliance relative to a supplied stage model.

Specified by:
resolveAppliance in interface Engine
Parameters:
stage - the stage model
Returns:
the appliance
Throws:
Exception

resolveAppliance

public Appliance resolveAppliance(StageDescriptor stage)
                           throws NoProviderDefinitionException,
                                  Exception
Return an appliance relative to a supplied stage descriptor.

Specified by:
resolveAppliance in interface Engine
Parameters:
stage - the stage descriptor
Returns:
the appliance
Throws:
NoProviderDefinitionException - if no provider an be found for the supplied stage
Exception - if an error occurs

resolveAppliance

public Appliance resolveAppliance(String source)
                           throws Exception
Return an appliance relative to a specific path.

Specified by:
resolveAppliance in interface Engine
Parameters:
source - the appliance path
Returns:
the appliance
Throws:
Exception - if an error occurs

isAssembled

public boolean isAssembled()
Returns the assembled state of the appliance.

Specified by:
isAssembled in interface Composite
Returns:
true if this appliance is assembled

assemble

public void assemble()
              throws AssemblyException
Assemble the appliance.

Specified by:
assemble in interface Composite
Throws:
ApplianceException - if an error occurs during appliance assembly
AssemblyException

disassemble

public void disassemble()
Disassemble the appliance.

Specified by:
disassemble in interface Composite

getProviders

public Appliance[] getProviders()
Returns the set of appliances instances that provide services to the set of appliances managed by this container.

Specified by:
getProviders in interface Composite
Returns:
an empty set of consumed appliance instances

deploy

public void deploy()
            throws Exception
Deploy the appliance. If the deployment policy is startup an initial instance of a component will be deployed.

Specified by:
deploy in interface Deployable
Throws:
Exception - if a deployment error occurs

decommission

public void decommission()
Decommission the block. Under the decommissioning phase, all active components will be taken down.

Specified by:
decommission in interface Deployable

resolve

public Object resolve(Object consumer)
               throws Exception
Resolve a object to a value.

Specified by:
resolve in interface Home
Parameters:
consumer - the consumer
Returns:
the resolved object
Throws:
Exception - if an error occurs

resolve

public Object resolve(Object source,
                      Class[] ref)
               throws Exception
Resolve a object to a value qualified by a supplied service reference.

Specified by:
resolve in interface Home
Parameters:
source - the context within the the resolution is applied
ref - the requested service interfaces
Returns:
the resolved object
Throws:
Exception - if an error occurs

release

public void release(Object source,
                    Object instance)
Release an object

Specified by:
release in interface Home
Parameters:
source - the client that obtained the intial reference
instance - the object to be released

dispose

public void dispose()
Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractAppliance

createAppliance

public Appliance createAppliance(Model model)
                          throws ApplianceException
Create a new appliance.

Parameters:
model - the component model
Returns:
the appliance
Throws:
ApplianceException

toString

public String toString()
Overrides:
toString in class AbstractAppliance


Copyright © Apache Software Foundation. All Rights Reserved.