public class Utility
extends java.lang.Object
Constructor and Description |
---|
Utility() |
Modifier and Type | Method and Description |
---|---|
static int |
countSubstringInstances(java.lang.String haystack,
java.lang.String needle)
Get the number of times that a substring occurs in a String
|
static java.lang.String |
getAbsolutePath(java.lang.String filePath)
Method to convert the file path to absolute, if relative
|
static java.lang.String |
getDateTime()
Get the current date time.
|
static java.lang.String |
getDirPath(java.lang.String pathname)
Remove the filename/expression from the pathname and return base path
|
static java.lang.String |
getFileDate() |
static java.lang.String |
getHomeDirectory() |
static boolean |
getNodePropsBool(java.util.Properties nodeProps,
java.lang.String key)
Utility method to get a boolean from a
Properties . |
static java.lang.String |
getNodePropsString(java.util.Properties nodeProps,
java.lang.String key,
boolean needed)
Utility method to get a String from a
Properties . |
static java.util.List<java.lang.String> |
getValuesFromXML(java.io.File file,
java.lang.String tagName,
java.lang.String attributeName)
Utility method to extract values from an XML file.
|
static boolean |
isReportTime()
Determine if the current day is during the portion of the month when
reports are generated.
|
static java.io.File |
replaceStringInFile(java.lang.String oldStr,
java.lang.String newStr,
java.io.File in,
java.io.File out) |
public static java.lang.String getDateTime()
public static java.lang.String getFileDate()
public static java.lang.String getHomeDirectory()
public static java.lang.String getAbsolutePath(java.lang.String filePath)
filePath
- Current path given through the command-linepublic static java.io.File replaceStringInFile(java.lang.String oldStr, java.lang.String newStr, java.io.File in, java.io.File out) throws java.io.IOException
java.io.IOException
public static java.util.List<java.lang.String> getValuesFromXML(java.io.File file, java.lang.String tagName, java.lang.String attributeName) throws java.lang.Exception
file
- tagName
- name of the tag we are looking forattributeName
- if applicable, else set to nulljavax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
java.lang.Exception
public static java.lang.String getNodePropsString(java.util.Properties nodeProps, java.lang.String key, boolean needed) throws ReportManagerException
Properties
.nodeProps
- The Properties containing the desired valuekey
- The key of the desired valueneeded
- Whether the value must be presentLogsManagerException
- If needed is true and the given key is not present or if the value is null or emptyReportManagerException
public static boolean getNodePropsBool(java.util.Properties nodeProps, java.lang.String key) throws ReportManagerException
Properties
.nodeProps
- The Properties containing the desired
valuekey
- The key of the desired valueReportManagerException
- If the given key is not present or if
the value is null or emptypublic static java.lang.String getDirPath(java.lang.String pathname)
pathname
- public static int countSubstringInstances(java.lang.String haystack, java.lang.String needle)
haystack
- The string to search throughneedle
- The substring to for which we searchpublic static boolean isReportTime()
Copyright © 2010-2018 Planetary Data System. All Rights Reserved.