public class HierarchicalProperties
extends java.lang.Object
ODE_PREFFIX
.
Properties must respect the following pattern: [level1.[level2.]prefix.]property
A concrete use case could be the definition of properties for wsdl services and ports.
alias.foo_ns=http://foo.com timeout=40000 a_namespace_with_no_alias_defined.film-service.port-of-cannes.ode.timeout=50000 max-redirects=30 foo_ns.brel-service.ode.max-redirects=40 foo_ns.brel-service.port-of-amsterdam.ode.max-redirects=60The following values may be expected:
getProperty("max-redirects") => 30 getProperty("http://foo.com", "brel-service", "max-redirects") => 40 getProperty("http://foo.com", "brel-service", "port-of-amsterdam", "max-redirects") => 60 getProperty("a_namespace_with_no_alias_defined", "film-service", "timeout") => 40000 getProperty("a_namespace_with_no_alias_defined", "film-service", "port-of-cannes", "timeout") => 50000 getProperty("http://foo.com", "port-of-amsterdam", "timeout") => 40000
Values may contain some environment variables. For instance, message=You're using ${java.version}.
If a property name ends with ".file" or ".path", the assumption is made that the associated value is a path and as such is resolved against the path of the file it was loaded from.
Assigned properties must not start with 'system.' or 'env.'. These prefix are reserved to access system properties and environment variables.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ODE_PREFFIX |
Constructor and Description |
---|
HierarchicalProperties(java.io.File file) |
HierarchicalProperties(java.io.File[] files) |
HierarchicalProperties(java.io.File[] files,
java.lang.String prefix) |
HierarchicalProperties(java.io.File file,
java.lang.String prefix) |
HierarchicalProperties(java.util.List<java.io.File> propFiles) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all content.
|
java.lang.String |
getPrefix() |
java.util.Map |
getProperties(javax.xml.namespace.QName service) |
java.util.Map |
getProperties(javax.xml.namespace.QName service,
java.lang.String port)
Return a map containing all the properties for the given port.
|
java.util.Map |
getProperties(java.lang.String serviceNamespaceURI,
java.lang.String serviceLocalPart) |
java.util.Map |
getProperties(java.lang.String serviceNamespaceURI,
java.lang.String serviceLocalPart,
java.lang.String port) |
java.lang.String |
getProperty(javax.xml.namespace.QName service,
java.lang.String property) |
java.lang.String |
getProperty(javax.xml.namespace.QName service,
java.lang.String port,
java.lang.String property) |
java.lang.String |
getProperty(java.lang.String property) |
java.lang.String |
getProperty(java.lang.String serviceNamespaceURI,
java.lang.String serviceLocalPart,
java.lang.String property) |
java.lang.String |
getProperty(java.lang.String serviceNamespaceURI,
java.lang.String serviceLocalPart,
java.lang.String port,
java.lang.String property) |
protected org.apache.ode.utils.HierarchicalProperties.ChainedMap |
getRootMap() |
void |
loadFiles()
Clear all existing content, then read the file and parse each property.
|
public static final java.lang.String ODE_PREFFIX
public HierarchicalProperties(java.io.File[] files, java.lang.String prefix) throws java.io.IOException
files
- the property file to be loaded. The file may not exist.
But if the file exists it has to be a file (not a directory), otherwhise an IOException is thrown. Files will be loaded in the given order.prefix
- the property prefixjava.io.IOException
public HierarchicalProperties(java.io.File[] files) throws java.io.IOException
java.io.IOException
public HierarchicalProperties(java.io.File file, java.lang.String prefix) throws java.io.IOException
java.io.IOException
public HierarchicalProperties(java.io.File file) throws java.io.IOException
java.io.IOException
public HierarchicalProperties(java.util.List<java.io.File> propFiles) throws java.io.IOException
java.io.IOException
public void loadFiles() throws java.io.IOException
java.io.IOException
- if the file is a Directorypublic void clear()
loadFiles()
is not invoked later, all returned values will be null.protected org.apache.ode.utils.HierarchicalProperties.ChainedMap getRootMap()
public java.util.Map getProperties(java.lang.String serviceNamespaceURI, java.lang.String serviceLocalPart)
public java.util.Map getProperties(javax.xml.namespace.QName service)
service
- getProperties(String, String)
public java.util.Map getProperties(java.lang.String serviceNamespaceURI, java.lang.String serviceLocalPart, java.lang.String port)
public java.util.Map getProperties(javax.xml.namespace.QName service, java.lang.String port)
service
- port
- public java.lang.String getProperty(java.lang.String property)
public java.lang.String getProperty(java.lang.String serviceNamespaceURI, java.lang.String serviceLocalPart, java.lang.String property)
public java.lang.String getProperty(javax.xml.namespace.QName service, java.lang.String property)
public java.lang.String getProperty(java.lang.String serviceNamespaceURI, java.lang.String serviceLocalPart, java.lang.String port, java.lang.String property)
public java.lang.String getProperty(javax.xml.namespace.QName service, java.lang.String port, java.lang.String property)
public java.lang.String getPrefix()