eXo Kernel :: Container 2.4.4-CLD

org.exoplatform.container.xml
Class Deserializer

java.lang.Object
  extended by 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
static 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
static String PORTAL_CONTAINER_VARIABLE_PREFIX
          The prefix of the name of all the variables tied to the current portal container
 
Constructor Summary
Deserializer()
           
 
Method Summary
static String cleanString(String s)
          This methods will remove useless characters from the given String and return the result
static Boolean resolveBoolean(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 an IllegalArgumentException is thrown
static Double resolveDouble(String s)
          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
static Integer resolveInteger(String s)
          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
static Long resolveLong(String s)
          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
static String resolveNClean(String s)
          This method will first resolves the variables then it will clean the results
static String resolveString(String s)
          Resolve a string value.
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
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

Deserializer

public Deserializer()
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:
  1. Resolve any system property in the input value
  2. If the input value is null then the returned value is null
  3. If the value is equals to the string litteral true ignoring the case then true is returned
  4. If the value is equals to the string litteral false ignoring the case then false is returned
  5. Otherwise an IllegalArgumentException is 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:
  1. Resolve any system property in the input value
  2. Attempt to parse the value using the Integer.parseInt(String) method and returns its value.
  3. 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:
  1. Resolve any system property in the input value
  2. Attempt to parse the value using the Long.parseLong(String) method and returns its value.
  3. 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:
  1. Resolve any system property in the input value
  2. Attempt to parse the value using the Double.parseDouble(String) method and returns its value.
  3. 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 value
props - 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 given String and return the result

Parameters:
s - the input value
Returns:
null if the input value is null, s.trim() otherwise

resolveNClean

public static String resolveNClean(String s)
This method will first resolves the variables then it will clean the results

Parameters:
s - the input value
Returns:
the resolve and clean value

eXo Kernel :: Container 2.4.4-CLD

Copyright © 2013 eXo Platform SAS. All Rights Reserved.