Namespace: OpenEdge.Logging
Class
TokenResolver
Parent classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object

/* *************************************************************************************************************************
Copyright (c) 2016-2017 by Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
File:TokenResolver
Purpose:Resolves certain known token names into useful values
Author(s):pjudge
Created:Wed Nov 16 13:02:52 EST 2016
Notes:* Token substitutions are allowed for file names
the token format is ${<token>}, where
token = group "." arg
groups = session | env | guid | t[ime] | web | ver[sion]
cp | req[uest] | name
If a token cannot be resovled, or resolves to a value of
? (unknown) then the token name is used.
- any readable attribute on the session handle may be used
- any env var available via OE-GETENV() may be used
- Correlates to the SESSION:LOCAL-VERSION-INFO
- MAJOR, MINOR, MAINT
- a default-format GUID is used
- Values are taken from the time at which the file name is being built.
- The args are based on http://en.cppreference.com/w/c/chrono/strftime
TODAY: An ISO-DATE formated DATE value is used
NOW:An ISO-DATE formated datetime-tz value is used
YYYY:The current year, incl century
YY:The current year, sans century
BB:The full month name (from the MONTH_LONG property)
B:The shortened month name (from the MONTH_SHORT property)
MM:The integer month value, with leading 0 if needed
M:The integer month value with no leading 0
DD:The integer day value, with leading 0 if needed
D:The integer month value, with no leading 0
HH:The hour value, in 24-hour clock format (ie 18 for 6pm)
H:The hour value, in 12-hour clock format (ie 6 for 6pm)
MMM:The minute value, with leading 0
SS:The second value, with leading 0
SSS:The millisecond value, with leading 0
Z:The timezone (based on the current session), with leading +/-
PP:The AM/PM indicator, as AM or PM
P:The AM/PM indicator, as A or P
AA:The full day of the week, from the WEEKDAY_LONG property
A:The short day of the week, from the WEEKDAY_SHORT property
W:The integer day of the week
Will return ? if we're not in a request (ie startup event procs). Values
are taken from the session:current-request-info
TPT:The adapter type (transport) for this request
CCID:The client context id
ID:The current request id
SESSION:The current session id
THREAD:(PASOE) the current thread id
WEBAPP
SVC
any other cgi value
credential-arg "." db-name
credential-arg
The current user will be used (from the request info or the security-policy)
UID:The current user id
QUID:The qualified user id (user@domain)
DOMAIN:The domain name of the current user
db-name
An optional logical db name from which to extract the CP. If none is set, use the security-policy
tokenArg = format-expression "." logger-name
- logger-name : a named-hierarchy dotted-name
- named-hierarchy
something like OpenEdge.Net.DataObject.DataObjectHandler (a logger name) will become
O.N.D.DataObjectHandler (default or .1K)
o.n.d.DataObjectHandler (.1L)
OE.N.DO.DataObjectHandler (.1C)
OE.N.DO.DOH (.0C)
- format-expression
keep-expr case-expr
keep-expr:
number of significant entries to keep (from right)
0:All entries will be trimmed (ie zero kept)
1:Only the last/only will be keep whole (default)
2..n: The number of entries (from the right) to keep
case-expr
U:trimmed elements are upper-cased
L:trimmed elements are lower-cased
K:trimmed elements are left alone (default)
C:trimmed elements are Camel-cased (caps only written)




Method Summary
Options Name Purpose
CHARACTER Resolve (character) /* Resolves any tokens in the file name into appropriate values @param character The source string @return character The resolved string */
CHARACTER ResolveName (character, character) /* Resolves a NAME-based token arg, based on the type/logger name given @param character The token argument for ${NAME.*} tokens @param character The (type) name to resolve @return character The resolved string */
CHARACTER ResolveTime (character, character[12], character[12], character[7], character[7], datetime-tz) /* Resolves a time-based token arg, based on the timestamp given @param character The token argument for ${T.*} tokens @param character[12] The long-form month names (ie January) @param character[12] The short-form month names (ie Jan) @param character[7] The long-form weekday names (ie Thursday) @param character[7] The short-form weekday names (ie Thurs) @param datetime-tz The timestamp to use to resolve the token @return character The resolved string */
CHARACTER ResolveTime (character, datetime-tz) /* Resolves a time-based token arg, based on the timestamp given @param character The token argument for ${T.*} tokens @param datetime-tz The timestamp to use to resolve the token @return character The resolved string */
CHARACTER ResolveUser (character, handle) /* Resolves a CP-based token arg, based on the client-principal. It is the CALLER's responsibility to clean up the C-P object represented by this handle @param character The token argument for ${CP.*} tokens @param handle A user represented by a client-principal @return character The resolved string */

Event Summary
Options Name Purpose
TokenResolved (Object, TokenResolverEventArgs) /* Event published after a token is resolved by this resolver. Allows a listener to override the value */

Property Summary
Options Name Purpose
CHARACTER MONTH_LONG
CHARACTER MONTH_SHORT
CHARACTER WEEKDAY_LONG
CHARACTER WEEKDAY_SHORT


Method Detail
Top

CHARACTER Resolve (character)

/* Resolves any tokens in the file name into appropriate values
Parameters:
pcBaseString CHARACTER
Returns CHARACTER
character The resolved string
Top

CHARACTER ResolveName (character, character)

/* Resolves a NAME-based token arg, based on the type/logger name given
Parameters:
pTokenArg CHARACTER
pName CHARACTER
Returns CHARACTER
character The resolved string
Top

CHARACTER ResolveTime (character, character[12], character[12], character[7], character[7], datetime-tz)

/* Resolves a time-based token arg, based on the timestamp given
Parameters:
pTokenArg CHARACTER
pMonthLong CHARACTER
pMonthShort CHARACTER
pWeekdayLong CHARACTER
pWeekdayShort CHARACTER
pTimestamp DATETIME-TZ
Returns CHARACTER
character The resolved string
Top

CHARACTER ResolveTime (character, datetime-tz)

/* Resolves a time-based token arg, based on the timestamp given
Parameters:
pTokenArg CHARACTER
pTimestamp DATETIME-TZ
Returns CHARACTER
character The resolved string
Top

CHARACTER ResolveUser (character, handle)

/* Resolves a CP-based token arg, based on the client-principal.
It is the CALLER's responsibility to clean up the C-P object represented by this handle
Parameters:
pTokenArg CHARACTER
pUser HANDLE
Returns CHARACTER
character The resolved string


Event Detail
Top

TokenResolved (Object, TokenResolverEventArgs)

/* Event published after a token is resolved by this resolver. Allows a listener to override the value
Parameters:
pSender Progress.Lang.Object
pArgs OpenEdge.Logging.TokenResolverEventArgs


Property Detail
Top

CHARACTER MONTH_LONG

Returns CHARACTER
Top

CHARACTER MONTH_SHORT

Returns CHARACTER
Top

CHARACTER WEEKDAY_LONG

Returns CHARACTER
Top

CHARACTER WEEKDAY_SHORT

Returns CHARACTER


Copyright © 2017 Progress Software Corporation. All rights Reserved.

Progress® OpenEdge® Release 11.7