org.dspace.content.packager
Class AbstractIMSCPIngester

java.lang.Object
  extended by org.dspace.content.packager.AbstractIMSCPIngester
All Implemented Interfaces:
PackageIngester
Direct Known Subclasses:
OCWIMSCPIngester

public abstract class AbstractIMSCPIngester
extends Object
implements PackageIngester

Base class for package ingester of the IMS Content Package spec, or IMSCP.

For more information about IMSCP, see IMS Global Learning Consortium, http://www.imsglobal.org/content/packaging/

This is a generic packager framework intended to be subclassed to create ingesters for more specific IMSCP "profiles". IMSCP is an abstract and flexible framework that can encompass many different kinds of metadata and inner package structures each with its own expectations and restrictions.

Version:
$Revision$
Author:
Larry Stone
See Also:
IMSCPManifest

Constructor Summary
AbstractIMSCPIngester()
           
 
Method Summary
abstract  void addLicense(Context context, Collection collection, Item item, IMSCPManifest manifest, String license)
          Add license(s) to Item based on contents of manifest and other policies.
abstract  void checkPackageFiles(Set packageFiles, Set missingFiles, IMSCPManifest manifest)
          Hook for subclass to modify the test of the package's integrity, and add other tests.
abstract  void crosswalk(Context context, Item item, IMSCPManifest manifest, boolean validate)
          Crosswalk item's descriptive (and other Item-level) metadata from the manifest.
abstract  void finishItem(Context context, Item item, Collection collection)
          Hook for final "finishing" operations on the new Item.
abstract  Class getManifestClass()
          Get flavor of manifest used by this ingester.
 WorkspaceItem ingest(Context context, Collection collection, InputStream pkg, PackageParameters params, String license)
          Create a new DSpace item out of an IMSCP content package.
 Item replace(Context ctx, Item item, InputStream pckage, PackageParameters params)
          XXX FIXME Replace is not implemented yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractIMSCPIngester

public AbstractIMSCPIngester()
Method Detail

ingest

public WorkspaceItem ingest(Context context,
                            Collection collection,
                            InputStream pkg,
                            PackageParameters params,
                            String license)
                     throws PackageException,
                            CrosswalkException,
                            AuthorizeException,
                            SQLException,
                            IOException
Create a new DSpace item out of an IMSCP content package. All contents are dictated by the IMSCP manifest. Package is a ZIP archive, all files relative to top level and the manifest (as per spec) in imsmanifest.xml.

Specified by:
ingest in interface PackageIngester
Parameters:
context - - DSpace context.
collection - - collection under which to create new item.
pkg - - input stream containing package to ingest.
license - - may be null, which takes default license.
Returns:
workspace item created by ingest.
Throws:
PackageValidationException - if package is unacceptable or there is a fatal error turning it into an Item.
PackageException
CrosswalkException
AuthorizeException
SQLException
IOException

replace

public Item replace(Context ctx,
                    Item item,
                    InputStream pckage,
                    PackageParameters params)
             throws PackageException,
                    UnsupportedOperationException,
                    CrosswalkException,
                    AuthorizeException,
                    SQLException,
                    IOException
XXX FIXME Replace is not implemented yet.

Specified by:
replace in interface PackageIngester
Throws:
PackageException
UnsupportedOperationException
CrosswalkException
AuthorizeException
SQLException
IOException

getManifestClass

public abstract Class getManifestClass()
Get flavor of manifest used by this ingester.


checkPackageFiles

public abstract void checkPackageFiles(Set packageFiles,
                                       Set missingFiles,
                                       IMSCPManifest manifest)
                                throws PackageValidationException,
                                       CrosswalkException
Hook for subclass to modify the test of the package's integrity, and add other tests. E.g. evaluate a PGP signature of the manifest in a separate file.

The packageFiles contains "extra" files that were in the package but were not referenced by the IMSCP manifest. The implementation of this method should look for any "extra" files uses (e.g. a checksum or cryptographic signature for the manifest itself) and remove them from the Set.

The missingFiles set is for any files referenced by the manifest but not found in the package. The implementation can check it for "false positives", or add other missing files it knows of.

If either of the Sets missingFiles or packageFiles is not empty, the ingest will fail.

Parameters:
packageFiles - files in package but not referenced by manifest.
missingFiles - files referenced by manifest but not in package
Throws:
PackageValidationException
CrosswalkException

crosswalk

public abstract void crosswalk(Context context,
                               Item item,
                               IMSCPManifest manifest,
                               boolean validate)
                        throws PackageException,
                               CrosswalkException,
                               AuthorizeException,
                               SQLException,
                               IOException
Crosswalk item's descriptive (and other Item-level) metadata from the manifest.

Throws:
PackageException
CrosswalkException
AuthorizeException
SQLException
IOException

addLicense

public abstract void addLicense(Context context,
                                Collection collection,
                                Item item,
                                IMSCPManifest manifest,
                                String license)
                         throws PackageException,
                                CrosswalkException,
                                AuthorizeException,
                                SQLException,
                                IOException
Add license(s) to Item based on contents of manifest and other policies. The implementation of this method controls exactly what licenses are added to the new item, including the DSpace deposit license. It is given the collection (which is the source of a default deposit license), an optional user-supplied deposit license (in the form of a String). It can also apply a Creative Commons license.

This framework does not add any licenses by default.

Parameters:
context - the DSpace context
collection - DSpace Collection to which the item is being submitted.
license - optional user-supplied Deposit License text (may be null)
Throws:
PackageException
CrosswalkException
AuthorizeException
SQLException
IOException

finishItem

public abstract void finishItem(Context context,
                                Item item,
                                Collection collection)
                         throws PackageException,
                                CrosswalkException,
                                AuthorizeException,
                                SQLException,
                                IOException
Hook for final "finishing" operations on the new Item. This method is called when the new Item is otherwise complete and ready to be returned. The implementation should use this opportunity to make whatever final checks and modifications are necessary.

Parameters:
context - the DSpace context
item - the item
collection - the parent collection to-be
Throws:
PackageException
CrosswalkException
AuthorizeException
SQLException
IOException


Copyright © 2010 The DSpace Foundation. All Rights Reserved.