com.plumtree.openfoundation.util
Class XPFileProperty

java.lang.Object
  extended by com.plumtree.openfoundation.util.XPFileProperty

public class XPFileProperty
extends java.lang.Object

Loads an XML file containing name/value pairs. The format for this file looks like this:

 <?xml version="1.0" encoding="UTF-8"?>
 <properties>
        <surf>is up</surf>
        <database> testDB </database>
        <CHANGELIST>koOOoky</CHANGELIST>
 </properties>


Constructor Summary
XPFileProperty(java.lang.String file_location, java.lang.String file_name)
          Loads XML property file from the file_location with the file_name.
 
Method Summary
 void Clear()
          Clears this this XPFileProperty set.
 IXPEnumerator GetKeys()
          Returns an enumeration of keys.
 java.lang.String GetProperty(java.lang.String key)
          Returns the selected property Returns null if the key does not existed.
 XPStringDictionary GetStringDictionary()
          return a string dictionary.
 void RemoveProperty(java.lang.String key)
          Removes a specific key in the property object.
 void Save()
          Saves the property object to the file that was opened.
 void SetProperty(java.lang.String name, java.lang.String val)
          Sets a property.
 void SetStringDictionary(XPStringDictionary sd)
          sets the properties object from a string dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPFileProperty

public XPFileProperty(java.lang.String file_location,
                      java.lang.String file_name)
Loads XML property file from the file_location with the file_name. No exception is thrown if the specified file is not found, The property file won't get loaded in that case.

Parameters:
file_location - - full file location e.g. c:\temp\dir1
file_name - - property file name.
Throws:
XPException - wrapping any underlying platform exception other than FileNotFound (fix to 24946).
Method Detail

GetProperty

public java.lang.String GetProperty(java.lang.String key)
Returns the selected property Returns null if the key does not existed.

Parameters:
key - - the key for the property you are interested in
Returns:
Returns the Interested Property as String.

GetStringDictionary

public XPStringDictionary GetStringDictionary()
return a string dictionary.

Returns:
A XPStringDictionary of the Properties.

SetStringDictionary

public void SetStringDictionary(XPStringDictionary sd)
sets the properties object from a string dictionary.

Parameters:
sd - Input XPStringDictionary to set the current StringDictionary.

GetKeys

public IXPEnumerator GetKeys()
Returns an enumeration of keys.

Returns:
An XPEnumerator that can iterate through the keys in this hashtable.

SetProperty

public void SetProperty(java.lang.String name,
                        java.lang.String val)
Sets a property.

Parameters:
name - - the name of the property to set
val - - the value of the property to set This does not save the properties file, you must explicitly select save to store the file

RemoveProperty

public void RemoveProperty(java.lang.String key)
Removes a specific key in the property object.

Parameters:
key - - the key you want to remove

Clear

public void Clear()
Clears this this XPFileProperty set.


Save

public void Save()
Saves the property object to the file that was opened.

Throws:
XPException - wrapping any underlying platform exception.


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.