API:EPrints/Plugin/Import

From EPrints Documentation
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::Plugin::Import


METHODS

new

$plugin = EPrints::Plugin::Import->new( %params )

Creates a new Import plugin. In addition to those parameters defined by EPrints::Plugin:

  • accept
Array reference of acceptable MIME types. By default includes application/x-eprints-import-XXX, where XXX is the case-insensitive id of the plugin.
  • actions
Array reference of named actions.
  • advertise
Boolean for whether to advertise this plugin to users.
  • arguments
Hash reference of supported arguments/default values.
  • Handler
Reference to a handler class, typically EPrints::CLIProcessor or EPrints::ScreenProcessor.
  • produce
Array reference of object types this plugin can produce.
  • screen
The screen id this plugin uses to provide its import UI.
  • visible
"staff" (staff only) or "all" (anyone).


handler

$handler = $plugin->handler()

Returns the Handler object, which is used for messages and object creation.


set_handler

$plugin->set_handler( $handler )

Set the handler object.


can_input

$ok = $plugin->can_input( TYPE )

Supports user input via:

  • textarea
Paste into a text area.
  • file
Upload a file.
  • form
Calls $plugin->render_input_form() to render an input form.


input_fh

$plugin->input_fh( fh => FILEHANDLE [, %opts] )

Import one or more objects from FILEHANDLE. FILEHANDLE should be set to binary semantics using perlfunc/binmode.

This method should by subclassed.


input_file

$plugin->input_file( filename => FILENAME [, %opts] )

Opens FILENAME for reading, sets binary semantics and calls input_fh to actually read the file.

This method may be subclassed (e.g. see EPrints::Plugin::Import::TextFile).


epdata_to_dataobj

$dataobj = $plugin->epdata_to_dataobj( $epdata, %opts )

Turn $epdata into a EPrints::DataObj using the dataset argument passed in %opts.

Uses the handler object to perform the actual object creation.

When sub-classing you must call epdata_to_dataobj in order to correctly handle the parse-only and test phases during import.


warning

$plugin->warning( $text )

Generate a warning message using $text.


error

$plugin->error( $text )

Generate an error message using $text.


is_tool

$bool = $plugin->is_tool()

Returns true if this plugin is a tool that should be rendered as a link.


COPYRIGHT

Copyright 2000-2012 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/.