|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.content.packager.AbstractPackageIngester
public abstract class AbstractPackageIngester
An abstract implementation of a DSpace Package Ingester, which implements a few helper/utility methods that most (all?) PackageIngesters may find useful.
First, implements recursive functionality in ingestAll() and replaceAll() methods of the PackageIngester interface. These methods are setup to recursively call ingest() and replace() respectively.
Finally, it also implements several utility methods (createDSpaceObject(), finishCreateItem(), updateDSpaceObject()) which subclasses may find useful. This classes will allow subclasses to easily create/update objects without having to worry too much about normal DSpace submission workflows (which is taken care of in these utility methods).
All Package ingesters should either extend this abstract class
or implement PackageIngester to better suit their needs.
PackageIngester| Constructor Summary | |
|---|---|
AbstractPackageIngester()
|
|
| Method Summary | |
|---|---|
void |
addPackageReference(DSpaceObject dso,
String packageRef)
During ingestion process, some submission information packages (SIPs) may reference other packages to be ingested (recursively). |
protected void |
addToIngestedList(DSpaceObject dso)
Add DSpaceObject to list of successfully ingested/replaced objects |
protected List<DSpaceObject> |
getIngestedList()
Return List of all DSpaceObjects which have been ingested/replaced by this instance of the Ingester. |
List<String> |
getPackageReferences(DSpaceObject dso)
Return a list of known SIP references from a newly created DSpaceObject. |
List<DSpaceObject> |
ingestAll(Context context,
DSpaceObject parent,
File pkgFile,
PackageParameters params,
String license)
Recursively create one or more DSpace Objects out of the contents of the ingested package (and all other referenced packages). |
List<DSpaceObject> |
replaceAll(Context context,
DSpaceObject dso,
File pkgFile,
PackageParameters params)
Recursively replace one or more DSpace Objects out of the contents of the ingested package (and all other referenced packages). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.dspace.content.packager.PackageIngester |
|---|
getParameterHelp, ingest, replace |
| Constructor Detail |
|---|
public AbstractPackageIngester()
| Method Detail |
|---|
public List<DSpaceObject> ingestAll(Context context,
DSpaceObject parent,
File pkgFile,
PackageParameters params,
String license)
throws PackageException,
UnsupportedOperationException,
CrosswalkException,
AuthorizeException,
SQLException,
IOException
For example, a scenario may be to create a Collection based on a collection-level package, and also create an Item for every item-level package referenced by the collection-level package.
The output of this method is one or more newly created
The packager may choose not to implement
The deposit license (Only significant for Item) is passed
explicitly as a string since there is no place for it in many
package formats. It is optional and may be given as
DspaceObjects.
ingestAll,
or simply forward the call to ingest if it is unable to support
recursive ingestion.
null.
ingestAll in interface PackageIngester
context - DSpace context.parent - parent under which to create the initial object
(may be null -- in which case ingester must determine parent from package
or throw an error).pkgFile - The initial package file to ingestparams - Properties-style list of options (interpreted by each packager).license - may be null, which takes default license.
PackageValidationException - if initial package (or any referenced package)
is unacceptable or there is a fatal error in creating a DSpaceObject
UnsupportedOperationException - if this packager does not
implement ingestAll
PackageException
CrosswalkException
AuthorizeException
SQLException
IOException
public List<DSpaceObject> replaceAll(Context context,
DSpaceObject dso,
File pkgFile,
PackageParameters params)
throws PackageException,
UnsupportedOperationException,
CrosswalkException,
AuthorizeException,
SQLException,
IOException
dso. All other
objects are replaced based on information provided in the referenced packages.
For example, a scenario may be to replace a Collection based on a collection-level package, and also replace *every* Item in that collection based on the item-level packages referenced by the collection-level package.
Please note that since the dso input only specifies the
initial object to replace, any additional objects to replace must be
determined based on the referenced packages (or initial package itself).
The output of this method is one or more replaced
The packager may choose not to implement
DspaceObjects.
replaceAll,
since it somewhat contradicts the archival nature of DSpace. It also
may choose to forward the call to replace if it is unable to
support recursive replacement.
replaceAll in interface PackageIngester
context - DSpace context.dso - initial existing DSpace Object to be replaced, may be null
if object to replace can be determined from packagepkgFile - The package file to ingest.params - Properties-style list of options specific to this packager
PackageValidationException - if initial package (or any referenced package)
is unacceptable or there is a fatal error in creating a DSpaceObject
UnsupportedOperationException - if this packager does not
implement replaceAll
PackageException
CrosswalkException
AuthorizeException
SQLException
IOException
public void addPackageReference(DSpaceObject dso,
String packageRef)
This method collects all references to other packages, so that we can choose to recursively ingest them, as necessary, alongside the DSpaceObject created from the original SIP.
References are collected based on the DSpaceObject created from the SIP (this way we keep the context of these references).
dso - DSpaceObject whose SIP referenced another packagepackageRef - A reference to another package, which can be ingested after this onepublic List<String> getPackageReferences(DSpaceObject dso)
These references should detail where another package exists which should be ingested alongside the current DSpaceObject.
The AbstractPackageIngester or an equivalent SIP handler is expected
to understand how to deal with these package references.
dso - DSpaceObject whose SIP referenced other SIPs
protected void addToIngestedList(DSpaceObject dso)
dso - DSpaceObjectprotected List<DSpaceObject> getIngestedList()
This list can be useful in reporting back to the user what content has been added or replaced. It's used by ingestAll() and replaceAll() to return this list of everything that was ingested/replaced.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||