public interface MProperties
Applications can use the methods in this class to add and replace
attribute values and can also remove the whole subtree by calling
MProperties.removeProperties()
with the desired MProperties
as an argument.
This class is instantiated by the SDK itself.
Warning: Using settableMProperties
incorrectly can cause serious problems
that can cause adapters to stop functioning. TIBCO Software Inc.
cannot guarantee that problem resulting form the incorrect use of
MProperties
class can be solved.
Warning: MProperties
allows arbitrary editing of a resource whose structure is very
strictly regulated. Even the slightest mistake, such as a typographical error,
can render a configuration incorrect. Using settable properties is analogous
to hand-editing database files and should be approached with similar caution.
Use MProperties
class to create/modify repository at your own risk.
Modifier and Type | Method and Description |
---|---|
void |
append(java.lang.String path,
java.lang.Object value)
Add the specified value to the association list specified by path.
|
void |
delete(java.lang.String path)
Delete the attribute and nested elements referenced by the specified path parameter.
|
java.util.Enumeration |
elements(java.lang.String path)
Enumerate over all immediate subelements in TIBCO Repository, starting at the specified
location.
|
java.lang.Object |
get(java.lang.String path)
Retrieve the value of the attribute at the specified location.
|
java.lang.Object |
get(java.lang.String path,
boolean doSubstitution)
Retrieve the value of the attribute at the specified location with or without
global variable substitution.
|
java.lang.Object |
get(java.lang.String path,
java.lang.Object defaultValue)
Return the default value if no value exists or there is an exception.
|
int |
getCount(java.lang.String path)
Return the number of properties that share the same name and can be found
at the specified location.
|
java.lang.String |
getPath()
Return the TIBCO Repository path for the location represented by
this
MProperties . |
int |
getPropertyCount(java.lang.String path)
Deprecated.
Replaced by
getCount(String) |
MPropertiesRegistry |
getRegistry()
Return the
MPropertiesRegistry with which this MProperties is associated. |
java.lang.String |
getString(java.lang.String path)
If the value at the path is a string, return it.
|
java.lang.String |
getString(java.lang.String path,
java.lang.String defaultValue)
Return the default value if no value exists or there is an exception.
|
java.lang.String |
getValue(java.lang.String path)
Deprecated.
Replaced by
getString(path) . |
java.lang.String |
getValue(java.lang.String path,
java.lang.String defaultValue)
Deprecated.
Replaced by
getString(path) . |
boolean |
isChanged()
Determine whether this
MProperties instance is changed. |
boolean |
isLinkChased()
Returns if link chasing is turned on.
|
boolean |
isLocked()
Determine whether this
MProperties instance is locked. |
boolean |
isWritable()
Determine whether this
MProperties instance is writable. |
void |
lock()
Lock this
MProperties instance so no one can write to it. |
void |
set(java.lang.String path,
java.lang.Object value)
Start URL for prop should point to RepoObjectNode in repo
|
void |
setLinkChased(boolean flag)
Set whether link chasing should be turned on
|
void append(java.lang.String path, java.lang.Object value) throws MException
You can only set values for an MProperties
instance if the instance
was created as a settable instance and if it is not locked.
Calling this method with the same path value creates multiple entries in the repository.
path
- can specify an attribute at any level in the tree.
See also Format of path Argument in the description of get(String path, Object defaultValue)
value
- Value to add.MException
- on invalid entry format.java.util.Enumeration elements(java.lang.String path) throws MException
The items are enumerated in the following order:
MException
java.lang.Object get(java.lang.String path) throws MException
path
- can specify a property at any level
in the property tree. The syntax is as follows:
/foo|x/bar|y/baz
See also Format of path Argument in the description
of get(String path, Object defaultValue)
MException
- on invalid entry format.java.lang.Object get(java.lang.String path, boolean doSubstitution) throws MException
path
- can specify a property at any level
in the property tree. The syntax is as follows:
/foo|x/bar|y/baz
doSubstitution
- If true then global variable substitution is done ,
otherwise no substitution is done.MException
- on invalid entry format.java.lang.Object get(java.lang.String path, java.lang.Object defaultValue)
get()
method uses a path argument that can specify an
element at any level in the hierarchy. The syntax is as follows:
/parent_element|x/element|y/attribute
This means:
(/)
and the |n
part after
every branch name are optional. If the "|n" part is omitted, then the first
branch (starting from zero) is assumed. This omission can be convenient
when branch names do not repeat at the same node.
For example, consider the following object that is defined in the
adapter instance description object:
connection
userName = username1
password = password1
import
msgDefinition = msgDefinition1
subject = subject1
field
tibName = tibName1
psftName = psftName1
field
tibName = tibName2
psftName = psftName2
To point to the tibName attribute of the second field, use this syntax:
/import|0/field|1/psftName
int getCount(java.lang.String path) throws MException
/green/red|1/blue
would follow the first branch of green, the 2nd branch of red, and count
as many blue as there are.MException
java.lang.String getPath()
MProperties
.int getPropertyCount(java.lang.String path) throws MException
getCount(String)
MException
MPropertiesRegistry getRegistry()
MPropertiesRegistry
with which this MProperties
is associated.java.lang.String getString(java.lang.String path)
java.lang.String getString(java.lang.String path, java.lang.String defaultValue)
java.lang.String getValue(java.lang.String path)
getString(path)
.java.lang.String getValue(java.lang.String path, java.lang.String defaultValue)
getString(path)
.defaultValue
- lets you pass in a default value that is returned if there is no current value.boolean isChanged()
MProperties
instance is changed.
Whether an MProperties
instance is considered changed or not depends on several factors:
MProperties
instance is created, it is unchanged. MPropertiesRegistry.newProperties()
factory method,
the MProperties
is considered changed as soon as the URL is read. MProperties
is considered changed. MProperties
is again considered unchanged. MProperties
is unchanged. boolean isLinkChased()
boolean isLocked()
MProperties
instance is locked. Applications
can lock an MProperties
instance by calling the lock()
method.boolean isWritable()
MProperties
instance is writable.
The instance is writable if it was constructed with the MPropertiesRegistry.newSettableProperties()
method. It is not writable otherwise.void lock() throws MException
MProperties
instance so no one can write to it.
To make changes to an MProperties
instance, applications go through these steps:
MProperties
instance calling this method.
MProperties.append()
or
MProperties.set()
.
MPropertiesRegistry.commit()
.
This call unlocks the MProperties
instance as a side effect.
MException
isLocked()
void set(java.lang.String path, java.lang.Object value) throws MException
MException
void setLinkChased(boolean flag)
void delete(java.lang.String path) throws MException
MProperties
instance if the instance was
created as a settable instance and it is not locked.path
- can specify an attribute at any level
in the tree. The syntax is as follows:
/foo|x/bar|y/baz
See also Format of path Argument in the description
of get(String path, Object defaultValue)
MException