Class SurveyActionServiceConnector

All Implemented Interfaces:
AuditLoggingComponent, SecureConnectorExtension, VirtualConnectorExtension, SurveyActionService
Direct Known Subclasses:
CSVSurveyService, FileSurveyService, FolderSurveyService, PostgresDatabaseSurveyActionService, PostgresServerSurveyActionService, SurveyActionPipelineConnector, SurveyApacheAtlasConnector, SurveyApacheKafkaServerConnector

public abstract class SurveyActionServiceConnector extends ConnectorBase implements SurveyActionService, AuditLoggingComponent, VirtualConnectorExtension
SurveyActionServiceConnector describes a specific type of connector that is responsible for analyzing the content of a specific asset. Information about the asset to analyze is passed in the survey context. The returned discovery context also contains the results. Some discovery services manage the invocation of other discovery services. These discovery services are called discovery pipelines.
  • Field Details

    • surveyActionServiceName

      protected String surveyActionServiceName
    • surveyContext

      protected SurveyContext surveyContext
    • auditLog

      protected AuditLog auditLog
    • embeddedConnectors

      protected List<Connector> embeddedConnectors
  • Constructor Details

    • SurveyActionServiceConnector

      public SurveyActionServiceConnector()
  • Method Details

    • setAuditLog

      public void setAuditLog(AuditLog auditLog)
      Receive an audit log object that can be used to record audit log messages. The caller has initialized it with the correct component description and log destinations.
      Specified by:
      setAuditLog in interface AuditLoggingComponent
      Parameters:
      auditLog - audit log object
    • getConnectorComponentDescription

      public ComponentDescription getConnectorComponentDescription()
      Return the component description that is used by this connector in the audit log.
      Specified by:
      getConnectorComponentDescription in interface AuditLoggingComponent
      Returns:
      id, name, description, wiki page URL.
    • initializeEmbeddedConnectors

      public void initializeEmbeddedConnectors(List<Connector> embeddedConnectors)
      Set up the list of survey action services connectors that will be invoked as part of this survey action pipeline. The connectors are initialized waiting to start. After start() is called on the survey action pipeline, it will choreograph the invocation of its embedded survey action services by calling start() to each of them when they are to run. Similar processing is needed for the disconnect() method.
      Specified by:
      initializeEmbeddedConnectors in interface VirtualConnectorExtension
      Parameters:
      embeddedConnectors - list of embedded connectors that are hopefully survey action services
    • setSurveyContext

      public void setSurveyContext(SurveyContext surveyContext)
      Set up details of the asset to analyze and the results of any previous analysis.
      Parameters:
      surveyContext - information about the asset to analyze and the results of analysis of other survey action service request. Partial results from other survey action services run as part of the same survey action service request may also be stored in the newAnnotations list.
    • setSurveyActionServiceName

      public void setSurveyActionServiceName(String surveyActionServiceName)
      Set up the survey action service name. This is used in error messages.
      Parameters:
      surveyActionServiceName - name of the survey action service
    • getSurveyContext

      protected SurveyContext getSurveyContext() throws ConnectorCheckedException
      Return the survey context for this survey action service. This is typically called after the disconnect() method is called. If called before disconnect(), it may only contain partial results.
      Returns:
      survey context containing the results discovered (so far) by the survey action service.
      Throws:
      ConnectorCheckedException - the service is no longer active
    • getAnnotationStore

      protected AnnotationStore getAnnotationStore() throws ConnectorCheckedException
      Throws:
      ConnectorCheckedException
    • throwWrongTypeOfAsset

      protected void throwWrongTypeOfAsset(String assetGUID, String assetType, String supportedAssetType, String methodName) throws ConnectorCheckedException
      Log that the survey action service can not process the type of asset it has been passed.
      Parameters:
      assetGUID - identifier of the asset
      assetType - type of the asset
      supportedAssetType - supported asset types
      methodName - calling method
      Throws:
      ConnectorCheckedException - resulting exception
    • throwWrongTypeOfConnector

      public void throwWrongTypeOfConnector(String actualConnectorClass, String expectedConnectorClass, String assetGUID, String methodName) throws ConnectorCheckedException
      Log audit message and throw exception to indicate that the asset's connector is wrong.
      Parameters:
      actualConnectorClass - class name of the supplied connector
      expectedConnectorClass - class name expected for the connector
      assetGUID - unique identifier for the asset
      methodName - calling method
      Throws:
      ConnectorCheckedException - requested exception
    • logWrongTypeOfConnector

      public void logWrongTypeOfConnector(String actualConnectorClass, String expectedConnectorClass, String assetGUID, String methodName)
      Log audit message and throw exception to indicate that the asset's connector is wrong.
      Parameters:
      actualConnectorClass - class name of the supplied connector
      expectedConnectorClass - class name expected for the connector
      assetGUID - unique identifier for the asset
      methodName - calling method
    • getEmbeddedSurveyActionServices

      protected List<SurveyActionServiceConnector> getEmbeddedSurveyActionServices() throws ConnectorCheckedException
      Retrieve and validate the list of embedded connectors and cast them to survey action service connector. This is used by SurveyPipelines and SurveyScanningServices.
      Returns:
      list of survey action service connectors
      Throws:
      ConnectorCheckedException - one of the embedded connectors is not a survey action service
    • start

      public void start() throws ConnectorCheckedException
      Indicates that the survey action service is completely configured and can begin processing. This is where the function of the survey action service is implemented. This is a standard method from the Open Connector Framework (OCF) so be sure to call super.start() in your version.
      Overrides:
      start in class ConnectorBase
      Throws:
      ConnectorCheckedException - there is a problem within the survey action service.
    • handleUnexpectedException

      protected void handleUnexpectedException(String methodName, Exception error) throws ConnectorCheckedException
      Provide a common exception for unexpected errors.
      Parameters:
      methodName - calling method
      error - caught exception
      Throws:
      ConnectorCheckedException - wrapped exception
    • disconnect

      public void disconnect() throws ConnectorCheckedException
      Free up any resources held since the connector is no longer needed.
      Overrides:
      disconnect in class ConnectorBase
      Throws:
      ConnectorCheckedException - there is a problem within the connector.