| java.lang.Object org.apache.derby.iapi.util.IdUtil
IdUtil | abstract public class IdUtil (Code) | | Utility class for parsing and producing string representations of
ids. This class supports both delimited and un-delimited ids.
The syntax for an id follows.
id := delim-id | unDelim-id
delim-id := "[""|[any char but quote]]+"
undelim-id := (a-z|A-Z|anyunicodeletter)[a-z|A-Z|_|0-9|anyunicodeletter|anyunicodedigit]*
In the syntax braces show grouping. '*' means repeat 0 or more times.
'|' means or. '+' means repeat 1 or more times.
In addition this class provides support for qualified names. A qualified name
is a dot (.) separated list of ids.
Limitations:
- Unicode escape sequences in ids are not supported.
- Escape sequences (\n...) are not supported.
|
Method Summary | |
public static String | appendId(String id, String list) Append an id in external form.
the list with the id appended. | public static String | deleteId(String id, String list) Delete an id from a list of ids.
Parameters: id - an id in normal form (quotes removed, upshifted) Parameters: list - a comma separated list of ids in externalform (possibly delmited or not upshifted). | public static String | delimitId(String id) Delimit the identifier provided. | public static String | dups(String[] l) Return an IdList with all the ids that are repeated
in l. | public static String | getUserAuthorizationId(String userName) | public static String | getUserNameFromURLProps(Properties params) Get user name from URL properties. | public static boolean | idOnList(String id, String list) Return true if the id provided is on the list provided. | public static String | intersect(String[] l1, String[] l2) Return an IdList with all the ids that in l1 and l2
or null if not ids are on both lists. | public static String | mkIdList(String[] ids) Produce a string form of an idList from an array of
normalized ids. | public static String | mkQualifiedName(String id1, String id2) Produce a delimited two part qualified name from two
un-delimited identifiers. | public static String | mkQualifiedName(String[] ids) Make a string form of a qualified name from the array of ids provided. | public static String[][] | parseDbClassPath(String input, boolean normalizeToUpper) Scan a database classpath from the string provided. | public static String | parseId(String s) Convert the String provided to an ID. | public static String | parseId(StringReader r, boolean normalize, boolean normalizeToUpper) Read an id from the StringReader provided. | public static String[] | parseIdList(String p) Scan a list of ids from the string provided. | public static String[] | parseQualifiedName(String s, boolean normalizeToUpper) Scan a qualified name from the String provided. | public static String[] | parseQualifiedName(StringReader r, boolean normalizeToUpper) Scan a qualified name from a StringReader. | public static String | pruneDups(String l) |
DBCP_SCHEMA_NAME | final public static int DBCP_SCHEMA_NAME(Code) | | Index of the schema name in a jar name on a db classpath
|
DBCP_SQL_JAR_NAME | final public static int DBCP_SQL_JAR_NAME(Code) | | Index of the sql jar name in a jar name on a db classpath
|
deleteId | public static String deleteId(String id, String list) throws StandardException(Code) | | Delete an id from a list of ids.
Parameters: id - an id in normal form (quotes removed, upshifted) Parameters: list - a comma separated list of ids in externalform (possibly delmited or not upshifted). the list with the id deleted or null if theresulting list has no ids. If 'id' is not on 'list'this returns list unchanged. exception: StandardException - oops. |
delimitId | public static String delimitId(String id)(Code) | | Delimit the identifier provided.
the delimited identifier. |
dups | public static String dups(String[] l)(Code) | | Return an IdList with all the ids that are repeated
in l.
Parameters: l - a list of ids in normal form. |
getUserNameFromURLProps | public static String getUserNameFromURLProps(Properties params)(Code) | | Get user name from URL properties. Handles the case of "" user.
exception: StandardException - on error |
idOnList | public static boolean idOnList(String id, String list) throws StandardException(Code) | | Return true if the id provided is on the list provided.
Parameters: id - an id in normal form Parameters: list - a list of ids in external form. exception: StandardException - oops. |
intersect | public static String intersect(String[] l1, String[] l2)(Code) | | Return an IdList with all the ids that in l1 and l2
or null if not ids are on both lists.
Parameters: l1 - An array of ids in normal form Parameters: l2 - An array of ids in nomral form |
mkIdList | public static String mkIdList(String[] ids)(Code) | | Produce a string form of an idList from an array of
normalized ids.
|
mkQualifiedName | public static String mkQualifiedName(String id1, String id2)(Code) | | Produce a delimited two part qualified name from two
un-delimited identifiers.
the result. |
mkQualifiedName | public static String mkQualifiedName(String[] ids)(Code) | | Make a string form of a qualified name from the array of ids provided.
|
parseDbClassPath | public static String[][] parseDbClassPath(String input, boolean normalizeToUpper) throws StandardException(Code) | | Scan a database classpath from the string provided. This returns
an array with one qualified name per entry on the classpath. The
constants above describe the content of the returned names. This
raises an an exception if the string does not contain a valid database
class path.
classpath := item[:item]*
item := id.id
In the syntax braces ([]) show grouping. '*' means repeat 0 or more times.
The syntax for id is defined in IdUtil.
Classpath returned is a two part name.
If the class path is empty then this returns an array
of zero length.
exception: StandardException - Oops |
parseId | public static String parseId(String s) throws StandardException(Code) | | Convert the String provided to an ID. Throw an exception
iff the string does not contain only a valid external form
for an id. This is a convenience routine that simply
uses getId(StringReader) to do the work.
See the header for getId below for restrictions.
exception: StandardException - Oops |
parseId | public static String parseId(StringReader r, boolean normalize, boolean normalizeToUpper) throws StandardException(Code) | | Read an id from the StringReader provided.
Parameters: normalize - true means return ids in nomral form, false meansreturn them as they were entered.Raise an exception if the first thing in the StringReaderis not a valid id. exception: StandardException - Ooops. |
parseIdList | public static String[] parseIdList(String p) throws StandardException(Code) | | Scan a list of ids from the string provided. This returns
an array with id per entry. This raises an an exception if
the string does not contain a valid list of names.
exception: StandardException - Oops |
parseQualifiedName | public static String[] parseQualifiedName(String s, boolean normalizeToUpper) throws StandardException(Code) | | Scan a qualified name from the String provided. Raise an excepion
if the string does not contain a qualified name.
Parameters: s - The string to be parsed Parameters: normalizeToUpper - If true then undelimited names are converted to upper case (the ANSI standard). If false then undelimited names are converted to lower case (used when the source database is Informix Foundation). An array of strings made by breaking the input string at its dots, '.'. exception: StandardException - Oops |
parseQualifiedName | public static String[] parseQualifiedName(StringReader r, boolean normalizeToUpper) throws StandardException(Code) | | Scan a qualified name from a StringReader. Return an array
of Strings with 1 entry per name scanned. Raise an exception
if the StringReader does not contain a valid qualified name.
Parameters: r - A StringReader for the string to be parsed Parameters: normalizeToUpper - If true then undelimited names are converted to upper case (the ANSI standard). If false then undelimited names are converted to lower case (used when the source database is Informix Foundation). An array of strings made by breaking the input string at its dots, '.'. exception: StandardException - Oops |
|
|