|
|||||||||
| Home >> All >> org >> scoja >> [ common overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.scoja.common
Class PriorityUtils

java.lang.Objectorg.scoja.common.PriorityUtils
- public abstract class PriorityUtils
- extends java.lang.Object
This a utility class to work with Syslog priorities. Contains named constants for facilities and levels. It has serveral methods to convert between priority integers and strings.
| Field Summary | |
static int |
ALERT
Level: Action must be taken immediately |
static int |
AUTH
Facility: Security/authorization messages |
static int |
AUTHPRIV
Facility: Security/authorization messages (private) (Linux) |
static int |
CRIT
Level: Critical conditions |
static int |
CRON
Facility: Clock daemon |
static int |
DAEMON
Facility: System daemons |
static int |
DEBUG
Level: Debug-level messages |
static int |
DEFAULT_PRIORITY
|
static int |
EMERG
Level: System is unusable. |
static int |
ERR
Level: Error conditions |
static int |
FACILITY_MASK
Mask to extract facility part from a priority (previous to shift with FACILITY_SHIFT 55 . |
static int |
FACILITY_SHIFT
Shift to apply to a priority to get its facility. |
private static java.lang.String[] |
facilityNames
All facilities names, sorted according theirs facility number. |
static int |
FTP
Facility: Ftp daemon (Linux) |
static int |
INFO
Level: Informational |
static int |
KERN
Facility: Kernel messages |
static int |
LEVEL_MASK
Mask to extract level part from a priority. |
private static java.lang.String[][] |
levelNames
All level names, sorted according theirs level number. |
static int |
LOCAL0
Facility: Reserved for local use |
static int |
LOCAL1
Facility: Reserved for local use |
static int |
LOCAL2
Facility: Reserved for local use |
static int |
LOCAL3
Facility: Reserved for local use |
static int |
LOCAL4
Facility: Reserved for local use |
static int |
LOCAL5
Facility: Reserved for local use |
static int |
LOCAL6
Facility: Reserved for local use |
static int |
LOCAL7
Facility: Reserved for local use |
static int |
LPR
Facility: Line printer subsystem |
static int |
MAIL
Facility: Mail system |
private static java.util.Map |
name2facility
A table to convert from facility name to facility value; It is a mapping from String to Integer. |
private static java.util.Map |
name2level
A table to convert from level name to level value. |
static int |
NEWS
Facility: Network news subsystem |
static int |
NOTICE
Level: Normal but significant condition |
static int |
SYSLOG
Facility: Messages generated internally by syslogd |
static int |
TOTAL_FACILITIES
|
static int |
TOTAL_LEVELS
Current number of levels. |
static int |
UNKNOWN_FACILITY
To use when we a facility is needed but we have no sensible facility value. |
static int |
UNKNOWN_LEVEL
To use when we a level is needed but we have no sensible level value. |
static int |
UNKNOWN_PRIORITY
To use when we a priority is needed but we have no sensible priority value. |
static int |
USER
Facility: Random user-level messages |
static int |
UUCP
Facility: UUCP subsystem |
static int |
WARNING
Level: Warning conditions |
| Constructor Summary | |
PriorityUtils()
|
|
| Method Summary | |
static int |
buildPriority(int facility,
int level)
Builds a priority from a facility and a level. |
static int |
getFacility(int priority)
Return the facility part of a priority. |
static java.lang.String |
getFacilityName(int facility)
Return the name of facility if it is known;
null otherwise. |
static int |
getLevel(int priority)
Return the level part of a priority. |
static java.lang.String |
getLevelName(int level)
Return the name of level if it is known;
null otherwise. |
static java.lang.String |
getPriorityName(int priority)
Return the name of priority if both its facility
and level are known; null otherwise. |
static int |
parseFacility(java.lang.String facility)
Compares facility against known facility names
and returns it corresponding facility number. |
static int |
parseLevel(java.lang.String level)
Compares level against known level names
and returns it corresponding level number. |
static int |
parsePriority(java.lang.String priority)
Tries to build a priority number from its string description at priority. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
UNKNOWN_LEVEL
public static final int UNKNOWN_LEVEL
- To use when we a level is needed but we have no sensible
level value.
- See Also:
- Constant Field Values
EMERG
public static final int EMERG
- Level: System is unusable.
- See Also:
- Constant Field Values
ALERT
public static final int ALERT
- Level: Action must be taken immediately
- See Also:
- Constant Field Values
CRIT
public static final int CRIT
- Level: Critical conditions
- See Also:
- Constant Field Values
ERR
public static final int ERR
- Level: Error conditions
- See Also:
- Constant Field Values
WARNING
public static final int WARNING
- Level: Warning conditions
- See Also:
- Constant Field Values
NOTICE
public static final int NOTICE
- Level: Normal but significant condition
- See Also:
- Constant Field Values
INFO
public static final int INFO
- Level: Informational
- See Also:
- Constant Field Values
DEBUG
public static final int DEBUG
- Level: Debug-level messages
- See Also:
- Constant Field Values
TOTAL_LEVELS
public static final int TOTAL_LEVELS
- Current number of levels.
- See Also:
- Constant Field Values
UNKNOWN_FACILITY
public static final int UNKNOWN_FACILITY
- To use when we a facility is needed but we have no sensible
facility value.
- See Also:
- Constant Field Values
KERN
public static final int KERN
- Facility: Kernel messages
- See Also:
- Constant Field Values
USER
public static final int USER
- Facility: Random user-level messages
- See Also:
- Constant Field Values
public static final int MAIL
- Facility: Mail system
- See Also:
- Constant Field Values
DAEMON
public static final int DAEMON
- Facility: System daemons
- See Also:
- Constant Field Values
AUTH
public static final int AUTH
- Facility: Security/authorization messages
- See Also:
- Constant Field Values
SYSLOG
public static final int SYSLOG
- Facility: Messages generated internally by syslogd
- See Also:
- Constant Field Values
LPR
public static final int LPR
- Facility: Line printer subsystem
- See Also:
- Constant Field Values
NEWS
public static final int NEWS
- Facility: Network news subsystem
- See Also:
- Constant Field Values
UUCP
public static final int UUCP
- Facility: UUCP subsystem
- See Also:
- Constant Field Values
CRON
public static final int CRON
- Facility: Clock daemon
- See Also:
- Constant Field Values
AUTHPRIV
public static final int AUTHPRIV
- Facility: Security/authorization messages (private) (Linux)
- See Also:
- Constant Field Values
FTP
public static final int FTP
- Facility: Ftp daemon (Linux)
- See Also:
- Constant Field Values
LOCAL0
public static final int LOCAL0
- Facility: Reserved for local use
- See Also:
- Constant Field Values
LOCAL1
public static final int LOCAL1
- Facility: Reserved for local use
- See Also:
- Constant Field Values
LOCAL2
public static final int LOCAL2
- Facility: Reserved for local use
- See Also:
- Constant Field Values
LOCAL3
public static final int LOCAL3
- Facility: Reserved for local use
- See Also:
- Constant Field Values
LOCAL4
public static final int LOCAL4
- Facility: Reserved for local use
- See Also:
- Constant Field Values
LOCAL5
public static final int LOCAL5
- Facility: Reserved for local use
- See Also:
- Constant Field Values
LOCAL6
public static final int LOCAL6
- Facility: Reserved for local use
- See Also:
- Constant Field Values
LOCAL7
public static final int LOCAL7
- Facility: Reserved for local use
- See Also:
- Constant Field Values
TOTAL_FACILITIES
public static final int TOTAL_FACILITIES
- See Also:
- Constant Field Values
UNKNOWN_PRIORITY
public static final int UNKNOWN_PRIORITY
- To use when we a priority is needed but we have no sensible
priority value.
- See Also:
- Constant Field Values
DEFAULT_PRIORITY
public static final int DEFAULT_PRIORITY
LEVEL_MASK
public static final int LEVEL_MASK
- Mask to extract level part from a priority.
- See Also:
- Constant Field Values
FACILITY_MASK
public static final int FACILITY_MASK
- Mask to extract facility part from a priority (previous to
shift with
FACILITY_SHIFT55 .- See Also:
- Constant Field Values
FACILITY_SHIFT
public static final int FACILITY_SHIFT
- Shift to apply to a priority to get its facility.
- See Also:
- Constant Field Values
levelNames
private static java.lang.String[][] levelNames
- All level names, sorted according theirs level number.
Some levels have more than one name; this is why we have a matrix
instead of a vector.
The first name is the modern one; the rest are deprecated names.
facilityNames
private static java.lang.String[] facilityNames
- All facilities names, sorted according theirs facility number.
Facilities between
FTP55 andLOCAL055 have no name; so this array containsnullat these positions.
name2level
private static java.util.Map name2level
- A table to convert from level name to level value.
It is a mapping from String to Integer.
It is filled with values from
levelNames55 .
name2facility
private static java.util.Map name2facility
- A table to convert from facility name to facility value;
It is a mapping from String to Integer.
It is filled with non null entries of
facilityNames55 .
| Constructor Detail |
PriorityUtils
public PriorityUtils()
| Method Detail |
getFacility
public static int getFacility(int priority)
- Return the facility part of a priority.
getLevel
public static int getLevel(int priority)
- Return the level part of a priority.
buildPriority
public static int buildPriority(int facility,
int level)
- Builds a priority from a facility and a level.
getFacilityName
public static java.lang.String getFacilityName(int facility)
- Return the name of
facilityif it is known;nullotherwise.
getLevelName
public static java.lang.String getLevelName(int level)
- Return the name of
levelif it is known;nullotherwise.
getPriorityName
public static java.lang.String getPriorityName(int priority)
- Return the name of
priorityif both its facility and level are known;nullotherwise.
parseFacility
public static int parseFacility(java.lang.String facility)
- Compares
facilityagainst known facility names and returns it corresponding facility number. Capitalization is irrelevant. Iffacilityis not a know facility name, returns -1.
parseLevel
public static int parseLevel(java.lang.String level)
- Compares
levelagainst known level names and returns it corresponding level number. Capitalization is irrelevant.
parsePriority
public static int parsePriority(java.lang.String priority)
- Tries to build a priority number from its string description at
priority.
|
|||||||||
| Home >> All >> org >> scoja >> [ common overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.scoja.common.PriorityUtils