Package org.dspace.pack.mets
Class METSPacker
- java.lang.Object
-
- org.dspace.pack.mets.METSPacker
-
-
Constructor Summary
Constructors Constructor Description METSPacker(org.dspace.core.Context context, String archFmt)METSPacker(org.dspace.core.Context context, org.dspace.content.DSpaceObject dso, String archFmt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>getChildPackageRefs()Return list of referenced child packages (AIPs) which were located during the unpacking of an AIP (see unpack()).org.dspace.content.DSpaceObjectgetDSO()Get DSpaceObject we are working withFilepack(File packDir)Create a METS AIP Package, using the configured AIP PackageDisseminator (in dspace.cfg)voidsetContentFilter(String filter)Sets a filter on this packer.voidsetContext(org.dspace.core.Context context)Set application contextvoidsetDSO(org.dspace.content.DSpaceObject dso)Set DSpaceObject we are working withvoidsetReferenceFilter(String filterSet)longsize(String method)Estimate the size of the object as packed into a bag.voidunpack(File archive)Restore/Replace a DSpaceObject based on the contents of a METS AIP Package, using the configured AIP PackageIngester (in dspace.cfg)voidunpack(File archive, org.dspace.content.packager.PackageParameters pkgParams)Restore/Replace a *single* DSpaceObject based on the contents of a METS AIP Package, and the given PackageParameters.
-
-
-
Method Detail
-
setContext
public void setContext(org.dspace.core.Context context)
Set application context- Parameters:
context-
-
getDSO
public org.dspace.content.DSpaceObject getDSO()
Get DSpaceObject we are working with- Returns:
- dso DSpaceObject
-
setDSO
public void setDSO(org.dspace.content.DSpaceObject dso)
Set DSpaceObject we are working with- Parameters:
dso- DSpaceObject
-
pack
public File pack(File packDir) throws org.dspace.authorize.AuthorizeException, IOException, SQLException
Create a METS AIP Package, using the configured AIP PackageDisseminator (in dspace.cfg)- Specified by:
packin interfacePacker- Parameters:
packDir- the directory where this package should be created- Returns:
- the created package file
- Throws:
org.dspace.authorize.AuthorizeException- if authorize errorIOException- if I/O errorSQLException- if database error
-
unpack
public void unpack(File archive) throws org.dspace.authorize.AuthorizeException, IOException, SQLException
Restore/Replace a DSpaceObject based on the contents of a METS AIP Package, using the configured AIP PackageIngester (in dspace.cfg)- Specified by:
unpackin interfacePacker- Parameters:
archive- the METS AIP package- Throws:
org.dspace.authorize.AuthorizeException- if authorize errorIOException- if I/O errorSQLException- if database error
-
unpack
public void unpack(File archive, org.dspace.content.packager.PackageParameters pkgParams) throws org.dspace.authorize.AuthorizeException, IOException, SQLException
Restore/Replace a *single* DSpaceObject based on the contents of a METS AIP Package, and the given PackageParameters. This uses the configured AIP PackageIngester (in dspace.cfg).Please note that it is up to the calling Curation Task to perform any recursive restores/replaces of child objects. If recursiveMode is enabled, this method will attempt to save all referenced child packages for access via getChildPackageRefs().
- Parameters:
archive- the METS AIP packagepkgParams- the PackageParameters (if null, defaults to Recursive Replace settings)- Throws:
org.dspace.authorize.AuthorizeException- if authorize errorIOException- if I/O errorSQLException- if database error
-
size
public long size(String method) throws SQLException
Description copied from interface:PackerEstimate the size of the object as packed into a bag. This estimate uses any defined content filters.- Specified by:
sizein interfacePacker- Parameters:
method- how to estimate - not currently implemented- Returns:
- the bagged object size in bytes
- Throws:
SQLException- if database error
-
setContentFilter
public void setContentFilter(String filter)
Description copied from interface:PackerSets a filter on this packer. A filter will ignore (skip) object content when packing to a bag. Filter syntax:["+"]{BundleName,}+That is, a list of Item bundle names taken to be exclusions, unless preceeded by a '+", where the list is taken to be inclusive.- Specified by:
setContentFilterin interfacePacker- Parameters:
filter- filter
-
setReferenceFilter
public void setReferenceFilter(String filterSet)
- Specified by:
setReferenceFilterin interfacePacker
-
getChildPackageRefs
public List<String> getChildPackageRefs()
Return list of referenced child packages (AIPs) which were located during the unpacking of an AIP (see unpack()).This may be used by tasks so that they can recursively unpack() additional referenced child packages as needed.
- Returns:
- List of references to child AIPs
-
-