Package org.exoplatform.container.xml
Class Deserializer
- java.lang.Object
-
- org.exoplatform.container.xml.Deserializer
-
public class Deserializer extends Object
A deserializer used by JIBX that resolve system properties to allow runtime configuration.- Version:
- $Revision$
- Author:
- Julien Viet
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXO_CONTAINER_PROP_NAMEThe name of the variable to use to get the current container name as a suffix if the current container is a portal container, the value of the variable will be "-${portal-container-name}", it will be an empty String otherwisestatic StringPORTAL_CONTAINER_VARIABLE_PREFIXThe prefix of the name of all the variables tied to the current portal container
-
Constructor Summary
Constructors Constructor Description Deserializer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcleanString(String s)This methods will remove useless characters from the givenStringand return the resultstatic BooleanresolveBoolean(String s)Resolve a boolean value with the following algorithm: Resolve any system property in the input value If the input value is null then the returned value is null If the value is equals to the string litteral true ignoring the case then true is returned If the value is equals to the string litteral false ignoring the case then false is returned Otherwise anIllegalArgumentExceptionis thrownstatic DoubleresolveDouble(String s)Resolve a double value with the following algorithm: Resolve any system property in the input value Attempt to parse the value using theDouble.parseDouble(String)method and returns its value. If the parsing fails then throws anIllegalArgumentExceptionstatic IntegerresolveInteger(String s)Resolve an integer value with the following algorithm: Resolve any system property in the input value Attempt to parse the value using theInteger.parseInt(String)method and returns its value. If the parsing fails then throws anIllegalArgumentExceptionstatic LongresolveLong(String s)Resolve a long value with the following algorithm: Resolve any system property in the input value Attempt to parse the value using theLong.parseLong(String)method and returns its value. If the parsing fails then throws anIllegalArgumentExceptionstatic StringresolveNClean(String s)This method will first resolves the variables then it will clean the resultsstatic StringresolveString(String s)Resolve a string value.static StringresolveVariables(String input)Resolve the variables of type ${my.var} for the current context which is composed of the system properties and the portal container settingsstatic StringresolveVariables(String input, Map<String,Object> props)Resolve the variables of type ${my.var} for the current context which is composed of the system properties, the portal container settings and the given settings
-
-
-
Field Detail
-
EXO_CONTAINER_PROP_NAME
public static final String EXO_CONTAINER_PROP_NAME
The name of the variable to use to get the current container name as a suffix if the current container is a portal container, the value of the variable will be "-${portal-container-name}", it will be an empty String otherwise- See Also:
- Constant Field Values
-
PORTAL_CONTAINER_VARIABLE_PREFIX
public static final String PORTAL_CONTAINER_VARIABLE_PREFIX
The prefix of the name of all the variables tied to the current portal container- See Also:
- Constant Field Values
-
-
Method Detail
-
resolveString
public static String resolveString(String s)
Resolve a string value. If the input value is null then the returned value is null.- Parameters:
s- the input value- Returns:
- the resolve value
-
resolveBoolean
public static Boolean resolveBoolean(String s) throws IllegalArgumentException
Resolve a boolean value with the following algorithm:- Resolve any system property in the input value
- If the input value is null then the returned value is null
- If the value is equals to the string litteral true ignoring the case then true is returned
- If the value is equals to the string litteral false ignoring the case then false is returned
- Otherwise an
IllegalArgumentExceptionis thrown
- Parameters:
s- the input value- Returns:
- the resolve value
- Throws:
IllegalArgumentException- if the argument is not correct
-
resolveInteger
public static Integer resolveInteger(String s) throws IllegalArgumentException
Resolve an integer value with the following algorithm:- Resolve any system property in the input value
- Attempt to parse the value using the
Integer.parseInt(String)method and returns its value. - If the parsing fails then throws an
IllegalArgumentException
- Parameters:
s- the input value- Returns:
- the resolve value
- Throws:
IllegalArgumentException- if the argument is not correct
-
resolveLong
public static Long resolveLong(String s) throws IllegalArgumentException
Resolve a long value with the following algorithm:- Resolve any system property in the input value
- Attempt to parse the value using the
Long.parseLong(String)method and returns its value. - If the parsing fails then throws an
IllegalArgumentException
- Parameters:
s- the input value- Returns:
- the resolve value
- Throws:
IllegalArgumentException- if the argument is not correct
-
resolveDouble
public static Double resolveDouble(String s) throws IllegalArgumentException
Resolve a double value with the following algorithm:- Resolve any system property in the input value
- Attempt to parse the value using the
Double.parseDouble(String)method and returns its value. - If the parsing fails then throws an
IllegalArgumentException
- Parameters:
s- the input value- Returns:
- the resolve value
- Throws:
IllegalArgumentException- if the argument is not correct
-
resolveVariables
public static String resolveVariables(String input)
Resolve the variables of type ${my.var} for the current context which is composed of the system properties and the portal container settings- Parameters:
input- the input value- Returns:
- the resolve value
-
resolveVariables
public static String resolveVariables(String input, Map<String,Object> props)
Resolve the variables of type ${my.var} for the current context which is composed of the system properties, the portal container settings and the given settings- Parameters:
input- the input valueprops- a set of parameters to add for the variable resolution- Returns:
- the resolve value
-
cleanString
public static String cleanString(String s)
This methods will remove useless characters from the givenStringand return the result- Parameters:
s- the input value- Returns:
nullif the input value isnull,s.trim()otherwise
-
-