org.apache.hivemind.internal
Interface Module

All Superinterfaces:
Locatable
All Known Implementing Classes:
ModuleImpl

public interface Module
extends Locatable

The definition of a HiveMind Module. A Module is a container of service extension points and configuration extension points. It also acts as a "gateway" so that services and configurations in other modules may be accessed.

Why do we expose the Module rather than the RegistryInfrastructure? It's more than just qualifying ids before passing them up to the RI. At some future point, a concept of visibility will be added to HiveMind. This will make many services and configurations private to the module which defines them and the necessary visibility filtering logic will be here.

Author:
Howard Lewis Ship

Method Summary
 boolean containsService(java.lang.Class serviceInterface)
          Returns true if a single service exists which implements the specified service interface and is visible to this module.
 ClassResolver getClassResolver()
          Returns the resource resolver for this module.
 java.lang.Object getConfiguration(java.lang.String configurationId)
          Returns the container for the specified configuration point.
 ErrorHandler getErrorHandler()
          Returns the ErrorHandler for this Registry.
 java.util.Locale getLocale()
           
 Messages getMessages()
          Returns an object that can provide and format localized messages for this module.
 java.lang.String getModuleId()
          Returns the unique identifier for this module.
 RegistryInfrastructure getRegistry()
           
 java.lang.Object getService(java.lang.Class serviceInterface)
          Finds a service that implements the provided interface.
 java.lang.Object getService(java.lang.String serviceId, java.lang.Class serviceInterface)
          Looks up the ServicePoint (throwing an exception if not found) and invokes ServicePoint.getService(Class).
 ServiceModelFactory getServiceModelFactory(java.lang.String name)
           
 ServicePoint getServicePoint(java.lang.String serviceId)
          Returns the identified service extension point.
 java.lang.Class resolveType(java.lang.String type)
          Returns the class matching the type.
 
Methods inherited from interface org.apache.hivemind.Locatable
getLocation
 

Method Detail

getModuleId

java.lang.String getModuleId()
Returns the unique identifier for this module.


containsService

boolean containsService(java.lang.Class serviceInterface)
Returns true if a single service exists which implements the specified service interface and is visible to this module.

Parameters:
serviceInterface -
Returns:
true if a single visible service for the specified service interface exists
Since:
1.1

getService

java.lang.Object getService(java.lang.String serviceId,
                            java.lang.Class serviceInterface)
Looks up the ServicePoint (throwing an exception if not found) and invokes ServicePoint.getService(Class).

Parameters:
serviceId - an unqualified id for a service within this module, or a fully qualified id for a service in this or any other module
serviceInterface - type the result will be cast to

getService

java.lang.Object getService(java.lang.Class serviceInterface)
Finds a service that implements the provided interface. Exactly one such service may exist or an exception is thrown.

Parameters:
serviceInterface - used to locate the service

getServicePoint

ServicePoint getServicePoint(java.lang.String serviceId)
Returns the identified service extension point.

Parameters:
serviceId - an unqualified id for a service within this module, or a fully qualified id for a service in this or any other module
Throws:
ApplicationRuntimeException - if no such service extension point exists

getConfiguration

java.lang.Object getConfiguration(java.lang.String configurationId)
Returns the container for the specified configuration point.

Parameters:
configurationId - an unqualified id for a configuration within this module, or a fully qualified id for a configuration in this or any other module
Throws:
ApplicationRuntimeException - if this module does not contain the specified configuration extension point.

getClassResolver

ClassResolver getClassResolver()
Returns the resource resolver for this module. The resource resolver is used to locate classes by name (using the correct classloader).


resolveType

java.lang.Class resolveType(java.lang.String type)
Returns the class matching the type. First, attempts to resolve the type exactly as is. If that fails, resolves the type within the module's defined package.

Parameters:
type - the Java type to convert into a class. May be a primitive type, or an array of objects or primitives.
Returns:
the corresponding Class object.
Throws:
ApplicationRuntimeException - if the type may not be converted into a Class.
Since:
1.1

getMessages

Messages getMessages()
Returns an object that can provide and format localized messages for this module. The messages come from a properties file, hivemodule.properties (localized) stored with the HiveMind deployment descriptor in the META-INF folder.


getServiceModelFactory

ServiceModelFactory getServiceModelFactory(java.lang.String name)
See Also:
RegistryInfrastructure.getServiceModelFactory(String)

getLocale

java.util.Locale getLocale()
See Also:
Registry.getLocale()

getErrorHandler

ErrorHandler getErrorHandler()
Returns the ErrorHandler for this Registry.


getRegistry

RegistryInfrastructure getRegistry()
Returns:
the registry infrastructure interface


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.