Package org.opends.server.loggers
Class CommonAudit
- java.lang.Object
-
- org.opends.server.loggers.CommonAudit
-
public class CommonAudit extends Object
Entry point for the common audit facility.This class manages the AuditService instances and Audit Event Handlers that correspond to the publishers defined in OpenDJ configuration.
In theory there should be only one instance of AuditService for all the event handlers but defining one service per handler allow to perform filtering at the DJ server level.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_TRANSACTION_IDTransaction id used when the incoming request does not contain a transaction id.
-
Constructor Summary
Constructors Constructor Description CommonAudit(ServerContext serverContext)Creates the common audit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOrUpdatePublisher(LogPublisherCfg newConfig)Adds or updates the publisher corresponding to the provided configuration to common audit.org.forgerock.json.resource.RequestHandlergetAuditServiceForHttpAccessLog()Returns the audit service that manages HTTP Access logging.org.forgerock.json.resource.RequestHandlergetRequestHandler(LogPublisherCfg config)Returns the Common Audit request handler for the provided configuration.booleanisCommonAuditConfig(LogPublisherCfg config)Indicates if the provided log publisher configuration corresponds to a common audit publisher.booleanisExistingCommonAuditConfig(LogPublisherCfg config)Indicates if the provided log publisher configuration corresponds to a common audit publisher.booleanisHttpAccessLogEnabled()Indicates if HTTP access logging is enabled for common audit.voidremovePublisher(LogPublisherCfg config)Removes the publisher corresponding to the provided configuration from common audit.voidsetTrustTransactionIds(boolean shouldTrust)Sets the indicator for transactionIds trusting.booleanshouldTrustTransactionIds()Indicates if transactionIds received from requests should be trusted.voidshutdown()Shutdown common audit.
-
-
-
Field Detail
-
DEFAULT_TRANSACTION_ID
public static final String DEFAULT_TRANSACTION_ID
Transaction id used when the incoming request does not contain a transaction id.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CommonAudit
public CommonAudit(ServerContext serverContext) throws ConfigException
Creates the common audit.- Parameters:
serverContext- The server context.- Throws:
ConfigException- If an error occurs.
-
-
Method Detail
-
shouldTrustTransactionIds
public boolean shouldTrustTransactionIds()
Indicates if transactionIds received from requests should be trusted.- Returns:
trueif transactionIds should be trusted,falseotherwise
-
setTrustTransactionIds
public void setTrustTransactionIds(boolean shouldTrust)
Sets the indicator for transactionIds trusting.- Parameters:
shouldTrust-trueif transactionIds should be trusted,falseotherwise
-
getRequestHandler
public org.forgerock.json.resource.RequestHandler getRequestHandler(LogPublisherCfg config) throws ConfigException
Returns the Common Audit request handler for the provided configuration.- Parameters:
config- The log publisher configuration- Returns:
- the request handler associated to the log publisher
- Throws:
ConfigException- If an error occurs
-
addOrUpdatePublisher
public void addOrUpdatePublisher(LogPublisherCfg newConfig) throws ConfigException
Adds or updates the publisher corresponding to the provided configuration to common audit.- Parameters:
newConfig- Configuration of the publisher- Throws:
ConfigException- If an error occurs.
-
removePublisher
public void removePublisher(LogPublisherCfg config) throws ConfigException
Removes the publisher corresponding to the provided configuration from common audit.- Parameters:
config- Configuration of publisher to remove- Throws:
ConfigException- If an error occurs.
-
shutdown
public void shutdown()
Shutdown common audit.
-
isCommonAuditConfig
public boolean isCommonAuditConfig(LogPublisherCfg config) throws ConfigException
Indicates if the provided log publisher configuration corresponds to a common audit publisher.The common audit publisher may not already exist.
This method must not be used when the corresponding configuration is deleted, because it implies checking the corresponding configuration entry in the server.
- Parameters:
config- The log publisher configuration.- Returns:
trueif publisher corresponds to a common audit publisher- Throws:
ConfigException- If an error occurs
-
isExistingCommonAuditConfig
public boolean isExistingCommonAuditConfig(LogPublisherCfg config) throws ConfigException
Indicates if the provided log publisher configuration corresponds to a common audit publisher.- Parameters:
config- The log publisher configuration.- Returns:
trueif publisher is defined for common audit,falseotherwise- Throws:
ConfigException- If an error occurs
-
isHttpAccessLogEnabled
public boolean isHttpAccessLogEnabled()
Indicates if HTTP access logging is enabled for common audit.- Returns:
trueif there is at least one HTTP access logger enabled for common audit.
-
getAuditServiceForHttpAccessLog
public org.forgerock.json.resource.RequestHandler getAuditServiceForHttpAccessLog()
Returns the audit service that manages HTTP Access logging.- Returns:
- the request handler that accepts audit events
-
-