Package ro.sync.util.editorvars
Class EditorVariablesBase
- java.lang.Object
-
- ro.sync.util.editorvars.EditorVariablesBase
-
- All Implemented Interfaces:
EditorVariablesConstants
- Direct Known Subclasses:
EditorVariables
@API(type=NOT_EXTENDABLE, src=PRIVATE) public class EditorVariablesBase extends java.lang.Object implements EditorVariablesConstants
Base for EditorVariables. Needed in the beginning to avoid a class cycle.
-
-
Field Summary
-
Fields inherited from interface ro.sync.util.editorvars.EditorVariablesConstants
ACTIVE_PROFILING_CONDITION_SET, ANCESTOR_FILE_TO_DIFF, ANSWER_PARAM_START, ARCHIVE_FILE_DIRECTORY, ARCHIVE_FILE_DIRECTORY_URL, ARCHIVE_NAME, ARCHIVE_NAME_WITH_EXTENSION, ARCHIVE_PATH, ARCHIVE_PATH_URL, ASK_PARAM_START, ASK_PARAM_VALUE_TEMPLATE, AUTHOR_NAME, BASE_FRAMEWORK_DIRECTORY, BASE_FRAMEWORK_URL, CONFIGURED_DITA_OT_DIR, CONFIGURED_DITA_OT_DIR_URL, CT_CARET_EDITOR_VARIABLE, CT_SELECTION_EDITOR_VARIABLE, CURRENT_FILE, CURRENT_FILE_DIRECTORY, CURRENT_FILE_DIRECTORY_URL, CURRENT_FILE_URL, CURRENT_FILE_URL_OLD, CURRENT_FILENAME, CURRENT_FILENAME_WITH_EXTENSION, DATE_FUNCTION_SAMPLE, DATE_FUNCTION_VARIABLE_PREFIX, DEBUGGER_XML_SOURCE, DEBUGGER_XSL_SOURCE, DETECTED_SCHEMA, DETECTED_SCHEMA_URL, EDITOR_VARIABLES_PREFIX, EDITOR_VARIABLES_SUFIX, ENV_FUNCTION_SAMPLE, ENV_FUNCTION_VARIABLE_PREFIX, ENV_VAR_NAME, FIRST_FILE_TO_DIFF, FO_INPUT_FILE, FOP_AH_TRANSFORMATION_METHOD, FOP_TRANSFORMATION_METHOD, FRAMEWORK_DIR_FUNCTION_TEMPLATE, FRAMEWORK_DIR_FUNCTION_VARIABLE_PREFIX, FRAMEWORK_DIRECTORY, FRAMEWORK_FUNCTION_VARIABLE_PREFIX, FRAMEWORK_URL, FRAMEWORK_URL_FUNCTION_TEMPLATE, FRAMEWORKS_DIRECTORY, FRAMEWORKS_DIRECTORY_URL, FUNCTION_VARIABLE_SUFFIX, ID, MAKE_RELATIVE_FUNCTION_SAMPLE, MAKE_RELATIVE_FUNCTION_VARIABLE_PREFIX, OUTPUT_FILE, OUTPUT_FILE_URL, OXYGEN_HOME_URL, OXYGEN_INSTALL_DIR, PATH_SEPARATOR, PLUGIN_DIR_FUNCTION_TEMPLATE, PLUGIN_DIR_FUNCTION_VARIABLE_PREFIX, PLUGIN_DIR_URL_FUNCTION_VARIABLE_PREFIX, PLUGIN_URL_FUNCTION_TEMPLATE, PROJECT_DIRECTORY, PROJECT_DIRECTORY_URL, PROJECT_NAME, ROOT_MAP_DIR, ROOT_MAP_DIR_URL, ROOT_MAP_FILE, ROOT_MAP_URL, SECOND_FILE_TO_DIFF, SQL, SQL_URL, STATIC_XPATH_FUNCTION_VARIABLE_PREFIX, SYSTEM_FUNCTION_SAMPLE, SYSTEM_FUNCTION_VARIABLE_PREFIX, SYSTEM_VAR_NAME, TIMESTAMP, TRANSFORMATION_SAVED_FILE, TRANSLATE_FUNCTION_VARIABLE_PREFIX, UNIQUE_CARET_MARKER_FOR_AUTHOR, UNIQUE_CARET_MARKER_PI_NAME_FOR_AUTHOR, USER_HOME_DIR, USER_HOME_URL, UUID, XML, XML_CATALOG_FILES_LIST, XML_URL, XPATH_FUNCTION_SAMPLE, XPROC, XPROC_URL, XQUERY, XQUERY_URL, XSL, XSL_URL
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
expandEnvAndSystem(java.lang.String expr)
Expand the environment and system variables.protected static boolean
fastEquals(java.lang.String varName, java.lang.String varPrefix)
Checks if the variable name is the one that appears inside the prefix form.protected static java.lang.String
getName(java.lang.String editorVariable)
Get the name of the given editor variable.protected static void
registerEnvAndSystemResolver(ro.sync.util.editorvars.expander.EditorVariableExpander expander)
Register the resolvers for the environment and system variables.static java.lang.String
replaceFunctions(java.lang.String expr, java.lang.String functionVariablePrefix, java.lang.String functionVariableSuffix, EditorVariables.FunctionResolver keyToValueMap)
Replace all functions with the value taken from the map corresponding to the key
-
-
-
Method Detail
-
expandEnvAndSystem
public static java.lang.String expandEnvAndSystem(java.lang.String expr)
Expand the environment and system variables.- Parameters:
expr
- The expression containing environment and system variables.- Returns:
- The expression with the environment and system variables expanded.
-
registerEnvAndSystemResolver
protected static void registerEnvAndSystemResolver(ro.sync.util.editorvars.expander.EditorVariableExpander expander)
Register the resolvers for the environment and system variables.- Parameters:
expander
- The expander where to register the resolvers.
-
getName
protected static final java.lang.String getName(java.lang.String editorVariable)
Get the name of the given editor variable.
For example, for "${pd}", get "pd."- Parameters:
editorVariable
- The editor variable.- Returns:
- the name.
-
fastEquals
protected static final boolean fastEquals(java.lang.String varName, java.lang.String varPrefix)
Checks if the variable name is the one that appears inside the prefix form. A prefix form is either ${varName} or ${varName(- Parameters:
varName
- Variable name.varPrefix
- ${varName} or ${varName(- Returns:
true
if the variable name is the one present inside the prefix form.
-
replaceFunctions
public static java.lang.String replaceFunctions(java.lang.String expr, java.lang.String functionVariablePrefix, java.lang.String functionVariableSuffix, EditorVariables.FunctionResolver keyToValueMap)
Replace all functions with the value taken from the map corresponding to the key- Parameters:
expr
- The expression to modify.functionVariablePrefix
- Prefix of function signature.functionVariableSuffix
- Suffix of function signature.keyToValueMap
- Map between keys and values.- Returns:
- The processed expression.
-
-