API:EPrints/Repository

From EPrints Documentation
Revision as of 16:59, 31 December 2010 by Pm705 (talk | contribs)
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::Repository - Single connection to a specific EPrints Repository

User Comments


DESCRIPTION

This module is really a Repository, REALLY. The name is up to date and everything :-)

EPrints::Repository represents a connection to the EPrints system. It connects to a single EPrints repository, and the database used by that repository.

Each Repository has a "current language". If you are running in a multilingual mode, this is used by the HTML rendering functions to choose what language to return text in.

The Repository object also knows about the current apache connection, if there is one, including the CGI parameters.

If the connection requires a username and password then it can also give access to the EPrints::DataObj::User object representing the user who is causing this request. See current_user().

The Repository object also provides access to the XHTML class which contains many methods for creating XHTML results which can be returned via the web interface.

User Comments


METHODS

User Comments


query

$query = $repository->query

Return the CGI object describing the current HTTP query, or undefined if this isn't a CGI script.

User Comments


xml

$xml = $repo->xml

Return an XML object for working with XML.

User Comments


xhtml

$xhtml = $repo->xhtml

Return an XHTML object for working with XHTML.

User Comments


eprint

$eprint = $repository->eprint( $eprint_id );

Return the eprint with the given ID, or undef.

User Comments


user

$user = $repository->user( $user_id );

Return the user with the given ID, or undef.

User Comments


user_by_username

$user = $repository->user_by_username( $username );

Return the user with the given username, or undef.

User Comments


user_by_email

$user = $repository->user_by_email( $email );

Return the user with the given email, or undef.

User Comments


dataset

$dataset = $repository->dataset( $setname )

Return a given dataset or undef if it doesn't exist.

User Comments


config

$confitem = $repository->config( $key, [@subkeys] )

Returns a named configuration setting including those defined in archvies/<archive_id>/cfg/cfg.d/

$repository->config( "stuff", "en", "foo" )

is equivalent to

$repository->config( "stuff" )->{en}->{foo}

User Comments


log

$repository->log( $msg )

Calls the log method from ArchiveConfig.pm for this repository with the given parameters. Basically logs the comments wherever the site admin wants them to go. Printed to STDERR by default.

User Comments


call

$result = $repository->call( $cmd, @params )

Calls the subroutine named $cmd from the configuration perl modules for this repository with the given params and returns the result.

User Comments


can_call

$boolean = $repository->can_call( @cmd_conf_path )

Return true if the given subroutine exists in this repository's config package.

User Comments


try_call

$result = $repository->try_call( $cmd, @params )

Calls the subroutine named $cmd from the configuration perl modules for this repository with the given params and returns the result.

If the subroutine does not exist then quietly returns undef.

This is used to call deprecated callback subroutines.

User Comments


get_id

$id = $repository->get_id 

Returns the id string of this repository.

User Comments


Accessor Methods

User Comments


param

$value or @values = $repository->param( $name )

Passes through to CGI.pm param method.

$value = $repository->param( $name ): returns the value of CGI parameter $name.

$value = $repository->param( $name ): returns the value of CGI parameter $name.

@values = $repository->param: returns an array of the names of all the CGI parameters in the current request.

User Comments


current_user

$user = $repository->current_user

Return the current EPrints::DataObj::User for this session.

Return undef if there isn't one.

User Comments