SIAM::Driver::Simple - a reference implementation of SIAM Driver
The driver does not connect to any external databases. Instead, it reads all the SIAM objects from its YAML data file.
The top level element in the data file is expected to be an array of objects that are contained in the SIAM root. The following object classes are expected to be contained by the root object:
SIAM::Contract
SIAM::AccessScope
SIAM::User
Each object definition may have an entry with the key _contains_ which points to an array of contained objects. For example, an SIAM::Contract object is expected to contain one or more SIAM::Service objects.
_contains_
SIAM::Service
All other keys in the object entry define the object attributes. The values are expected to be strings and numbers. The data file should define all the attributes, including object.id and object.class.
object.id
object.class
See the file t/driver-simple.data.yaml in SIAM package distribution for reference.
The following methods are required by SIAM::Documentation::DriverSpec.
SIAM::Documentation::DriverSpec
Instantiates a new driver object. The method expects a driver object and a hash reference containing the attributes, as follows:
datafile
Full path of the YAML data file which defines all the objects for this driver.
logger
Logger configuration as specified in Log::Handler description.
Log::Handler
Reads the YAML data file
Disconnects the driver from its underlying databases.
$status = $driver->fetch_attributes($attrs);
Retrieve the object by ID and populate the hash with object attributes.
$value = $driver->fetch_computable($id, $key);
Retrieve a computable. Return empty string if unsupported.
$ids = $driver->fetch_contained_object_ids($id, 'SIAM::Contract', { 'match_attribute' => [ 'object.access_scope_id', ['SCOPEID01', 'SCOPEID02'] ] } );
Retrieve the contained object IDs.
$classes = $driver->fetch_contained_classes($id);
Returns arrayref with class names.
$attr = $driver->fetch_container($id);
Retrieve the container ID and class.
Returns the last error message.
The following methods are not in the Specification.
Prints a debug message to the logger
Prints an error message to the logger. Also saves the message for errmsg();
SIAM::Driver::Simple->clone_data($siam, $fh, {'SIAM::Contract' => 'CTRT000[12]'});
The method takes a SIAM object, a write file handle, and optional hashref with filters. The method walks through the SIAM data and produces a YAML data file suitable for use by SIAM::Driver::Simple. The method is usable for producing a test data out of productive system.
SIAM::Driver::Simple
The third argument, if present, defines regular expressions to filter the object IDs. Keys are object classes, and values are regular expressions which would be matched against object IDs.
SIAM::Documentation::DriverSpec, YAML, Log::Handler
To install SIAM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SIAM
CPAN shell
perl -MCPAN -e shell install SIAM
For more information on module installation, please visit the detailed CPAN module installation guide.