Difference between revisions of "API:EPrints/DataObj/EPM"
Line 8: | Line 8: | ||
'''EPrints::DataObj::EPM''' - Class representing an EPrints Package | '''EPrints::DataObj::EPM''' - Class representing an EPrints Package | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | |||
<!-- Pod2Wiki=head_description --> | <!-- Pod2Wiki=head_description --> | ||
==DESCRIPTION== | ==DESCRIPTION== | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | |||
<!-- Pod2Wiki=head_system_metadata --> | <!-- Pod2Wiki=head_system_metadata --> | ||
==SYSTEM METADATA== | ==SYSTEM METADATA== | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | |||
<!-- Pod2Wiki=head_methods --> | <!-- Pod2Wiki=head_methods --> | ||
==METHODS== | ==METHODS== | ||
− | < | + | <!-- Pod2Wiki=head_get_system_field_info --> |
− | + | ===get_system_field_info=== | |
− | |||
− | |||
− | < | + | <source lang="perl">$metadata = EPrints::DataObj::EPM->get_system_field_info |
− | |||
− | |||
− | |||
− | + | </source> | |
Return an array describing the system metadata of the EPrint dataset. | Return an array describing the system metadata of the EPrint dataset. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_map --> | |
− | <!-- Pod2Wiki= | ||
===map=== | ===map=== | ||
− | + | <source lang="perl">EPrints::DataObj::EPM->map( $repo, sub { ... }, $ctx ) | |
+ | |||
+ | </source> | ||
Apply a function over all installed EPMs. | Apply a function over all installed EPMs. | ||
− | + | <pre> sub { | |
my( $repo, $dataset, $epm [, $ctx ] ) = @_; | my( $repo, $dataset, $epm [, $ctx ] ) = @_; | ||
− | } | + | }</pre> |
− | + | ||
This loads the EPM index files only. | This loads the EPM index files only. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_new --> | |
− | <!-- Pod2Wiki= | ||
===new=== | ===new=== | ||
− | + | <source lang="perl">$epm = EPrints::DataObj::EPM->new( $repo, $id ) | |
+ | |||
+ | </source> | ||
Returns a new object representing the installed package $id. | Returns a new object representing the installed package $id. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_new_from_manifest --> | |
− | <!-- Pod2Wiki= | ||
===new_from_manifest=== | ===new_from_manifest=== | ||
− | + | <source lang="perl">$epm = EPrint::DataObj::EPM->new_from_manifest( $repo, $epdata [, @manifest ] ) | |
+ | |||
+ | </source> | ||
Makes and returns a new EPM object based on a manifest of installable files. | Makes and returns a new EPM object based on a manifest of installable files. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_commit --> | |
− | <!-- Pod2Wiki= | ||
===commit=== | ===commit=== | ||
− | + | <source lang="perl">$epm->commit | |
+ | |||
+ | </source> | ||
Commit any changes to the installed .epm, .epmi files. | Commit any changes to the installed .epm, .epmi files. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_rebuild --> | |
− | <!-- Pod2Wiki= | ||
===rebuild=== | ===rebuild=== | ||
− | + | <source lang="perl">$epm->rebuild | |
+ | |||
+ | </source> | ||
Reload all of the installed files (regenerating hashes if necessary). | Reload all of the installed files (regenerating hashes if necessary). | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_version --> | |
− | <!-- Pod2Wiki= | ||
===version=== | ===version=== | ||
− | + | <source lang="perl">$v = $epm->version | |
+ | |||
+ | </source> | ||
Returns a stringified version suitable for string gt/lt matching. | Returns a stringified version suitable for string gt/lt matching. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_is_enabled --> | |
− | <!-- Pod2Wiki= | ||
===is_enabled=== | ===is_enabled=== | ||
− | + | <source lang="perl">$bool = $epm->is_enabled | |
+ | |||
+ | </source> | ||
Returns true if the $epm is enabled for the current repository. | Returns true if the $epm is enabled for the current repository. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_repositories --> | |
− | <!-- Pod2Wiki= | ||
===repositories=== | ===repositories=== | ||
− | + | <source lang="perl">@repoids = $epm->repositories | |
+ | |||
+ | </source> | ||
Returns a list of repository ids this $epm is enabled in. | Returns a list of repository ids this $epm is enabled in. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_package_filename --> | |
− | <!-- Pod2Wiki= | ||
===package_filename=== | ===package_filename=== | ||
− | + | <source lang="perl">$filename = $epm->package_filename() | |
+ | |||
+ | </source> | ||
Returns the complete package filename. | Returns the complete package filename. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_epm_dir --> | |
− | <!-- Pod2Wiki= | ||
===epm_dir=== | ===epm_dir=== | ||
− | + | <source lang="perl">$dir = $epm->epm_dir | |
+ | |||
+ | </source> | ||
Path to the epm directory for this $epm. | Path to the epm directory for this $epm. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_installed_files --> | |
− | <!-- Pod2Wiki= | ||
===installed_files=== | ===installed_files=== | ||
− | + | <source lang="perl">@files = $epm->installed_files() | |
+ | |||
+ | </source> | ||
Returns a list of installed files as [[API:EPrints/DataObj/File|EPrints::DataObj::File]]. | Returns a list of installed files as [[API:EPrints/DataObj/File|EPrints::DataObj::File]]. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_repository_files --> | |
− | <!-- Pod2Wiki= | ||
===repository_files=== | ===repository_files=== | ||
− | + | <source lang="perl">@files = $epm->repository_files() | |
+ | |||
+ | </source> | ||
Returns the list of configuration files used to enable/configure an $epm. | Returns the list of configuration files used to enable/configure an $epm. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_control_screen --> | |
− | <!-- Pod2Wiki= | ||
===control_screen=== | ===control_screen=== | ||
− | + | <source lang="perl">$screen = $epm->control_screen( %params ) | |
+ | |||
+ | </source> | ||
Returns the control screen for this $epm. %params are passed to the plugin constructor. | Returns the control screen for this $epm. %params are passed to the plugin constructor. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_serialise --> | |
− | <!-- Pod2Wiki= | ||
===serialise=== | ===serialise=== | ||
− | + | <source lang="perl">$epm->serialise( $fh, [ FILES ] ) | |
+ | |||
+ | </source> | ||
Serialises this EPM to the open file handle $fh. If FILES is true file contents are included. | Serialises this EPM to the open file handle $fh. If FILES is true file contents are included. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_install --> | |
− | <!-- Pod2Wiki= | ||
===install=== | ===install=== | ||
− | + | <source lang="perl">$ok = $epm->install( HANDLER [, FORCE ] ) | |
+ | |||
+ | </source> | ||
Install the EPM into the system. HANDLER is a [[API:EPrints/CLIProcessor|EPrints::CLIProcessor]] or [[API:EPrints/ScreenProcessor|EPrints::ScreenProcessor]], used for reporting errors. | Install the EPM into the system. HANDLER is a [[API:EPrints/CLIProcessor|EPrints::CLIProcessor]] or [[API:EPrints/ScreenProcessor|EPrints::ScreenProcessor]], used for reporting errors. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_uninstall --> | |
− | <!-- Pod2Wiki= | ||
===uninstall=== | ===uninstall=== | ||
− | + | <source lang="perl">$ok = $epm->uninstall( HANDLER [, FORCE ] ) | |
+ | |||
+ | </source> | ||
Remove the EPM from the system. HANDLER is a [[API:EPrints/CLIProcessor|EPrints::CLIProcessor]] or [[API:EPrints/ScreenProcessor|EPrints::ScreenProcessor]], used for reporting errors. | Remove the EPM from the system. HANDLER is a [[API:EPrints/CLIProcessor|EPrints::CLIProcessor]] or [[API:EPrints/ScreenProcessor|EPrints::ScreenProcessor]], used for reporting errors. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_disable_unchanged --> | |
− | <!-- Pod2Wiki= | ||
===disable_unchanged=== | ===disable_unchanged=== | ||
− | + | <source lang="perl">$ok = $epm->disable_unchanged() | |
+ | |||
+ | </source> | ||
Remove unchanged files from the repository directory. This allows a new version of the EPM to be installed/enabled. | Remove unchanged files from the repository directory. This allows a new version of the EPM to be installed/enabled. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_enable --> | |
− | <!-- Pod2Wiki= | ||
===enable=== | ===enable=== | ||
− | + | <source lang="perl">$ok = $epm->enable( $handler ) | |
+ | |||
+ | </source> | ||
Enables the $epm for the current repository. | Enables the $epm for the current repository. | ||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | |||
<!-- Pod2Wiki=head_utility_methods --> | <!-- Pod2Wiki=head_utility_methods --> | ||
===Utility Methods=== | ===Utility Methods=== | ||
− | + | $conf = $epm->current_counters() | |
− | + | $conf = $epm->current_datasets() | |
− | + | $ok = $epm->update_counters( $conf ) | |
+ | $ok = $epm->update_datasets( $conf ) | ||
+ | Update the datasets following any configuration changes made by the extension on being enabled. $conf should be retrieved before enabling by using [[API:EPrints/DataObj/EPM#current_datasets|current_datasets]]. | ||
+ | $ok = $epm->publish( $handler, $base_url, %opts ) | ||
+ | Publish this EPM to a remote system using SWORD. | ||
− | + | $base_url is the URL of the SWORD endpoint or a page containing a SWORD <link>. | |
− | |||
− | |||
− | |||
− | + | Options: | |
− | |||
− | |||
− | |||
+ | <pre> username - username for Basic auth | ||
+ | password - password for Basic auth</pre> | ||
− | + | $epm->add_to_xml( $dest, $src ) | |
− | + | Add this package's XML $src to $dest XML. Useful for workflows and citations. | |
− | |||
− | |||
− | + | $src may have these additional attributes on elements: | |
− | |||
− | |||
− | |||
+ | * operation = "replace" | "disable" | *"merge" | ||
+ | : Where replace will replace the default element, disable will disable it and merge will merge the new branch with the old. | ||
− | + | $epm->remove_from_xml( $dest ) | |
− | + | Remove this package's extensions from $dest XML. | |
− | |||
− | |||
− | |||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=head_copyright --> | |
− | <!-- Pod2Wiki= | + | ==COPYRIGHT== |
− | ==== | + | Copyright 2000-2011 University of Southampton. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | This file is part of EPrints http://www.eprints.org/. | ||
− | + | EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | |
− | |||
− | |||
− | |||
− | + | EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | |
− | |||
− | + | You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
− | + | <!-- Pod2Wiki=_postamble_ --> | |
− | <!-- Pod2Wiki= | ||
− | |||
− | |||
− | |||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 09:57, 22 January 2013
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
- 1 NAME
- 2 DESCRIPTION
- 3 SYSTEM METADATA
- 4 METHODS
- 4.1 get_system_field_info
- 4.2 map
- 4.3 new
- 4.4 new_from_manifest
- 4.5 commit
- 4.6 rebuild
- 4.7 version
- 4.8 is_enabled
- 4.9 repositories
- 4.10 package_filename
- 4.11 epm_dir
- 4.12 installed_files
- 4.13 repository_files
- 4.14 control_screen
- 4.15 serialise
- 4.16 install
- 4.17 uninstall
- 4.18 disable_unchanged
- 4.19 enable
- 4.20 Utility Methods
- 5 COPYRIGHT
NAME
EPrints::DataObj::EPM - Class representing an EPrints Package
DESCRIPTION
SYSTEM METADATA
METHODS
get_system_field_info
$metadata = EPrints::DataObj::EPM->get_system_field_info
Return an array describing the system metadata of the EPrint dataset.
map
EPrints::DataObj::EPM->map( $repo, sub { ... }, $ctx )
Apply a function over all installed EPMs.
sub { my( $repo, $dataset, $epm [, $ctx ] ) = @_; }
This loads the EPM index files only.
new
$epm = EPrints::DataObj::EPM->new( $repo, $id )
Returns a new object representing the installed package $id.
new_from_manifest
$epm = EPrint::DataObj::EPM->new_from_manifest( $repo, $epdata [, @manifest ] )
Makes and returns a new EPM object based on a manifest of installable files.
commit
$epm->commit
Commit any changes to the installed .epm, .epmi files.
rebuild
$epm->rebuild
Reload all of the installed files (regenerating hashes if necessary).
version
$v = $epm->version
Returns a stringified version suitable for string gt/lt matching.
is_enabled
$bool = $epm->is_enabled
Returns true if the $epm is enabled for the current repository.
repositories
@repoids = $epm->repositories
Returns a list of repository ids this $epm is enabled in.
package_filename
$filename = $epm->package_filename()
Returns the complete package filename.
epm_dir
$dir = $epm->epm_dir
Path to the epm directory for this $epm.
installed_files
@files = $epm->installed_files()
Returns a list of installed files as EPrints::DataObj::File.
repository_files
@files = $epm->repository_files()
Returns the list of configuration files used to enable/configure an $epm.
control_screen
$screen = $epm->control_screen( %params )
Returns the control screen for this $epm. %params are passed to the plugin constructor.
serialise
$epm->serialise( $fh, [ FILES ] )
Serialises this EPM to the open file handle $fh. If FILES is true file contents are included.
install
$ok = $epm->install( HANDLER [, FORCE ] )
Install the EPM into the system. HANDLER is a EPrints::CLIProcessor or EPrints::ScreenProcessor, used for reporting errors.
uninstall
$ok = $epm->uninstall( HANDLER [, FORCE ] )
Remove the EPM from the system. HANDLER is a EPrints::CLIProcessor or EPrints::ScreenProcessor, used for reporting errors.
disable_unchanged
$ok = $epm->disable_unchanged()
Remove unchanged files from the repository directory. This allows a new version of the EPM to be installed/enabled.
enable
$ok = $epm->enable( $handler )
Enables the $epm for the current repository.
Utility Methods
$conf = $epm->current_counters() $conf = $epm->current_datasets() $ok = $epm->update_counters( $conf ) $ok = $epm->update_datasets( $conf )
Update the datasets following any configuration changes made by the extension on being enabled. $conf should be retrieved before enabling by using current_datasets.
$ok = $epm->publish( $handler, $base_url, %opts )
Publish this EPM to a remote system using SWORD.
$base_url is the URL of the SWORD endpoint or a page containing a SWORD <link>.
Options:
username - username for Basic auth password - password for Basic auth
$epm->add_to_xml( $dest, $src )
Add this package's XML $src to $dest XML. Useful for workflows and citations.
$src may have these additional attributes on elements:
- operation = "replace" | "disable" | *"merge"
- Where replace will replace the default element, disable will disable it and merge will merge the new branch with the old.
$epm->remove_from_xml( $dest )
Remove this package's extensions from $dest XML.
COPYRIGHT
Copyright 2000-2011 University of Southampton.
This file is part of EPrints http://www.eprints.org/.
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.