# -*-perl-*-  
#
#  This file is part of ACIS software, http://acis.openlib.org/
#
#  Description:
#
#    AMF metadata output plugin for EPrints 2.3.15+
#
#
#  Copyright (C) 2005 Ivan Kurmanov for ACIS project, http://acis.openlib.org/
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License, version 2, as
#  published by the Free Software Foundation.
# 
#  This program 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 General Public License for more details.
# 
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#  ---
#  $Id: amf,v 2.0 2005/12/27 19:47:36 ivan Exp $
#  ---
#
#  INSTALLATION
#
#  To install the plugin, simply copy the file into the plugins/output
#  directory of your EPrints directory, e.g. /opt/eprints2/plugins/output/ .
# 
#




use AMF;
use ACIS::EPrints::MetadataExport::AMF;

EPrints::Plugins::register( 
        id => "output/amf",
        name => "AMF",
        parent => "output/core_output",
        accept => [ 'dataobj/eprint' ],
        mime_type => \&mime_type,
        suffix => \&suffix,
        output_list => \&output_list,
        output_dataobj => \&output_dataobj,
        visible => "all",
);

sub mime_type {
  return "text/xml";
}

sub suffix {
  return ".amf.xml";
}


sub output_list {
  return '';
}

sub output_dataobj {
  my( $plugin, $dataobj ) = @_;

  my $amf =
    ACIS::EPrints::MetadataExport::AMF::get_amf_from_eprint( $dataobj );
  return $amf;
}



