public class LeoUtils extends Object
Constructor and Description |
---|
LeoUtils() |
Modifier and Type | Method and Description |
---|---|
static org.apache.uima.resource.Parameter[] |
addParameter(org.apache.uima.resource.Parameter p,
org.apache.uima.resource.Parameter[] parameters)
Add the parameter p to the array of parameters.
|
static URL |
createURL(String name)
Computes the absolute URL for this import, using the relative location or name, whichever is specified by this import object.
|
static String |
extractPearFile(File installDir,
File pearFile,
boolean doVerification,
boolean cleanInstallDir)
Extracts the contents of a PEAR file to the directory specified, optionally performs a verification
step.
|
static String |
filterText(String input,
List<TextFilter> filters)
Return a String that has applied the list of filters to the input string.
|
static String |
getFileURI(File f)
Return a URI string locator for the File object provided.
|
static String |
getHeaderManipulationSafeString(Object object)
returns a Header-Manipulation safe string using a "WhiteList" approach.
|
static org.apache.uima.resource.Parameter |
getParameter(String name,
org.apache.uima.resource.Parameter[] parameters)
Return the Parameter in the array whose name matches the name provided.
|
static Class<?> |
getRuntimeClass()
Determines the currently executing runtime class.
|
static Set<org.apache.uima.resource.metadata.ConfigurationParameter> |
getStaticConfigurationParameters(Class c)
Create the set of ConfigurationParameter objects from the Param class of an object.
|
static String |
getTimestampDateDotTime()
Return a timestamp in the format of yyyyMMdd.HHmmss.
|
static String |
getTimestampDateUnderscoreTime()
Return a timestamp in the format of yyyyMMdd_HHmmss.
|
static String |
getUUID()
Generate a random UUID string.
|
static List<File> |
listFiles(File src,
FileFilter filter,
boolean recurse)
Return a list of File Objects in a directory.
|
static groovy.util.ConfigObject |
loadConfigFile(String environment,
String... configFilePaths)
Load the config file(s).
|
static Map<String,String> |
parseMappingString(String jsonString)
Convert the JSON formatted string into a Map of Strings.
|
public static String getTimestampDateDotTime()
public static String getTimestampDateUnderscoreTime()
public static String getUUID()
public static URL createURL(String name) throws org.apache.uima.util.InvalidXMLException
name
- the name of this import's target.org.apache.uima.util.InvalidXMLException
- if the import could not be resolvedpublic static String getFileURI(File f)
f
- the file to get URI for.public static List<File> listFiles(File src, FileFilter filter, boolean recurse)
src
- Source directory where the search will be performed.filter
- Optional, File filter to limit results that are returned.recurse
- If true then recurse into subdirectories, only return this directory results if falsepublic static String extractPearFile(File installDir, File pearFile, boolean doVerification, boolean cleanInstallDir) throws org.apache.uima.pear.tools.PackageInstallerException, IOException
installDir
- Directory where the pear file will be extracted.pearFile
- Pear file to extractdoVerification
- If true then the PackageInstaller will perform an optional validation stepcleanInstallDir
- Clean out the installation directory before extractingorg.apache.uima.pear.tools.PackageInstallerException
- If there is an error extracting the PEAR fileIOException
- If there is an error retrieving the path toe hte root component descriptor filepublic static Class<?> getRuntimeClass()
public static groovy.util.ConfigObject loadConfigFile(String environment, String... configFilePaths) throws IOException
environment
- name of the environment to loadconfigFilePaths
- paths the config files to load, local or remoteIOException
- if there is a problem reading the config filespublic static String filterText(String input, List<TextFilter> filters) throws IOException
input
- Text to be filtered if there are filters definedfilters
- List of text filters to apply to the input textIOException
- if there is an error getting the bytes from the filtered textpublic static Set<org.apache.uima.resource.metadata.ConfigurationParameter> getStaticConfigurationParameters(Class c)
c
- Param classpublic static org.apache.uima.resource.Parameter getParameter(String name, org.apache.uima.resource.Parameter[] parameters)
name
- Name of the parameter to findparameters
- Array of parameters to searchpublic static org.apache.uima.resource.Parameter[] addParameter(org.apache.uima.resource.Parameter p, org.apache.uima.resource.Parameter[] parameters)
p
- Parameter to addparameters
- Array of parameters to which the parameter will be addedpublic static Map<String,String> parseMappingString(String jsonString) throws com.google.gson.JsonSyntaxException
jsonString
- JSON formatted validation string mapcom.google.gson.JsonSyntaxException
- if the JSON string is invalidpublic static String getHeaderManipulationSafeString(Object object)
value
- the String value to be made Header-Manipulation safeCopyright © 2018 Department of Veterans Affairs. All Rights Reserved.