|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.codemonster.surinam.mgmt.impl.ServiceBlockImpl
public class ServiceBlockImpl
This is the implementation of the service block. It represents one of the most visible objects in the Surinam framework... the ServiceBlock.
| Constructor Summary | |
|---|---|
ServiceBlockImpl(ClassLoader parentLoader)
A convenience constructor that initializes with an empty class path. |
|
ServiceBlockImpl(ClassLoader parentLoader,
URL[] classpath)
We start out by allocating the application's class loader and makes it a child of the given loader. |
|
| Method Summary | |
|---|---|
void |
bindProviderImplementation(ImplementationBlueprint blueprint)
This will create, register and assign a new organization implementation to the given contract. |
ReentrantReadWriteLock |
getActionLock()
This is for when we need to lock down all activities on a block while an update that contains multiple steps that need to be atomic. |
BlueprintManager |
getBlueprintMgr()
|
Class |
getContractClass(String className)
This method will return a reference to the Class object that has been loaded from within the service block context. |
ServiceDirectory |
getServiceDirectory()
For those times when a client might want to query the directory for more than simply asking for implementations, we allow clients to hold references to the service directory. |
ServiceDirectoryAdmin |
getServiceDirectoryAdmin()
Simple accessor for times when we need access to the ServiceDirectory's administrative interface. |
ServiceFinder |
getServiceFinder()
If you have a Service Block, you can acquire the Finder. |
GreedyClassLoader |
getServiceLoader()
In order to generate the proxies, we need access to the class loader. |
ManagedService |
getStaticService(Class className)
Takes a contract class object and returns the associated service object. |
ManagedService |
getStaticService(String className)
Takes a fully-qualified string name of the contract class and returns the associated service object. |
void |
injectRequiredServices(ImplementationBlueprint blueprint)
|
void |
invalidateReferences()
This method is to be called at the end of Graph Reshaping event. |
boolean |
isRegisteredContract(String contractName)
Simple query to see if a contract is registered or not. |
void |
registerContract(ContractBlueprint contractBlueprint)
This will register a new contract for use in the application. |
void |
registerEntryPoint(EntryPointBlueprint entryPoint)
An entry point is just like a normal service except that the contract class is expected to be taken from the parent loader and not locally. |
void |
reset()
This method will cause the Service Block to flush all its internal structures and reset its state to what it was when it was first created. |
void |
retireEntryPoint(String contractName)
This will strike the contract from the Service Directory, clients will begin to receive UnknownServiceExceptions and this action will also free the organization implementation that was servicing the contract if there was one. |
void |
retireServiceContract(String contractName)
This will remove the contract from the Service Directory, clients will begin to receive UnknownServiceExceptions and this action will also free the implementation that was servicing the contract if there is one. |
void |
setBlueprintMgr(BlueprintManager blueprintMgr)
Normally this is not used. |
void |
setServiceDirectory(ServiceDirectory svcDirectory)
standard setter. |
void |
synchronizeBindings()
This administrative process causes the BlueprintManager to clear out its implementation bindings and rebuild them all so that the BPM and the Service Directory are in synch with each other. |
void |
unbindServiceImplementation(String serviceName)
This will unbind the Provider Implementation from the given Service Contract, clients will begin to receive ServiceUnavailableExceptions as the Contract will be assigned the default implementation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ServiceBlockImpl(ClassLoader parentLoader)
parentLoader - The class loader of the parent process/context.
public ServiceBlockImpl(ClassLoader parentLoader,
URL[] classpath)
parentLoader - The class loader of the parent process/context.classpath - This is an array of URL objects that point to jar files to be included in this block's
classpath.| Method Detail |
|---|
public final void synchronizeBindings()
throws ClassNotFoundException
synchronizeBindings in interface ServiceBlockAdminClassNotFoundException - thrown of there is a problem with the synchronization, which involves
some class lookup activities. If this should happen, it is very bad.public final void setServiceDirectory(ServiceDirectory svcDirectory)
svcDirectory - Service Directory instance.public final ServiceFinder getServiceFinder()
getServiceFinder in interface ServiceBlockpublic final ServiceDirectory getServiceDirectory()
getServiceDirectory in interface ServiceBlockAdminpublic final ServiceDirectoryAdmin getServiceDirectoryAdmin()
ServiceBlockAdmin
getServiceDirectoryAdmin in interface ServiceBlockAdminpublic final boolean isRegisteredContract(String contractName)
ServiceBlock
isRegisteredContract in interface ServiceBlockcontractName - String name of the Contract being queried.
public final Class getContractClass(String className)
ServiceBlock
getContractClass in interface ServiceBlockgetContractClass in interface ServiceBlockAdminclassName - String name of the Contract Class being queried.
UnknownServiceExceptionpublic final ManagedService getStaticService(Class className)
getStaticService in interface ServiceBlockclassName - The fully-qualified class name of the service contract.
public final ManagedService getStaticService(String className)
throws ClassNotFoundException
getStaticService in interface ServiceBlockclassName - fq name of the service contract.
ClassNotFoundException - Thrown if the given class doesn't map to anything in the Service Block.public final GreedyClassLoader getServiceLoader()
getServiceLoader in interface ServiceBlockAdminpublic final BlueprintManager getBlueprintMgr()
getBlueprintMgr in interface ServiceBlockAdminpublic void setBlueprintMgr(BlueprintManager blueprintMgr)
setBlueprintMgr in interface ServiceBlockAdminblueprintMgr - sets the ServiceBlock's Blueprint Manager.
public void registerContract(ContractBlueprint contractBlueprint)
throws MalformedURLException,
ClassNotFoundException
registerContract in interface ServiceBlockAdmincontractBlueprint - This is a blueprint for a service contract.
MalformedURLException - This will include classpath definitions which may be malformed.
ClassNotFoundException - The specified class may not be found.
public final void registerEntryPoint(EntryPointBlueprint entryPoint)
throws MalformedURLException,
ClassNotFoundException
registerEntryPoint in interface ServiceBlockAdminentryPoint - This is a blueprint that specifies the details of this entry point.
MalformedURLException - This will include classpath definitions which may be malformed.
ClassNotFoundException - The specified class may not be found.public final void unbindServiceImplementation(String serviceName)
unbindServiceImplementation in interface ServiceBlockAdminserviceName - This is the Contract name whose current implementation is to be unbound.
public final void bindProviderImplementation(ImplementationBlueprint blueprint)
throws ClassNotFoundException,
MissingInterfaceException,
InstantiationException,
MissingAnnotationException,
IllegalAccessException,
DependencyInjectionException,
BindingDeclarationError
bindProviderImplementation in interface ServiceBlockAdminblueprint - This is the meta object that provides the spec for building the implementation.
ClassNotFoundException - Thrown if the class specified in the blueprint cannot be found.
MissingInterfaceException - Thrown if the implementation does not implement the required interfaces.
InstantiationException - Thrown if there is a failure creating the organization implementation.
MissingAnnotationException - Thrown if the organization implementation does not have the required
annotations.
IllegalAccessException - An attempt will be made to instantiate a new instance of the specified
implementation, this could fail.
DependencyInjectionException - The framework will try to inject any services that it depends on. If
any of those services are unavailable, injection will not be attempted. If the service is available but the
attempt to inject via the specified method should fail the exception is also thrown.
BindingDeclarationError - Thrown when the binding declaration
is broken.
public void injectRequiredServices(ImplementationBlueprint blueprint)
throws UnknownServiceException,
ClassNotFoundException,
DependencyInjectionException,
IllegalAccessException
injectRequiredServices in interface ServiceBlockAdminblueprint - This is the service Blueprint that contains meta-information on injected services.
ClassNotFoundException - Thrown if the class specified in the blueprint cannot be found.
DependencyInjectionException - The framework will try to inject any services that it depends on. If
any of those services are unavailable, injection will not be attempted. If the service is available but the
attempt to inject via the specified method should fail the exception is also thrown.
IllegalAccessException - An attempt will be made to instantiate a new instance of the specified
UnknownServiceExceptionpublic void retireEntryPoint(String contractName)
retireEntryPoint in interface ServiceBlockAdmincontractName - This is the name of the EntryPoint to be retired.public void retireServiceContract(String contractName)
retireServiceContract in interface ServiceBlockAdmincontractName - This is the Contract name to be retired.public void reset()
reset in interface ServiceBlockAdminpublic ReentrantReadWriteLock getActionLock()
ServiceBlockAdmin
getActionLock in interface ServiceBlockAdminpublic void invalidateReferences()
invalidateReferences in interface ServiceBlockAdmin
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||