Solstice::State::Memory - An interface to some global memory where the all of the state information is stored.


Solstice documentation Contained in the Solstice distribution.

Index


Code Index:

NAME

Top

Solstice::State::Memory - An interface to some global memory where the all of the state information is stored.

SYNOPSIS

Top

  use Solstice::State::Memory;

  my $state_service = new Solstice::State::Memory;

DESCRIPTION

Top

All of the states, pageflows, and remotes are stored in one place -- right here.

Superclass

Solstice::Service::Memory

Methods

new()

Constructor.

setMachine($state)

Sets the state machine.

getMachine()

Gets the state machine.

setLastParsedTime($pageflow_file, $time)

Sets the timestamp for the last time a pageflow file was parsed.

requiresParsing($pageflow_file)

Gets whether the pageflow file needs to be parsed (i.e., been changed since the last time it was parsed).

Modules Used

Solstice::Service::Memory.

AUTHOR

Top

Catalyst Group, <catalyst@u.washington.edu>

VERSION

Top

$Revision: 3364 $

COPYRIGHT

Top


Solstice documentation Contained in the Solstice distribution.
package Solstice::State::Memory;

# $Id: Memory.pm 3364 2006-05-05 07:18:21Z mcrawfor $

use 5.006_000;
use strict;
use warnings;

use base qw(Solstice::Service::Memory);

use File::stat;

our ($VERSION) = ('$Revision: 3364 $' =~ /^\$Revision:\s*([\d.]*)/);

sub new {
    my $obj = shift;
    my $self = $obj->SUPER::new(@_);
    return $self;
}


sub setMachine {
    my ($self, $state_machine) = @_;
    $self->setValue('stateMachine', $state_machine);
}


sub getMachine {
    my ($self) = @_;
    return $self->getValue('stateMachine');
}


sub setLastParsedTime {
    my ($self, $pageflow_file, $time) = @_;
    $self->setValue('last_parsed_time_'.$pageflow_file, $time);
}


sub requiresParsing {
    my ($self, $pageflow_file) = @_;
    my $file_info = stat($pageflow_file);
    my $last_modified_time = $file_info->mtime;
    my $last_parsed_time = $self->getValue('last_parsed_time_'.$pageflow_file) || 0;
    return ($last_modified_time > $last_parsed_time);
}


1;
__END__