Package com.pathomation
Class PMA
java.lang.Object
com.pathomation.PMA
Helper class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
This method is used to clear the URLs cachestatic String
createPathWithLabel
(String value) This method is used to add the drive name to a path before sending it to pma_java SDK why is this needed?static Document
This method is used to parse a XML contentstatic org.json.JSONArray
getJSONArrayResponse
(String value) This method is used to creates a json Array out of a stringstatic StringBuffer
This method is used to create a StringBuffer from a connection URLstatic org.json.JSONObject
getJSONObjectResponse
(String value) This method is used to create a json Object out of a stringstatic String
This method is used to cache results from requested URLs (GET method)static Boolean
isJSONArray
(String value) This method is used to check if a json returned is an arraystatic Boolean
isJSONObject
(String value) This method is used to check if a json returned is an objectstatic String
This method is used to concatenate a couple of Strings while replacing "\\" by "/"static String
This method is used to encode a String to be compatible as a urlremoveDriveName
(List<String> lst) This method is used to remove the drive name from a path returned by pma_java SDK why is this needed : for PMA.core(.lite) the path sent should include the drive name (if not blank) and the paths returned also include the drive name e.g.static void
setDebugFlag
(Boolean flag) This method is used to determine whether the Java SDK runs in debugging mode or not.static String
This method is used to retrieve HTML Code from URLxmlToStringArray
(Document root, Integer... varargs) This method is used to get a list of the values of "String" tags of a XML documentxmlToStringArray
(Element root, Integer... varargs) This method is an overload of method xmlToStringArray to cope with "root" argument as an "Element" instead of a "Document"
-
Field Details
-
debug
public static boolean debug -
logger
for logging purposes
-
-
Constructor Details
-
PMA
public PMA()
-
-
Method Details
-
join
This method is used to concatenate a couple of Strings while replacing "\\" by "/"- Parameters:
varargs
- Array of String optional arguments, each argument is a string to be concatenated- Returns:
- Concatenation of a couple of String while making sure the first string always ends with "/"
-
pmaQ
This method is used to encode a String to be compatible as a url- Parameters:
arg
- string to be encoded- Returns:
- Encoded String to be compatible as a url
-
httpGet
This method is used to cache results from requested URLs (GET method)- Parameters:
url
- URL to requestproperty
- Header value- Returns:
- Data returned following a request to a specific URL
-
clearURLCache
public static void clearURLCache()This method is used to clear the URLs cache -
setDebugFlag
This method is used to determine whether the Java SDK runs in debugging mode or not. When in debugging mode (flag = true), extra output is produced when certain conditions in the code are not met- Parameters:
flag
- Debugging mode (activated or deactivated)
-
urlReader
This method is used to retrieve HTML Code from URL- Parameters:
url
- to get HTML code from- Returns:
- HTML code generated from the url argument
-
domParser
This method is used to parse a XML content- Parameters:
s
- XML content to parse- Returns:
- Document parsed XML
-
xmlToStringArray
This method is used to get a list of the values of "String" tags of a XML document- Parameters:
root
- XML documentvarargs
- Array of optional argumentslimit : First optional argument(int), default value(0), defines a limit
- Returns:
- Values' list of tags named "string" in a XML document
-
xmlToStringArray
This method is an overload of method xmlToStringArray to cope with "root" argument as an "Element" instead of a "Document"- Parameters:
root
- XML documentvarargs
- Array of optional argumentslimit : First optional argument(int), default value(0), defines a limit
- Returns:
- Values' list of tags named "string" in a XML document
-
getJSONAsStringBuffer
This method is used to create a StringBuffer from a connection URL- Parameters:
con
- http connection URL to retrieve JSON from- Returns:
- string buffer created from the connection URL
-
isJSONObject
This method is used to check if a json returned is an object- Parameters:
value
- json in String format- Returns:
- True if it's a JSONObject, false otherwise
-
isJSONArray
This method is used to check if a json returned is an array- Parameters:
value
- json in String format- Returns:
- True if it's a JSONObject, false otherwise
-
getJSONObjectResponse
This method is used to create a json Object out of a string- Parameters:
value
- json in String format- Returns:
- Creates a Json object from a string
-
getJSONArrayResponse
This method is used to creates a json Array out of a string- Parameters:
value
- json in String format- Returns:
- Creates a Json array from a string
-
removeDriveName
This method is used to remove the drive name from a path returned by pma_java SDK why is this needed : for PMA.core(.lite) the path sent should include the drive name (if not blank) and the paths returned also include the drive name e.g. "Primary Disk (C:)/samples" it's necessary to remove drive name from the path's root to be able to use these paths in file system- Parameters:
lst
- List of paths (directories, root directories, slides...)- Returns:
- List of paths formatted to remove the Disk label if it exists
-
createPathWithLabel
This method is used to add the drive name to a path before sending it to pma_java SDK why is this needed? : for PMA.core(.lite) the path sent should include the drive name (if not blank) and the paths returned also include the drive name e.g. "Primary Disk (C:)/samples" it's necessary to add drive name to the path's root to be able to make a valid request to PMA.core(.lite)- Parameters:
value
- path to be formatted- Returns:
- Path formatted to include the Disk label if it doesn't exist
-