Class ServiceImp

java.lang.Object
com.adaptris.core.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

public abstract class ServiceImp extends Object implements Service

Implementation of default / common behaviour for Services. Includes basic implementation of MessageEventGenerator which returns the fully qualified name of the class.

  • 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

      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 interface ComponentLifecycle
      Throws:
      CoreException - wrapping any underlying Exceptions
    • 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 interface ComponentLifecycle
    • closeService

      protected abstract void closeService()
    • stop

      public void stop()
      Description copied from interface: ComponentLifecycle
      Stop the component

      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

      Specified by:
      stop in interface ComponentLifecycle
    • 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 interface ComponentLifecycle
      Throws:
      CoreException - wrapping any underlying Exceptions
    • createName

      public String createName()
      Description copied from interface: MessageEventGenerator
      Create a name for any MleMarker that is generated.

      The default implementation is to return the classname of the component in question.

      * @return the name for any MleMarker that is generated.
      Specified by:
      createName in interface MessageEventGenerator
    • createQualifier

      public String createQualifier()
      Description copied from interface: MessageEventGenerator
      Create a qualifier for any MleMarker 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 interface MessageEventGenerator
      Returns:
      the qualifier for any MleMarker that is generated.
    • getUniqueId

      public String getUniqueId()
      Description copied from interface: AdaptrisComponent
      Get the unique-id that is associated with this component.
      Specified by:
      getUniqueId in interface AdaptrisComponent
      Returns:
      the unique-id
    • setUniqueId

      public void setUniqueId(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 of ServiceCollection.

      Specified by:
      setUniqueId in interface Service
      Parameters:
      s - this Service's unique identifier
    • isBranching

      public boolean isBranching()
      Description copied from interface: Service

      Returns true if the implementation supports branching.

      Specified by:
      isBranching in interface Service
      Returns:
      true if the implementation supports branching
      See Also:
    • continueOnFailure

      public boolean continueOnFailure()
      Description copied from interface: Service

      If true containers should continue and apply the next configured Service even if this Service throws an Exception.

      Specified by:
      continueOnFailure in interface Service
      Returns:
      continueOnFail
    • getContinueOnFail

      public Boolean getContinueOnFail()
      Returns:
      whether or not this service is configured to continue on failure.
      See Also:
    • setContinueOnFail

      public void setContinueOnFail(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 Boolean getIsTrackingEndpoint()
    • setIsTrackingEndpoint

      public void setIsTrackingEndpoint(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 interface MessageEventGenerator
      Returns:
      true if this should be considered an 'end-point' for tracking purposes, otherwise false
    • setComments

      public void setComments(String s)
      Specified by:
      setComments in interface ConfigComment
    • getComments

      public String getComments()
      Specified by:
      getComments in interface ConfigComment
    • changeState

      public void changeState(ComponentState newState)

      Updates the state for the component ComponentState.

      Specified by:
      changeState in interface StateManagedComponent
    • retrieveComponentState

      public ComponentState retrieveComponentState()

      Returns the last record ComponentState.

      Specified by:
      retrieveComponentState in interface StateManagedComponent
      Returns:
      the current ComponentState
    • requestInit

      public void requestInit() throws CoreException

      Request this component is init'd.

      Specified by:
      requestInit in interface StateManagedComponent
      Throws:
      CoreException - wrapping any underlying Exceptions
    • requestStart

      public void requestStart() throws CoreException

      Request this component is started.

      Specified by:
      requestStart in interface StateManagedComponent
      Throws:
      CoreException - wrapping any underlying Exceptions
    • requestStop

      public void requestStop()

      Request this component is stopped.

      Specified by:
      requestStop in interface StateManagedComponent
    • requestClose

      public void requestClose()

      Request this component is closed.

      Specified by:
      requestClose in interface StateManagedComponent