Package org.dspace.content.crosswalk
Class MODSDisseminationCrosswalk
java.lang.Object
org.dspace.core.SelfNamedPlugin
org.dspace.content.crosswalk.MODSDisseminationCrosswalk
- All Implemented Interfaces:
DisseminationCrosswalk,NameAwarePlugin
Configurable MODS Crosswalk
This class supports multiple dissemination crosswalks from DSpace internal data to the MODS XML format (see http://www.loc.gov/standards/mods/.)
It registers multiple Plugin names, which it reads from the DSpace configuration as follows:
Configuration
Every key starting with"crosswalk.mods.properties." describes a
MODS crosswalk. Everything after the last period is the plugin name,
and the value is the pathname (relative to dspace.dir/config)
of the crosswalk configuration file.
You can have two names point to the same crosswalk, just add two configuration entries with the same value, e.g.
crosswalk.mods.properties.MODS = crosswalks/mods.properties
crosswalk.mods.properties.default = crosswalks/mods.properties
The first line creates a plugin with the name "MODS"
which is configured from the file dspace-dir/config/crosswalks/mods.properties.
Since there is significant overhead in reading the properties file to configure the crosswalk, and a crosswalk instance may be used any number of times, we recommend caching one instance of the crosswalk for each name and simply reusing those instances. The PluginService does this by default.
- Author:
- Larry Stone, Scott Phillips
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CollectionServiceprotected final CommunityServiceprotected static final ConfigurationServiceprotected final HandleServiceprotected final ItemServicestatic final org.jdom2.NamespaceMODS namespace.static final StringURL of MODS XML SchemaFields inherited from interface org.dspace.content.crosswalk.DisseminationCrosswalk
XSI_NS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanModsCrosswalk can disseminate: Items, Collections, Communities, and Site.protected List<MetadataValueDTO>collection2Metadata(Collection collection) Generate a list of metadata elements for the given DSpace collection.protected List<MetadataValueDTO>community2Metadata(Community community) Generate a list of metadata elements for the given DSpace community.protected MetadataValueDTOcreateDCValue(String element, String qualifier, String value) org.jdom2.ElementdisseminateElement(Context context, DSpaceObject dso) Disseminate an Item, Collection, or Community to MODS.List<org.jdom2.Element>disseminateList(Context context, DSpaceObject dso) Returns object's metadata in MODS format, as List of XML structure nodes.org.jdom2.Namespace[]Return the MODS namespacestatic String[]Return the MODS schemaprotected List<MetadataValueDTO>item2Metadata(Item item) Generate a list of metadata elements for the given DSpace item.booleanModsCrosswalk prefer's element form over list.protected List<MetadataValueDTO>site2Metadata(Site site) Generate a list of metadata elements for the given DSpace site.Methods inherited from class org.dspace.core.SelfNamedPlugin
getPluginInstanceName, setPluginInstanceName
-
Field Details
-
communityService
-
collectionService
-
itemService
-
handleService
-
configurationService
-
MODS_NS
public static final org.jdom2.Namespace MODS_NSMODS namespace. -
MODS_XSD
URL of MODS XML Schema- See Also:
-
-
Constructor Details
-
MODSDisseminationCrosswalk
public MODSDisseminationCrosswalk()
-
-
Method Details
-
getPluginNames
-
getNamespaces
public org.jdom2.Namespace[] getNamespaces()Return the MODS namespace- Specified by:
getNamespacesin interfaceDisseminationCrosswalk- Returns:
- array of namespaces, which may be empty.
-
getSchemaLocation
Return the MODS schema- Specified by:
getSchemaLocationin interfaceDisseminationCrosswalk- Returns:
- SchemaLocation string, including URI namespace, followed by whitespace and URI of XML schema document, or empty string if unknown.
-
disseminateList
public List<org.jdom2.Element> disseminateList(Context context, DSpaceObject dso) throws CrosswalkException, IOException, SQLException, AuthorizeException Returns object's metadata in MODS format, as List of XML structure nodes.- Specified by:
disseminateListin interfaceDisseminationCrosswalk- Parameters:
context- contextdso- the DSpace Object whose metadata to export.- Returns:
- List of Elements
- Throws:
CrosswalkException- if crosswalk errorIOException- if IO errorSQLException- if database errorAuthorizeException- if authorization error
-
disseminateElement
public org.jdom2.Element disseminateElement(Context context, DSpaceObject dso) throws CrosswalkException, IOException, SQLException, AuthorizeException Disseminate an Item, Collection, or Community to MODS.- Specified by:
disseminateElementin interfaceDisseminationCrosswalk- Parameters:
context- contextdso- the DSpace Object whose metadata to export.- Returns:
- root Element of the target metadata, never
null - Throws:
CrosswalkException- if crosswalk errorIOException- if IO errorSQLException- if database errorAuthorizeException- if authorization error
-
canDisseminate
ModsCrosswalk can disseminate: Items, Collections, Communities, and Site.- Specified by:
canDisseminatein interfaceDisseminationCrosswalk- Parameters:
dso- dspace object, e.g. anItem.- Returns:
- true when disseminator is capable of producing metadata.
-
preferList
public boolean preferList()ModsCrosswalk prefer's element form over list.- Specified by:
preferListin interfaceDisseminationCrosswalk- Returns:
- true when disseminator prefers you call disseminateList().
-
site2Metadata
Generate a list of metadata elements for the given DSpace site.- Parameters:
site- The site to derive metadata from- Returns:
- list of metadata
-
community2Metadata
Generate a list of metadata elements for the given DSpace community.- Parameters:
community- The community to derive metadata from- Returns:
- list of metadata
-
collection2Metadata
Generate a list of metadata elements for the given DSpace collection.- Parameters:
collection- The collection to derive metadata from- Returns:
- list of metadata
-
item2Metadata
Generate a list of metadata elements for the given DSpace item.- Parameters:
item- The item to derive metadata from- Returns:
- list of metadata
-
createDCValue
-