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:
OMRSAuditLogStore
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, securedProperties
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedOMRSAuditLogStoreConnectorBase()Default constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description OMRSAuditLogRecordgetAuditLogRecord(String logRecordId)Retrieve a specific audit log record.List<OMRSAuditLogRecord>getAuditLogRecordsByComponent(String component, Date startDate, Date endDate, int offset, int maximumRecords)Retrieve a list of log records written by a specific component.List<OMRSAuditLogRecord>getAuditLogRecordsBySeverity(String severity, Date startDate, Date endDate, int offset, int maximumRecords)Retrieve a list of log records that have specific severity.List<OMRSAuditLogRecord>getAuditLogRecordsByTimeStamp(Date startDate, Date endDate, int offset, int maximumRecords)Retrieve a list of log records written in a specified time period.StringgetDestinationName()Return the name of this audit log destination.protected StringgetJSONLogRecord(OMRSAuditLogRecord logRecord, String methodName)Create JSON version of the log record.List<String>getSupportedSeverities()Return the list of supported severities that this destination is configured to support.voidinitialize(String connectorInstanceId, ConnectionProperties connectionProperties)Call made by the ConnectorProvider to initialize the Connector with the base services.protected booleanisSupportedSeverity(OMRSAuditLogRecord logRecord)Should the record be written to this destination?StringstoreLogRecord(AuditLogRecord logRecord)Store the audit log record in the audit log store.abstract StringstoreLogRecord(OMRSAuditLogRecord logRecord)Store the audit log record in the audit log store.protected voidvalidateLogRecord(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, equals, getConnectedAssetProperties, getConnection, getConnectorInstanceId, hashCode, initializeConnectedAssetProperties, isActive, start, toString
-
-
-
-
Method Detail
-
getDestinationName
public String getDestinationName()
Return the name of this audit log destination.- Specified by:
getDestinationNamein interfaceOMRSAuditLogStore- Returns:
- string display name suitable for messages.
-
getSupportedSeverities
public List<String> getSupportedSeverities()
Return the list of supported severities that this destination is configured to support.- Specified by:
getSupportedSeveritiesin 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:
storeLogRecordin 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:
getAuditLogRecordin 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:
getAuditLogRecordsByTimeStampin 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:
getAuditLogRecordsBySeverityin 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:
getAuditLogRecordsByComponentin 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
protected boolean isSupportedSeverity(OMRSAuditLogRecord logRecord)
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(OMRSAuditLogRecord 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
public void initialize(String connectorInstanceId, ConnectionProperties connectionProperties)
Call made by the ConnectorProvider to initialize the Connector with the base services.- Overrides:
initializein classConnectorBase- Parameters:
connectorInstanceId- unique id for the connector instance useful for messages etcconnectionProperties- POJO for the configuration used to create the connector.
-
-