API Docs

Invenio 3 module to connect Invenio to Archivematica.

class invenio_archivematica.ext.InvenioArchivematica(app=None)[source]

Invenio-Archivematica extension.

Extension initialization.

init_app(app)[source]

Flask application initialization.

init_config(app)[source]

Initialize configuration.

init_listeners()[source]

Register the listener to invenio_sipstore’s signals.

API

API for Invenio 3 module to connect Invenio to Archivematica.

invenio_archivematica.api.change_status_func = {<ArchiveStatus.FAILED: 'FAILED'>: <function fail_transfer>, <ArchiveStatus.WAITING: 'WAITING'>: <function start_transfer>, <ArchiveStatus.IGNORED: 'IGNORED'>: None, <ArchiveStatus.DELETED: 'DELETED'>: None, <ArchiveStatus.NEW: 'NEW'>: <function start_transfer>, <ArchiveStatus.REGISTERED: 'REGISTERED'>: <function finish_transfer>, <ArchiveStatus.PROCESSING_AIP: 'PROCESSING_AIP'>: <function process_aip>, <ArchiveStatus.PROCESSING_TRANSFER: 'PROCESSING_TRANSFER'>: <function process_transfer>}

Dictionary that maps status to functions used to change the status.

invenio_archivematica.api.fail_transfer(sip, accession_id='', archivematica_id=None)[source]

Fail the archive process for a sip.

Fail the transfer of the sip in asynchronous mode. See invenio_archivematica.tasks

Parameters:
  • sip (invenio_sipstore.api.SIP) – the sip to archive
  • accession_id (str) – the accession_id
  • archivematica_id (str) – the ID of the created AIP in Archivematica
invenio_archivematica.api.finish_transfer(sip, accession_id='', archivematica_id=None)[source]

Finish the archive process for a sip.

Finish the transfer of the sip in asynchronous mode. See invenio_archivematica.tasks

Parameters:
  • sip (invenio_sipstore.api.SIP) – the sip to archive
  • accession_id (str) – the accession_id
  • archivematica_id (str) – the ID of the created AIP in Archivematica
invenio_archivematica.api.process_aip(sip, accession_id='', archivematica_id=None)[source]

Create the archive for a sip.

Process the aip of the sip in asynchronous mode. See invenio_archivematica.tasks

Parameters:
  • sip (invenio_sipstore.api.SIP) – the sip to archive
  • accession_id (str) – the accession_id
  • archivematica_id (str) – the ID of the AIP in Archivematica
invenio_archivematica.api.process_transfer(sip, accession_id='', archivematica_id=None)[source]

Create the archive for a sip.

Process the transfer of the sip in asynchronous mode. See invenio_archivematica.tasks

Parameters:
  • sip (invenio_sipstore.api.SIP) – the sip to archive
  • accession_id (str) – the accession_id
  • archivematica_id (str) – the ID of the AIP in Archivematica
invenio_archivematica.api.start_transfer(sip, accession_id, archivematica_id=None)[source]

Start the archive process for a sip.

Start the transfer of the sip in asynchronous mode. See invenio_archivematica.tasks

Parameters:

Models

Archive models.

class invenio_archivematica.models.Archive(**kwargs)[source]

Registers the status of a sip: archived or not.

The status is a member of invenio_archivematica.models.ArchiveStatus.

A sip can have only one archive, and an archive applies to only one sip.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

accession_id

Accessioned ID of the AIP in Archivematica.

archivematica_id

ID of the AIP in Archivematica.

classmethod create(sip, accession_id=None, archivematica_id=None)[source]

Create a new Archive object and add it to the session.

The new Archive object will have a NEW status

Parameters:
  • sip (invenio_sipstore.models.SIP) – the sip attached to the archive
  • accession_id (str) – the accession ID of the AIP
  • archivematica_id (str) – The UUID of the AIP
classmethod get_from_accession_id(accession_id)[source]

Return the Archive object associated to the given accession_id.

If the accession_id is not in the table, it returns None.

Parameters:accession_id (str) – the accession_id of the Archive object.
Return type:invenio_archivematica.models.Archive or None
classmethod get_from_sip(uuid)[source]

Return the Archive object associated to the given sip.

It tries to get the Archive object associated to the sip. If it exists, it returns it, otherwise it returns None.

Parameters:uuid (str) – the uuid of the sip
Return type:invenio_archivematica.models.Archive or None
id

ID of the Archive object.

sip

Relationship with SIP.

sip_id

SIP related with the Archive.

status

Status of the archive.

class invenio_archivematica.models.ArchiveStatus[source]

Constants for possible status of any given Archive object.

DELETED = 'DELETED'

The archive has been deleted.

FAILED = 'FAILED'

The sip has not been archived because of an error.

IGNORED = 'IGNORED'

The sip won’t be archived.

NEW = 'NEW'

The sip has been created or updated, but not yet archived.

PROCESSING_AIP = 'PROCESSING_AIP'

The sip is currently being processed as an AIP (final step).

PROCESSING_TRANSFER = 'PROCESSING_TRANSFER'

The sip is currently being processed as a transfer (first step).

REGISTERED = 'REGISTERED'

The sip has been archived.

WAITING = 'WAITING'

The sip has been transfered, and is waiting for processing.

title

Return human readable title.

invenio_archivematica.models.status_converter(status, aip_processing=False)[source]

Convert a status given by Archivematica into an ArchiveStatus.

Parameters:
  • status (str) – a status returned by an Archivematica API
  • aip_processing (bool) – tells if it is processing the AIP or the transfer

Views

Invenio-Archivematica views.