com.codemonster.surinam.mgmt
Class ServiceBlockCommander

java.lang.Object
  extended by com.codemonster.surinam.mgmt.ServiceBlockCommander

public class ServiceBlockCommander
extends Object

This is a wrapper for a Service Block that will accept Action (command) Sequences and apply them to the given Service Block. This arrangement keeps the command layer separate so that the API can exist independently without knowledge of a command wrapper. This separation would also make it easier to create new wrappers and or extend existing wrappers without altering the core API.


Constructor Summary
ServiceBlockCommander(ServiceBlock serviceBlock)
          Here we require the commander to be handed the ServiceBlock that it will wrap.
 
Method Summary
 void apply(ActionSequence actions)
          Here, we iterate through the list, executing each action.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceBlockCommander

public ServiceBlockCommander(ServiceBlock serviceBlock)
Here we require the commander to be handed the ServiceBlock that it will wrap. This is as much for convenience as to stress the importance of the block to the wrapper.

Parameters:
serviceBlock - the service block instance to be wrapped with the command API.
Method Detail

apply

public void apply(ActionSequence actions)
           throws IllegalAccessException,
                  MalformedURLException,
                  MissingAnnotationException,
                  UnknownServiceException,
                  MissingInterfaceException,
                  DependencyInjectionException,
                  InstantiationException,
                  ClassNotFoundException,
                  BindingDeclarationError
Here, we iterate through the list, executing each action. Since this is effectively the same as what we can do programmatically, we will need to be prepared for all the failures that could happen in the hard-coded programmed approach. It is possible that if you have an Action Document or Sequence, that represents the current state of the service block an attempt to apply

Parameters:
actions - The ActionSequence to be executed on the ServiceBlock.
Throws:
IllegalAccessException - Thrown if there is an access problem.
MalformedURLException - Thrown if there is a bad classpath segment.
MissingAnnotationException - Thrown if a required annotation is missing.
UnknownServiceException - Thrown if we try to perform an assignment to a service that doesn't exist.
MissingInterfaceException - Thrown if a required interface is missing.
DependencyInjectionException - Thrown if dependency injection fails.
InstantiationException - Thrown if the ServiceBlock is unable to instantiate a needed class.
ClassNotFoundException - Thrown if a class loader is unable to load a needed class.
BindingDeclarationError - Thrown if there is a problem binding an impl to a contract in the ActionSequence.


Copyright © 2010. All Rights Reserved.