NAME

SIAM::Driver::Simple - a reference implementation of SIAM Driver

SYNOPSIS

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.

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, with a single exclusion for object.container_id which is calculated automatically.

See the file t/driver-simple.data.yaml in SIAM package distribution for reference.

MANDATORY METHODS

The following methods are required by SIAM::Documentation::DriverSpec.

new

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.

connect

Reads the YAML data file

disconnect

Disconnects the driver from its underlying databases.

fetch_attributes

$status = $driver->fetch_attributes($attrs);

Retrieve the object by ID and populate the hash with object attributes.

fetch_contained_object_ids

$ids = $driver->fetch_contained_object_ids($id, 'SIAM::Contract', {
    'match_attribute' => [ 'object.access_scope_id',
                           ['SCOPEID01', 'SCOPEID02'] ]
   }
  );

Retrieve the contained object IDs.

errmsg

Returns the last error message.

ADDITIONAL METHODS

The following methods are not in the Specification.

debug

Prints a debug message to the logger

error

Prints an error message to the logger. Also saves the message for errmsg();

SEE ALSO

SIAM::Documentation::DriverSpec, YAML, Log::Handler