NAME
Metabase::Gateway - Manage Metabase fact submission
SYNOPSIS
my $mg = Metabase::Gateway->new(
fact_classes => \@valid_fact_classes,
librarian => $librarian,
secret_librarian => $secret_librarian,
);
$mg->handle_submission({
fact => $fact_struct,
submitter => $profile_struct
});
DESCRIPTION
The Metabase::Gateway class manages submissions to the Metabase. It provides fact and submitter validation or authorization before storing new facts in a Metabase.
USAGE
new
my $mg = Metabase::Gateway->new(
fact_classes => \@valid_fact_classes,
librarian => $librarian,
secret_librarian => $secret_librarian,
);
Gateway constructor. Takes three required attributes fact_classes
, librarian
and secret_librarian
. See below for details.
ATTRIBUTES
approved_types
Returns a list of approved fact types. Automatically generated; cannot be initialized. Used for validating submitted facts.
autocreate_profile
A boolean option. If true, if a submission is from an unknown user profile, the profile will be added to the Metabase. If false, an exception will be thrown. Default is false.
fact_classes
Array reference containing a list of valid Metabase::Fact subclasses. Only facts from these classes may be added to the Metabase. Required.
librarian
A librarian object to manage fact data. Required.
secret_librarian
A librarian object to manage user profile data. This is generally kept in a separate data store to isolate user profile facts from public, searchable facts. Required.
METHODS
enqueue
$mg->enqueue( $fact, $profile );
Add a fact from a user (identified by a profile) to the Metabase the gateway is managing. Used internally by handle_submission.
handle_submission
$mg->handle_submission({
fact => $fact_struct,
submitter => $profile_struct
});
Extract a fact and profile from a deserialized data structure and add it to the Metabase. The fact and profile structs are generated from the as_struct
method.
BUGS
Please report any bugs or feature using the CPAN Request Tracker. Bugs can be submitted through the web interface at http://rt.cpan.org/Dist/Display.html?Queue=Metabase
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
David A. Golden (DAGOLDEN)
Ricardo J. B. Signes (RJBS)
COPYRIGHT AND LICENSE
Portions copyright (c) 2008-2009 by David A. Golden
Portions copyright (c) 2008-2009 by Ricardo J. B. Signes
Licensed under terms of Perl itself (the "License"). You may not use this file except in compliance with the License. A copy of the License was distributed with this file or you may obtain a copy of the License from http://dev.perl.org/licenses/
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.