Class OMRSAuditLogStoreConnectorBase
java.lang.Object
org.odpi.openmetadata.frameworks.connectors.Connector
org.odpi.openmetadata.frameworks.connectors.ConnectorBase
org.odpi.openmetadata.repositoryservices.connectors.stores.auditlogstore.OMRSAuditLogStoreConnectorBase
- All Implemented Interfaces:
SecureConnectorExtension
,OMRSAuditLogStore
- Direct Known Subclasses:
ConsoleAuditLogStoreConnector
,EventDisplayAuditLogStoreConnector
,EventTopicAuditLogStoreConnector
,FileBasedAuditLogStoreConnector
,SLF4JAuditLogStoreConnector
public abstract class OMRSAuditLogStoreConnectorBase
extends ConnectorBase
implements OMRSAuditLogStore
OMRSAuditLogStoreConnectorBase is the base class for connectors that support the OMRSAuditLog.
It has implementations of the query methods that throw "function not supported". This means that
log destinations that do not support queries can ignore these methods.
It also supports the start and stop method for the connector which only need to be
overridden if the connector has work to do at these times
-
Nested Class Summary
Nested classes/interfaces inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
ConnectorBase.ProtectedConnection
-
Field Summary
Fields inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
connectedAssetProperties, connectionBean, connectionProperties, connectorInstanceId, secretsStoreConnectorMap
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAuditLogRecord
(String logRecordId) Retrieve a specific audit log record.getAuditLogRecordsByComponent
(String component, Date startDate, Date endDate, int offset, int maximumRecords) Retrieve a list of log records written by a specific component.getAuditLogRecordsBySeverity
(String severity, Date startDate, Date endDate, int offset, int maximumRecords) Retrieve a list of log records that have specific severity.getAuditLogRecordsByTimeStamp
(Date startDate, Date endDate, int offset, int maximumRecords) Retrieve a list of log records written in a specified time period.Return the name of this audit log destination.protected String
getJSONLogRecord
(AuditLogRecord logRecord, String methodName) Create JSON version of the log record.Return the list of supported severities that this destination is configured to support.void
initialize
(String connectorInstanceId, ConnectionProperties connectionProperties) Call made by the ConnectorProvider to initialize the Connector with the base services.protected boolean
isSupportedSeverity
(OMRSAuditLogRecord logRecord) Should the record be written to this destination?storeLogRecord
(AuditLogRecord logRecord) Store the audit log record in the audit log store.abstract String
storeLogRecord
(OMRSAuditLogRecord logRecord) Store the audit log record in the audit log store.protected void
validateLogRecord
(OMRSAuditLogRecord logRecord, String methodName) Validate that the log record supplied by the OMRS is properly filled out.Methods inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
disconnect, disconnectConnectors, equals, getArrayConfigurationProperty, getAssetTypeName, getBooleanConfigurationProperty, getConnectedAssetProperties, getConnection, getConnectorInstanceId, getIntConfigurationProperty, getNetworkAddresses, getStringConfigurationProperty, getSuppliedPlaceholderProperties, hashCode, initializeConnectedAssetProperties, initializeSecretsStoreConnector, isActive, start, 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
-
Constructor Details
-
OMRSAuditLogStoreConnectorBase
protected OMRSAuditLogStoreConnectorBase()Default constructor
-
-
Method Details
-
getDestinationName
Return the name of this audit log destination.- Specified by:
getDestinationName
in interfaceOMRSAuditLogStore
- Returns:
- string display name suitable for messages.
-
getSupportedSeverities
Return the list of supported severities that this destination is configured to support.- Specified by:
getSupportedSeverities
in interfaceOMRSAuditLogStore
- Returns:
- list of severity names (see OMRSAuditLogRecordSeverity)
-
storeLogRecord
public abstract String storeLogRecord(OMRSAuditLogRecord logRecord) throws InvalidParameterException, RepositoryErrorException Store the audit log record in the audit log store.- Specified by:
storeLogRecord
in interfaceOMRSAuditLogStore
- Parameters:
logRecord
- log record to store- Returns:
- unique identifier assigned to the log record
- Throws:
InvalidParameterException
- indicates that the logRecord parameter is invalid.RepositoryErrorException
- indicates that the audit log store is not available or has an error.
-
storeLogRecord
public String storeLogRecord(AuditLogRecord logRecord) throws InvalidParameterException, RepositoryErrorException Store the audit log record in the audit log store.- Parameters:
logRecord
- log record to store- Returns:
- unique identifier assigned to the log record
- Throws:
InvalidParameterException
- indicates that the logRecord parameter is invalid.RepositoryErrorException
- indicates that the audit log store is not available or has an error.
-
getAuditLogRecord
public OMRSAuditLogRecord getAuditLogRecord(String logRecordId) throws InvalidParameterException, FunctionNotSupportedException, RepositoryErrorException Retrieve a specific audit log record.- Specified by:
getAuditLogRecord
in interfaceOMRSAuditLogStore
- Parameters:
logRecordId
- unique identifier for the log record- Returns:
- requested audit log record
- Throws:
InvalidParameterException
- indicates that the logRecordId parameter is invalid.FunctionNotSupportedException
- indicates that the audit log store does not support queries.RepositoryErrorException
- indicates that the audit log store is not available or has an error.
-
getAuditLogRecordsByTimeStamp
public List<OMRSAuditLogRecord> getAuditLogRecordsByTimeStamp(Date startDate, Date endDate, int offset, int maximumRecords) throws InvalidParameterException, PagingErrorException, FunctionNotSupportedException, RepositoryErrorException Retrieve a list of log records written in a specified time period. The offset and maximumRecords parameters support a paging- Specified by:
getAuditLogRecordsByTimeStamp
in interfaceOMRSAuditLogStore
- Parameters:
startDate
- start of time periodendDate
- end of time periodoffset
- offset of full collection to begin the return resultsmaximumRecords
- maximum number of log records to return- Returns:
- list of log records from the specified time period
- Throws:
InvalidParameterException
- indicates that the start and/or end date parameters are invalid.PagingErrorException
- indicates that the offset or the maximumRecords parameters are invalid.FunctionNotSupportedException
- indicates that the audit log store does not support queries.RepositoryErrorException
- indicates that the audit log store is not available or has an error.
-
getAuditLogRecordsBySeverity
public List<OMRSAuditLogRecord> getAuditLogRecordsBySeverity(String severity, Date startDate, Date endDate, int offset, int maximumRecords) throws InvalidParameterException, PagingErrorException, FunctionNotSupportedException, RepositoryErrorException Retrieve a list of log records that have specific severity. The offset and maximumRecords parameters support a paging model.- Specified by:
getAuditLogRecordsBySeverity
in interfaceOMRSAuditLogStore
- Parameters:
severity
- the severity value of messages to returnstartDate
- start of time periodendDate
- end of time periodoffset
- offset of full collection to begin the return resultsmaximumRecords
- maximum number of log records to return- Returns:
- list of log records from the specified time period
- Throws:
InvalidParameterException
- indicates that the severity, start and/or end date parameters are invalid.PagingErrorException
- indicates that the offset or the maximumRecords parameters are invalid.FunctionNotSupportedException
- indicates that the audit log store does not support queries.RepositoryErrorException
- indicates that the audit log store is not available or has an error.
-
getAuditLogRecordsByComponent
public List<OMRSAuditLogRecord> getAuditLogRecordsByComponent(String component, Date startDate, Date endDate, int offset, int maximumRecords) throws InvalidParameterException, PagingErrorException, FunctionNotSupportedException, RepositoryErrorException Retrieve a list of log records written by a specific component. The offset and maximumRecords parameters support a paging model.- Specified by:
getAuditLogRecordsByComponent
in interfaceOMRSAuditLogStore
- Parameters:
component
- name of the component to retrieve events fromstartDate
- start of time periodendDate
- end of time periodoffset
- offset of full collection to begin the return resultsmaximumRecords
- maximum number of log records to return- Returns:
- list of log records from the specified time period
- Throws:
InvalidParameterException
- indicates that the component, start and/or end date parameters are invalid.PagingErrorException
- indicates that the offset or the maximumRecords parameters are invalid.FunctionNotSupportedException
- indicates that the audit log store does not support queries.RepositoryErrorException
- indicates that the audit log store is not available or has an error.
-
validateLogRecord
protected void validateLogRecord(OMRSAuditLogRecord logRecord, String methodName) throws InvalidParameterException Validate that the log record supplied by the OMRS is properly filled out.- Parameters:
logRecord
- supplied by the OMRSmethodName
- calling method- Throws:
InvalidParameterException
- the log record is not valid
-
isSupportedSeverity
Should the record be written to this destination?- Parameters:
logRecord
- record to log- Returns:
- boolean flag to indicate whether the log record's severity matches the supported severities.
-
getJSONLogRecord
protected String getJSONLogRecord(AuditLogRecord logRecord, String methodName) throws InvalidParameterException Create JSON version of the log record.- Parameters:
logRecord
- log recordmethodName
- calling method- Returns:
- JSON string
- Throws:
InvalidParameterException
- unable to convert the log record.
-
initialize
Call made by the ConnectorProvider to initialize the Connector with the base services.- Overrides:
initialize
in classConnectorBase
- Parameters:
connectorInstanceId
- unique id for the connector instance useful for messages etcconnectionProperties
- POJO for the configuration used to create the connector.
-