Class Properties

Description

Class to provide functions to emulate the java.util.Properties class.

This class emulates many of the methods found in the java.util.Properties class. It can be particularily helpful when implementing the server side of AJAX based applications (you can easily build/send a XML document to your client side JavaScript using this class).

Here is an example of creating a simple AJAX style response (in this example, we are simply passing back values for variables "x", "y" and "z" - it's up to the client side JavaScript to do something with the values):

  1.  $p new Properties();
  2.  $p->setComment("This \"is\" a test.");
  3.  $p->setProperty("x","123");
  4.  $p->setProperty("y","2");
  5.  $p->setProperty("z","135");
  6.  
  7.  $p->renderPage();

Located in /lib/Properties.php (line 37)


	
			
Direct descendents
Class Description
WuiProperties Class to provide functions to emulate the java.util.Properties class.
Method Summary
static void disableCaching ()
static void getPostGet ( $name, [$defval $defval = null], string $key)
Properties __construct ()
void getAsArray ()
String getProperty ($key $key, [$defValue $defValue = null])
Number loadFromXML ($fname $fname)
void printJSON ()
void printXML ()
void removeProperty ($key $key)
void renderJSON ()
void renderPage ()
true setComment ($comment $comment)
void setDocumentInfo ($toolList $toolList, [$release $release = 0])
void setIncludeXsl ($enable $enable)
true setProperty ($key $key, $value $value)
void size ()
void storeToXML ([$fh $fh = null])
Methods
static method disableCaching (line 356)

Update header information such that the client won't cache results.

  • access: public
static void disableCaching ()
static method getPostGet (line 444)

Get value from POST/GET (regardless of whether its a POST/GET).

  • access: public
static void getPostGet ( $name, [$defval $defval = null], string $key)
  • string $key: The key to look up the value of.
  • $defval $defval: Default value to return if value not found (null if not specified).
  • $name
Constructor __construct (line 53)

Constructs instance of object (with no properties).

  • access: public
Properties __construct ()

Redefined in descendants as:
getAsArray (line 432)

Get the key/value pairs as a associative array.

  • access: public
void getAsArray ()
getProperty (line 127)

Gets property value.

  • return: value associated with 'key' or default value (typically null) if property is not available.
  • access: public
String getProperty ($key $key, [$defValue $defValue = null])
  • $key $key: A string containing the 'key' associated with the property (string must be at least 1 character long).
  • $defValue $defValue: The default value to return if the property is not available (this will be null if you don't explicitly specify your own default).
loadFromXML (line 202)

Read the entire set of properties from a properties XML file.

This function reads the entire set of properties from a properties XML document and add the key/value pairs to the object.

  • return: of entries added.
  • access: public
Number loadFromXML ($fname $fname)
  • $fname $fname: Name of file to read XML content from.
printJSON (line 339)

Prints the entire set of properties as JSON (see renderJSON).

  • access: public
void printJSON ()
printXML (line 276)

Prints the entire set of properties as a XML document.

  • access: public
void printXML ()
removeProperty (line 142)

Removes a key/value pair from the set of properties.

  • access: public
void removeProperty ($key $key)
  • $key $key: A string containing the 'key' which is to be removed from the set of properties (its OK if key doesn't exist - doesn't do anything).
renderJSON (line 423)

Renders the contents of the Properties object to a HTTP client as JSON.

THIS method is useful when one is using the Properties object to serve information back to a HTTP client (typically a JavaScript function running within a user's web browser). In general it works in the following manner:

  • Construct a new instance of the Properties object.
  • Invoke the #setProperty method multiple times to add properties.
  • Invoke this method one time to serve the information back to the client.
The results are returned using JavaScript Object Notation (JSON) which can be eval()ed directly by the client.

NOTE: When using this function, the values in the properties table can contain ANY characters. However, the keys must ALL be LEGAL JavaScript attribute names. Think:

 // 'key' must be legal JavaScript
 // 'value' can be anything as we apply the necessary escape/unescape
 var O = new Object(); o.key = unescape(value);

  • access: public
void renderJSON ()
renderPage (line 384)

Renders the contents of the Properties object to a HTTP client.

THIS method is useful when one is using the Properties object to serve information back to a HTTP client (typically a JavaScript function running within a user's web browser). In general it works in the following manner:

  • Construct a new instance of the Properties object.
  • Invoke the #setProperty method multiple times to add properties.
  • Invoke this method one time to serve the information back to the client.

  • access: public
void renderPage ()
setComment (line 74)

Sets comment to associate with set of properties.

  • return: if comment was accepted, false if not.
  • access: public
true setComment ($comment $comment)
  • $comment $comment: New comment to assign to the property set (must be at least one character long).
setDocumentInfo (line 174)

Add the stndard set of NST properties to identify the XML content.

This function adds the standard set of NST properties used to help identify the XML content. This includes the fields:

<dl> <dt>document_source</dt><dd>String listing tools used to generate XML content.</dd> <dt>document_version</dt><dd>A document version identifier having the form: NNNN.rrr. For example: 2130.011 indicates NST v2.13.0 and XML document release 11. NOTE: You can only specify the release integer portion (the major portion is fixed based on the build).</dd> <dt>create_time_formatted</dt><dd>A formatted time stamp.</dd> <dt>create_time_secs</dt><dd>The timestamp as a numeric seconds value.</dd> </dl>

  • access: public
void setDocumentInfo ($toolList $toolList, [$release $release = 0])
  • $toolList $toolList: - String containing list of scripts/tools used.
  • $release $release: - Integer release ID of the XML document (keep bumping as you change the contents of your XML structure).
setIncludeXsl (line 90)

Sets whether or not the XSL style sheet: /nstwui/cgi-bin/xsl/properties2html.xsl is included in the output.

  • access: public
void setIncludeXsl ($enable $enable)
  • $enable $enable: Set to 'true' to include the style sheet for pretty rendering, otherwise set to 'false'.
setProperty (line 106)

Sets property value.

  • return: if property key/value was accepted and stored, false if not.
  • access: public
true setProperty ($key $key, $value $value)
  • $key $key: A string containing the 'key' to associated with the property (string must be at least 1 character long).
  • $value $value: A string containing the 'value' to associate with the property (string may be 0 length, but you may not pass null).
size (line 62)

Returns the number of key/value pairs in the properties objects.

  • access: public
void size ()
storeToXML (line 250)

Stores the entire set of properties as a XML document.

This function writes the entire set of properties as a XML document to the file specified.

  • access: public
void storeToXML ([$fh $fh = null])
  • $fh $fh: Handle to store the information to (or null for STDOUT).
toUrlParams (line 320)

Forms a single string that can be put after the '?' in a URL.

This method allows one to create a single string in the form that can be appended after the '?' when building a URL (the 'search' component of 'window.location').

  • return: string like: 'x=3&y=hello%20world&z=abc'
  • access: public
A toUrlParams ()

Documentation generated on Sun, 11 Feb 2018 07:41:02 -0500 by phpDocumentor 1.4.4