Package edu.isi.pegasus.common.util
Class Separator
- java.lang.Object
-
- edu.isi.pegasus.common.util.Separator
-
public class Separator extends java.lang.ObjectThis class solely defines the separators used in the textual in- and output between namespace, name and version(s). A textual representation of a definition looks like ns::name:version, and a textual representation of a uses like ns::name:min,max.- Version:
- $Revision$
- Author:
- Jens-S. Vöckler, Yong Zhao
- See Also:
Definition
-
-
Field Summary
Fields Modifier and Type Field Description private static int[][]actionmapMaps the action associated with a state and a character class.private static short[][]actionmap2Maps the action associated with a state and char class.static java.lang.StringDEFAULTDeprecated.The default namespace isnull.static java.lang.StringNAMEThis constant defines the separator between an identifier and its version.static java.lang.StringNAMESPACEThis constant defines the separator between a namespace and the identifier.private static short[][]statemapMaps the state and character class to the follow-up state.private static short[][]statemap2Maps the new state from current state and character class.static java.lang.StringVERSIONThis constant defines the separator that denotes a version range.
-
Constructor Summary
Constructors Constructor Description Separator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringcombine(java.lang.String namespace, java.lang.String name, java.lang.String version)Combines the three components that constitute a fully-qualified definition identifier into a single string.static java.lang.Stringcombine(java.lang.String namespace, java.lang.String name, java.lang.String min, java.lang.String max)Combines the four components that reference a fully-qualified definition identifier into a single string.static java.lang.String[]split(java.lang.String fqdn)Splits a fully-qualified identifier into its components.static java.lang.String[]splitFQDI(java.lang.String fqdi)Splits a fully-qualified definition identifier into separate namespace, name and version.
-
-
-
Field Detail
-
NAMESPACE
public static final java.lang.String NAMESPACE
This constant defines the separator between a namespace and the identifier.- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME
This constant defines the separator between an identifier and its version.- See Also:
- Constant Field Values
-
VERSION
public static final java.lang.String VERSION
This constant defines the separator that denotes a version range. Version ranges are only used with the "uses" clause, which maps from a derivation to a transformation.- See Also:
- Constant Field Values
-
DEFAULT
public static final java.lang.String DEFAULT
Deprecated.The default namespace isnull.Although not truly a separator, this is the name of the default namespace, which is used in the absence of a namespace.- See Also:
- Constant Field Values
-
actionmap2
private static short[][] actionmap2
Maps the action associated with a state and char class. The following actions were determined:0 no operation 1 save character 2 empty save into ns 3 empty save into id 4 empty save into vs 5 empty save into id, save
-
statemap2
private static short[][] statemap2
Maps the new state from current state and character class. The following character classes are distinguished:0 EOS 1 colon (:) 2 other (*)
-
actionmap
private static int[][] actionmap
Maps the action associated with a state and a character class. The actions are as follows:0 no operation 1 save character 2 empty save into ns 3 empty save into name 4 empty save into vs 5 empty save into vs, 4args 6 empty save into max 7 empty save into max, 4args 8 empty save into name, save
-
statemap
private static short[][] statemap
Maps the state and character class to the follow-up state. The final state 16 is a regular final state, and final state 17 is the error final state. All other states are intermediary states.Four character classes are distinguished:
0 end of string (EOS) 1 colon (:) 2 comma (,) 3 any other
-
-
Method Detail
-
combine
public static java.lang.String combine(java.lang.String namespace, java.lang.String name, java.lang.String version)Combines the three components that constitute a fully-qualified definition identifier into a single string.- Parameters:
namespace- is the namespace, may be empty or null.name- is the name to use, must not be empty nor null.version- is the version to attach, may be empty or null.- Returns:
- the combination of namespace, name and version with separators.
- Throws:
java.lang.NullPointerException- will be thrown on an empty or null name, as no such identifier can be constructed.
-
combine
public static java.lang.String combine(java.lang.String namespace, java.lang.String name, java.lang.String min, java.lang.String max)Combines the four components that reference a fully-qualified definition identifier into a single string.- Parameters:
namespace- is the namespace, may be empty or null.name- is the name to use, must not be empty nor null.min- is the lower version to attach, may be empty or null.max- is the upper version to attach, may be empty or null.- Returns:
- the combination of namespace, name and versions with appropriate separators.
- Throws:
java.lang.NullPointerException- will be thrown on an empty or null name, as no such identifier can be constructed.
-
splitFQDI
public static java.lang.String[] splitFQDI(java.lang.String fqdi) throws java.lang.IllegalArgumentExceptionSplits a fully-qualified definition identifier into separate namespace, name and version. Certain extensions permit a spec to distinguish between an empty namespace or version and a null (wildcard match) namespace and version.There is a subtle distinction between a null value and an empty value for the namespace and version. A null value is usually taken as a wildcard match. An empty string however is an exact match of a definition without the namespace or version.
In order to enable the DAX generation function to distinguish these cases when specifying user input, the following convention is supported, where * stands in for wild-card matches, and (-) for a match of an empty element:
INPUT NS ID VS id * id * ::id (-) id * ::id: (-) id (-) id: * id (-) id:vs * id vs n::id n id * n::id: n id (-) n::i:v n i v ::i:v (-) i v - Parameters:
fqdi- is the fully-qualified definition identifier.- Returns:
- an array with 3 entries representing namespace, name and version. Namespace and version may be empty or even null.
- Throws:
java.lang.IllegalArgumentException
-
split
public static java.lang.String[] split(java.lang.String fqdn) throws java.lang.IllegalArgumentExceptionSplits a fully-qualified identifier into its components. Please note that you must check the length of the result. If it contains three elements, it is a regular FQDN. If it contains four results, it is a tranformation reference range. Note though, if the version portion is not specified, a 3 argument string will always be returned, even if the context requires a 4 argument string.- Parameters:
fqdn- is the string to split into components.- Returns:
- a vector with three or four Strings, if it was parsable.
- namespace, may be null
- name, never null
- version for 3arg, or minimum version for 4arg, may be null
- maximum version for 4arg, may be null
- Throws:
java.lang.IllegalArgumentException
-
-