org.ocap.system.event.SystemEvent Maven / Gradle / Ivy
/*
* SystemEvent.java
* Created on February 20, 2004, 3:33 PM
*/
package org.ocap.system.event;
/**
* This class is the basis for system event messages. Applications cannot create
* this class directly, they must create one of the defined subclasses instead.
*
* The event type code is defined with ranges reserved for specific types of events.
* Ranges defined for the implementation using "SYS" cannot be used by applications.
*
* Ranges defined as "reserved" will be allocated by OCAP (or other future standards).
* Applications and OCAP implementations SHOULD NOT use these values until their
* meaning is standardized.
*
* Values in a SYS range that are not reserved may be used by OCAP implementers - their
* meaning is implementation-dependent.
*
* Values in an APP range that are not reserved may be used by OCAP applications - their
* meaning is application-dependent. The {@link #getAppID()} method may be useful to
* disambiguate these codes.
*
* Informational events can be used for any information desired. Recoverable error
* events do not prevent an application or the implementation from continued execution.
* Catastrophic events generated by or on behalf of an application indicate that the
* application cannot continue execution and will be a cause for self-destruction.
* Reboot events generated by the implementation indicate that the implementation cannot
* continue execution and a system generated reboot is imminent.
*/
public class SystemEvent
{
/**
* Start of range for system generated informational events.
*/
public static final int BEGIN_SYS_INFO_EVENT_TYPES = 0x00000000;
/**
* Start of range reserved for system generated informational events defined by
* OCAP. This reserved range ends with {@link #END_SYS_INFO_EVENT_TYPES}.
*/
public static final int BEGIN_SYS_INFO_RESERVED_EVENT_TYPES = 0x04000000;
/**
* End of range for system generated informational events.
*/
public static final int END_SYS_INFO_EVENT_TYPES = 0x07FFFFFF;
/**
* Start of range for application generated informational events.
*/
public static final int BEGIN_APP_INFO_EVENT_TYPES = 0x08000000;
/**
* Start of range reserved for application generated informational events defined by
* OCAP. This reserved range ends with {@link #END_APP_INFO_EVENT_TYPES}.
*/
public static final int BEGIN_APP_INFO_RESERVED_EVENT_TYPES = 0x0C000000;
/**
* End of range for application generated informational events.
*/
public static final int END_APP_INFO_EVENT_TYPES = 0x1FFFFFFF;
/**
* Start of range for system generated recoverable error events.
*
* These events may refer to a specific application, which will be identified by the
* {@link #getAppID()} method, or may be internal system errors, in which case
* getAppID()
will return null.
*/
public static final int BEGIN_SYS_REC_ERROR_EVENT_TYPES = 0x20000000;
/**
* Start of range reserved for system generated recoverable error events defined by
* OCAP. This reserved range ends with {@link #END_SYS_REC_ERROR_EVENT_TYPES}.
*/
public static final int BEGIN_SYS_REC_ERROR_RESERVED_EVENT_TYPES = 0x24000000;
/**
* End of range for system generated recoverable error events.
*/
public static final int END_SYS_REC_ERROR_EVENT_TYPES = 0x27FFFFFF;
/**
* Start of range for application generated recoverable error events.
*
* This type of error is intended to indicate that something went wrong (e.g. a data file
* could not be loaded or a system call failed), but the application is designed to handle
* the error gracefully so does not need to terminate.
*/
public static final int BEGIN_APP_REC_ERROR_EVENT_TYPES = 0x28000000;
/**
* Start of range reserved for application generated recoverable error events defined by
* OCAP. This reserved range ends with {@link #END_APP_REC_ERROR_EVENT_TYPES}.
*/
public static final int BEGIN_APP_REC_ERROR_RESERVED_EVENT_TYPES = 0x2C000000;
/**
* End of range for application generated recoverable error events.
*/
public static final int END_APP_REC_ERROR_EVENT_TYPES = 0x2FFFFFFF;
/**
* Start of range for system generated catastrophic events.
*
* These the events are generated by the system when it detects a
* catastrophic failure that will cause (or has caused) the application identified
* by the {@link #getAppID()} method to be terminated.
*
* These events may also be internal system errors, in which case
* getAppID()
will return null.
*/
public static final int BEGIN_SYS_CAT_ERROR_EVENT_TYPES = 0x30000000;
/**
* Start of range reserved for system generated catastrophic error events defined by
* OCAP. This reserved range ends with {@link #END_SYS_CAT_ERROR_EVENT_TYPES}.
*/
public static final int BEGIN_SYS_CAT_ERROR_RESERVED_EVENT_TYPES = 0x34000000;
/**
* End of range for system generated catastrophic error events.
*/
public static final int END_SYS_CAT_ERROR_EVENT_TYPES = 0x37FFFFFF;
/**
* Start of range reserved for application generated catastrophic error events defined by
* OCAP. This reserved range ends with {@link #END_APP_CAT_ERROR_EVENT_TYPES}.
*/
public static final int BEGIN_APP_CAT_ERROR_EVENT_TYPES = 0x38000000;
/**
* Start of range reserved for application generated catastrophic error events defined by
* OCAP. This reserved range ends with {@link #END_APP_CAT_ERROR_EVENT_TYPES}.
*/
public static final int BEGIN_APP_CAT_ERROR_RESERVED_EVENT_TYPES = 0x3C000000;
/**
* End of range for application generated catastrophic error events.
*/
public static final int END_APP_CAT_ERROR_EVENT_TYPES = 0x3FFFFFFF;
/**
* Start of range for system generated reboot events.
*/
public static final int BEGIN_SYS_REBOOT_EVENT_TYPES = 0x40000000;
/**
* Start of range reserved for system generated reboot events defined by
* OCAP. This reserved range ends with {@link #END_SYS_REBOOT_EVENT_TYPES}.
*/
public static final int BEGIN_SYS_REBOOT_RESERVED_EVENT_TYPES = 0x44000000;
/**
* End of range for system generated reboot events.
*/
public static final int END_SYS_REBOOT_EVENT_TYPES = 0x47FFFFFF;
/**
* Start of range for system generated resource depletion events.
*/
public static final int BEGIN_SYS_RES_DEP_EVENT_TYPES = 0x50000000;
/**
* Start of range reserved for system generated resource depletion events defined by
* OCAP. This reserved range ends with {@link #END_SYS_RES_DEP_EVENT_TYPES}.
*/
public static final int BEGIN_SYS_RES_DEP_RESERVED_EVENT_TYPES = 0x54000000;
/**
* End of range for system generated resource depletion events.
*/
public static final int END_SYS_RES_DEP_EVENT_TYPES = 0x57FFFFFF;
/**
* Start of range reserved for system generated deferred download events
* in response to a CVT signaling a deferred download. This reserved
* range ends with {@link #END_SYS_DNLD_EVENT_TYPES}.
*/
public static final int BEGIN_SYS_DNLD_EVENT_TYPES = 0X58000000;
/**
* End of range for system deferred download events.
*/
public static final int END_SYS_DNLD_EVENT_TYPES = 0X58FFFFFF;
/**
* System event constructor. Assigns a date, and AppID. The
* readable message is set to null.
*
* @param typeCode - Unique event type.
*
* @throws IllegalArgumentException if the typeCode is not in a defined application range
* when the event is created by an application.
*/
protected SystemEvent(int typeCode)
{
}
/**
* System event constructor with message. Assigns a date, and AppID.
*
* @param typeCode - Unique event type.
* @param message - Readable message specific to the event generator.
*
* @throws IllegalArgumentException if the typeCode is not in a defined application range
* when the event is created by an application.
*/
protected SystemEvent(int typeCode, String message)
{
}
/**
* This constructor is provided for internal use by OCAP implementations;
* applications SHOULD NOT call it.
*
* @param typeCode - The unique error type code.
* @param message - Readable message specific to the event generator.
* @param date - Event date in milli-seconds from midnight January 1, 1970 GMT.
* @param appId - The Id of the application logging the event.
*
* @throws SecurityException if this constructor is called by any application.
*/
protected SystemEvent(int typeCode, String message, long date,
org.dvb.application.AppID appId)
{
}
/**
* Gets the globally unique identifier of the application logging the event.
*
* @return The identifier of the application, or null for events that do not have an
* associated application (such as system initiated reboots).
*/
public org.dvb.application.AppID getAppID()
{
return null;
}
/**
* Gets the event type code. Identifies a code specific to the event system.
*
* @return type code of the event.
*/
public int getTypeCode()
{
return 0;
}
/**
* Gets the event date in milli-seconds from midnight January 1, 1970, GMT.
* The return value from this method can be passed to the java.util.Date(long) constructor.
*
* @return The date the event was submitted to the system.
*/
public long getDate()
{
return 0;
}
/**
* Gets the readable message.
*
* @return message string of the event.
*/
public String getMessage()
{
return null;
}
}