Class SurveyActionServiceConnector
java.lang.Object
org.odpi.openmetadata.frameworks.connectors.Connector
org.odpi.openmetadata.frameworks.connectors.ConnectorBase
org.odpi.openmetadata.frameworks.surveyaction.SurveyActionServiceConnector
- All Implemented Interfaces:
AuditLoggingComponent
,SecureConnectorExtension
,VirtualConnectorExtension
,SurveyActionService
- Direct Known Subclasses:
CocoClinicalTrialCertifyWeeklyMeasurementsService
,CSVSurveyService
,FileSurveyService
,FolderSurveyService
,OSSUnityCatalogServerSurveyBase
,PostgresDatabaseSurveyActionService
,PostgresServerSurveyActionService
,SurveyActionPipelineConnector
,SurveyApacheAtlasConnector
,SurveyApacheKafkaServerConnector
public abstract class SurveyActionServiceConnector
extends ConnectorBase
implements SurveyActionService, AuditLoggingComponent
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
ConnectorBase.ProtectedConnection
-
Field Summary
Modifier and TypeFieldDescriptionprotected AuditLog
protected Connector
protected static com.fasterxml.jackson.databind.ObjectMapper
protected final PropertyHelper
protected String
protected SurveyContext
Fields inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
connectedAssetProperties, connectionBean, connectionProperties, connectorInstanceId, messageFormatter, secretsStoreConnectorMap
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Free up any resources held since the connector is no longer needed.protected AnnotationStore
Return the component description that is used by this connector in the audit log.protected List<SurveyActionServiceConnector>
Retrieve and validate the list of embedded connectors and cast them to survey action service connector.getJSONProperties
(Object properties) Convert the supplied properties object to a JSON String.protected NestedSchemaType
getNestedSchemaType
(AssetUniverse assetUniverse, String schemaTypeName) Return the nested schema type associated with the assetprotected SurveyContext
Return the survey context for this survey action service.protected void
handleUnexpectedException
(String methodName, Exception error) Provide a common exception for unexpected errors.protected <T> Connector
performCheckAssetAnalysisStep
(Class<T> expectedConnectorClass, String expectedAssetType) This is the typical first analysis step of a survey action service.protected void
performCheckAssetAnalysisStep
(String expectedAssetType) This is the typical first analysis step of a survey action service.void
setAuditLog
(AuditLog auditLog) Receive an audit log object that can be used to record audit log messages.void
setSurveyActionServiceName
(String surveyActionServiceName) Set up the survey action service name.void
setSurveyContext
(SurveyContext surveyContext) Set up details of the asset to analyze and the results of any previous analysis.protected void
setUpAnnotation
(Annotation annotation, AnnotationType annotationType) Transfer common properties into an annotation.void
start()
Indicates that the survey action service is completely configured and can begin processing.protected void
throwMissingSchemaType
(String assetGUID) Record that an asset does not have a schema.protected ResourceProfileLogAnnotation
writeNameCountInventory
(AnnotationType annotationType, String inventoryName, Map<String, Integer> nameCounts, String surveyReportGUID) Create an inventory in a CSV File.protected ResourceProfileLogAnnotation
writeNameDescriptionInventory
(AnnotationType annotationType, String inventoryName, Map<String, String> nameDescriptions, String surveyReportGUID) Create an inventory in a CSV File.protected ResourceProfileLogAnnotation
writeNameListInventory
(AnnotationType annotationType, String inventoryName, List<String> names, String surveyReportGUID) Create an inventory in a CSV File.protected ResourceProfileLogAnnotation
writePropertyListInventory
(AnnotationType annotationType, String inventoryName, List<String> propertyNames, List<Map<String, String>> propertyList, String surveyReportGUID) Create an inventory in a CSV File.Methods inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
combineConfigurationProperties, disconnectConnectors, equals, getArrayConfigurationProperty, getAssetTypeName, getBooleanConfigurationProperty, getConnectedAssetProperties, getConnection, getConnectorInstanceId, getDateConfigurationProperty, getIntConfigurationProperty, getLongConfigurationProperty, getNetworkAddresses, getStringConfigurationProperty, getSuppliedPlaceholderProperties, hashCode, initialize, initializeConnectedAssetProperties, initializeEmbeddedConnectors, initializeSecretsStoreConnector, isActive, logExceptionRecord, logRecord, logRecord, throwMissingConfigurationProperty, throwMissingResource, throwNoAsset, throwWrongTypeOfAsset, throwWrongTypeOfResource, throwWrongTypeOfRootSchema, toString
Methods inherited from class org.odpi.openmetadata.frameworks.connectors.Connector
clearStatisticProperty, clearStatisticTimestamp, getConnectorStatistics, getStatisticCounter, getStatisticProperty, getStatisticTimestamp, incrementStatisticCounter, initializeStatisticCounter, setStatisticProperty, setStatisticTimestamp
-
Field Details
-
propertyHelper
-
connector
-
objectMapper
protected static com.fasterxml.jackson.databind.ObjectMapper objectMapper -
surveyActionServiceName
-
surveyContext
-
auditLog
-
embeddedConnectors
-
-
Constructor Details
-
SurveyActionServiceConnector
public SurveyActionServiceConnector()
-
-
Method Details
-
setAuditLog
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 interfaceAuditLoggingComponent
- Parameters:
auditLog
- audit log object
-
getConnectorComponentDescription
Return the component description that is used by this connector in the audit log.- Specified by:
getConnectorComponentDescription
in interfaceAuditLoggingComponent
- Returns:
- id, name, description, wiki page URL.
-
getJSONProperties
Convert the supplied properties object to a JSON String.- Parameters:
properties
- properties object- Returns:
- properties as a JSON String
- Throws:
PropertyServerException
- parsing error
-
setSurveyContext
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
Set up the survey action service name. This is used in error messages.- Parameters:
surveyActionServiceName
- name of the survey action service
-
performCheckAssetAnalysisStep
protected <T> Connector performCheckAssetAnalysisStep(Class<T> expectedConnectorClass, String expectedAssetType) throws ConnectorCheckedException, InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ConnectionCheckedException This is the typical first analysis step of a survey action service.- Type Parameters:
T
- type of connector- Parameters:
expectedConnectorClass
- the class of the desired connectorexpectedAssetType
- the type of asset that this survey service works on- Returns:
- the started connector which is of the correct type
- Throws:
ConnectorCheckedException
- problem with the connectorInvalidParameterException
- invalid propertyPropertyServerException
- problem with repositoriesUserNotAuthorizedException
- security problemConnectionCheckedException
- problem with connection
-
performCheckAssetAnalysisStep
protected void performCheckAssetAnalysisStep(String expectedAssetType) throws ConnectorCheckedException, InvalidParameterException, PropertyServerException, UserNotAuthorizedException This is the typical first analysis step of a survey action service. It is used by survey action services that do not use the asset connector.- Parameters:
expectedAssetType
- the type of asset that this survey service works on- Throws:
ConnectorCheckedException
- problem with the connectorInvalidParameterException
- invalid propertyPropertyServerException
- problem with repositoriesUserNotAuthorizedException
- security problem
-
getNestedSchemaType
protected NestedSchemaType getNestedSchemaType(AssetUniverse assetUniverse, String schemaTypeName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ConnectorCheckedException Return the nested schema type associated with the asset- Parameters:
assetUniverse
- details of assetschemaTypeName
- name of type for schema- Returns:
- nested schema type or null
- Throws:
ConnectorCheckedException
- problem with the connectorInvalidParameterException
- invalid propertyPropertyServerException
- problem with repositoriesUserNotAuthorizedException
- security problem
-
throwMissingSchemaType
protected void throwMissingSchemaType(String assetGUID) throws ConnectorCheckedException, InvalidParameterException, PropertyServerException, UserNotAuthorizedException Record that an asset does not have a schema.- Parameters:
assetGUID
- unique identifier of the asset- Throws:
ConnectorCheckedException
- problem with the connectorInvalidParameterException
- invalid propertyPropertyServerException
- problem with repositoriesUserNotAuthorizedException
- security problem
-
getSurveyContext
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
- Throws:
ConnectorCheckedException
-
setUpAnnotation
Transfer common properties into an annotation.- Parameters:
annotation
- output annotationannotationType
- annotation type definition
-
writePropertyListInventory
protected ResourceProfileLogAnnotation writePropertyListInventory(AnnotationType annotationType, String inventoryName, List<String> propertyNames, List<Map<String, String>> propertyList, String surveyReportGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, IOException, ConnectorCheckedExceptionCreate an inventory in a CSV File.- Parameters:
annotationType
- details about the annotationinventoryName
- name of the inventory (needs to be unique within the reportpropertyNames
- list of properties names in order they should appear in the filepropertyList
- list of property mapssurveyReportGUID
- unique identifier of the report to connect the log file to- Returns:
- inventory annotation
- Throws:
IOException
- problem writing fileInvalidParameterException
- problem creating CSV file assetPropertyServerException
- repository problem creating CSV file assetUserNotAuthorizedException
- authorization problem creating CSV file assetConnectorCheckedException
- survey has been asked to stop
-
writeNameListInventory
protected ResourceProfileLogAnnotation writeNameListInventory(AnnotationType annotationType, String inventoryName, List<String> names, String surveyReportGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, IOException, ConnectorCheckedException Create an inventory in a CSV File.- Parameters:
annotationType
- details about the annotationinventoryName
- name of the inventory (needs to be unique within the reportnames
- list of namessurveyReportGUID
- unique identifier of the report to connect the log file to- Returns:
- inventory annotation
- Throws:
IOException
- problem writing fileInvalidParameterException
- problem creating CSV file assetPropertyServerException
- repository problem creating CSV file assetUserNotAuthorizedException
- authorization problem creating CSV file assetConnectorCheckedException
- survey has been asked to stop
-
writeNameCountInventory
protected ResourceProfileLogAnnotation writeNameCountInventory(AnnotationType annotationType, String inventoryName, Map<String, Integer> nameCounts, String surveyReportGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, IOException, ConnectorCheckedExceptionCreate an inventory in a CSV File.- Parameters:
annotationType
- details about the annotationinventoryName
- name of the inventory (needs to be unique within the reportnameCounts
- map of names and how many times they appearsurveyReportGUID
- unique identifier of the report to connect the log file to- Returns:
- inventory annotation
- Throws:
IOException
- problem writing fileInvalidParameterException
- problem creating CSV file assetPropertyServerException
- repository problem creating CSV file assetUserNotAuthorizedException
- authorization problem creating CSV file assetConnectorCheckedException
- survey has been asked to stop
-
writeNameDescriptionInventory
protected ResourceProfileLogAnnotation writeNameDescriptionInventory(AnnotationType annotationType, String inventoryName, Map<String, String> nameDescriptions, String surveyReportGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, IOException, ConnectorCheckedExceptionCreate an inventory in a CSV File.- Parameters:
annotationType
- details about the annotationinventoryName
- name of the inventory (needs to be unique within the reportnameDescriptions
- map of names and how many times they appearsurveyReportGUID
- unique identifier of the report to connect the log file to- Returns:
- inventory annotation
- Throws:
IOException
- problem writing fileInvalidParameterException
- problem creating CSV file assetPropertyServerException
- repository problem creating CSV file assetUserNotAuthorizedException
- authorization problem creating CSV file assetConnectorCheckedException
- survey has been asked to stop
-
getEmbeddedSurveyActionServices
protected List<SurveyActionServiceConnector> getEmbeddedSurveyActionServices() throws ConnectorCheckedExceptionRetrieve 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
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 classConnectorBase
- 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 methoderror
- caught exception- Throws:
ConnectorCheckedException
- wrapped exception
-
disconnect
Free up any resources held since the connector is no longer needed.- Overrides:
disconnect
in classConnectorBase
- Throws:
ConnectorCheckedException
- there is a problem within the connector.
-