Class RoleDisseminator
- All Implemented Interfaces:
PackageDisseminator
- Author:
- Mark Wood
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classEmbody a thread for serializing users and groups. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final org.jdom2.NamespaceDSpace Roles XML Namespace in JDOM form.static final Stringstatic final Stringstatic final Stringprotected final EPersonServicestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected final GroupServicestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddisseminate(Context context, DSpaceObject object, PackageParameters params, File pkgFile) Export the object (Item, Collection, or Community) as a "package" on the indicated OutputStream.disseminateAll(Context context, DSpaceObject dso, PackageParameters params, File pkgFile) Recursively export one or more DSpace Objects as a series of packages.findAssociatedGroups(Context context, DSpaceObject object) Find all Groups associated with this DSpace Object.findAssociatedPeople(Context context, DSpaceObject object) Find all EPeople associated with this DSpace Object.protected StringgetGroupType(Context context, DSpaceObject dso, Group group) Return a Group Type string (see RoleDisseminator.GROUP_TYPE_* constants) which describes the type of group and its relation to the given object.getMIMEType(PackageParameters params) Identifies the MIME-type of this package, e.g.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.protected voidwriteEPerson(EPerson eperson, XMLStreamWriter writer, boolean emitPassword) Emit XML describing a single EPerson.protected voidwriteGroup(Context context, DSpaceObject relatedObject, Group group, XMLStreamWriter writer) Emit XML describing a single Group.protected voidwriteToStream(Context context, DSpaceObject object, OutputStream stream, boolean emitPasswords) Serialize users and groups to a stream.
-
Field Details
-
DSROLES_NS
public static final org.jdom2.Namespace DSROLES_NSDSpace Roles XML Namespace in JDOM form. -
DSPACE_ROLES
- See Also:
-
ID
- See Also:
-
GROUPS
- See Also:
-
GROUP
- See Also:
-
NAME
- See Also:
-
TYPE
- See Also:
-
MEMBERS
- See Also:
-
MEMBER
- See Also:
-
MEMBER_GROUPS
- See Also:
-
MEMBER_GROUP
- See Also:
-
EPERSONS
- See Also:
-
EPERSON
- See Also:
-
EMAIL
- See Also:
-
NETID
- See Also:
-
FIRST_NAME
- See Also:
-
LAST_NAME
- See Also:
-
LANGUAGE
- See Also:
-
PASSWORD_HASH
- See Also:
-
PASSWORD_DIGEST
- See Also:
-
PASSWORD_SALT
- See Also:
-
CAN_LOGIN
- See Also:
-
REQUIRE_CERTIFICATE
- See Also:
-
SELF_REGISTERED
- See Also:
-
GROUP_TYPE_ADMIN
- See Also:
-
GROUP_TYPE_SUBMIT
- See Also:
-
GROUP_TYPE_WORKFLOW_STEP_1
- See Also:
-
GROUP_TYPE_WORKFLOW_STEP_2
- See Also:
-
GROUP_TYPE_WORKFLOW_STEP_3
- See Also:
-
ePersonService
-
groupService
-
-
Constructor Details
-
RoleDisseminator
public RoleDisseminator()
-
-
Method Details
-
disseminate
public void disseminate(Context context, DSpaceObject object, PackageParameters params, File pkgFile) throws PackageException, CrosswalkException, AuthorizeException, SQLException, IOException Description copied from interface:PackageDisseminatorExport the object (Item, Collection, or Community) as a "package" on the indicated OutputStream. Package is any serialized representation of the item, at the discretion of the implementing class. It does not have to include content bitstreams.Use the
paramsparameter list to adjust the way the package is made, e.g. including a "metadataOnly" parameter might make the package a bare manifest in XML instead of a Zip file including manifest and contents.Throws an exception of the chosen object is not acceptable or there is a failure creating the package.
- Specified by:
disseminatein interfacePackageDisseminator- Parameters:
context- DSpace context.object- DSpace object (item, collection, etc)params- Properties-style list of options specific to this packagerpkgFile- File where export package should be written- Throws:
PackageValidationException- if package cannot be created or there is a fatal error in creating it.CrosswalkException- if crosswalk errorAuthorizeException- if authorization errorSQLException- if database errorIOException- if IO errorPackageException
-
writeToStream
protected void writeToStream(Context context, DSpaceObject object, OutputStream stream, boolean emitPasswords) throws PackageException Serialize users and groups to a stream.- Parameters:
context- current Contextobject- DSpaceObjectstream- receives the output. Is not closed by this method.emitPasswords- true if password hashes should be included.- Throws:
PackageException- if error
-
disseminateAll
public List<File> disseminateAll(Context context, DSpaceObject dso, PackageParameters params, File pkgFile) throws PackageException, CrosswalkException, AuthorizeException, SQLException, IOException Description copied from interface:PackageDisseminatorRecursively export one or more DSpace Objects as a series of packages. This method will export the given DSpace Object as well as all referenced DSpaceObjects (e.g. child objects) into a series of packages. The initial object is exported to the location specified by the pkgFile. All other generated packages are recursively exported to the same directory.Package is any serialized representation of the item, at the discretion of the implementing class. It does not have to include content bitstreams.
Use the
paramsparameter list to adjust the way the package is made, e.g. including a "metadataOnly" parameter might make the package a bare manifest in XML instead of a Zip file including manifest and contents.Throws an exception of the initial object is not acceptable or there is a failure creating the packages.
A packager may choose not to implement
disseminateAll, or simply forward the call todisseminateif it is unable to support recursive dissemination.- Specified by:
disseminateAllin interfacePackageDisseminator- Parameters:
context- DSpace context.dso- initial DSpace objectparams- Properties-style list of options specific to this packagerpkgFile- File where initial package should be written. All other packages will be written to the same directory as this File.- Returns:
- List of all package Files which were successfully disseminated
- Throws:
PackageValidationException- if package cannot be created or there is a fatal error in creating it.CrosswalkException- if crosswalk errorAuthorizeException- if authorization errorSQLException- if database errorIOException- if IO errorPackageException
-
getMIMEType
Description copied from interface:PackageDisseminatorIdentifies the MIME-type of this package, e.g."application/zip". Required when sending the package via HTTP, to provide the Content-Type header.- Specified by:
getMIMETypein interfacePackageDisseminator- Parameters:
params- Package Parameters- Returns:
- the MIME type (content-type header) of the package to be returned
-
writeGroup
protected void writeGroup(Context context, DSpaceObject relatedObject, Group group, XMLStreamWriter writer) throws XMLStreamException, PackageException Emit XML describing a single Group.- Parameters:
context- the DSpace ContextrelatedObject- the DSpaceObject related to this group (if any)group- the Group to describewriter- the description to this stream- Throws:
XMLStreamException- if XML errorPackageException- if packaging error
-
getGroupType
Return a Group Type string (see RoleDisseminator.GROUP_TYPE_* constants) which describes the type of group and its relation to the given object.As a basic example, if the Group is a Collection Administration group, the Group Type string returned should be "ADMIN"
If type string cannot be determined, null is returned.
- Parameters:
dso- the related DSpaceObjectgroup- the group- Returns:
- a group type string or null
-
writeEPerson
protected void writeEPerson(EPerson eperson, XMLStreamWriter writer, boolean emitPassword) throws XMLStreamException Emit XML describing a single EPerson.- Parameters:
eperson- the EPerson to describewriter- the description to this streamemitPassword- do not export the password hash unless true- Throws:
XMLStreamException- if XML error
-
findAssociatedGroups
protected List<Group> findAssociatedGroups(Context context, DSpaceObject object) throws SQLException Find all Groups associated with this DSpace Object.If object is SITE, all groups are returned.
If object is COMMUNITY or COLLECTION, only groups associated with those objects are returned (if any).
For all other objects, null is returned.
- Parameters:
context- The DSpace contextobject- the DSpace object- Returns:
- array of all associated groups
- Throws:
SQLException- if database error
-
findAssociatedPeople
protected List<EPerson> findAssociatedPeople(Context context, DSpaceObject object) throws SQLException Find all EPeople associated with this DSpace Object.If object is SITE, all people are returned.
For all other objects, null is returned.
- Parameters:
context- The DSpace contextobject- the DSpace object- Returns:
- array of all associated EPerson objects
- Throws:
SQLException- if database error
-
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 interfacePackageDisseminator- Returns:
- a string describing additional command-line options available with this packager
-