Package org.dspace.content.crosswalk
Class MODSDisseminationCrosswalk
- java.lang.Object
-
- org.dspace.core.SelfNamedPlugin
-
- org.dspace.content.crosswalk.MODSDisseminationCrosswalk
-
- All Implemented Interfaces:
DisseminationCrosswalk,NameAwarePlugin
public class MODSDisseminationCrosswalk extends SelfNamedPlugin implements DisseminationCrosswalk
Configurable MODS CrosswalkThis 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 todspace.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.propertiesThe 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
Fields Modifier and Type Field Description protected CollectionServicecollectionServiceprotected CommunityServicecommunityServiceprotected static ConfigurationServiceconfigurationServiceprotected HandleServicehandleServiceprotected ItemServiceitemServicestatic org.jdom.NamespaceMODS_NSMODS namespace.static StringMODS_XSDURL of MODS XML Schema-
Fields inherited from interface org.dspace.content.crosswalk.DisseminationCrosswalk
XSI_NS
-
-
Constructor Summary
Constructors Constructor Description MODSDisseminationCrosswalk()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanDisseminate(DSpaceObject dso)ModsCrosswalk 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.jdom.ElementdisseminateElement(Context context, DSpaceObject dso)Disseminate an Item, Collection, or Community to MODS.List<org.jdom.Element>disseminateList(Context context, DSpaceObject dso)Returns object's metadata in MODS format, as List of XML structure nodes.org.jdom.Namespace[]getNamespaces()Return the MODS namespacestatic String[]getPluginNames()StringgetSchemaLocation()Return the MODS schemaprotected List<MetadataValueDTO>item2Metadata(Item item)Generate a list of metadata elements for the given DSpace item.booleanpreferList()ModsCrosswalk 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 Detail
-
communityService
protected final CommunityService communityService
-
collectionService
protected final CollectionService collectionService
-
itemService
protected final ItemService itemService
-
handleService
protected final HandleService handleService
-
configurationService
protected static final ConfigurationService configurationService
-
MODS_NS
public static final org.jdom.Namespace MODS_NS
MODS namespace.
-
MODS_XSD
public static final String MODS_XSD
URL of MODS XML Schema- See Also:
- Constant Field Values
-
-
Method Detail
-
getPluginNames
public static String[] getPluginNames()
-
getNamespaces
public org.jdom.Namespace[] getNamespaces()
Return the MODS namespace- Specified by:
getNamespacesin interfaceDisseminationCrosswalk- Returns:
- array of namespaces, which may be empty.
-
getSchemaLocation
public String 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.jdom.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:
- results of crosswalk as list of XML elements.
- Throws:
CrosswalkException- if crosswalk errorIOException- if IO errorSQLException- if database errorAuthorizeException- if authorization error
-
disseminateElement
public org.jdom.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
public boolean canDisseminate(DSpaceObject dso)
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
protected List<MetadataValueDTO> site2Metadata(Site site)
Generate a list of metadata elements for the given DSpace site.- Parameters:
site- The site to derive metadata from- Returns:
- list of metadata
-
community2Metadata
protected List<MetadataValueDTO> community2Metadata(Community community)
Generate a list of metadata elements for the given DSpace community.- Parameters:
community- The community to derive metadata from- Returns:
- list of metadata
-
collection2Metadata
protected List<MetadataValueDTO> collection2Metadata(Collection collection)
Generate a list of metadata elements for the given DSpace collection.- Parameters:
collection- The collection to derive metadata from- Returns:
- list of metadata
-
item2Metadata
protected List<MetadataValueDTO> item2Metadata(Item item)
Generate a list of metadata elements for the given DSpace item.- Parameters:
item- The item to derive metadata from- Returns:
- list of metadata
-
createDCValue
protected MetadataValueDTO createDCValue(String element, String qualifier, String value)
-
-