public class JProperties extends Object
JProperties
utility class that can be used by opening an input stream from
a XML property file using a URL path that receives as parameter in setURL()
function. setURL()
function converting XML property file to standard property list.
initMessageID()
function load standard property file to property list. To use
this class, first the user should care to call the following method setURL()
with
certain URL name, else the user will get NullPointerException
. Each key and its
corresponding value in the property list is a string.
Modifier and Type | Method and Description |
---|---|
static boolean |
containsSpaceProperty(String fullSpaceName,
String key) |
static void |
convertCustomSpacePropsToJProperties(String spaceName,
Properties customProps,
JSpaceAttributes spaceAttrib)
Convert space attributes according to custom properties
|
static Properties |
convertXML(InputStream is)
Convert XML file to
Properties object. |
static JSpaceAttributes |
convertXML(InputStream is,
boolean isConvertToSystemProperty,
Properties customProps)
Convert XML file to
Properties object. |
static JSpaceAttributes |
convertXML(String uri,
boolean isConvertToSystemProperty)
Convert XML file to
Properties object. |
static String |
getAllSpacesPropertiesDump() |
static Properties |
getContainerProperties(String containerName)
Returns current
Properties object. |
static String |
getContainerPropertiesDump(String containerName) |
static String |
getContainerProperty(String containerName,
String key,
String defaultValue)
Searches for the property with the specified key in this property list of container.
|
static String |
getContainerProperty(String containerName,
String key,
String defaultValue,
boolean convert)
Retrieve container properties according to its name.
|
static <T> T |
getObjectSpaceProperty(String fullSpaceName,
String key) |
static String |
getPropertyFromSystem(String propertyValue)
Replace the XML propertyValue with System property value if contains.
|
static String |
getPropertyFromSystem(String propertyValue,
String defValue)
Replace the XML propertyValue with System property value if contains.
|
static String |
getPropertyFromSystemForComplicatedValue(String propertyValue,
String defValue) |
static Properties |
getSpaceProperties(String fullSpaceName)
Returns Properties of certain space.
|
static String |
getSpaceProperty(String fullSpaceName,
String key,
String defaultValue) |
static String |
getSpaceProperty(String fullSpaceName,
String key,
String defaultValue,
boolean convert) |
static String |
getURL()
Returns current URL name of container XML file.
|
static String |
getURL(String fullSpaceName)
Returns current URL name of space XML file.
|
static boolean |
isSystemProp(String propertyValue)
This method checks if value has format of system property
|
static JSpaceAttributes |
loadConfigDCache(String fileName)
Returns the DCache configuration as specified in the file.
|
static SpaceConfigReader |
loadDCacheConfig(ISpaceProxy remoteSpace,
Properties customProperties,
String dcacheSuffix) |
static void |
main(String[] args) |
static void |
removeSpaceProperties(String fullSpaceName)
Remove
Properties object of space from JProperties. |
static String |
resolveSystemPropertyName(String propertyValue) |
static void |
setInputStream(String containerName,
InputStream is,
Properties customProps)
Set the InputStream to the config file for resolving the xml file.
|
static void |
setSpaceProperties(String fullSpaceName,
Properties properties) |
static void |
setSpaceProperty(String fullSpaceName,
String key,
String value) |
static void |
setURL(String containerName,
String uriName)
Set URL name of property file for opening input stream.
|
static void |
setUrlWithoutSchema(String fullSpaceName,
Properties customProperties,
String urlName) |
static void |
setUrlWithSchema(String fullSpaceName,
Properties customProperties,
InputStream is)
Convert XML file of specific space to
Properties object and store in public
table. |
public static void setURL(String containerName, String uriName) throws SAXException, ParserConfigurationException, IOException
uriName
- URI name where stored property file.SAXException
- This Exception can contain basic error or warning
information from either the XML parser or the
applicationParserConfigurationException
- Parser Configuration ExceptionIOException
- If an error occurred during reading from this input
stream.getURL()
public static void setInputStream(String containerName, InputStream is, Properties customProps) throws SAXException, ParserConfigurationException, IOException
is
- The InputStream to the prop file where the property file is stored.SAXException
- This Exception can contain basic error or warning
information from either the XML parser or the
applicationParserConfigurationException
- Parser Configuration ExceptionIOException
- If an error occurred during reading from this input
stream.public static JSpaceAttributes loadConfigDCache(String fileName) throws SpaceConfigurationException, IOException, SAXException, ParserConfigurationException
fileName
- the name of the configuration fileSpaceConfigurationException
IOException
SAXException
ParserConfigurationException
public static void setUrlWithSchema(String fullSpaceName, Properties customProperties, InputStream is) throws SAXException, ParserConfigurationException, IOException
Properties
object and store in public
table.public static void setUrlWithoutSchema(String fullSpaceName, Properties customProperties, String urlName) throws SAXException, ParserConfigurationException, IOException
public static String getAllSpacesPropertiesDump()
public static String getContainerPropertiesDump(String containerName)
public static void convertCustomSpacePropsToJProperties(String spaceName, Properties customProps, JSpaceAttributes spaceAttrib)
spaceName
- if space name is null then use XPath as key (i.e in the case of DCache
config)customProps
- custom propertiesspaceAttrib
- space attributespublic static String getURL()
com.j_spaces.kernel.JProperties#setURL(java.lang.String)
public static String getURL(String fullSpaceName)
fullSpaceName
- Full space name: com.j_spaces.kernel.JProperties#setURL(String spaceName, String urlName)
public static void removeSpaceProperties(String fullSpaceName)
Properties
object of space from JProperties.fullSpaceName
- Full space name: public static Properties getContainerProperties(String containerName)
Properties
object.Properties
object.public static String getContainerProperty(String containerName, String key, String defaultValue)
key
- Certain key.defaultValue
- A default value.public static String getContainerProperty(String containerName, String key, String defaultValue, boolean convert)
containerName
- if name is null any container will be taken. That is done only for
system time property.key
- container property nameconvert
- indicates if convert with system propertypublic static Properties getSpaceProperties(String fullSpaceName)
fullSpaceName
- Full space name: public static void setSpaceProperties(String fullSpaceName, Properties properties)
public static SpaceConfigReader loadDCacheConfig(ISpaceProxy remoteSpace, Properties customProperties, String dcacheSuffix) throws SpaceInitializationException
SpaceInitializationException
public static String getSpaceProperty(String fullSpaceName, String key, String defaultValue)
public static String getSpaceProperty(String fullSpaceName, String key, String defaultValue, boolean convert)
public static void setSpaceProperty(String fullSpaceName, String key, String value)
public static JSpaceAttributes convertXML(String uri, boolean isConvertToSystemProperty) throws SAXException, ParserConfigurationException, IOException
Properties
object.uri
- URI
of XML file for conversion.isConvertToSystemProperty
- Is convert xml properties from System properties.Properties
object that converted from XML file.SAXException
ParserConfigurationException
IOException
public static Properties convertXML(InputStream is) throws SAXException, ParserConfigurationException, IOException
Properties
object.is
- InputStream
of XML file for conversion. By default converts xml
properties from System properties.Properties
object that was converted from XML file.SAXException
ParserConfigurationException
IOException
public static JSpaceAttributes convertXML(InputStream is, boolean isConvertToSystemProperty, Properties customProps) throws SAXException, ParserConfigurationException, IOException
Properties
object.is
- InputStream
of XML file for conversion.isConvertToSystemProperty
- Is convert xml properties from System properties.Properties
object that was converted from XML file.SAXException
ParserConfigurationException
IOException
public static String getPropertyFromSystem(String propertyValue)
propertyValue
- The XML property value.getPropertyFromSystem(String, String)
public static String getPropertyFromSystem(String propertyValue, String defValue)
propertyValue
- The XML property value.defValue
- Default value, When null default value is ignored.public static void main(String[] args)
public static String getPropertyFromSystemForComplicatedValue(String propertyValue, String defValue)
public static boolean isSystemProp(String propertyValue)
Copyright © GigaSpaces.