Class 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
    • Constructor Detail

      • OMRSAuditLogStoreConnectorBase

        protected OMRSAuditLogStoreConnectorBase()
        Default constructor
    • Method Detail

      • getDestinationName

        public java.lang.String getDestinationName()
        Return the name of this audit log destination.
        Specified by:
        getDestinationName in interface OMRSAuditLogStore
        Returns:
        string display name suitable for messages.
      • getSupportedSeverities

        public java.util.List<java.lang.String> getSupportedSeverities()
        Return the list of supported severities that this destination is configured to support.
        Specified by:
        getSupportedSeverities in interface OMRSAuditLogStore
        Returns:
        list of severity names (see OMRSAuditLogRecordSeverity)
      • storeLogRecord

        public abstract java.lang.String storeLogRecord​(OMRSAuditLogRecord logRecord)
                                                 throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException,
                                                        org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException
        Store the audit log record in the audit log store.
        Specified by:
        storeLogRecord in interface OMRSAuditLogStore
        Parameters:
        logRecord - log record to store
        Returns:
        unique identifier assigned to the log record
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException - indicates that the logRecord parameter is invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException - indicates that the audit log store is not available or has an error.
      • storeLogRecord

        public java.lang.String storeLogRecord​(AuditLogRecord logRecord)
                                        throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException,
                                               org.odpi.openmetadata.repositoryservices.ffdc.exception.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:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException - indicates that the logRecord parameter is invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException - indicates that the audit log store is not available or has an error.
      • getAuditLogRecord

        public OMRSAuditLogRecord getAuditLogRecord​(java.lang.String logRecordId)
                                             throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException,
                                                    org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException,
                                                    org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException
        Retrieve a specific audit log record.
        Specified by:
        getAuditLogRecord in interface OMRSAuditLogStore
        Parameters:
        logRecordId - unique identifier for the log record
        Returns:
        requested audit log record
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException - indicates that the logRecordId parameter is invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException - indicates that the audit log store does not support queries.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException - indicates that the audit log store is not available or has an error.
      • getAuditLogRecordsByTimeStamp

        public java.util.List<OMRSAuditLogRecord> getAuditLogRecordsByTimeStamp​(java.util.Date startDate,
                                                                                java.util.Date endDate,
                                                                                int offset,
                                                                                int maximumRecords)
                                                                         throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException,
                                                                                org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException,
                                                                                org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException,
                                                                                org.odpi.openmetadata.repositoryservices.ffdc.exception.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 interface OMRSAuditLogStore
        Parameters:
        startDate - start of time period
        endDate - end of time period
        offset - offset of full collection to begin the return results
        maximumRecords - maximum number of log records to return
        Returns:
        list of log records from the specified time period
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException - indicates that the start and/or end date parameters are invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException - indicates that the audit log store does not support queries.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException - indicates that the audit log store is not available or has an error.
      • getAuditLogRecordsBySeverity

        public java.util.List<OMRSAuditLogRecord> getAuditLogRecordsBySeverity​(java.lang.String severity,
                                                                               java.util.Date startDate,
                                                                               java.util.Date endDate,
                                                                               int offset,
                                                                               int maximumRecords)
                                                                        throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException,
                                                                               org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException,
                                                                               org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException,
                                                                               org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException
        Retrieve a list of log records that have specific severity. The offset and maximumRecords parameters support a paging model.
        Specified by:
        getAuditLogRecordsBySeverity in interface OMRSAuditLogStore
        Parameters:
        severity - the severity value of messages to return
        startDate - start of time period
        endDate - end of time period
        offset - offset of full collection to begin the return results
        maximumRecords - maximum number of log records to return
        Returns:
        list of log records from the specified time period
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException - indicates that the severity, start and/or end date parameters are invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException - indicates that the audit log store does not support queries.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException - indicates that the audit log store is not available or has an error.
      • getAuditLogRecordsByComponent

        public java.util.List<OMRSAuditLogRecord> getAuditLogRecordsByComponent​(java.lang.String component,
                                                                                java.util.Date startDate,
                                                                                java.util.Date endDate,
                                                                                int offset,
                                                                                int maximumRecords)
                                                                         throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException,
                                                                                org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException,
                                                                                org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException,
                                                                                org.odpi.openmetadata.repositoryservices.ffdc.exception.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 interface OMRSAuditLogStore
        Parameters:
        component - name of the component to retrieve events from
        startDate - start of time period
        endDate - end of time period
        offset - offset of full collection to begin the return results
        maximumRecords - maximum number of log records to return
        Returns:
        list of log records from the specified time period
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException - indicates that the component, start and/or end date parameters are invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException - indicates that the offset or the maximumRecords parameters are invalid.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException - indicates that the audit log store does not support queries.
        org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException - indicates that the audit log store is not available or has an error.
      • validateLogRecord

        protected void validateLogRecord​(OMRSAuditLogRecord logRecord,
                                         java.lang.String methodName)
                                  throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException
        Validate that the log record supplied by the OMRS is properly filled out.
        Parameters:
        logRecord - supplied by the OMRS
        methodName - calling method
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.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 java.lang.String getJSONLogRecord​(OMRSAuditLogRecord logRecord,
                                                    java.lang.String methodName)
                                             throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException
        Create JSON version of the log record.
        Parameters:
        logRecord - log record
        methodName - calling method
        Returns:
        JSON string
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException - unable to convert the log record.
      • initialize

        public void initialize​(java.lang.String connectorInstanceId,
                               ConnectionProperties connectionProperties)
        Call made by the ConnectorProvider to initialize the Connector with the base services.
        Overrides:
        initialize in class ConnectorBase
        Parameters:
        connectorInstanceId - unique id for the connector instance useful for messages etc
        connectionProperties - POJO for the configuration used to create the connector.