Difference between revisions of "API:EPrints/Repository"

From EPrints Documentation
Jump to: navigation, search
Line 10: Line 10:
 
'''EPrints::Repository''' - A single eprint repository
 
'''EPrints::Repository''' - A single eprint repository
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 36: Line 36:
 
   $returncode = $repository-&gt;exec( $cmd_id, %map );
 
   $returncode = $repository-&gt;exec( $cmd_id, %map );
 
    
 
    
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 45: Line 45:
 
This class is a single eprint repository with its own configuration, database and website.
 
This class is a single eprint repository with its own configuration, database and website.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 59: Line 59:
 
In a CGI context, creating a handle will link it to an existing  EPrints::Repository object, whereas calling this constructor will  cause all the config files to be read specially for you. (much slower!)
 
In a CGI context, creating a handle will link it to an existing  EPrints::Repository object, whereas calling this constructor will  cause all the config files to be read specially for you. (much slower!)
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 69: Line 69:
 
Returns a list of dataset ids in this repository.
 
Returns a list of dataset ids in this repository.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 79: Line 79:
 
Returns the cached EPrints::DataSet with the given dataset id name.
 
Returns the cached EPrints::DataSet with the given dataset id name.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 95: Line 95:
 
$repository-&gt;get_conf( "stuff" )-&gt;{en}-&gt;{foo}  
 
$repository-&gt;get_conf( "stuff" )-&gt;{en}-&gt;{foo}  
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 105: Line 105:
 
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.
 
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.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 115: Line 115:
 
Calls the subroutine named $cmd from the configuration perl modules for this repository with the given params and returns the result.
 
Calls the subroutine named $cmd from the configuration perl modules for this repository with the given params and returns the result.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 125: Line 125:
 
Return true if the given subroutine exists in this repository's config package.
 
Return true if the given subroutine exists in this repository's config package.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 135: Line 135:
 
Returns the id string of this repository.
 
Returns the id string of this repository.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 145: Line 145:
 
Executes a system command. $cmd_id is the id of the command as set in SystemSettings and %map contains a list of things to "fill in the blanks" in the invocation line in SystemSettings.  
 
Executes a system command. $cmd_id is the id of the command as set in SystemSettings and %map contains a list of things to "fill in the blanks" in the invocation line in SystemSettings.  
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->

Revision as of 14:03, 24 August 2009


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 - A single eprint repository

User Comments


SYNOPSIS

 $repository = $handle->get_repository;
 
 # without a $handle available
 $repository = EPrints::Repository->new( $id, [$noxml] );
 
 $id = $repository->get_id;
 $dataset = $repository->get_dataset( $setname );
 
 $repository->log( $msg );
 
 $confitem = $repository->get_conf( $key, [@subkeys] );
 
 # calling subtroutines in the config  
 $boolean = $repository->can_call( @cmd_conf_path );
 $result = $repository->call( $cmd, @params );
 
 # calling external commands
 $returncode = $repository->exec( $cmd_id, %map );
 

User Comments


DESCRIPTION

This class is a single eprint repository with its own configuration, database and website.

User Comments


$repository = EPrints::Repository->new( $id, [$noxml] )

Returns the repository with the given repository ID. If $noxml is specified then it skips loading the XML based configuration files (this is needed when creating an repository as it first has to create the DTD files, and if it can't start you have a catch 22 situtation).

This constructor should only be used if you don't want to create a EPrints::Handle for some reason.

In a CGI context, creating a handle will link it to an existing EPrints::Repository object, whereas calling this constructor will cause all the config files to be read specially for you. (much slower!)

User Comments


@dataset_ids = $repository->get_dataset_ids()

Returns a list of dataset ids in this repository.

User Comments


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

Returns the cached EPrints::DataSet with the given dataset id name.

User Comments


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

Returns a named configuration setting.

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

is equivalent to

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

User Comments


$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


$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


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

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

User Comments


$id = $repository->get_id

Returns the id string of this repository.

User Comments


$returncode = $repository->exec( $cmd_id, %map )

Executes a system command. $cmd_id is the id of the command as set in SystemSettings and %map contains a list of things to "fill in the blanks" in the invocation line in SystemSettings.

User Comments