Difference between revisions of "API:EPrints/Repository"

From EPrints Documentation
Jump to: navigation, search
(New page: <!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost. -...)
 
(Removing all content from page)
Line 1: Line 1:
<!-- Pod2Wiki=_preamble_
 
This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost.
 
-->{{Pod2Wiki}}{{API:Source|file=EPrints/Repository.pm|package_name=EPrints::Repository}}[[Category:API|Repository]]<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_name -->=NAME=
 
'''EPrints::Repository''' - A single eprint repository
 
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_description -->=DESCRIPTION=
 
This class is a single eprint repository with its own configuration, database and website.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_new -->==new==
 
 
  $repository = EPrints::Repository-&gt;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).
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_new_from_request -->==new_from_request==
 
 
  $repository = EPrints::Repository-&gt;new_from_request( $request )
 
 
This creates a new repository object. It looks at the given Apache request object and decides which repository to load based on the  value of the PerlVar "EPrints_ArchiveID".
 
 
Aborts with an error if this is not possible.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_language -->==get_language==
 
 
  $language = $repository-&gt;get_language( [$langid] )
 
 
Returns the EPrints::Language for the requested language id (or the default for this repository if $langid is not specified).
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_template_parts -->==get_template_parts==
 
 
  $template = $repository-&gt;get_template_parts( $langid, [$template_id] )
 
 
Returns an array of utf-8 strings alternating between XML and the id of a pin to replace. This is used for the faster template construction.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_template -->==get_template==
 
 
  $template = $repository-&gt;get_template( $langid, [$template_id] )
 
 
Returns the DOM document which is the webpage template for the given language. Do not modify the template without cloning it first.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_types -->==get_types==
 
 
  @type_ids = $repository-&gt;get_types( $type_set )
 
 
Return an array of keys for the named set. Comes from  /cfg/types/foo.xml
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_dataset -->==get_dataset==
 
 
  $dataset = $repository-&gt;get_dataset( $setname )
 
 
Returns the cached EPrints::DataSet with the given dataset id name.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_conf -->==get_conf==
 
 
  $confitem = $repository-&gt;get_conf( $key, [@subkeys] )
 
 
Returns a named configuration setting. Probably set in ArchiveConfig.pm
 
 
$repository-&gt;get_conf( "stuff", "en", "foo" )
 
 
is equivalent to
 
 
$repository-&gt;get_conf( "stuff" )-&gt;{en}-&gt;{foo}
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_log -->==log==
 
 
  $repository-&gt;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.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_call -->==call==
 
 
  $result = $repository-&gt;call( $cmd, @params )
 
 
Calls the subroutine named $cmd from the configuration perl modules for this repository with the given params and returns the result.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_can_call -->==can_call==
 
 
  $boolean = $repository-&gt;can_call( @cmd_conf_path )
 
 
Return true if the given subroutine exists in this repository's config package.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_try_call -->==try_call==
 
 
  $result = $repository-&gt;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.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_store_dirs -->==get_store_dirs==
 
 
  @dirs = $repository-&gt;get_store_dirs
 
 
Returns a list of directories available for storing documents. These may well be symlinks to other hard drives.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_store_dir_size -->==get_store_dir_size==
 
 
  $size = $repository-&gt;get_store_dir_size( $dir )
 
 
Returns the current storage (in bytes) used by a given documents dir. $dir should be one of the values returned by $repository-&gt;get_store_dirs.
 
 
This should not be called if disable_df is set in SystemSettings.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_parse_xml -->==parse_xml==
 
 
  $domdocument = $repository-&gt;parse_xml( $file, $no_expand );
 
 
Turns the given $file into a XML DOM document. If $no_expand is true then load &amp;entities; but do not expand them to the values in the DTD.
 
 
This function also sets the path in which the Parser will look for  DTD files to the repository's config directory.
 
 
Returns undef if an error occurs during parsing.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_id -->==get_id==
 
 
  $id = $repository-&gt;get_id
 
 
Returns the id string of this repository.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_exec -->==exec==
 
 
  $returncode = $repository-&gt;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.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_invocation -->==invocation==
 
 
  $commandstring = $repository-&gt;invocation( $cmd_id, %map )
 
 
Finds the invocation for the specified command from SystemSetting and fills in the blanks using %map. Returns a string which may be executed as a system call.
 
 
All arguments are ESCAPED using quotemeta() before being used (i.e. don't pre-escape arguments in %map).
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_field_defaults -->==get_field_defaults==
 
 
  $defaults = $repository-&gt;get_field_defaults( $fieldtype )
 
 
Return the cached default properties for this metadata field type. or undef.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_set_field_defaults -->==set_field_defaults==
 
 
  $repository-&gt;set_field_defaults( $fieldtype, $defaults )
 
 
Cache the default properties for this metadata field type.
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_generate_dtd -->==generate_dtd==
 
 
  $success = $repository-&gt;generate_dtd
 
 
Regenerate the DTD file for each language. This file is used when loading some of the XML files. It contains entities such as &amp;ruler; and &amp;adminemail; which make maintaining the XML files easier.
 
 
The entites in the DTD file are configured by get_entities in the ArchiveConfig.pm module.
 
 
Returns true. Might return false on error (not checking yet).
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_test_config -->==test_config==
 
 
  ( $returncode, $output) = $repository-&gt;test_config
 
 
This runs "epadmin test" as an external script to test if the current configuraion on disk loads OK. This can be used by the web interface to test if changes to config. files may be saved, or not.
 
 
$returncode will be zero if everything seems OK.
 
 
If not, then $output will contain the output of epadmin test
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_undocumented_methods -->=UNDOCUMENTED METHODS=
 
{{API:Undocumented Methods}}<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_can_execute -->==can_execute==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_can_invoke -->==can_invoke==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_check_secure_dirs -->==check_secure_dirs==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_freshen_citation -->==freshen_citation==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_freshen_template -->==freshen_template==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_citation_spec -->==get_citation_spec==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_citation_type -->==get_citation_type==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_plugin_class -->==get_plugin_class==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_plugin_ids -->==get_plugin_ids==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_workflow_config -->==get_workflow_config==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_new_archive_by_id -->==new_archive_by_id==
 
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=_postamble_ --><!-- End of Pod2Wiki -->
 

Revision as of 15:41, 12 August 2009