wt.audit
Class StandardAuditService

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.audit.StandardAuditService
All Implemented Interfaces:
AuditService, Manager, NetFactor, Serializable

public class StandardAuditService
extends StandardManager
implements AuditService, Serializable

Standard implementation of the audit API.

Use the newStandardAuditService static factory method(s), not the StandardAuditService constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static long ACTIVITY_PERIOD_SIZE
           
private  boolean auditEnabled
           
private static String CLASSNAME
           
private static int NRETRIES
           
private static String RESOURCE
           
private static int SLEEPTIME
           
private static boolean VERBOSE
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Constructor Summary
StandardAuditService()
           
 
Method Summary
 void createAuditEvent(AuditEventType event_type, WTPrincipalReference user_ref, ObjectReference audit_ref)
          Records event in the database and updates the last event association if audit_ref is not null.
 void deleteAuditEvents(AuditPeriod period, ObjectReference audit_ref, AuditEventType event_type)
          Deletes events.
private  long getActivityPeriod(Timestamp date1)
          Returns the absolute activity period a date is in.
 QueryResult getAuditEvents(AuditPeriod period, ObjectReference audit_ref, AuditEventType event_type, WTPrincipalReference user_ref)
          Returns all the audit events in a given period with the characteristics passed as arguments.
 AuditReport getAuditReport(AuditPeriod period, Vector audit_objs, AuditEventType event_type, boolean only_latest)
          Returns an audit report with information concerning an auditing period, a set of target objects and a specific event type.
 String getConceptualClassname()
          Deprecated.  
private  LastAuditEvent getLastAuditEvent(AuditEventType event_type, WTPrincipalReference user_ref, ObjectReference audit_ref)
          Retrieves the last audit event for a type, a user and an target object.
 Timestamp getLastEventTime(AuditEventType event_type, WTPrincipalReference user_ref, ObjectReference audit_ref)
          Returns the time of the last event of a certain type involving a given user and a target object.
private  AuditEvent getLatestEvent(AuditEventType event_type, WTPrincipalReference user_ref, ObjectReference audit_ref)
          Returns the latest event of a given type, for a given user and target object.
 boolean isAuditEnabled()
          Determines if auditing is enabled.
static StandardAuditService newStandardAuditService()
          Default factory for the class.
protected  void performShutdownProcess()
          Dummy method to be overridden by subclasses.
protected  void performStartupProcess()
          

Supported API: false
private  void registerAsListener()
           
 void registerEvents(ManagerService ms)
          Register events with the passed ManagerService.
private  void registerSpecificEvent(String eventKey)
          The specifics for each event are taken care of by the recorder factory, so there is no need to sweat the details here.
private  boolean sameActivityPeriod(Timestamp date1, Timestamp date2)
          Determines if two dates are in the same activity period.
private  void updateLastAuditEvent(AuditEventType event_type, WTPrincipalReference user_ref, ObjectReference audit_ref, Timestamp event_time)
          Updates the latest event type link.
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

ACTIVITY_PERIOD_SIZE

private static final long ACTIVITY_PERIOD_SIZE

VERBOSE

private static final boolean VERBOSE

NRETRIES

private static final int NRETRIES
See Also:
Constant Field Values

SLEEPTIME

private static final int SLEEPTIME
See Also:
Constant Field Values

auditEnabled

private boolean auditEnabled
Constructor Detail

StandardAuditService

public StandardAuditService()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

performShutdownProcess

protected void performShutdownProcess()
                               throws ManagerException
Dummy method to be overridden by subclasses. Subclasses should override this method and provide shutdown processing.

Supported API: false

Overrides:
performShutdownProcess in class StandardManager
Throws:
ManagerException

performStartupProcess

protected void performStartupProcess()
                              throws ManagerException


Supported API: false

Overrides:
performStartupProcess in class StandardManager
Throws:
ManagerException

newStandardAuditService

public static StandardAuditService newStandardAuditService()
                                                    throws WTException
Default factory for the class.

Supported API: false

Returns:
StandardAuditService
Throws:
WTException

createAuditEvent

public void createAuditEvent(AuditEventType event_type,
                             WTPrincipalReference user_ref,
                             ObjectReference audit_ref)
                      throws WTException
Records event in the database and updates the last event association if audit_ref is not null. Only the time of the last event within an activity period is actually recorded.

Supported API: false

Specified by:
createAuditEvent in interface AuditService
Parameters:
event_type -
user_ref -
audit_ref -
Throws:
WTException

deleteAuditEvents

public void deleteAuditEvents(AuditPeriod period,
                              ObjectReference audit_ref,
                              AuditEventType event_type)
                       throws WTException
Deletes events. Removes from the database all events corresponding to an audit event that were recorded for a given audit period for a given target object (given its reference). If event is null, all types of events are deleted. A reference to the target object may be null, in which case events for all objects are removed.

Supported API: false

Specified by:
deleteAuditEvents in interface AuditService
Parameters:
period -
audit_ref -
event_type -
Throws:
WTException

getAuditEvents

public QueryResult getAuditEvents(AuditPeriod period,
                                  ObjectReference audit_ref,
                                  AuditEventType event_type,
                                  WTPrincipalReference user_ref)
                           throws WTException
Returns all the audit events in a given period with the characteristics passed as arguments. If any of these arguments is 'null' it is not used to filter the resulting query.

Supported API: false

Specified by:
getAuditEvents in interface AuditService
Parameters:
period -
audit_ref -
event_type -
user_ref -
Returns:
QueryResult
Throws:
WTException

getAuditReport

public AuditReport getAuditReport(AuditPeriod period,
                                  Vector audit_objs,
                                  AuditEventType event_type,
                                  boolean only_latest)
                           throws WTException
Returns an audit report with information concerning an auditing period, a set of target objects and a specific event type. If the null is passed as argument for the vector of audit_objs, all objects are considered. On the other hand, event type must be not null.

If only latest is 'true' only the latest event for the same user and target object is included in the report; otherwise all are included.

Each element of the vector of target objects may be a reference or the object itself.

Supported API: false

Specified by:
getAuditReport in interface AuditService
Parameters:
period -
audit_objs -
event_type -
only_latest -
Returns:
AuditReport
Throws:
WTException

getLastEventTime

public Timestamp getLastEventTime(AuditEventType event_type,
                                  WTPrincipalReference user_ref,
                                  ObjectReference audit_ref)
                           throws WTException
Returns the time of the last event of a certain type involving a given user and a target object. Both user and target object are passed as references.

Supported API: false

Specified by:
getLastEventTime in interface AuditService
Parameters:
event_type -
user_ref -
audit_ref -
Returns:
Timestamp
Throws:
WTException

isAuditEnabled

public boolean isAuditEnabled()
                       throws WTException
Determines if auditing is enabled. Returns 'true' if project audit events are being captured and stored (ProjectAuditEvent); otherwise returns 'false'. Auditing is enabled if and only if in the configAudit.xml configuration file.

Supported API: false

Specified by:
isAuditEnabled in interface AuditService
Returns:
boolean
Throws:
WTException

getLatestEvent

private AuditEvent getLatestEvent(AuditEventType event_type,
                                  WTPrincipalReference user_ref,
                                  ObjectReference audit_ref)
                           throws WTException
Returns the latest event of a given type, for a given user and target object. Returns null if there is no event with these characteristics.

Throws:
WTException

updateLastAuditEvent

private void updateLastAuditEvent(AuditEventType event_type,
                                  WTPrincipalReference user_ref,
                                  ObjectReference audit_ref,
                                  Timestamp event_time)
                           throws WTException
Updates the latest event type link.

Throws:
WTException

getLastAuditEvent

private LastAuditEvent getLastAuditEvent(AuditEventType event_type,
                                         WTPrincipalReference user_ref,
                                         ObjectReference audit_ref)
                                  throws WTException
Retrieves the last audit event for a type, a user and an target object.

Throws:
WTException

sameActivityPeriod

private boolean sameActivityPeriod(Timestamp date1,
                                   Timestamp date2)
Determines if two dates are in the same activity period. Returns 'true' if this is indeed the case; 'false' otherwise. Returns false if ACTIVITY_PERIOD_SIZE <= 0.


registerAsListener

private void registerAsListener()
                         throws WTException
Throws:
WTException

registerSpecificEvent

private void registerSpecificEvent(String eventKey)
                            throws WTException
The specifics for each event are taken care of by the recorder factory, so there is no need to sweat the details here.

Throws:
WTException

registerEvents

public void registerEvents(ManagerService ms)
Description copied from class: StandardManager
Register events with the passed ManagerService. The default method does nothing, subclasses should provide an overriding implementation.

Supported API: false

Specified by:
registerEvents in interface Manager
Overrides:
registerEvents in class StandardManager
Parameters:
ms - the ManagerService with which to register events.

getActivityPeriod

private long getActivityPeriod(Timestamp date1)
Returns the absolute activity period a date is in. Absolute refers to the beginning of times, i. e., January 1, 1970. Assumes ACTIVITY_PERIOD_SIZE > 0.