API:EPrints/DataObj/EPM

From EPrints Documentation
Revision as of 09:57, 22 January 2013 by Tdb01r (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::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/.