Package org.wso2.securevault.commons
Class MiscellaneousUtil
java.lang.Object
org.wso2.securevault.commons.MiscellaneousUtil
TODO - This is a copy of class in synapse commons
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]asBytes(InputStream in) static booleanelementHasText(org.apache.axiom.om.OMElement element) static List<MiscellaneousUtil.ProtectedToken> extractProtectedTokens(String text) static Stringstatic StringgetProperty(Properties properties, String name, String defaultValue) Helper method to get the value of the property from a given property bagstatic <T> TgetProperty(Properties properties, String name, T defaultValue, Class<? extends T> type) Helper method to get the value of the property from a given property bag This method will return a value with the type equal to the type given by the Class type parameter.static StringgetProtectedToken(String text) getProtectedTokens(String text) static booleanisValidPropertyValue(String propValue) Validate the property value to avoid the processing of null values.static PropertiesloadProperties(String filePath) Loads the properties from a given property file pathstatic Stringresolve(String inputText, SecretResolver secretResolver) static Stringresolve(org.apache.axiom.om.OMAttribute attribute, SecretResolver secretResolver) static Stringresolve(org.apache.axiom.om.OMElement omElement, SecretResolver secretResolver)
-
Field Details
-
BCFKS
- See Also:
-
JKS
- See Also:
-
-
Method Details
-
getProperty
Helper method to get the value of the property from a given property bag- Parameters:
properties- The property collectionname- The name of the propertydefaultValue- The default value for the property- Returns:
- The value of the property if it is found , otherwise , default value
-
getProperty
public static <T> T getProperty(Properties properties, String name, T defaultValue, Class<? extends T> type) Helper method to get the value of the property from a given property bag This method will return a value with the type equal to the type given by the Class type parameter. Therefore, The user of this method can ensure that he is get what he request- Parameters:
properties- Properties bagname- Name of the propertydefaultValue- Default valuetype- Expected Type using Class- Returns:
- Value corresponding to the given property name
-
loadProperties
Loads the properties from a given property file path- Parameters:
filePath- Path of the property file- Returns:
- Properties loaded from given file
-
asBytes
-
getProtectedToken
-
getProtectedTokens
-
elementHasText
public static boolean elementHasText(org.apache.axiom.om.OMElement element) -
resolve
public static String resolve(org.apache.axiom.om.OMElement omElement, SecretResolver secretResolver) -
resolve
-
resolve
public static String resolve(org.apache.axiom.om.OMAttribute attribute, SecretResolver secretResolver) -
isValidPropertyValue
Validate the property value to avoid the processing of null values.- Parameters:
propValue- Value of the required property.- Returns:
- Return true if not null.
-
extractProtectedTokens
-
getKeyType
-