Class ServiceImp
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,ConfigComment,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,MimePartSelectorToMetadata,MultipartMessageBuilder,NullService,OauthTokenGetter,PayloadFromTemplateService,PayloadHashingService,PayloadToMetadataService,PooledSplitJoinService,ReadFileService,RegexpService,RemoveLoggingContext,ResolveExpressionService,RetryingServiceWrapper,RetryStoreServiceImpl,ShortCutJettyResponse,SimpleSequenceNumberService,StandaloneProducer,StatelessServiceWrapper,StopProcessingService,Switch,SwitchPayloadService,SymmetricKeyCryptographyService,SyntaxRoutingService,SystemCommandExecutorService,ThrowExceptionService,TranscodingService,UrlEncodedMetadataValues,UseXmlCharsetAsEncodingService,Utf8BomRemover,ValidateMetadataService,VerifyIdentityService,WaitService,While,WriteMetadataToFilesystem,XmlTransformService,XmlValidationService,XpathObjectMetadataService,XPathService
Implementation of default / common behaviour for Services. Includes basic implementation of
MessageEventGenerator which returns the fully qualified name of the class.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeState(ComponentState newState) Updates the state for the componentComponentState.final voidclose()Closes the component.protected abstract voidbooleanIf true containers should continue and apply the next configuredServiceeven if thisServicethrows anException.Create a name for anyMleMarkerthat is generated.Create a qualifier for anyMleMarkerthat is generated.booleanenabled()If true this service will run theLifecycleHelpermethods and be executed in the workflow for each message.Get the unique-id that is associated with this component.final voidinit()Initialises the component.protected abstract voidbooleanReturns true if the implementation supports branching.booleanReturns true if this should be considered an 'end-point' for tracking purposes, otherwise false.voidRequest this component is closed.voidRequest this component is init'd.voidRequest this component is started.voidRequest this component is stopped.Returns the last recordComponentState.voidvoidwhether or not this service is configured to continue on failure.voidsetEnabled(Boolean enabled) voidwhether or not this service is is a tracking endpoint.voidSets the unique identifier for thisService.voidstart()Starts the component.voidstop()Stop the componentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.adaptris.core.ComponentLifecycleExtension
prepare
-
Field Details
-
log
protected transient org.slf4j.Logger log
-
-
Constructor Details
-
ServiceImp
public ServiceImp()Creates a new instance. Default unique ID is autogenerated using
GuidGenerator.getUUID().
-
-
Method Details
-
init
Description copied from interface:ComponentLifecycleInitialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
initin interfaceComponentLifecycle- Throws:
CoreException- wrapping any underlyingExceptions
-
initService
- Throws:
CoreException
-
close
public final void close()Description copied from interface:ComponentLifecycleCloses the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeExceptionmay cause unintended consequences- Specified by:
closein interfaceComponentLifecycle
-
closeService
protected abstract void closeService() -
stop
public void stop()Description copied from interface:ComponentLifecycleStop 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 aRuntimeExceptionmay cause unintended consequences- Specified by:
stopin interfaceComponentLifecycle
-
start
Description copied from interface:ComponentLifecycleStarts 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:
startin interfaceComponentLifecycle- Throws:
CoreException- wrapping any underlyingExceptions
-
createName
Description copied from interface:MessageEventGeneratorCreate a name for anyMleMarkerthat is generated.The default implementation is to return the classname of the component in question.
* @return the name for anyMleMarkerthat is generated.- Specified by:
createNamein interfaceMessageEventGenerator
-
createQualifier
Description copied from interface:MessageEventGeneratorCreate a qualifier for anyMleMarkerthat 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:
createQualifierin interfaceMessageEventGenerator- Returns:
- the qualifier for any
MleMarkerthat is generated.
-
getEnabled
-
setEnabled
-
enabled
public boolean enabled()Description copied from interface:ServiceIf true this service will run the
LifecycleHelpermethods and be executed in the workflow for each message. If false, this service will not run theLifecycleHelperor execute during the workflow's processing. -
getUniqueId
Description copied from interface:AdaptrisComponentGet the unique-id that is associated with this component.- Specified by:
getUniqueIdin interfaceAdaptrisComponent- Returns:
- the unique-id
-
setUniqueId
Description copied from interface:ServiceSets the unique identifier for this
Service. These unique identifiers are optional but maybe required by some implementations ofServiceCollection.- Specified by:
setUniqueIdin interfaceService- Parameters:
s- thisService's unique identifier
-
isBranching
public boolean isBranching()Description copied from interface:ServiceReturns true if the implementation supports branching.
- Specified by:
isBranchingin interfaceService- Returns:
- true if the implementation supports branching
- See Also:
-
continueOnFailure
public boolean continueOnFailure()Description copied from interface:ServiceIf true containers should continue and apply the next configured
Serviceeven if thisServicethrows anException.- Specified by:
continueOnFailurein interfaceService- Returns:
- continueOnFail
-
getContinueOnFail
- Returns:
- whether or not this service is configured to continue on failure.
- See Also:
-
setContinueOnFail
whether or not this service is configured to continue on failure.- Parameters:
b- true/false, default if not specified is false.
-
getIsTrackingEndpoint
-
setIsTrackingEndpoint
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:MessageEventGeneratorReturns true if this should be considered an 'end-point' for tracking purposes, otherwise false.
- Specified by:
isTrackingEndpointin interfaceMessageEventGenerator- Returns:
- true if this should be considered an 'end-point' for tracking purposes, otherwise false
-
setComments
- Specified by:
setCommentsin interfaceConfigComment
-
getComments
- Specified by:
getCommentsin interfaceConfigComment
-
changeState
Updates the state for the component
ComponentState.- Specified by:
changeStatein interfaceStateManagedComponent
-
retrieveComponentState
Returns the last record
ComponentState.- Specified by:
retrieveComponentStatein interfaceStateManagedComponent- Returns:
- the current
ComponentState
-
requestInit
Request this component is init'd.
- Specified by:
requestInitin interfaceStateManagedComponent- Throws:
CoreException- wrapping any underlying Exceptions
-
requestStart
Request this component is started.
- Specified by:
requestStartin interfaceStateManagedComponent- Throws:
CoreException- wrapping any underlying Exceptions
-
requestStop
public void requestStop()Request this component is stopped.
- Specified by:
requestStopin interfaceStateManagedComponent
-
requestClose
public void requestClose()Request this component is closed.
- Specified by:
requestClosein interfaceStateManagedComponent
-