HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
JSONStorage Class Reference

Public Member Functions

 __construct ($registry=null)
 __destruct ()
 onBeforeSave ($event)
 onAfterSave ($event)
 setPath ($path)
 getPath ()
 setFile ($file)
 getFile ()
 verify ()
 load ()
 save ()
 setData ($key, $data, $registry=null)
 getData ($key, $registry=null)
 removeData ($key, $registry=null)
 getLength ($registry=null)
 getRegistry ($registry)
 registryExists ($registry)
 addRegistry ($registry)
 removeRegistry ($registry)

Public Attributes

const META = 'meta'
const REGISTRY = 'registry'

Protected Attributes

 $filename = 'registry.json'
 $path
 $dirty = false
 $default = "default"
 $data

Private Member Functions

 flush ()
 encode ($data)
 decode ($data)

Detailed Description

Definition at line 27 of file JSONStorage.php.

Constructor & Destructor Documentation

JSONStorage::__construct (   $registry = null)

class constructor

Parameters
null$registry

Definition at line 81 of file JSONStorage.php.

Here is the call graph for this function:

JSONStorage::__destruct ( )

class destructor - flush data

Definition at line 102 of file JSONStorage.php.

Here is the call graph for this function:

Member Function Documentation

JSONStorage::addRegistry (   $registry)

Add new collection name

Parameters
string$registrythe name of the registry (collection) to create
Returns
bool

Definition at line 341 of file JSONStorage.php.

Here is the call graph for this function:

Here is the caller graph for this function:

JSONStorage::decode (   $data)
private

JSON decodes the data

Parameters
string$data
Returns
mixed

Definition at line 415 of file JSONStorage.php.

Here is the caller graph for this function:

JSONStorage::encode (   $data)
private

JSON encodes the data

Parameters
string$data
Returns
string

Definition at line 403 of file JSONStorage.php.

Here is the caller graph for this function:

JSONStorage::flush ( )
private

Saves the global registry to the file

Returns
bool
Exceptions
Exception

Definition at line 373 of file JSONStorage.php.

Here is the call graph for this function:

Here is the caller graph for this function:

JSONStorage::getData (   $key,
  $registry = null 
)

Retrieves a data value from the registry

Parameters
string$keythe name of the key that holds the data
null$registrythe registry name
Returns
mixed the data in the key value, null otherwise

Definition at line 255 of file JSONStorage.php.

Here is the call graph for this function:

JSONStorage::getFile ( )

Property get file

Returns
string filename

Definition at line 167 of file JSONStorage.php.

Here is the caller graph for this function:

JSONStorage::getLength (   $registry = null)

Retrieves the number of keys in registry

Parameters
null$registrythe registry name
Returns
int the data length

Definition at line 299 of file JSONStorage.php.

Here is the call graph for this function:

JSONStorage::getPath ( )

Property get path

Returns
string

Definition at line 148 of file JSONStorage.php.

JSONStorage::getRegistry (   $registry)

Retrieves a registry collection based on its name

Parameters
string$registrythe name of the registry to retrieve
Returns
mixed|null the registry, null if none found

Definition at line 317 of file JSONStorage.php.

Here is the call graph for this function:

JSONStorage::load ( )

Loads registry data into memory

Exceptions
Exception

Definition at line 190 of file JSONStorage.php.

Here is the call graph for this function:

Here is the caller graph for this function:

JSONStorage::onAfterSave (   $event)

Fires after the registry has been saved

Parameters
CEvent$event

Definition at line 122 of file JSONStorage.php.

Here is the caller graph for this function:

JSONStorage::onBeforeSave (   $event)

Fires before registry has been saved

Parameters
CEvent$event

Definition at line 112 of file JSONStorage.php.

Here is the caller graph for this function:

JSONStorage::registryExists (   $registry)

Checkes whether a collection exists (registry)

Parameters
string$registrythe name of the registry to check existence
Returns
bool

Definition at line 329 of file JSONStorage.php.

Here is the caller graph for this function:

JSONStorage::removeData (   $key,
  $registry = null 
)

Removes data from a key in the registry

Parameters
string$keythe key name that holds the data to remove
null$registrythe registry name
Returns
bool true if successful, false otherwise

Definition at line 276 of file JSONStorage.php.

Here is the call graph for this function:

JSONStorage::removeRegistry (   $registry)

Remove an existing collection and all associated data

Parameters
string$registrythe name of the registry to remove
Returns
bool

Definition at line 358 of file JSONStorage.php.

Here is the call graph for this function:

JSONStorage::save ( )

Saves registry data to the file

Definition at line 214 of file JSONStorage.php.

Here is the call graph for this function:

JSONStorage::setData (   $key,
  $data,
  $registry = null 
)

Saves data to the registry

Parameters
string$keythe name of the key that will hold the data
array$datathe data to save
null$registrythe name of the registry
Returns
bool

Definition at line 234 of file JSONStorage.php.

Here is the call graph for this function:

JSONStorage::setFile (   $file)

Property set file

Parameters
string$filethe filename to save the registry to

Definition at line 158 of file JSONStorage.php.

Here is the caller graph for this function:

JSONStorage::setPath (   $path)

Property set path

Parameters
string$paththe full path of the directory with read/write access to save the registry file to
Returns
bool
Exceptions
Exception

Definition at line 135 of file JSONStorage.php.

Here is the caller graph for this function:

JSONStorage::verify ( )

Verifies data integrity

Returns
bool

Definition at line 176 of file JSONStorage.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

JSONStorage::$data
protected
Initial value:
array(
self::META => array(
"updated" => "",
"hash" => ""
),
self::REGISTRY => array(
"default" => array(
"foo" => "bar"
)
)
)

Definition at line 63 of file JSONStorage.php.

JSONStorage::$default = "default"
protected

Definition at line 58 of file JSONStorage.php.

JSONStorage::$dirty = false
protected

Definition at line 53 of file JSONStorage.php.

JSONStorage::$filename = 'registry.json'
protected

Definition at line 42 of file JSONStorage.php.

JSONStorage::$path
protected

Definition at line 48 of file JSONStorage.php.

const JSONStorage::META = 'meta'

const string the key to keep value information

Definition at line 32 of file JSONStorage.php.

const JSONStorage::REGISTRY = 'registry'

const string the key of the registry

Definition at line 37 of file JSONStorage.php.


The documentation for this class was generated from the following file: