@ComponentProfile(summary="A Service that refers to another Service configured elsewhere", tag="service,base") public class DynamicSharedService extends SharedServiceImpl
A Service instance that references a Service made available via SharedComponentList.getServices()
.
This differs from a normal SharedService
in that it allows you to resolve
the lookup name using
InterlokMessage.resolve(String)
. This reference will then be looked up and used for processing. A small cache (currently
16 items) is used to avoid excessive lifecycle overhead for looked up services.
In the adapter configuration file this class is aliased as dynamic-shared-service which is the preferred alternative to the fully qualified classname when building your configuration.
eventHandler, log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
DynamicSharedService() |
DynamicSharedService(java.lang.String lookupName) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
protected long |
expirationMillis() |
protected java.util.Map<java.lang.String,Service> |
getCache() |
TimeInterval |
getExpiration() |
java.lang.Integer |
getMaxEntries() |
void |
init()
Initialises the component.
|
boolean |
isBranching()
Returns true if the implementation supports branching.
|
protected int |
maxEntries() |
void |
prepare()
Prepare for initialisation.
|
void |
setExpiration(TimeInterval expiration) |
void |
setMaxEntries(java.lang.Integer maxEntries) |
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
<T extends DynamicSharedService> |
withExpiration(TimeInterval i) |
<T extends DynamicSharedService> |
withMaxEntries(java.lang.Integer i) |
applyService, changeState, continueOnFailure, createName, createQualifier, deepClone, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, isTrackingEndpoint, registerEventHandler, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId
triggerJndiLookup
public DynamicSharedService()
public DynamicSharedService(java.lang.String lookupName)
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic boolean isBranching()
Service
Returns true if the implementation supports branching.
BranchingServiceCollection
protected java.util.Map<java.lang.String,Service> getCache()
public java.lang.Integer getMaxEntries()
public void setMaxEntries(java.lang.Integer maxEntries)
protected int maxEntries()
public <T extends DynamicSharedService> T withMaxEntries(java.lang.Integer i)
public TimeInterval getExpiration()
public void setExpiration(TimeInterval expiration)
public <T extends DynamicSharedService> T withExpiration(TimeInterval i)
protected long expirationMillis()