Class RoleIngester
- java.lang.Object
-
- org.dspace.content.packager.RoleIngester
-
- All Implemented Interfaces:
PackageIngester
public class RoleIngester extends Object implements PackageIngester
Create EPersons and Groups from a file of external representations.- Author:
- mwood
-
-
Field Summary
Fields Modifier and Type Field Description protected CollectionServicecollectionServiceprotected CommunityServicecommunityServiceprotected EPersonServiceePersonServiceprotected GroupServicegroupService
-
Constructor Summary
Constructors Constructor Description RoleIngester()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetParameterHelp()Returns a user help string which should describe the additional valid command-line options that this packager implementation will accept when using the-oor--optionflags with the Packager script.DSpaceObjectingest(Context context, DSpaceObject parent, File pkgFile, PackageParameters params, String license)Create new DSpaceObject out of the ingested package.List<String>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).voidingestStream(Context context, DSpaceObject parent, PackageParameters params, InputStream stream)Ingest roles from an InputStream.DSpaceObjectreplace(Context context, DSpaceObject dso, File pkgFile, PackageParameters params)Replace an existing DSpace Object with contents of the ingested package.List<String>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).
-
-
-
Field Detail
-
communityService
protected CommunityService communityService
-
collectionService
protected CollectionService collectionService
-
groupService
protected GroupService groupService
-
ePersonService
protected EPersonService ePersonService
-
-
Method Detail
-
ingestStream
public void ingestStream(Context context, DSpaceObject parent, PackageParameters params, InputStream stream) throws PackageException, SQLException, AuthorizeException
Ingest roles from an InputStream.- Parameters:
context- DSpace Contextparent- the Parent DSpaceObjectparams- package paramsstream- input stream with the roles- Throws:
PackageException- if packaging errorSQLException- if database errorAuthorizeException- if authorization error
-
ingest
public DSpaceObject ingest(Context context, DSpaceObject parent, File pkgFile, PackageParameters params, String license) throws PackageException, CrosswalkException, AuthorizeException, SQLException, IOException
Description copied from interface:PackageIngesterCreate new DSpaceObject out of the ingested package. The object is created under the indicated parent. This creates aDSpaceObject. For Items, it is up to the caller to decide whether to install it or submit it to normal DSpace Workflow.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
null.Use
ingestAllmethod to perform a recursive ingest of all packages which are referenced by an initial package.- Specified by:
ingestin interfacePackageIngester- Parameters:
context- DSpace context.parent- parent under which to create new object (may be null -- in which case ingester must determine parent from package or throw an error).pkgFile- The package file to ingestparams- Properties-style list of options (interpreted by each packager).license- may be null, which takes default license.- Returns:
- DSpaceObject created by ingest.
- Throws:
PackageValidationException- if package is unacceptable or there is a fatal error turning it into a DSpaceObject.CrosswalkException- if crosswalk errorAuthorizeException- if authorization errorSQLException- if database errorIOException- if IO errorPackageException
-
ingestAll
public List<String> ingestAll(Context context, DSpaceObject parent, File pkgFile, PackageParameters params, String license) throws PackageException, UnsupportedOperationException, CrosswalkException, AuthorizeException, SQLException, IOException
Description copied from interface:PackageIngesterRecursively create one or more DSpace Objects out of the contents of the ingested package (and all other referenced packages). The initial object is created under the indicated parent. All other objects are created based on their relationship to the initial object.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 DSpaceObject Identifiers (i.e. Handles).
The packager may choose not to implement
ingestAll, or simply forward the call toingestif it is unable to support recursive ingestion.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
null.- Specified by:
ingestAllin interfacePackageIngester- Parameters:
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.- Returns:
- List of Identifiers of DSpaceObjects created
- Throws:
PackageValidationException- if initial package (or any referenced package) is unacceptable or there is a fatal error in creating a DSpaceObjectUnsupportedOperationException- if this packager does not implementingestAllCrosswalkException- if crosswalk errorAuthorizeException- if authorization errorSQLException- if database errorIOException- if IO errorPackageException
-
replace
public DSpaceObject replace(Context context, DSpaceObject dso, File pkgFile, PackageParameters params) throws PackageException, UnsupportedOperationException, CrosswalkException, AuthorizeException, SQLException, IOException
Description copied from interface:PackageIngesterReplace an existing DSpace Object with contents of the ingested package. The packager may choose not to implementreplace, since it somewhat contradicts the archival nature of DSpace. The exact function of this method is highly implementation-dependent.Use
replaceAllmethod to perform a recursive replace of objects referenced by a set of packages.- Specified by:
replacein interfacePackageIngester- Parameters:
context- DSpace context.dso- 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- Returns:
- DSpaceObject with contents replaced
- Throws:
PackageValidationException- if package is unacceptable or there is a fatal error turning it into an Item.UnsupportedOperationException- if this packager does not implementreplace.CrosswalkException- if crosswalk errorAuthorizeException- if authorization errorSQLException- if database errorIOException- if IO errorPackageException
-
replaceAll
public List<String> replaceAll(Context context, DSpaceObject dso, File pkgFile, PackageParameters params) throws PackageException, UnsupportedOperationException, CrosswalkException, AuthorizeException, SQLException, IOException
Description copied from interface:PackageIngesterRecursively replace one or more DSpace Objects out of the contents of the ingested package (and all other referenced packages). The initial object to replace is indicated bydso. 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
dsoinput 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 DSpaceObject Identifiers (i.e. Handles).
The packager may choose not to implement
replaceAll, since it somewhat contradicts the archival nature of DSpace. It also may choose to forward the call toreplaceif it is unable to support recursive replacement.- Specified by:
replaceAllin interfacePackageIngester- Parameters:
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- Returns:
- List of Identifiers of DSpaceObjects replaced
- Throws:
PackageValidationException- if initial package (or any referenced package) is unacceptable or there is a fatal error in creating a DSpaceObjectUnsupportedOperationException- if this packager does not implementreplaceAllCrosswalkException- if crosswalk errorAuthorizeException- if authorization errorSQLException- if database errorIOException- if IO errorPackageException
-
getParameterHelp
public String getParameterHelp()
Returns a user help string which should describe the additional valid command-line options that this packager implementation will accept when using the-oor--optionflags with the Packager script.- Specified by:
getParameterHelpin interfacePackageIngester- Returns:
- a string describing additional command-line options available with this packager
-
-