public class Utility extends Object
Modifier and Type | Field and Description |
---|---|
static String |
JDBC_CONFIG |
static String |
JDBC_PERFORMANCE |
static String |
logname |
static String |
PropertyFilePath |
static String |
SECONDARY_POSTIFX |
Constructor and Description |
---|
Utility() |
Modifier and Type | Method and Description |
---|---|
static void |
addStatusChangeSLA(org.miloss.fgsms.services.interfaces.policyconfiguration.ServicePolicy ret)
Addings the default Status Change SLA for email alerts
|
static boolean |
containsPolicyType(List<org.miloss.fgsms.services.interfaces.common.PolicyType> appliesTo,
org.miloss.fgsms.services.interfaces.common.PolicyType optionalPolicyTypeFilter)
convenience method, does the list contain the policy type
|
static String |
DE(String cipher)
Decrypts a password or other sensitive data.
|
static String |
durationLargestUnitToString(Duration d)
returns just the largest unit of measure for durations up to years
|
static String |
durationToString(Duration d)
Converts a duration to 1yr 1mo 1d 1hr 1min 1s string format
|
static long |
durationToTimeInMS(Duration d)
converts a duration to time in ms
|
static String |
EN(String clear)
encrypts a password AES 256 bit Requires the Unlimited Strength Crypto
Extensions
|
static String |
encodeHTML(String s)
HTML encodes strings to prevent CXS, if the parameter is an null or
empty, an empty string is returned, but never null
|
static String |
formatDateTime(Calendar cal) |
static String |
formatDateTime(Date cal) |
static String |
formatDateTime(long timestampEpoch) |
static String |
getActionNameFromXML(String xml)
uses a variety of classes to determine the name of the first XML child
node of a SOAP:envelope node
|
static List<org.miloss.fgsms.services.interfaces.common.PolicyType> |
getAllPolicyTypes() |
static JAXBContext |
getARSSerializationContext()
used by the Automated Reporting Service, creates a jaxb context to
serialize/deserial a reporting job
|
static Connection |
getConfigurationDB_NONPOOLED_Connection()
Deprecated.
|
static Connection |
getConfigurationDBConnection()
returns a JDNI pooled database connection if the primary cannot be
reached, the secondary is used or null is returned.
|
static String |
getHostName()
returns the lowercase hostname
|
static org.miloss.fgsms.services.interfaces.common.NameValuePair |
getNameValuePairByName(List<org.miloss.fgsms.services.interfaces.common.NameValuePair> set,
String name)
returns a live copy of the select nvp if it exists, or null
|
static Connection |
getPerformanceDB_NONPOOLED_Connection()
Deprecated.
|
static Connection |
getPerformanceDBConnection()
returns a JDNI pooled database connection if the primary cannot be
reached, the secondary is used or null is returned.
|
static JAXBContext |
getSerializationContext()
Gets a JAXBContext object which is used to create a
serializer/deserializer.
|
static boolean |
hasEmailSLA(org.miloss.fgsms.services.interfaces.policyconfiguration.ArrayOfSLAActionBaseType pc)
does this action list contain an email SLA
|
static boolean |
hasEmailSLA(org.miloss.fgsms.services.interfaces.policyconfiguration.ServicePolicy pc)
does this policy have an email sla action?
|
static String |
ICMClassificationToColorCodeString(us.gov.ic.ism.v2.ClassificationType type)
ICISM to color codes
|
static String |
ICMClassificationToString(us.gov.ic.ism.v2.ClassificationType type)
pretty print for ICISM class levels
|
static String |
listStringtoString(List<String> data)
converts a list of string to a single string whitespace, null and empty
strings are ignored
|
static org.miloss.fgsms.services.interfaces.policyconfiguration.SLAAction |
newEmailAction(String from,
String subject,
String body)
creates a new send an email sla action
|
static org.miloss.fgsms.services.interfaces.policyconfiguration.KeyNameValue |
newKeyNameValue(String key,
String name,
String value)
convenience wrapper
|
static org.miloss.fgsms.services.interfaces.policyconfiguration.KeyNameValueEnc |
newKeyNameValueEnc(org.miloss.fgsms.services.interfaces.policyconfiguration.KeyNameValue value,
boolean shouldEncrypt)
convenience wrapper
|
static org.miloss.fgsms.services.interfaces.common.NameValuePair |
newNameValuePair(String name,
String val,
boolean encrypted,
boolean encryptOnSave)
convenience method for NVP
|
static org.miloss.fgsms.services.interfaces.policyconfiguration.Plugin |
newPlugin(String classname,
String displayname,
String appliesto)
a convenience wrapper to create a new plugin instance
|
static Calendar |
parseDateTime(String s)
Parses the date/time stamp from a given input parameter using one of the
following formats
mm/dd/yyyy mm/dd/yyyy hh:mm:ss EEE MMM dd HH:mm:ss zzz yyyy - this is the standard output from the unix date command EEE mm/dd/yyyy HH:mm:ss.ms - this is the standard output from the windows command echo %date% %time% yyyy-MM-ddThh:mm:ss.zzzzzzz Epoch time (ms) PnYnMnDTnHnMnS - XML lexical representation |
static boolean |
stringIsNullOrEmpty(String s)
string is null or empty
|
static String |
truncate(String x,
int length)
String Truncator if a null or empty string is passed, an empty string is
returned
|
static void |
validateClassification(org.miloss.fgsms.services.interfaces.common.SecurityWrapper w)
throws an illegal argument exception if the object is null or not
specified, caveats is options
|
public static final String logname
public static final String JDBC_PERFORMANCE
public static final String JDBC_CONFIG
public static final String SECONDARY_POSTIFX
public static final String PropertyFilePath
public static String formatDateTime(long timestampEpoch)
public static Calendar parseDateTime(String s) throws Exception
s
- the input stringException
- if the date cannot be parsedpublic static void addStatusChangeSLA(org.miloss.fgsms.services.interfaces.policyconfiguration.ServicePolicy ret)
ret
- public static JAXBContext getARSSerializationContext() throws JAXBException
JAXBException
public static JAXBContext getSerializationContext() throws JAXBException
JAXBException
public static void validateClassification(org.miloss.fgsms.services.interfaces.common.SecurityWrapper w)
w
- public static String getHostName()
public static boolean hasEmailSLA(org.miloss.fgsms.services.interfaces.policyconfiguration.ServicePolicy pc)
pc
- public static boolean hasEmailSLA(org.miloss.fgsms.services.interfaces.policyconfiguration.ArrayOfSLAActionBaseType pc)
pc
- public static String EN(String clear)
clear
- public static String DE(String cipher)
cipher
- public static String durationToString(Duration d)
d
- public static String durationLargestUnitToString(Duration d)
d
- public static String ICMClassificationToString(us.gov.ic.ism.v2.ClassificationType type)
type
- public static String ICMClassificationToColorCodeString(us.gov.ic.ism.v2.ClassificationType type)
type
- public static String listStringtoString(List<String> data)
public static String getActionNameFromXML(String xml)
xml
- public static String encodeHTML(String s)
s
- public static boolean stringIsNullOrEmpty(String s)
s
- public static long durationToTimeInMS(Duration d)
d
- public static String truncate(String x, int length)
x
- length
- @Deprecated public static Connection getPerformanceDB_NONPOOLED_Connection()
@Deprecated public static Connection getConfigurationDB_NONPOOLED_Connection()
public static Connection getPerformanceDBConnection()
public static Connection getConfigurationDBConnection()
public static org.miloss.fgsms.services.interfaces.common.NameValuePair newNameValuePair(String name, String val, boolean encrypted, boolean encryptOnSave)
name
- val
- encrypted
- encryptOnSave
- public static org.miloss.fgsms.services.interfaces.policyconfiguration.SLAAction newEmailAction(String from, String subject, String body)
from
- subject
- body
- public static org.miloss.fgsms.services.interfaces.common.NameValuePair getNameValuePairByName(List<org.miloss.fgsms.services.interfaces.common.NameValuePair> set, String name)
set
- name
- public static org.miloss.fgsms.services.interfaces.policyconfiguration.Plugin newPlugin(String classname, String displayname, String appliesto)
classname
- displayname
- appliesto
- FEDERATION_PUBLISH,SLA_RULE,SLA_ACTION, LOGGERpublic static List<org.miloss.fgsms.services.interfaces.common.PolicyType> getAllPolicyTypes()
public static boolean containsPolicyType(List<org.miloss.fgsms.services.interfaces.common.PolicyType> appliesTo, org.miloss.fgsms.services.interfaces.common.PolicyType optionalPolicyTypeFilter)
appliesTo
- optionalPolicyTypeFilter
- public static org.miloss.fgsms.services.interfaces.policyconfiguration.KeyNameValue newKeyNameValue(String key, String name, String value)
key
- name
- value
- public static org.miloss.fgsms.services.interfaces.policyconfiguration.KeyNameValueEnc newKeyNameValueEnc(org.miloss.fgsms.services.interfaces.policyconfiguration.KeyNameValue value, boolean shouldEncrypt)
value
- shouldEncrypt
- Copyright © 2008–2017 MIL-OSS. All rights reserved.