Package cz.metacentrum.perun.core.api
Interface AuditMessagesManager
- All Known Implementing Classes:
- AuditMessagesManagerEntry
public interface AuditMessagesManager
AuditMessagesManager manages audit messages (logs). Entry Logic interface.
- Author:
- Michal Stava, Pavel Zlámal
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionvoidcreateAuditerConsumer(PerunSession perunSession, String consumerName) Creates new auditer consumer with last processed id which equals current auditer log max id.Return list of names of all possible eventsgetAllAuditerConsumers(PerunSession perunSession) Get all registered auditer consumers as map name(String)=lastProcessedId(Integer).intgetAuditerMessagesCount(PerunSession perunSession) Get count of all messages in auditLOG.intgetLastMessageId(PerunSession perunSession) Get ID of last (newest) message in audit log (max_id).getMessages(PerunSession perunSession) Returns 100 newest audit messages from auditLOG.getMessages(PerunSession perunSession, int count) Returns exact number of newest audit messages defined by 'count' param (disregarding message IDs).getMessagesByCount(PerunSession perunSession, int count) Returns all messages with IDs within the range from max(ID) to (max(ID)-count), where number of returned messages is equal or less than 'count' param, because some IDs could be skipped in the sequence.getMessagesByIdAndCount(PerunSession perunSession, int id, int count) Returns "count" number of messages that are more or equal than the given ID (ascending order), i.e. the method returns newer messages by provided ID.getMessagesPage(PerunSession perunSession, MessagesPageQuery query) Returns page of audit messages.voidlog(PerunSession perunSession, String message) Log arbitrary audit message.pollConsumerEvents(PerunSession perunSession, String consumerName) Returns list of AuditEvents from audit log with IDs > lastProcessedId for registered auditer consumer.pollConsumerEvents(PerunSession perunSession, String consumerName, int lastProcessedId) Returns list of AuditEvents from audit log with IDs > lastProcessedId for registered auditer consumer.pollConsumerMessages(PerunSession perunSession, String consumerName) Returns list of AuditMessages from audit log with IDs > lastProcessedId for registered auditer consumer.pollConsumerMessages(PerunSession perunSession, String consumerName, int lastProcessedId) Returns list of AuditMessages from audit log with IDs > lastProcessedId given.voidsetLastProcessedId(PerunSession perunSession, String consumerName, int lastProcessedId) Deprecated.
- 
Field Details- 
COUNTOFMESSAGES
 
- 
- 
Method Details- 
createAuditerConsumervoid createAuditerConsumer(PerunSession perunSession, String consumerName) throws PrivilegeException Creates new auditer consumer with last processed id which equals current auditer log max id.- Parameters:
- perunSession- perun session
- consumerName- new name for consumer
- Throws:
- InternalErrorException- When implementation fails
- PrivilegeException- When you are not authorized to create auditer consumer
 
- 
findAllPossibleEventsReturn list of names of all possible events- Parameters:
- sess- perun session
- Returns:
- list of all possible events
- Throws:
- InternalErrorException- When implementation fails
 
- 
getAllAuditerConsumersGet all registered auditer consumers as map name(String)=lastProcessedId(Integer).- Parameters:
- perunSession- perun session
- Returns:
- Mapping of auditer consumer names to their last processed ID.
- Throws:
- InternalErrorException- When implementation fails
 
- 
getAuditerMessagesCountGet count of all messages in auditLOG.- Parameters:
- perunSession- perun session
- Returns:
- Count of all messages in audit log
- Throws:
- InternalErrorException- When implementation fails
 
- 
getLastMessageIdGet ID of last (newest) message in audit log (max_id).- Parameters:
- perunSession- perun session
- Returns:
- ID of last (newest) message.
- Throws:
- InternalErrorException- When implementation fails
 
- 
getMessagesReturns 100 newest audit messages from auditLOG. If there is a less messages than 100, then all of them are returned.- Parameters:
- perunSession- perun session
- Returns:
- List of 100 newest audit messages
- Throws:
- InternalErrorException- When implementation fails
 
- 
getMessagesReturns exact number of newest audit messages defined by 'count' param (disregarding message IDs). If there is less messages present, then all of them are returned.- Parameters:
- perunSession- perun session
- count- Count of returned messages.
- Returns:
- List of audit messages
- Throws:
- InternalErrorException- When implementation fails
 
- 
getMessagesByCountReturns all messages with IDs within the range from max(ID) to (max(ID)-count), where number of returned messages is equal or less than 'count' param, because some IDs could be skipped in the sequence.- Parameters:
- perunSession- perun session
- count- Number of IDs to subtract from max(ID)
- Returns:
- List of audit messages
- Throws:
- InternalErrorException- When implementation fails
 
- 
getMessagesByIdAndCountList<AuditMessage> getMessagesByIdAndCount(PerunSession perunSession, int id, int count) throws PrivilegeException Returns "count" number of messages that are more or equal than the given ID (ascending order), i.e. the method returns newer messages by provided ID.- Parameters:
- perunSession- perun session
- id- starting id from which the messages will be taken
- count- Number of messages that will be returned
- Returns:
- List of audit messages
- Throws:
- PrivilegeException- when the principal does not have sufficient rights
 
- 
getMessagesPagePaginated<AuditMessage> getMessagesPage(PerunSession perunSession, MessagesPageQuery query) throws PrivilegeException Returns page of audit messages. Query parameter specifies offset and page size and allows filtering by name of event. Total count is only estimated.- Parameters:
- perunSession- perun session
- Returns:
- Page of audit messages
- Throws:
- InternalErrorException- When implementation fails
- PrivilegeException
 
- 
logLog arbitrary audit message.- Parameters:
- perunSession- perun session
- message- message to be logged
- Throws:
- InternalErrorException- When implementation fails
- PrivilegeException- When you are not authorized to log arbitrary message
 
- 
pollConsumerEventsList<AuditEvent> pollConsumerEvents(PerunSession perunSession, String consumerName) throws PrivilegeException Returns list of AuditEvents from audit log with IDs > lastProcessedId for registered auditer consumer. Number of returned events for one call is limited (by default 10 000). You might need to fetch additional events by repeating this call.- Parameters:
- perunSession- perun session
- consumerName- consumer to get messages for
- Returns:
- List of audit messages
- Throws:
- InternalErrorException- When implementation fails
- PrivilegeException- When you are not authorized to poll events
 
- 
pollConsumerEventsList<AuditEvent> pollConsumerEvents(PerunSession perunSession, String consumerName, int lastProcessedId) throws PrivilegeException Returns list of AuditEvents from audit log with IDs > lastProcessedId for registered auditer consumer. Number of returned events for one call is limited (by default 10 000). You might need to fetch additional events by repeating this call.- Parameters:
- perunSession- perun session
- consumerName- consumer to get messages for
- lastProcessedId- id of the last event
- Returns:
- List of audit messages
- Throws:
- InternalErrorException- When implementation fails
- PrivilegeException- When you are not authorized to poll events
 
- 
pollConsumerMessagesList<AuditMessage> pollConsumerMessages(PerunSession perunSession, String consumerName) throws PrivilegeException Returns list of AuditMessages from audit log with IDs > lastProcessedId for registered auditer consumer. Number of returned messages for one call is limited (by default 10 000). You might need to fetch additional messages by repeating this call.- Parameters:
- perunSession- perun session
- consumerName- consumer to get messages for
- Returns:
- List of audit messages
- Throws:
- InternalErrorException- When implementation fails
- PrivilegeException- When you are not authorized to poll messages
 
- 
pollConsumerMessagesList<AuditMessage> pollConsumerMessages(PerunSession perunSession, String consumerName, int lastProcessedId) throws PrivilegeException Returns list of AuditMessages from audit log with IDs > lastProcessedId given. Number of returned messages for one call is limited (by default 10 000). You might need to fetch additional messages by repeating this call.- Parameters:
- perunSession- perun session
- consumerName- consumer to get messages for
- lastProcessedId- id of the last message
- Returns:
- List of audit messages
- Throws:
- InternalErrorException- When implementation fails
- PrivilegeException- When you are not authorized to poll messages
 
- 
setLastProcessedId@Deprecated void setLastProcessedId(PerunSession perunSession, String consumerName, int lastProcessedId) throws PrivilegeException Deprecated.Set ID of last processed message for specified consumer.- Parameters:
- perunSession- perun session
- consumerName- name of consumer
- lastProcessedId- id of last processed message in consumer
- Throws:
- InternalErrorException- When implementation fails
- PrivilegeException- When you are not authorized to set last processed id
 
 
-