|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.codemonster.surinam.core.framework.impl.ServiceDirectoryImpl
public class ServiceDirectoryImpl
This is the default service directory implementation for the Surinam project. This is one of the more important pieces of the whole framework from a runtime perspective since this is the central directory for all registered Entry Points, Service Contracts and Implementations.
Constructor Summary | |
---|---|
ServiceDirectoryImpl()
|
Method Summary | |
---|---|
void |
activateService(Class serviceName)
This is just an idea for lifecycle support that we might ask a organization implementation to mark itself as unavailable. |
boolean |
bindImplementation(Class serviceName,
ManagedService managedService)
Here, we store the given impl for this service interface. |
void |
deactivateService(Class serviceName)
This is just an idea for lifecycle support that we might ask a organization implementation to mark itself as unavailable. |
Set<Class> |
getAllServices()
This is an easy way to acquire the list of known services, including both Entry Points and Service Points. |
Object |
getProviderImplementation(VersionedProviderImplementationName versionedProviderImplementationName)
This method will allow external threads to build their own compound versionedProviderImplementationName that identifies a versioned implementation class and get a reference to that impl class. |
ManagedService |
getService(Class serviceClass)
We take the class of the service interface we want to use and we return an implementation of that service interface. |
ManagedService |
getUnvalidatedService(Class serviceClass)
This method returns a managed service but does not consider the reference valid for making an invocation on. |
boolean |
isBoundImplementation(ManagedService impl)
This method will scan the collection of held implementations to see if there's a match. |
boolean |
isBoundImplementation(VersionedProviderImplementationName key)
Simple query to see if a particular implementation is known to the directory. |
boolean |
isRegisteredContract(Class serviceClass)
Simple query to see if a contract is registered or not. |
void |
registerContractWithDefaultBinding(Class serviceClass)
The given service Class will be registered with default binding. |
void |
reset()
This method will cause the Service Directory to flush all its internal mappings and reset its state to what it was when it was first created. |
void |
retireContract(Class serviceClass)
Takes the given Contract (or EntryPoint) and removes it from the directory and frees the Contract and any implementation bound to it. |
void |
retireEntryPoint(Class entryPointClass)
A little syntactic sugar since retiring an Entry Point is the same as for a Contract. |
String |
toHTML()
This method will render the service directory structure as an HTML string. |
String |
toXML()
This method will render the service directory structure as an xml string. |
void |
unbindImplementation(ManagedService managedService)
|
void |
unbindImplementation(VersionedProviderImplementationName versionedImplName)
|
void |
unbindServiceImplementation(Class serviceName)
Unbinding an implementation will set the given service to the default placeholder. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceDirectoryImpl()
Method Detail |
---|
public ManagedService getService(Class serviceClass) throws UnknownServiceException, UnavailableServiceException
ServiceDirectory
getService
in interface ServiceDirectory
serviceClass
- This should be the class of an interface.
UnknownServiceException
- This exception can be thrown if the
service that the proxy tries to acquire has been removed from the directory.
UnavailableServiceException
- This exception gets thrown if
the service is known but has removed itself from an active state possibly due to some runtime failure.jpublic ManagedService getUnvalidatedService(Class serviceClass) throws UnknownServiceException, UnavailableServiceException
getUnvalidatedService
in interface ServiceDirectoryAdmin
serviceClass
- This is the key by which, we will acquire a reference to the service.
UnknownServiceException
UnavailableServiceException
public Set<Class> getAllServices()
ServiceDirectoryAdmin
getAllServices
in interface ServiceDirectoryAdmin
public Object getProviderImplementation(VersionedProviderImplementationName versionedProviderImplementationName)
ServiceDirectoryAdmin
getProviderImplementation
in interface ServiceDirectoryAdmin
versionedProviderImplementationName
- This is the key that will be used to indentify and acquire the
impl object.
public boolean isRegisteredContract(Class serviceClass)
ServiceDirectory
isRegisteredContract
in interface ServiceDirectory
serviceClass
- This is the class object for the Service Contract interface.
public boolean isBoundImplementation(VersionedProviderImplementationName key)
ServiceDirectory
isBoundImplementation
in interface ServiceDirectory
key
- This is the key that will be used to indentify and acquire the impl object.
public boolean isBoundImplementation(ManagedService impl)
ServiceDirectoryAdmin
isBoundImplementation
in interface ServiceDirectoryAdmin
impl
- The instance being searched for.
public boolean bindImplementation(Class serviceName, ManagedService managedService) throws ServiceBindingException
ServiceDirectoryAdmin
bindImplementation
in interface ServiceDirectoryAdmin
serviceName
- This is the class for the interface that defines the service contract.managedService
- This is the implementation instance for this interface which must extend the Adapter or
ServiceBindingException
- Thrown if there is a problem
with the assignment.public void unbindServiceImplementation(Class serviceName)
ServiceDirectoryAdmin
unbindServiceImplementation
in interface ServiceDirectoryAdmin
serviceName
- The service class for the service point for which we wish to remove the impl.public void unbindImplementation(VersionedProviderImplementationName versionedImplName)
public void unbindImplementation(ManagedService managedService)
public void registerContractWithDefaultBinding(Class serviceClass)
registerContractWithDefaultBinding
in interface ServiceDirectoryAdmin
serviceClass
- The fq Class object for the service.public void retireEntryPoint(Class entryPointClass)
entryPointClass
- public void retireContract(Class serviceClass)
retireContract
in interface ServiceDirectoryAdmin
serviceClass
- The fq name of the service you wish to retire.public void activateService(Class serviceName)
activateService
in interface ServiceDirectoryAdmin
serviceName
- Name of the service to be activated.public void deactivateService(Class serviceName)
deactivateService
in interface ServiceDirectoryAdmin
serviceName
- Name of the service to be deactivated.public void reset()
reset
in interface ServiceDirectoryAdmin
public String toXML()
toXML
in interface ServiceDirectory
public String toHTML()
toHTML
in interface ServiceDirectory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |