|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hivemind.impl.BaseLocatable
org.apache.hivemind.impl.AbstractExtensionPoint
org.apache.hivemind.impl.ServicePointImpl
public final class ServicePointImpl
Abstract implementation of ServicePoint. Provides some of
the machinery for creating new service instances, delegating most of it to the
ServiceModel instace for the service.
| Constructor Summary | |
|---|---|
ServicePointImpl()
|
|
| Method Summary | |
|---|---|
void |
addInterceptorContribution(ServiceInterceptorContribution contribution)
|
void |
addRegistryShutdownListener(RegistryShutdownListener listener)
Adds a shutdown listener; HiveMind uses two coordinators; the first is the hivemind.ShutdownCoordinator service, which is the coordinator used for service implementations. |
void |
clearConstructorInformation()
Invoked by the ServiceModel when constuction information (the builder and interceptors) is no longer needed. |
protected void |
extendDescription(ToStringBuilder builder)
Implemented in subclasses to provide details about subclass properties. |
void |
forceServiceInstantiation()
Forces the service into existence. |
java.lang.Class |
getDeclaredInterface()
Returns the interface for the service as specified in the descriptor; starting with release 1.1 it is possible to define a service in terms of a class (as the interface) and a synthetic interface is generated where appropriate. |
java.util.List |
getOrderedInterceptorContributions()
Returns a list of ServiceInterceptorContributions,
ordered according to their dependencies. |
Occurances |
getParametersCount()
Returns the number of parameter object expected; generally this is the default of exactly one ( Occurances.REQUIRED). |
Schema |
getParametersSchema()
Returns the Schema used to process any parameters passed to the service. |
java.lang.Object |
getService(java.lang.Class serviceInterface)
Obtains the full service implementation for this service extension point, an object that implements the service interface. |
ServiceImplementationConstructor |
getServiceConstructor()
Returns the service constructor, if defined, or the default service constructor. |
ServiceImplementationConstructor |
getServiceConstructor(boolean defaultConstructor)
|
java.lang.Class |
getServiceInterface()
Returns the type of the service, the interface the service implements. |
java.lang.String |
getServiceInterfaceClassName()
Returns the fully qualified class name of the service interface. |
java.lang.String |
getServiceModel()
|
void |
setParametersCount(Occurances occurances)
|
void |
setParametersSchema(Schema schema)
|
void |
setServiceConstructor(ServiceImplementationConstructor contribution,
boolean defaultConstructor)
|
void |
setServiceInterfaceName(java.lang.String string)
|
void |
setServiceModel(java.lang.String model)
|
void |
setShutdownCoordinator(ShutdownCoordinator coordinator)
|
| Methods inherited from class org.apache.hivemind.impl.AbstractExtensionPoint |
|---|
getErrorLog, getExtensionPointId, getLog, getModule, setExtensionPointId, setModule, setVisibility, toString, visibleToModule |
| Methods inherited from class org.apache.hivemind.impl.BaseLocatable |
|---|
getLocation, setLocation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.hivemind.internal.ExtensionPoint |
|---|
getErrorLog, getExtensionPointId, getLog, getModule, visibleToModule |
| Methods inherited from interface org.apache.hivemind.Locatable |
|---|
getLocation |
| Constructor Detail |
|---|
public ServicePointImpl()
| Method Detail |
|---|
protected void extendDescription(ToStringBuilder builder)
AbstractExtensionPoint
extendDescription in class AbstractExtensionPointpublic void addInterceptorContribution(ServiceInterceptorContribution contribution)
public java.lang.Class getServiceInterface()
ServicePoint
getServiceInterface in interface ServicePointpublic java.lang.Class getDeclaredInterface()
ServicePoint
getDeclaredInterface in interface ServicePointpublic java.lang.String getServiceInterfaceClassName()
ServicePoint
getServiceInterfaceClassName in interface ServicePoint
public void setServiceConstructor(ServiceImplementationConstructor contribution,
boolean defaultConstructor)
public void setServiceInterfaceName(java.lang.String string)
public void setParametersSchema(Schema schema)
public Schema getParametersSchema()
ServicePointSchema used to process any parameters passed to the service. Service
implementation factories and service interceptor factories allow parameters.
getParametersSchema in interface ServicePointpublic ServiceImplementationConstructor getServiceConstructor(boolean defaultConstructor)
public java.lang.Object getService(java.lang.Class serviceInterface)
ServicePoint
getService in interface ServicePointserviceInterface - the class that the service will be cast to; a check is made that the service is
assignable to the indicated interface. It does not have to, necessarily, match the
service interface (it could be a super-interface, for example).
public java.lang.String getServiceModel()
public void setServiceModel(java.lang.String model)
public void clearConstructorInformation()
ConstructableServicePoint
clearConstructorInformation in interface ConstructableServicePointpublic java.util.List getOrderedInterceptorContributions()
ConstructableServicePointServiceInterceptorContributions,
ordered according to their dependencies. May return null or an empty list.
Note that the order is tricky! To keep any error messages while ordering the interceptors understandable, they are ordered according into runtime execution order. Example: If we want a logging interceptor to operate before a security-check interceptor, we'll write the following in the descriptor:
<interceptor service-id="hivemind.LoggingInterceptor" before="*"/>
<interceptor service-id="somepackage.SecurityInterceptor"/>
The before value for the first interceptor contribution will be assigned to
the contribution's
followingInterceptorIds
property, because all other interceptors (including the security interceptor) should have
their behavior follow the logging interceptor.
To get this behavior, the logging interceptor will delegate to the security interceptor, and the security interceptor will delegate to the core service implementation.
The trick is that interceptors are applied in reverse order: we start with core service implementation, wrap it with the security interceptor, then wrap that with the logging interceptor ... but that's an issue that applies when building the interceptor stack around the core service implementation.
getOrderedInterceptorContributions in interface ConstructableServicePointpublic void setShutdownCoordinator(ShutdownCoordinator coordinator)
public void addRegistryShutdownListener(RegistryShutdownListener listener)
ConstructableServicePoint
addRegistryShutdownListener in interface ConstructableServicePointlistener - the listener to be added to the infrastructure's shutdown coordinatorpublic void forceServiceInstantiation()
forceServiceInstantiation in interface ServicePointpublic Occurances getParametersCount()
ServicePointOccurances.REQUIRED).
getParametersCount in interface ServicePointpublic void setParametersCount(Occurances occurances)
public ServiceImplementationConstructor getServiceConstructor()
getServiceConstructor in interface ConstructableServicePoint
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||