Package org.mycore.frontend.cli
Class MCRDerivateCommands
java.lang.Object
org.mycore.frontend.cli.MCRAbstractCommands
org.mycore.frontend.cli.MCRDerivateCommands
- All Implemented Interfaces:
MCRExternalCommandInterface
@MCRCommandGroup(name="Derivate Commands")
public class MCRDerivateCommands
extends MCRAbstractCommands
Provides static methods that implement commands for the MyCoRe command line
interface.
- Version:
- $Revision$ $Date: 2010-10-29 15:17:03 +0200 (Fri, 29 Oct 2010) $
- Author:
- Jens Kupferschmidt, Frank Lützenkirchen
-
Field Summary
Fields inherited from class org.mycore.frontend.cli.MCRAbstractCommands
command
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkObjectsInDerivates
(String baseId) Check the object links in derivates of MCR base ID for existing.static void
Delete an MCRDerivate from the datastore.Delete MCRDerivates form ID to ID from the datastore.deletes all MCRDerivate from the datastore.exportAllDerivatesOfProjectWithStylesheet
(String project, String dirname, String style) This command looks for all derivates starting with project name in the application and builds export commands.exportAllDerivatesWithStylesheet
(String dirname, String style) This command looks for all derivates in the application and builds export commands.static void
exportWithStylesheet
(String id, String dirname, String style) Export an MCRDerivate to a file named MCRObjectID.xml in a directory named dirname and store the derivate files in a nested directory named MCRObjectID.static void
exportWithStylesheet
(String fromID, String toID, String dirname, String style) Export any MCRDerivate's to files named MCRObjectID.xml in a directory named dirname and the derivate files in nested directories named MCRObjectID.static void
linkDerivateToObject
(String derivateId, String objectId) Links the given derivate to the given object.loadFromDirectory
(String directory) Loads MCRDerivates from all XML files in a directory.static boolean
loadFromFile
(String file) Loads an MCRDerivates from an XML file.static boolean
loadFromFile
(String file, boolean importMode) Loads an MCRDerivates from an XML file.static void
renameFiles
(String derivate, String pattern, String newName) The method start the repair the content search index for all derivates.repairDerivateSearchForBase
(String project) Repairing the content search index for all derivates in project {0}.static void
The method start the repair the content search index for one.static void
setClassificationOfDerivate
(String derivateIDStr, String categoriesCommaList) static void
setMainFile
(String derivateIDString, String filePath) static void
setOrderOfDerivate
(String derivateIDStr, String orderStr) static void
Export an MCRDerivate to a file named MCRObjectID.xml in a directory named dirname and store the derivate files in a nested directory named MCRObjectID.The method start the repair the content search index for all derivates.static void
testRenameFile
(String filename, String pattern, String newName) static void
transformXMLMatchingPatternWithStylesheet
(String pattern, String derivate, String stylesheet) updateFromDirectory
(String directory) Updates MCRDerivates from all XML files in a directory.static boolean
updateFromFile
(String file) Updates an MCRDerivates from an XML file.static boolean
updateFromFile
(String file, boolean importMode) Updates an MCRDerivates from an XML file.Methods inherited from class org.mycore.frontend.cli.MCRAbstractCommands
addCommand, getDisplayName, getPossibleCommands, setDisplayName
-
Field Details
-
DEFAULT_STYLE
Default transformer script- See Also:
-
-
Constructor Details
-
MCRDerivateCommands
public MCRDerivateCommands()
-
-
Method Details
-
deleteAllDerivates
@MCRCommand(syntax="delete all derivates", help="Removes all derivates from the repository", order=10) public static List<String> deleteAllDerivates()deletes all MCRDerivate from the datastore. -
delete
@MCRCommand(syntax="delete derivate {0}", help="The command remove a derivate with the MCRObjectID {0}", order=30) public static void delete(String id) throws MCRPersistenceException, MCRActiveLinkException, MCRAccessException Delete an MCRDerivate from the datastore.- Parameters:
id
- the ID of the MCRDerivate that should be deleted- Throws:
MCRActiveLinkException
MCRAccessException
- seeMCRMetadataManager.delete(MCRDerivate)
MCRPersistenceException
-
delete
@MCRCommand(syntax="delete derivate from {0} to {1}", help="The command remove derivates in the number range between the MCRObjectID {0} and {1}.", order=20) public static List<String> delete(String idFrom, String idTo) throws MCRPersistenceException, MCRActiveLinkException, MCRAccessException Delete MCRDerivates form ID to ID from the datastore.- Parameters:
idFrom
- the start ID for deleting the MCRDerivateidTo
- the stop ID for deleting the MCRDerivate- Throws:
MCRAccessException
- seeMCRMetadataManager.delete(MCRDerivate)
MCRPersistenceException
MCRActiveLinkException
-
loadFromDirectory
@MCRCommand(syntax="load all derivates from directory {0}", help="Loads all MCRDerivates from the directory {0} to the system. If the numerical part of a provided ID is zero, a new ID with the same project ID and type is assigned.", order=60) public static List<String> loadFromDirectory(String directory) Loads MCRDerivates from all XML files in a directory.- Parameters:
directory
- the directory containing the XML files
-
updateFromDirectory
@MCRCommand(syntax="update all derivates from directory {0}", help="The command update all derivates form the directory {0} in the system.", order=70) public static List<String> updateFromDirectory(String directory) Updates MCRDerivates from all XML files in a directory.- Parameters:
directory
- the directory containing the XML files
-
loadFromFile
@MCRCommand(syntax="load derivate from file {0}", help="Loads an MCRDerivate from the file {0} to the system. If the numerical part of the provided ID is zero, a new ID with the same project ID and type is assigned.", order=40) public static boolean loadFromFile(String file) throws SAXParseException, IOException, MCRPersistenceException, MCRAccessException Loads an MCRDerivates from an XML file.- Parameters:
file
- the location of the xml file- Throws:
MCRAccessException
- seeMCRMetadataManager.create(MCRDerivate)
SAXParseException
IOException
MCRPersistenceException
-
loadFromFile
public static boolean loadFromFile(String file, boolean importMode) throws SAXParseException, IOException, MCRPersistenceException, MCRAccessException Loads an MCRDerivates from an XML file.- Parameters:
file
- the location of the xml fileimportMode
- if true, servdates are taken from xml file- Throws:
MCRAccessException
- seeMCRMetadataManager.create(MCRDerivate)
MCRPersistenceException
SAXParseException
IOException
-
updateFromFile
@MCRCommand(syntax="update derivate from file {0}", help="The command update a derivate form the file {0} in the system.", order=50) public static boolean updateFromFile(String file) throws SAXParseException, IOException, MCRPersistenceException, MCRAccessException Updates an MCRDerivates from an XML file.- Parameters:
file
- the location of the xml file- Throws:
MCRAccessException
- seeMCRMetadataManager.update(MCRDerivate)
MCRPersistenceException
SAXParseException
IOException
-
updateFromFile
public static boolean updateFromFile(String file, boolean importMode) throws SAXParseException, IOException, MCRPersistenceException, MCRAccessException Updates an MCRDerivates from an XML file.- Parameters:
file
- the location of the xml fileimportMode
- if true, servdates are taken from xml file- Throws:
MCRAccessException
- seeMCRMetadataManager.update(MCRDerivate)
SAXParseException
IOException
MCRPersistenceException
-
show
@MCRCommand(syntax="show loadable derivate of {0} to directory {1}", help="The command store the derivate with the MCRObjectID {0} to the directory {1}, without ifs-metadata", order=130) public static void show(String id, String dirname) Export an MCRDerivate to a file named MCRObjectID.xml in a directory named dirname and store the derivate files in a nested directory named MCRObjectID. The IFS-Attribute of the derivate files aren't saved, for reloading purpose after deleting a derivate in the datastore- Parameters:
id
- the ID of the MCRDerivate to be save.dirname
- the dirname to store the derivate
-
exportWithStylesheet
@MCRCommand(syntax="export derivate {0} to directory {1} with stylesheet {2}", help="Stores the derivate with the MCRObjectID {0} to the directory {1} with the stylesheet {2}-derivate.xsl. For {2}, the default is xsl/save.", order=90) public static void exportWithStylesheet(String id, String dirname, String style) Export an MCRDerivate to a file named MCRObjectID.xml in a directory named dirname and store the derivate files in a nested directory named MCRObjectID. The method uses the converter stylesheet style.xsl.- Parameters:
id
- the ID of the MCRDerivate to be save.dirname
- the dirname to store the derivatestyle
- the type of the stylesheet
-
exportWithStylesheet
@MCRCommand(syntax="export derivates from {0} to {1} to directory {2} with stylesheet {3}", help="Stores all derivates with MCRObjectID\'s between {0} and {1} to the directory {2} with the stylesheet {3}-derivate.xsl. For {3}, the default is xsl/save.", order=80) public static void exportWithStylesheet(String fromID, String toID, String dirname, String style) Export any MCRDerivate's to files named MCRObjectID.xml in a directory named dirname and the derivate files in nested directories named MCRObjectID. Exporting starts with fromID and ends with toID. IDs that aren't found will be skipped. The method use the converter stylesheet style.xsl.- Parameters:
fromID
- the ID of the MCRObject from be save.toID
- the ID of the MCRObject to be save.dirname
- the filename to store the objectstyle
- the type of the stylesheet
-
exportAllDerivatesWithStylesheet
@MCRCommand(syntax="export all derivates to directory {0} with stylesheet {1}", help="Stores all derivates to the directory {0} with the stylesheet {1}-derivate.xsl. For {1}, the default is xsl/save.", order=100) public static List<String> exportAllDerivatesWithStylesheet(String dirname, String style) This command looks for all derivates in the application and builds export commands.- Parameters:
dirname
- the filename to store the objectstyle
- the type of the stylesheet- Returns:
- a list of export commands for each derivate
-
exportAllDerivatesOfProjectWithStylesheet
@MCRCommand(syntax="export all derivates of project {0} to directory {1} with stylesheet {2}", help="Stores all derivates of project {0} to the directory {1} with the stylesheet {2}-derivate.xsl. For {2}, the default is xsl/save.", order=110) public static List<String> exportAllDerivatesOfProjectWithStylesheet(String project, String dirname, String style) This command looks for all derivates starting with project name in the application and builds export commands.- Parameters:
dirname
- the filename to store the objectstyle
- the type of the stylesheet- Returns:
- a list of export commands for derivates with project name
-
repairDerivateSearch
@MCRCommand(syntax="repair derivate search of type derivate", help="The command read the Content store and reindex the derivate search stores.", order=140) public static List<String> repairDerivateSearch()The method start the repair the content search index for all derivates. -
repairDerivateSearchForBase
@MCRCommand(syntax="repair derivate search of project {0}", help="Reads the Content store for project {0} and reindexes the derivate search stores.", order=141) public static List<String> repairDerivateSearchForBase(String project) Repairing the content search index for all derivates in project {0}.- Parameters:
project
- the project part of a MCRObjectID e.g. *DocPortal*_derivate
-
repairDerivateSearchForID
@MCRCommand(syntax="repair derivate search of ID {0}", help="The command read the Content store for MCRObjectID {0} and reindex the derivate search store.", order=150) public static void repairDerivateSearchForID(String id) throws IOException The method start the repair the content search index for one.- Parameters:
id
- the MCRObjectID as String- Throws:
IOException
-
synchronizeAllDerivates
@MCRCommand(syntax="synchronize all derivates", help="The command read each derivate and synchronize the xlink:label with the derivate entry of the mycoreobject.", order=160) public static List<String> synchronizeAllDerivates()The method start the repair the content search index for all derivates. -
linkDerivateToObject
@MCRCommand(syntax="link derivate {0} to {1}", help="links the given derivate {0} to the given mycore object {1}", order=180) public static void linkDerivateToObject(String derivateId, String objectId) throws Exception Links the given derivate to the given object.- Throws:
Exception
-
checkObjectsInDerivates
@MCRCommand(syntax="check object entries in derivates for base {0}", help="check in all derivates of MCR base ID {0} for existing linked objects", order=400) public static void checkObjectsInDerivates(String baseId) throws IOException Check the object links in derivates of MCR base ID for existing. It looks to the XML store on the disk to get all object IDs.- Parameters:
baseId
- the base part of a MCRObjectID e.g. DocPortal_derivate- Throws:
IOException
-
transformXMLMatchingPatternWithStylesheet
@MCRCommand(syntax="transform xml matching file name pattern {0} in derivate {1} with stylesheet {2}", help="Finds all files in Derivate {1} which match the pattern {0} (the complete path with regex: or glob:*.xml syntax) and transforms them with stylesheet {2}") public static void transformXMLMatchingPatternWithStylesheet(String pattern, String derivate, String stylesheet) throws IOException - Throws:
IOException
-
setMainFile
@MCRCommand(syntax="set main file of {0} to {1}", help="Sets the main file of the derivate with the id {0} to the file with the path {1}") public static void setMainFile(String derivateIDString, String filePath) throws MCRAccessException - Throws:
MCRAccessException
-
renameFiles
@MCRCommand(syntax="rename files from derivate {0} with {1} to {2}", help="Renames multiple files in one Derivate with the ID {0} the given RegEx pattern {1} and the replacement {2}. You can try out your pattern with the command: \'test rename file {0} with {1} to {2}\'.") public static void renameFiles(String derivate, String pattern, String newName) throws IOException - Throws:
IOException
-
testRenameFile
@MCRCommand(syntax="test rename file {0} with {1} to {2}", help="Tests the rename pattern {1} on one file {0} and replaces it with {2}, so you can try the rename before renaming all files. This command does not change any files.") public static void testRenameFile(String filename, String pattern, String newName) -
setOrderOfDerivate
@MCRCommand(syntax="set order of derivate {0} to {1}", help="Sets the order of derivate {0} to the number {1} see also MCR-2003") public static void setOrderOfDerivate(String derivateIDStr, String orderStr) throws MCRAccessException - Throws:
MCRAccessException
-
setClassificationOfDerivate
@MCRCommand(syntax="set classification of derivate {0} to {1}", help="Sets the classification of derivate {0} to the categories {1} (comma separated) of classification \'derivate_types\' or any fully qualified category, removing any previous definition.") public static void setClassificationOfDerivate(String derivateIDStr, String categoriesCommaList) throws MCRAccessException - Throws:
MCRAccessException
-