com.codemonster.surinam.export.framework
Interface ServiceDirectory

All Known Implementing Classes:
ServiceDirectoryImpl

public interface ServiceDirectory

The Service Directory API is the primary high-level interface for general access, although 'general' is a relative term in this context since most developers may never need to work with the Service Directory directly. However, this interface represents an important layer of access that, while perfectly adequate for many uses, it doesn't expose some of the deeper functionality; for that, developers should move to the admin interface.

The Service Directory disallows 'ghosts' so there can be no registered services without a bound implementation; this is true even if an implementation has deactivated itself.

See Also:
ServiceDirectoryAdmin

Method Summary
 ManagedService getService(Class clazz)
          We take the class of the service interface we want to use and we return an implementation of that service interface.
 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.
 String toHTML()
          This is a simple utility method will return the service directory as an HTML-formatted string.
 String toXML()
          This is a simple utility method will return the service directory as an XML-formatted string.
 

Method Detail

getService

ManagedService getService(Class clazz)
                          throws UnavailableServiceException,
                                 UnknownServiceException
We take the class of the service interface we want to use and we return an implementation of that service interface.

Parameters:
clazz - This should be the class of an interface.
Returns:
Returns an object that implements the given interface, normally a proxy.
Throws:
UnavailableServiceException - This exception gets thrown if the service is known but has removed itself from an active state possibly due to some runtime failure.j
UnknownServiceException - This exception can be thrown if the service that the proxy tries to acquire has been removed from the directory.

isBoundImplementation

boolean isBoundImplementation(VersionedProviderImplementationName key)
Simple query to see if a particular implementation is known to the directory.

Parameters:
key - This is the key that will be used to indentify and acquire the impl object.
Returns:
Returns a boolean indicating whether this is a known implementation.

isRegisteredContract

boolean isRegisteredContract(Class serviceClass)
Simple query to see if a contract is registered or not.

Parameters:
serviceClass - This is the class object for the Service Contract interface.
Returns:
Returns a boolean indicating whether this is a known Service Contract.

toXML

String toXML()
This is a simple utility method will return the service directory as an XML-formatted string. This is not intended to be a full-on presentation layer as this would not be the appropriate place for it. Instead, it is here as a development method to help people perform a quick gut-check for diagnostic purposes.

Returns:
Returns a string representation of the service directory mappings as XML.

toHTML

String toHTML()
This is a simple utility method will return the service directory as an HTML-formatted string. This is not intended to be a full-on presentation layer as this would not be the appropriate place for it. Instead, it is here as a development method to help people perform a quick gut-check for diagnostic purposes.

Returns:
Returns a string representation of the service directory mappings as HTML.


Copyright © 2010. All Rights Reserved.