Package org.apache.wsil.util
Class Util
- java.lang.Object
-
- org.apache.wsil.util.Util
-
public final class Util extends java.lang.Object
This class will ...- Version:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LINE_SEPARATOR
Line separator character.protected static java.lang.String
sClassName
Class name.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
createHttpsURL(java.lang.String url)
Create an HTTPS URL.static java.net.URL
createURL(java.lang.String urlString)
Creates a URL object.static void
debug(java.lang.String className, java.lang.String methodName, java.lang.Exception e)
This method prints a formatted message using System.out.prinln.static void
debug(java.lang.String className, java.lang.String methodName, java.lang.String msg)
This method prints a formatted message using System.out.prinln.static java.lang.ThreadGroup
findThreadGroup(java.lang.String sName)
Local a thread group using its name.static java.lang.String
formatURL(java.lang.String hostname, java.lang.String port, java.lang.String urn)
Build a URL string from hostname, port and URN.static java.lang.String
getDateTimeStamp()
Get date/time stamp for current date/time.static java.lang.String
getDateTimeStamp(java.util.Date date)
Get date/time stamp for current date/time.static java.io.InputStream
getInputStream(java.lang.String sResourceName)
Get contents of a resource and return as a input stream.static java.io.InputStream
getInputStream(java.net.URL urlFile)
Get the input stream from a URL.static java.lang.String
getLocalHostName()
Get local host name.static void
out(java.lang.String className, java.lang.String methodName, java.lang.Exception e)
This method prints a formatted message using System.out.prinln.static void
out(java.lang.String className, java.lang.String methodName, java.lang.String msg)
This method prints a formatted message using System.out.prinln.static java.lang.String
replaceString(java.lang.String sText, java.lang.String sFind, java.lang.String sReplace)
This method will replace all of the occurances of a string with a substitution string.static java.lang.String[]
toStringArray(java.lang.String s)
Convert a string into a string array.static java.lang.String[]
toStringArray(java.lang.String s, java.lang.String sDelim)
Convert a string into a string array.static java.lang.String
toXMLString(java.util.Collection collection)
Get XML string representation for WSIL element.
-
-
-
Method Detail
-
findThreadGroup
public static java.lang.ThreadGroup findThreadGroup(java.lang.String sName)
Local a thread group using its name.- Parameters:
sName
- thread group name- Returns:
- Returns thread group.
-
out
public static void out(java.lang.String className, java.lang.String methodName, java.lang.Exception e)
This method prints a formatted message using System.out.prinln.- Parameters:
className
- class name which originated messagemethodName
- method name which originated messagee
- exception
-
out
public static void out(java.lang.String className, java.lang.String methodName, java.lang.String msg)
This method prints a formatted message using System.out.prinln.- Parameters:
className
- class name which originated messagemethodName
- method name which originated messagemsg
- message text
-
debug
public static void debug(java.lang.String className, java.lang.String methodName, java.lang.Exception e)
This method prints a formatted message using System.out.prinln.- Parameters:
className
- class name which originated messagemethodName
- method name which originated messagee
- exception
-
debug
public static void debug(java.lang.String className, java.lang.String methodName, java.lang.String msg)
This method prints a formatted message using System.out.prinln.- Parameters:
className
- class name which originated messagemethodName
- method name which originated messagemsg
- message text
-
getDateTimeStamp
public static java.lang.String getDateTimeStamp()
Get date/time stamp for current date/time.- Parameters:
sName
- thread group name
-
getDateTimeStamp
public static java.lang.String getDateTimeStamp(java.util.Date date)
Get date/time stamp for current date/time.- Parameters:
sName
- thread group name
-
getInputStream
public static java.io.InputStream getInputStream(java.lang.String sResourceName) throws java.io.IOException
Get contents of a resource and return as a input stream.- Parameters:
sResourceName
- the name of the resource to get and return as an input stream- Throws:
java.io.IOException
-
getInputStream
public static java.io.InputStream getInputStream(java.net.URL urlFile) throws java.io.IOException, java.net.ConnectException
Get the input stream from a URL.- Parameters:
url
- the URL to get the input stream from- Throws:
java.io.IOException
java.net.ConnectException
-
getLocalHostName
public static java.lang.String getLocalHostName()
Get local host name.
-
formatURL
public static java.lang.String formatURL(java.lang.String hostname, java.lang.String port, java.lang.String urn)
Build a URL string from hostname, port and URN.- Parameters:
hostname
- the hostnameport
- the porturn
- the URN- Returns:
- Returns formatted URL string.
-
replaceString
public static java.lang.String replaceString(java.lang.String sText, java.lang.String sFind, java.lang.String sReplace)
This method will replace all of the occurances of a string with a substitution string.- Parameters:
sText
- String to udpate.sFind
- String to find.sReplace
- String to use for substitution.- Returns:
- Returns updated string.
-
toStringArray
public static java.lang.String[] toStringArray(java.lang.String s)
Convert a string into a string array.- Parameters:
s
- string to convert to a string array
-
toStringArray
public static java.lang.String[] toStringArray(java.lang.String s, java.lang.String sDelim)
Convert a string into a string array.- Parameters:
s
- string to convert to a string array
-
createURL
public static java.net.URL createURL(java.lang.String urlString) throws java.net.MalformedURLException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
Creates a URL object. If the URL uses the https protocol, then the correct URLStreamHandler is associated with the URL object.- Parameters:
urlString
- URL string to format into a URL object- Returns:
- Returns a URL object. A null value is returned if the input URL string is null.
- Throws:
java.net.MalformedURLException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
-
createHttpsURL
public static java.lang.String createHttpsURL(java.lang.String url)
Create an HTTPS URL.
-
toXMLString
public static java.lang.String toXMLString(java.util.Collection collection)
Get XML string representation for WSIL element.
-
-