|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.openfoundation.util.XPPropertyBag
public class XPPropertyBag
Note that we do not maintain a copy of the Xerces XML persistence
object, since it can be a large object (50k+) and cause memory
overflow during large crawls (issue 26142).
This object can serialize itself to and from XML. The format
it uses is simple:
1. The root element is names "PTBAG" with an attribute "V"
which indicates the Plumtree propertybag version # (1.1)
and the standard attribute "XML-SPACE" set to "preserve".
(This is required to save leading and trailing spaces as well
as tabs and CR-LFs.). XML-SPACE is specific to MSXML and should
really be xml:space going forward. Our parsing needs to maintain
backwards compatibility.
2. Each sub element is one of "I" (integer), "D" (date), "F" (float),
"A" (array), or "O" (object). Each subelement has an attribute
"N" which is the name of the element. Subelements at a given
level should have a unique property name with no trailing or
leading spaces.
3. The "O" element type is special and indicates an object which
is simply a property bag itself. The structure is essentially
recursive and the same as the root except for the name.
4. The "A" child elements have the same structure as
a propertybag, but has a set of required child elements
and stores array values. The name of each field is a comma-delimited
list of array indices (eg, "1,2,3"). The size of each dimension
is also stored as "MAX#" where "#" is the dimension. The number
of dimensions is stored as "DIMS".
The array can have multiple dimensions. Each dimension should
have at least one field.
5. Note that date properties will be serialized in a standard
format "MM/DD/YYYY H:M:S", not the localized format.
6. There is currently no DTD.
7. Property names are not case-sensitive.
8. Floats should be represented as US English encoded strings. That is,
the decimal point should be used instead of a comma as in Europe.
Example:
Microsoft web site
A pointer to Microsoft's web site.
101
The 1st name
The 2nd name
The 3rd name
MSN web site
A pointer to MSN's web site.
1001
Constructor Summary | |
---|---|
XPPropertyBag()
Creates a new XPPropertyBag object. |
Method Summary | |
---|---|
IXPPropertyBag |
Clone()
Clone a property bag. |
boolean |
Compare(IXPPropertyBag propBag)
IPTPropertyBag version of Compare. |
int |
GetCount()
Returns the count of elements in the property bag. |
IXPEnumerator |
GetEnumerator()
Returns Enumerator for XPPropertyBag. |
IXPEnumerator |
GetKeys()
GetKeys returns an enumerator of the keys in the PropertyBag. |
void |
LoadFromBinary(byte[] xml)
LoadFromBinary. |
void |
LoadFromFile(java.lang.String fileName)
LoadFromFile. |
void |
LoadFromInputStream(XPInputStream stream)
Loads the property bag interpreting Input Stream. |
void |
LoadFromXML(java.lang.String xmlString)
LoadFromXML. |
double |
ReadAsDouble(java.lang.String property)
Retrieve an individual property value by name. |
int |
ReadAsInt(java.lang.String property)
Retrieve an individual property value by name. |
IXPPropertyBag |
ReadAsIXPPropertyBag(java.lang.String property)
Retrieve an individual property value by name. |
java.lang.Object |
ReadAsObject(java.lang.String property)
Retrieve an individual property value by name. |
java.lang.Object[] |
ReadAsObject1DArray(java.lang.String property)
Returns the value to which the specified key is mapped in this hashtable. |
java.lang.Object[][] |
ReadAsObject2DArray(java.lang.String property)
Returns the value to which the specified key is mapped in this hashtable. |
java.lang.String |
ReadAsString(java.lang.String property)
Returns the String value of the object stored under the specified property, rendered via toString(), or null if no value is present for that property name. |
XPDateTime |
ReadAsXPDateTime(java.lang.String property)
Retrieve an individual property value by name. |
void |
Remove(java.lang.String property)
Remove. |
void |
RemoveAll()
Removes All Elements. |
byte[] |
SaveToBinary(int xmlFormat)
Saves Property bag values in binary format. |
void |
SaveToFile(java.lang.String fileName)
Saves Property bag values to the given file. |
java.lang.String |
SaveToXML(int xmlFormat)
Saves the Property Bag values into XML format. |
java.lang.String |
toString()
Deprecated. Use ToString() |
java.lang.String |
ToString()
Converts Propertybag values into String. |
void |
Write(java.lang.String property,
double _value)
Set/add an individual property value by name. |
void |
Write(java.lang.String property,
int _value)
Set/add an individual property value by name. |
void |
Write(java.lang.String property,
IXPPropertyBag _value)
Set/add an individual property value by name. |
void |
Write(java.lang.String property,
java.lang.Object _value)
Write. |
void |
Write(java.lang.String property,
java.lang.Object[] _value)
Write. |
void |
Write(java.lang.String property,
java.lang.Object[][] _value)
Write. |
void |
Write(java.lang.String property,
java.lang.String _value)
Set/add an individual property value by name. |
void |
Write(java.lang.String property,
XPDateTime _value)
Set/add an individual property value by name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XPPropertyBag()
Method Detail |
---|
public IXPPropertyBag Clone()
Clone
in interface IXPPropertyBag
public boolean Compare(IXPPropertyBag propBag)
Compare
in interface IXPPropertyBag
propBag
- an IXPPropertyBag object.
public int GetCount()
GetCount
in interface IXPPropertyBag
public IXPEnumerator GetEnumerator()
IXPPropertyBag
GetEnumerator
in interface IXPPropertyBag
public IXPEnumerator GetKeys()
public void LoadFromBinary(byte[] xml)
IXPPropertyBag
LoadFromBinary
in interface IXPPropertyBag
xml
- Input Binary to load XML from.public void LoadFromFile(java.lang.String fileName)
IXPPropertyBag
LoadFromFile
in interface IXPPropertyBag
fileName
- to Load From.public void LoadFromXML(java.lang.String xmlString)
IXPPropertyBag
LoadFromXML
in interface IXPPropertyBag
xmlString
- XML in String Format as input.public void LoadFromInputStream(XPInputStream stream)
stream
- XPInputStream or a subclass of it.public double ReadAsDouble(java.lang.String property)
IXPPropertyBag
ReadAsDouble
in interface IXPPropertyBag
property
- Property Value to be read as String.
public int ReadAsInt(java.lang.String property)
IXPPropertyBag
ReadAsInt
in interface IXPPropertyBag
property
- Property Value to be read as int.
public IXPPropertyBag ReadAsIXPPropertyBag(java.lang.String property)
IXPPropertyBag
ReadAsIXPPropertyBag
in interface IXPPropertyBag
property
- Property Value to be read as String.
public java.lang.Object ReadAsObject(java.lang.String property)
IXPPropertyBag
ReadAsObject
in interface IXPPropertyBag
property
- Property Value to be read as String.
public java.lang.Object[] ReadAsObject1DArray(java.lang.String property)
ReadAsObject1DArray
in interface IXPPropertyBag
property
- Property Name.
public java.lang.Object[][] ReadAsObject2DArray(java.lang.String property)
ReadAsObject2DArray
in interface IXPPropertyBag
property
- Property Name.
public java.lang.String ReadAsString(java.lang.String property)
ReadAsString
in interface IXPPropertyBag
property
- Property Value to be read as String.
public XPDateTime ReadAsXPDateTime(java.lang.String property)
IXPPropertyBag
ReadAsXPDateTime
in interface IXPPropertyBag
property
- XPDateTime Value to be read as String.
public void Remove(java.lang.String property)
IXPPropertyBag
Remove
in interface IXPPropertyBag
property
- to be removed.public void RemoveAll()
IXPPropertyBag
RemoveAll
in interface IXPPropertyBag
public byte[] SaveToBinary(int xmlFormat)
SaveToBinary
in interface IXPPropertyBag
xmlFormat
- is input.
public void SaveToFile(java.lang.String fileName)
SaveToFile
in interface IXPPropertyBag
fileName
- to which Property bag should be written.public java.lang.String SaveToXML(int xmlFormat)
SaveToXML
in interface IXPPropertyBag
xmlFormat
- Type of XMLFormat.
public java.lang.String ToString()
public java.lang.String toString()
toString
in class java.lang.Object
XPException
- if problempublic void Write(java.lang.String property, double _value)
IXPPropertyBag
Write
in interface IXPPropertyBag
property
- Property name as String._value
- Property Value as double.public void Write(java.lang.String property, int _value)
IXPPropertyBag
Write
in interface IXPPropertyBag
property
- Property name as String._value
- Property Value as intpublic void Write(java.lang.String property, IXPPropertyBag _value)
IXPPropertyBag
Write
in interface IXPPropertyBag
property
- Property name as String._value
- Property Value as IXPPropertyBag.public void Write(java.lang.String property, java.lang.Object _value)
IXPPropertyBag
Write
in interface IXPPropertyBag
property
- Property name as String._value
- Property Value as Object.public void Write(java.lang.String property, java.lang.Object[] _value)
IXPPropertyBag
Write
in interface IXPPropertyBag
property
- Property name as String._value
- Property Value as Object Array.public void Write(java.lang.String property, java.lang.Object[][] _value)
IXPPropertyBag
Write
in interface IXPPropertyBag
property
- Property name as String._value
- Property Value as 2D Object Array.public void Write(java.lang.String property, java.lang.String _value)
IXPPropertyBag
Write
in interface IXPPropertyBag
property
- Property name as String._value
- Property Value as String.public void Write(java.lang.String property, XPDateTime _value)
IXPPropertyBag
Write
in interface IXPPropertyBag
property
- Property name as String._value
- Property Value as XPDateTime.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |