Class ServiceImp
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
- Direct Known Subclasses:
AddExtendedLoggingContext
,AddFormattedMetadataService
,AddLoggingContext
,AddNamespaceObjectMetadata
,AddPayloadService
,AddTimestampMetadataService
,AggregatingConsumeServiceImpl
,AlwaysFailService
,Base64Service
,BranchingServiceImp
,CacheServiceImpl
,ChangeCharEncodingService
,ClearLoggingContext
,CoreSecurityService
,DuplicateMessageRoutingService
,DuplicateMetadataValueService
,DynamicServiceExecutor
,ExceptionHandlingServiceWrapper
,ExceptionReportService
,FindAndReplaceService
,FlattenMimeParts
,ForEach
,FormDataToMetadata
,GunzipService
,GzipService
,HttpRequestServiceImpl
,IfElse
,InputOutputService
,JdbcService
,JettyResponseService
,JmxOperationImpl
,LoggingServiceImpl
,MessageSplitterServiceImp
,MetadataComparisonService
,MetadataServiceImpl
,MetadataToPayloadService
,MimePartSelector
,MultipartMessageBuilder
,NullService
,OauthTokenGetter
,PayloadFromTemplateService
,PayloadHashingService
,PayloadToMetadataService
,PooledSplitJoinService
,ReadFileService
,RegexpService
,RemoveLoggingContext
,ResolveExpressionService
,RetryingServiceWrapper
,RetryStoreServiceImpl
,ScriptingServiceImp
,ShortCutJettyResponse
,SimpleSequenceNumberService
,StandaloneProducer
,StatelessServiceWrapper
,StopProcessingService
,Switch
,SwitchPayloadService
,SymmetricKeyCryptographyService
,SyntaxRoutingService
,SystemCommandExecutorService
,ThrowExceptionService
,TranscodingService
,UrlEncodedMetadataValues
,UseXmlCharsetAsEncodingService
,Utf8BomRemover
,ValidateMetadataService
,VerifyIdentityService
,WaitService
,While
,WriteMetadataToFilesystem
,XmlTransformService
,XmlValidationService
,XpathObjectMetadataService
,XPathService
public abstract class ServiceImp extends java.lang.Object implements Service
Implementation of default / common behaviour for
Service
s. Includes basic implementation ofMessageEventGenerator
which returns the fully qualified name of the class.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description ServiceImp()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
changeState(ComponentState newState)
Updates the state for the componentComponentState
.void
close()
Closes the component.protected abstract void
closeService()
boolean
continueOnFailure()
If true containers should continue and apply the next configuredService
even if thisService
throws anException
.java.lang.String
createName()
Create a name for anyMleMarker
that is generated.java.lang.String
createQualifier()
Create a qualifier for anyMleMarker
that is generated.java.lang.Boolean
getContinueOnFail()
java.lang.Boolean
getIsTrackingEndpoint()
java.lang.String
getUniqueId()
Get the unique-id that is associated with this component.void
init()
Initialises the component.protected abstract void
initService()
boolean
isBranching()
Returns true if the implementation supports branching.boolean
isTrackingEndpoint()
Returns true if this should be considered an 'end-point' for tracking purposes, otherwise false.void
requestClose()
Request this component is closed.void
requestInit()
Request this component is init'd.void
requestStart()
Request this component is started.void
requestStop()
Request this component is stopped.ComponentState
retrieveComponentState()
Returns the last recordComponentState
.void
setContinueOnFail(java.lang.Boolean b)
whether or not this service is configured to continue on failure.void
setIsTrackingEndpoint(java.lang.Boolean b)
whether or not this service is is a tracking endpoint.void
setUniqueId(java.lang.String s)
Sets the unique identifier for thisService
.void
start()
Starts the component.void
stop()
Stop the component-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.ComponentLifecycleExtension
prepare
-
-
-
-
Constructor Detail
-
ServiceImp
public ServiceImp()
Creates a new instance. Default unique ID is autogenerated using
GuidGenerator.getUUID()
.
-
-
Method Detail
-
init
public final void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Throws:
CoreException
- wrapping any underlyingException
s
-
initService
protected abstract void initService() throws CoreException
- Throws:
CoreException
-
close
public final void close()
Description copied from interface:ComponentLifecycle
Closes the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeException
may cause unintended consequences- Specified by:
close
in interfaceComponentLifecycle
-
closeService
protected abstract void closeService()
-
stop
public void stop()
Description copied from interface:ComponentLifecycle
Stop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing aRuntimeException
may cause unintended consequences- Specified by:
stop
in interfaceComponentLifecycle
-
start
public void start() throws CoreException
Description copied from interface:ComponentLifecycle
Starts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.- Specified by:
start
in interfaceComponentLifecycle
- Throws:
CoreException
- wrapping any underlyingException
s
-
createName
public java.lang.String createName()
Description copied from interface:MessageEventGenerator
Create a name for anyMleMarker
that is generated.The default implementation is to return the classname of the component in question.
* @return the name for anyMleMarker
that is generated.- Specified by:
createName
in interfaceMessageEventGenerator
-
createQualifier
public java.lang.String createQualifier()
Description copied from interface:MessageEventGenerator
Create a qualifier for anyMleMarker
that is generated.The default implementation is to return the unique-id of the component in question, or the empty string if not configured
- Specified by:
createQualifier
in interfaceMessageEventGenerator
- Returns:
- the qualifier for any
MleMarker
that is generated.
-
getUniqueId
public java.lang.String getUniqueId()
Description copied from interface:AdaptrisComponent
Get the unique-id that is associated with this component.- Specified by:
getUniqueId
in interfaceAdaptrisComponent
- Returns:
- the unique-id
-
setUniqueId
public void setUniqueId(java.lang.String s)
Description copied from interface:Service
Sets the unique identifier for this
Service
. These unique identifiers are optional but maybe required by some implementations ofServiceCollection
.- Specified by:
setUniqueId
in interfaceService
- Parameters:
s
- thisService
's unique identifier
-
isBranching
public boolean isBranching()
Description copied from interface:Service
Returns true if the implementation supports branching.
- Specified by:
isBranching
in interfaceService
- Returns:
- true if the implementation supports branching
- See Also:
BranchingServiceCollection
-
continueOnFailure
public boolean continueOnFailure()
Description copied from interface:Service
If true containers should continue and apply the next configured
Service
even if thisService
throws anException
.- Specified by:
continueOnFailure
in interfaceService
- Returns:
- continueOnFail
-
getContinueOnFail
public java.lang.Boolean getContinueOnFail()
- Returns:
- whether or not this service is configured to continue on failure.
- See Also:
continueOnFailure()
-
setContinueOnFail
public void setContinueOnFail(java.lang.Boolean b)
whether or not this service is configured to continue on failure.- Parameters:
b
- true/false, default if not specified is false.
-
getIsTrackingEndpoint
public java.lang.Boolean getIsTrackingEndpoint()
-
setIsTrackingEndpoint
public void setIsTrackingEndpoint(java.lang.Boolean b)
whether or not this service is is a tracking endpoint.- Parameters:
b
- true/false, default if not specified is false.
-
isTrackingEndpoint
public boolean isTrackingEndpoint()
Description copied from interface:MessageEventGenerator
Returns true if this should be considered an 'end-point' for tracking purposes, otherwise false.
- Specified by:
isTrackingEndpoint
in interfaceMessageEventGenerator
- Returns:
- true if this should be considered an 'end-point' for tracking purposes, otherwise false
-
changeState
public void changeState(ComponentState newState)
Updates the state for the component
ComponentState
.- Specified by:
changeState
in interfaceStateManagedComponent
-
retrieveComponentState
public ComponentState retrieveComponentState()
Returns the last record
ComponentState
.- Specified by:
retrieveComponentState
in interfaceStateManagedComponent
- Returns:
- the current
ComponentState
-
requestInit
public void requestInit() throws CoreException
Request this component is init'd.
- Specified by:
requestInit
in interfaceStateManagedComponent
- Throws:
CoreException
- wrapping any underlying Exceptions
-
requestStart
public void requestStart() throws CoreException
Request this component is started.
- Specified by:
requestStart
in interfaceStateManagedComponent
- Throws:
CoreException
- wrapping any underlying Exceptions
-
requestStop
public void requestStop()
Request this component is stopped.
- Specified by:
requestStop
in interfaceStateManagedComponent
-
requestClose
public void requestClose()
Request this component is closed.
- Specified by:
requestClose
in interfaceStateManagedComponent
-
-