diff --git a/.travis.yml b/.travis.yml
index c891e1569a..41229df646 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,20 @@ env:
# Give Maven 1GB of memory to work with
- MAVEN_OPTS=-Xmx1024M
+jdk:
+ # DS-3384 Oracle JDK 8 has DocLint enabled by default.
+ # Let's use this to catch any newly introduced DocLint issues.
+ - oraclejdk8
+ - oraclejdk7
+
+## Should we run into any problems with oraclejdk8 on Travis, we may try the following workaround.
+## https://docs.travis-ci.com/user/languages/java#Testing-Against-Multiple-JDKs
+## https://github.com/travis-ci/travis-ci/issues/3259#issuecomment-130860338
+#addons:
+# apt:
+# packages:
+# - oracle-java8-installer
+
# Install prerequisites for building Mirage2 more rapidly
before_install:
# Install Node.js 6.5.0 & print version info
diff --git a/dspace-api/pom.xml b/dspace-api/pom.xml
index 61f90291a0..ea3692cf71 100644
--- a/dspace-api/pom.xml
+++ b/dspace-api/pom.xml
@@ -12,7 +12,7 @@
org.dspace
dspace-parent
- 6.0-rc5-SNAPSHOT
+ 7.0-SNAPSHOT
..
diff --git a/dspace-api/src/main/java/org/apache/solr/handler/extraction/ExtractingParams.java b/dspace-api/src/main/java/org/apache/solr/handler/extraction/ExtractingParams.java
index 68319795a6..014d4e0d6b 100644
--- a/dspace-api/src/main/java/org/apache/solr/handler/extraction/ExtractingParams.java
+++ b/dspace-api/src/main/java/org/apache/solr/handler/extraction/ExtractingParams.java
@@ -71,11 +71,11 @@ public interface ExtractingParams {
/**
* Restrict the extracted parts of a document to be indexed
- * by passing in an XPath expression. All content that satisfies the XPath expr.
- * will be passed to the {@link SolrContentHandler}.
+ * by passing in an XPath expression. All content that satisfies the XPath expr.
+ * will be passed to the {@link org.apache.solr.handler.extraction.SolrContentHandler}.
*
* See Tika's docs for what the extracted document looks like.
- *
+ *
* @see #CAPTURE_ELEMENTS
*/
public static final String XPATH_EXPRESSION = "xpath";
@@ -105,7 +105,7 @@ public interface ExtractingParams {
* Capture the specified fields (and everything included below it that isn't capture by some other capture field) separately from the default. This is different
* then the case of passing in an XPath expression.
*
- * The Capture field is based on the localName returned to the {@link SolrContentHandler}
+ * The Capture field is based on the localName returned to the {@link org.apache.solr.handler.extraction.SolrContentHandler}
* by Tika, not to be confused by the mapped field. The field name can then
* be mapped into the index schema.
*
diff --git a/dspace-api/src/main/java/org/dspace/administer/CommunityFiliator.java b/dspace-api/src/main/java/org/dspace/administer/CommunityFiliator.java
index 9765753ec2..70b525347b 100644
--- a/dspace-api/src/main/java/org/dspace/administer/CommunityFiliator.java
+++ b/dspace-api/src/main/java/org/dspace/administer/CommunityFiliator.java
@@ -48,7 +48,7 @@ public class CommunityFiliator
/**
*
- * @param argv arguments
+ * @param argv the command line arguments given
* @throws Exception if error
*/
public static void main(String[] argv) throws Exception
diff --git a/dspace-api/src/main/java/org/dspace/administer/CreateAdministrator.java b/dspace-api/src/main/java/org/dspace/administer/CreateAdministrator.java
index fd40243b50..c1c80e5f52 100644
--- a/dspace-api/src/main/java/org/dspace/administer/CreateAdministrator.java
+++ b/dspace-api/src/main/java/org/dspace/administer/CreateAdministrator.java
@@ -47,8 +47,8 @@ import org.dspace.eperson.service.GroupService;
*/
public final class CreateAdministrator
{
- /** DSpace Context object */
- private final Context context;
+ /** DSpace Context object */
+ private final Context context;
protected EPersonService ePersonService;
protected GroupService groupService;
@@ -57,37 +57,36 @@ public final class CreateAdministrator
* For invoking via the command line. If called with no command line arguments,
* it will negotiate with the user for the administrator details
*
- * @param argv
- * command-line arguments
+ * @param argv the command line arguments given
* @throws Exception if error
*/
public static void main(String[] argv)
- throws Exception
+ throws Exception
{
- CommandLineParser parser = new PosixParser();
- Options options = new Options();
-
- CreateAdministrator ca = new CreateAdministrator();
-
- options.addOption("e", "email", true, "administrator email address");
- options.addOption("f", "first", true, "administrator first name");
- options.addOption("l", "last", true, "administrator last name");
- options.addOption("c", "language", true, "administrator language");
- options.addOption("p", "password", true, "administrator password");
-
- CommandLine line = parser.parse(options, argv);
-
- if (line.hasOption("e") && line.hasOption("f") && line.hasOption("l") &&
- line.hasOption("c") && line.hasOption("p"))
- {
- ca.createAdministrator(line.getOptionValue("e"),
- line.getOptionValue("f"), line.getOptionValue("l"),
- line.getOptionValue("c"), line.getOptionValue("p"));
- }
- else
- {
- ca.negotiateAdministratorDetails();
- }
+ CommandLineParser parser = new PosixParser();
+ Options options = new Options();
+
+ CreateAdministrator ca = new CreateAdministrator();
+
+ options.addOption("e", "email", true, "administrator email address");
+ options.addOption("f", "first", true, "administrator first name");
+ options.addOption("l", "last", true, "administrator last name");
+ options.addOption("c", "language", true, "administrator language");
+ options.addOption("p", "password", true, "administrator password");
+
+ CommandLine line = parser.parse(options, argv);
+
+ if (line.hasOption("e") && line.hasOption("f") && line.hasOption("l") &&
+ line.hasOption("c") && line.hasOption("p"))
+ {
+ ca.createAdministrator(line.getOptionValue("e"),
+ line.getOptionValue("f"), line.getOptionValue("l"),
+ line.getOptionValue("c"), line.getOptionValue("p"));
+ }
+ else
+ {
+ ca.negotiateAdministratorDetails();
+ }
}
/**
@@ -96,9 +95,9 @@ public final class CreateAdministrator
* @throws Exception if error
*/
protected CreateAdministrator()
- throws Exception
+ throws Exception
{
- context = new Context();
+ context = new Context();
groupService = EPersonServiceFactory.getInstance().getGroupService();
ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
}
@@ -110,27 +109,27 @@ public final class CreateAdministrator
* @throws Exception if error
*/
protected void negotiateAdministratorDetails()
- throws Exception
+ throws Exception
{
Console console = System.console();
-
- System.out.println("Creating an initial administrator account");
-
- boolean dataOK = false;
-
- String email = null;
- String firstName = null;
- String lastName = null;
+
+ System.out.println("Creating an initial administrator account");
+
+ boolean dataOK = false;
+
+ String email = null;
+ String firstName = null;
+ String lastName = null;
char[] password1 = null;
char[] password2 = null;
- String language = I18nUtil.DEFAULTLOCALE.getLanguage();
-
- while (!dataOK)
- {
- System.out.print("E-mail address: ");
- System.out.flush();
-
- email = console.readLine();
+ String language = I18nUtil.DEFAULTLOCALE.getLanguage();
+
+ while (!dataOK)
+ {
+ System.out.print("E-mail address: ");
+ System.out.flush();
+
+ email = console.readLine();
if (!StringUtils.isBlank(email))
{
email = email.trim();
@@ -140,34 +139,34 @@ public final class CreateAdministrator
System.out.println("Please provide an email address.");
continue;
}
-
- System.out.print("First name: ");
- System.out.flush();
-
- firstName = console.readLine();
+
+ System.out.print("First name: ");
+ System.out.flush();
+
+ firstName = console.readLine();
if (firstName != null)
{
firstName = firstName.trim();
}
-
- System.out.print("Last name: ");
- System.out.flush();
-
- lastName = console.readLine();
+
+ System.out.print("Last name: ");
+ System.out.flush();
+
+ lastName = console.readLine();
if (lastName != null)
{
lastName = lastName.trim();
}
-
+
if (ConfigurationManager.getProperty("webui.supported.locales") != null)
{
System.out.println("Select one of the following languages: " + ConfigurationManager.getProperty("webui.supported.locales"));
System.out.print("Language: ");
System.out.flush();
- language = console.readLine();
+ language = console.readLine();
if (language != null)
{
@@ -176,25 +175,25 @@ public final class CreateAdministrator
}
}
- System.out.println("Password will not display on screen.");
- System.out.print("Password: ");
- System.out.flush();
+ System.out.println("Password will not display on screen.");
+ System.out.print("Password: ");
+ System.out.flush();
- password1 = console.readPassword();
-
- System.out.print("Again to confirm: ");
- System.out.flush();
-
- password2 = console.readPassword();
+ password1 = console.readPassword();
+
+ System.out.print("Again to confirm: ");
+ System.out.flush();
+
+ password2 = console.readPassword();
//TODO real password validation
if (password1.length > 1 && Arrays.equals(password1, password2))
- {
- // password OK
- System.out.print("Is the above data correct? (y or n): ");
- System.out.flush();
-
- String s = console.readLine();
+ {
+ // password OK
+ System.out.print("Is the above data correct? (y or n): ");
+ System.out.flush();
+
+ String s = console.readLine();
if (s != null)
{
@@ -204,15 +203,15 @@ public final class CreateAdministrator
dataOK = true;
}
}
- }
- else
- {
- System.out.println("Passwords don't match");
- }
- }
-
- // if we make it to here, we are ready to create an administrator
- createAdministrator(email, firstName, lastName, language, String.valueOf(password1));
+ }
+ else
+ {
+ System.out.println("Passwords don't match");
+ }
+ }
+
+ // if we make it to here, we are ready to create an administrator
+ createAdministrator(email, firstName, lastName, language, String.valueOf(password1));
//Cleaning arrays that held password
Arrays.fill(password1, ' ');
@@ -223,31 +222,31 @@ public final class CreateAdministrator
* Create the administrator with the given details. If the user
* already exists then they are simply upped to administrator status
*
- * @param email the email for the user
- * @param first user's first name
- * @param last user's last name
+ * @param email the email for the user
+ * @param first user's first name
+ * @param last user's last name
* @param language preferred language
- * @param pw desired password
+ * @param pw desired password
*
* @throws Exception if error
*/
protected void createAdministrator(String email, String first, String last,
- String language, String pw)
- throws Exception
+ String language, String pw)
+ throws Exception
{
- // Of course we aren't an administrator yet so we need to
- // circumvent authorisation
- context.turnOffAuthorisationSystem();
-
- // Find administrator group
- Group admins = groupService.findByName(context, Group.ADMIN);
-
- if (admins == null)
- {
- throw new IllegalStateException("Error, no admin group (group 1) found");
- }
-
- // Create the administrator e-person
+ // Of course we aren't an administrator yet so we need to
+ // circumvent authorisation
+ context.turnOffAuthorisationSystem();
+
+ // Find administrator group
+ Group admins = groupService.findByName(context, Group.ADMIN);
+
+ if (admins == null)
+ {
+ throw new IllegalStateException("Error, no admin group (group 1) found");
+ }
+
+ // Create the administrator e-person
EPerson eperson = ePersonService.findByEmail(context,email);
// check if the email belongs to a registered user,
@@ -260,18 +259,18 @@ public final class CreateAdministrator
eperson.setRequireCertificate(false);
eperson.setSelfRegistered(false);
}
-
- eperson.setLastName(context, last);
- eperson.setFirstName(context, first);
- eperson.setLanguage(context, language);
+
+ eperson.setLastName(context, last);
+ eperson.setFirstName(context, first);
+ eperson.setLanguage(context, language);
ePersonService.setPassword(eperson, pw);
ePersonService.update(context, eperson);
-
- groupService.addMember(context, admins, eperson);
+
+ groupService.addMember(context, admins, eperson);
groupService.update(context, admins);
-
- context.complete();
-
- System.out.println("Administrator account created");
+
+ context.complete();
+
+ System.out.println("Administrator account created");
}
}
diff --git a/dspace-api/src/main/java/org/dspace/administer/MetadataImporter.java b/dspace-api/src/main/java/org/dspace/administer/MetadataImporter.java
index 1e1882d7ae..49e6661a55 100644
--- a/dspace-api/src/main/java/org/dspace/administer/MetadataImporter.java
+++ b/dspace-api/src/main/java/org/dspace/administer/MetadataImporter.java
@@ -71,7 +71,8 @@ public class MetadataImporter
/**
* main method for reading user input from the command line
- * @param args arguments
+ *
+ * @param args the command line arguments given
* @throws ParseException if parse error
* @throws SQLException if database error
* @throws IOException if IO error
@@ -83,9 +84,9 @@ public class MetadataImporter
* @throws RegistryImportException if import fails
**/
public static void main(String[] args)
- throws ParseException, SQLException, IOException, TransformerException,
- ParserConfigurationException, AuthorizeException, SAXException,
- NonUniqueMetadataException, RegistryImportException
+ throws ParseException, SQLException, IOException, TransformerException,
+ ParserConfigurationException, AuthorizeException, SAXException,
+ NonUniqueMetadataException, RegistryImportException
{
boolean forceUpdate = false;
@@ -114,7 +115,7 @@ public class MetadataImporter
/**
* Load the data from the specified file path into the database
*
- * @param file the file path containing the source data
+ * @param file the file path containing the source data
* @param forceUpdate whether to force update
* @throws SQLException if database error
* @throws IOException if IO error
@@ -126,8 +127,8 @@ public class MetadataImporter
* @throws RegistryImportException if import fails
*/
public static void loadRegistry(String file, boolean forceUpdate)
- throws SQLException, IOException, TransformerException, ParserConfigurationException,
- AuthorizeException, SAXException, NonUniqueMetadataException, RegistryImportException
+ throws SQLException, IOException, TransformerException, ParserConfigurationException,
+ AuthorizeException, SAXException, NonUniqueMetadataException, RegistryImportException
{
Context context = null;
@@ -301,8 +302,8 @@ public class MetadataImporter
public static void usage()
{
String usage = "Use this class with the following option:\n" +
- " -f : specify which xml source file " +
- "contains the DC fields to import.\n";
+ " -f : specify which xml source file " +
+ "contains the DC fields to import.\n";
System.out.println(usage);
}
}
diff --git a/dspace-api/src/main/java/org/dspace/administer/RegistryLoader.java b/dspace-api/src/main/java/org/dspace/administer/RegistryLoader.java
index 092a61e145..4ec485fb43 100644
--- a/dspace-api/src/main/java/org/dspace/administer/RegistryLoader.java
+++ b/dspace-api/src/main/java/org/dspace/administer/RegistryLoader.java
@@ -54,8 +54,7 @@ public class RegistryLoader
/**
* For invoking via the command line
*
- * @param argv
- * command-line arguments
+ * @param argv the command line arguments given
* @throws Exception if error
*/
public static void main(String[] argv) throws Exception
diff --git a/dspace-api/src/main/java/org/dspace/administer/StructBuilder.java b/dspace-api/src/main/java/org/dspace/administer/StructBuilder.java
index e90d4ae962..c1f8f928fd 100644
--- a/dspace-api/src/main/java/org/dspace/administer/StructBuilder.java
+++ b/dspace-api/src/main/java/org/dspace/administer/StructBuilder.java
@@ -92,47 +92,48 @@ public class StructBuilder
*
* The output file will contain exactly the same as the source xml document, but
* with the handle for each imported item added as an attribute.
- * @param argv commandline arguments
+ *
+ * @param argv the command line arguments given
* @throws Exception if an error occurs
*/
public static void main(String[] argv)
- throws Exception
+ throws Exception
{
CommandLineParser parser = new PosixParser();
- Options options = new Options();
+ Options options = new Options();
- options.addOption( "f", "file", true, "file");
- options.addOption( "e", "eperson", true, "eperson");
- options.addOption("o", "output", true, "output");
-
- CommandLine line = parser.parse( options, argv );
-
- String file = null;
- String eperson = null;
- String output = null;
-
- if (line.hasOption('f'))
- {
- file = line.getOptionValue('f');
- }
-
- if (line.hasOption('e'))
- {
- eperson = line.getOptionValue('e');
- }
-
- if (line.hasOption('o'))
- {
- output = line.getOptionValue('o');
- }
-
- if (output == null || eperson == null || file == null)
- {
- usage();
- System.exit(0);
- }
-
+ options.addOption( "f", "file", true, "file");
+ options.addOption( "e", "eperson", true, "eperson");
+ options.addOption("o", "output", true, "output");
+
+ CommandLine line = parser.parse( options, argv );
+
+ String file = null;
+ String eperson = null;
+ String output = null;
+
+ if (line.hasOption('f'))
+ {
+ file = line.getOptionValue('f');
+ }
+
+ if (line.hasOption('e'))
+ {
+ eperson = line.getOptionValue('e');
+ }
+
+ if (line.hasOption('o'))
+ {
+ output = line.getOptionValue('o');
+ }
+
+ if (output == null || eperson == null || file == null)
+ {
+ usage();
+ System.exit(0);
+ }
+
// create a context
Context context = new Context();
@@ -204,12 +205,12 @@ public class StructBuilder
* Validate the XML document. This method does not return, but if validation
* fails it generates an error and ceases execution
*
- * @param document the XML document object
+ * @param document the XML document object
* @throws TransformerException if transformer error
*
*/
private static void validate(org.w3c.dom.Document document)
- throws TransformerException
+ throws TransformerException
{
StringBuffer err = new StringBuffer();
boolean trip = false;
@@ -245,13 +246,13 @@ public class StructBuilder
*
* @param communities the NodeList of communities to validate
* @param level the level in the XML document that we are at, for the purposes
- * of error reporting
+ * of error reporting
*
* @return the errors that need to be generated by the calling method, or null if
- * no errors.
+ * no errors.
*/
private static String validateCommunities(NodeList communities, int level)
- throws TransformerException
+ throws TransformerException
{
StringBuffer err = new StringBuffer();
boolean trip = false;
@@ -260,32 +261,32 @@ public class StructBuilder
for (int i = 0; i < communities.getLength(); i++)
{
Node n = communities.item(i);
- NodeList name = XPathAPI.selectNodeList(n, "name");
- if (name.getLength() != 1)
- {
- String pos = Integer.toString(i + 1);
- err.append("-The level " + level + " community in position " + pos);
- err.append(" does not contain exactly one name field\n");
- trip = true;
- }
-
- // validate sub communities
- NodeList subCommunities = XPathAPI.selectNodeList(n, "community");
- String comErrs = validateCommunities(subCommunities, level + 1);
- if (comErrs != null)
- {
- err.append(comErrs);
- trip = true;
- }
-
- // validate collections
- NodeList collections = XPathAPI.selectNodeList(n, "collection");
- String colErrs = validateCollections(collections, level + 1);
- if (colErrs != null)
- {
- err.append(colErrs);
- trip = true;
- }
+ NodeList name = XPathAPI.selectNodeList(n, "name");
+ if (name.getLength() != 1)
+ {
+ String pos = Integer.toString(i + 1);
+ err.append("-The level " + level + " community in position " + pos);
+ err.append(" does not contain exactly one name field\n");
+ trip = true;
+ }
+
+ // validate sub communities
+ NodeList subCommunities = XPathAPI.selectNodeList(n, "community");
+ String comErrs = validateCommunities(subCommunities, level + 1);
+ if (comErrs != null)
+ {
+ err.append(comErrs);
+ trip = true;
+ }
+
+ // validate collections
+ NodeList collections = XPathAPI.selectNodeList(n, "collection");
+ String colErrs = validateCollections(collections, level + 1);
+ if (colErrs != null)
+ {
+ err.append(colErrs);
+ trip = true;
+ }
}
if (trip)
@@ -306,7 +307,7 @@ public class StructBuilder
* @return the errors to be generated by the calling method, or null if none
*/
private static String validateCollections(NodeList collections, int level)
- throws TransformerException
+ throws TransformerException
{
StringBuffer err = new StringBuffer();
boolean trip = false;
@@ -315,14 +316,14 @@ public class StructBuilder
for (int i = 0; i < collections.getLength(); i++)
{
Node n = collections.item(i);
- NodeList name = XPathAPI.selectNodeList(n, "name");
- if (name.getLength() != 1)
- {
- String pos = Integer.toString(i + 1);
- err.append("-The level " + level + " collection in position " + pos);
- err.append(" does not contain exactly one name field\n");
- trip = true;
- }
+ NodeList name = XPathAPI.selectNodeList(n, "name");
+ if (name.getLength() != 1)
+ {
+ String pos = Integer.toString(i + 1);
+ err.append("-The level " + level + " collection in position " + pos);
+ err.append(" does not contain exactly one name field\n");
+ trip = true;
+ }
}
if (trip)
@@ -342,7 +343,7 @@ public class StructBuilder
* @return the DOM representation of the XML file
*/
private static org.w3c.dom.Document loadXML(String filename)
- throws IOException, ParserConfigurationException, SAXException
+ throws IOException, ParserConfigurationException, SAXException
{
DocumentBuilder builder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
@@ -385,10 +386,10 @@ public class StructBuilder
* @param parent the parent community of the nodelist of communities to create
*
* @return an element array containing additional information regarding the
- * created communities (e.g. the handles they have been assigned)
+ * created communities (e.g. the handles they have been assigned)
*/
private static Element[] handleCommunities(Context context, NodeList communities, Community parent)
- throws TransformerException, SQLException, Exception
+ throws TransformerException, SQLException, Exception
{
Element[] elements = new Element[communities.getLength()];
@@ -506,10 +507,10 @@ public class StructBuilder
* @param parent the parent community to whom the collections belong
*
* @return an Element array containing additional information about the
- * created collections (e.g. the handle)
+ * created collections (e.g. the handle)
*/
private static Element[] handleCollections(Context context, NodeList collections, Community parent)
- throws TransformerException, SQLException, AuthorizeException, IOException, Exception
+ throws TransformerException, SQLException, AuthorizeException, IOException, Exception
{
Element[] elements = new Element[collections.getLength()];
diff --git a/dspace-api/src/main/java/org/dspace/app/checker/ChecksumChecker.java b/dspace-api/src/main/java/org/dspace/app/checker/ChecksumChecker.java
index df8b1eddbf..00ec210ad9 100644
--- a/dspace-api/src/main/java/org/dspace/app/checker/ChecksumChecker.java
+++ b/dspace-api/src/main/java/org/dspace/app/checker/ChecksumChecker.java
@@ -53,25 +53,25 @@ public final class ChecksumChecker
/**
* Command line access to the checksum package.
*
- * @param args
- *
- * - -h
- * - Print help on command line options
- * - -l
- * - loop through bitstreams once
- * - -L
- * - loop continuously through bitstreams
- * - -d
- * - specify duration of process run
- * - -b
- * - specify bitstream IDs
- * - -a [handle_id]
- * - check anything by handle
- * - -e
- * - Report only errors in the logs
- * - -p
- * - Don't prune results before running checker
- *
+ *
+ * - -h
+ * - Print help on command line options
+ * - -l
+ * - loop through bitstreams once
+ * - -L
+ * - loop continuously through bitstreams
+ * - -d
+ * - specify duration of process run
+ * - -b
+ * - specify bitstream IDs
+ * - -a [handle_id]
+ * - check anything by handle
+ * - -e
+ * - Report only errors in the logs
+ * - -p
+ * - Don't prune results before running checker
+ *
+ * @param args the command line arguments given
* @throws SQLException if error
*/
public static void main(String[] args) throws SQLException {
@@ -84,7 +84,7 @@ public final class ChecksumChecker
options.addOption("l", "looping", false, "Loop once through bitstreams");
options.addOption("L", "continuous", false,
- "Loop continuously through bitstreams");
+ "Loop continuously through bitstreams");
options.addOption("h", "help", false, "Help");
options.addOption("d", "duration", true, "Checking duration");
options.addOption("c", "count", true, "Check count");
@@ -92,19 +92,18 @@ public final class ChecksumChecker
options.addOption("v", "verbose", false, "Report all processing");
OptionBuilder.withArgName("bitstream-ids").hasArgs().withDescription(
- "Space separated list of bitstream ids");
+ "Space separated list of bitstream ids");
Option useBitstreamIds = OptionBuilder.create('b');
options.addOption(useBitstreamIds);
options.addOption("p", "prune", false, "Prune configuration file");
- options
- .addOption(OptionBuilder
- .withArgName("prune")
- .hasOptionalArgs(1)
- .withDescription(
- "Prune old results (optionally using specified properties file for configuration)")
- .create('p'));
+ options.addOption(OptionBuilder
+ .withArgName("prune")
+ .hasOptionalArgs(1)
+ .withDescription(
+ "Prune old results (optionally using specified properties file for configuration)")
+ .create('p'));
try
{
@@ -233,7 +232,7 @@ public final class ChecksumChecker
context.complete();
context = null;
} finally {
- if(context != null){
+ if (context != null) {
context.abort();
}
}
@@ -249,19 +248,15 @@ public final class ChecksumChecker
HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("Checksum Checker\n", options);
- System.out
- .println("\nSpecify a duration for checker process, using s(seconds),"
- + "m(minutes), or h(hours): ChecksumChecker -d 30s"
- + " OR ChecksumChecker -d 30m"
- + " OR ChecksumChecker -d 2h");
- System.out
- .println("\nSpecify bitstream IDs: ChecksumChecker -b 13 15 17 20");
+ System.out.println("\nSpecify a duration for checker process, using s(seconds),"
+ + "m(minutes), or h(hours): ChecksumChecker -d 30s"
+ + " OR ChecksumChecker -d 30m"
+ + " OR ChecksumChecker -d 2h");
+ System.out.println("\nSpecify bitstream IDs: ChecksumChecker -b 13 15 17 20");
System.out.println("\nLoop once through all bitstreams: "
- + "ChecksumChecker -l");
- System.out
- .println("\nLoop continuously through all bitstreams: ChecksumChecker -L");
- System.out
- .println("\nCheck a defined number of bitstreams: ChecksumChecker -c 10");
+ + "ChecksumChecker -l");
+ System.out.println("\nLoop continuously through all bitstreams: ChecksumChecker -L");
+ System.out.println("\nCheck a defined number of bitstreams: ChecksumChecker -c 10");
System.out.println("\nReport all processing (verbose)(default reports only errors): ChecksumChecker -v");
System.out.println("\nDefault (no arguments) is equivalent to '-c 1'");
System.exit(0);
diff --git a/dspace-api/src/main/java/org/dspace/app/harvest/Harvest.java b/dspace-api/src/main/java/org/dspace/app/harvest/Harvest.java
index 3e74bc12e7..ad74ea58bc 100644
--- a/dspace-api/src/main/java/org/dspace/app/harvest/Harvest.java
+++ b/dspace-api/src/main/java/org/dspace/app/harvest/Harvest.java
@@ -67,12 +67,18 @@ public class Harvest
options.addOption("P", "purge", false, "purge all harvestable collections");
- options.addOption("e", "eperson", true, "eperson");
- options.addOption("c", "collection", true, "harvesting collection (handle or id)");
- options.addOption("t", "type", true, "type of harvesting (0 for none)");
- options.addOption("a", "address", true, "address of the OAI-PMH server");
- options.addOption("i", "oai_set_id", true, "id of the PMH set representing the harvested collection");
- options.addOption("m", "metadata_format", true, "the name of the desired metadata format for harvesting, resolved to namespace and crosswalk in dspace.cfg");
+ options.addOption("e", "eperson", true,
+ "eperson");
+ options.addOption("c", "collection", true,
+ "harvesting collection (handle or id)");
+ options.addOption("t", "type", true,
+ "type of harvesting (0 for none)");
+ options.addOption("a", "address", true,
+ "address of the OAI-PMH server");
+ options.addOption("i", "oai_set_id", true,
+ "id of the PMH set representing the harvested collection");
+ options.addOption("m", "metadata_format", true,
+ "the name of the desired metadata format for harvesting, resolved to namespace and crosswalk in dspace.cfg");
options.addOption("h", "help", false, "help");
@@ -90,22 +96,14 @@ public class Harvest
{
HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("Harvest\n", options);
- System.out
- .println("\nPING OAI server: Harvest -g -s oai_source -i oai_set_id");
- System.out
- .println("RUNONCE harvest with arbitrary options: Harvest -o -e eperson -c collection -t harvest_type -a oai_source -i oai_set_id -m metadata_format");
- System.out
- .println("SETUP a collection for harvesting: Harvest -s -c collection -t harvest_type -a oai_source -i oai_set_id -m metadata_format");
- System.out
- .println("RUN harvest once: Harvest -r -e eperson -c collection");
- System.out
- .println("START harvest scheduler: Harvest -S");
- System.out
- .println("RESET all harvest status: Harvest -R");
- System.out
- .println("PURGE a collection of items and settings: Harvest -p -e eperson -c collection");
- System.out
- .println("PURGE all harvestable collections: Harvest -P -e eperson");
+ System.out.println("\nPING OAI server: Harvest -g -s oai_source -i oai_set_id");
+ System.out.println("RUNONCE harvest with arbitrary options: Harvest -o -e eperson -c collection -t harvest_type -a oai_source -i oai_set_id -m metadata_format");
+ System.out.println("SETUP a collection for harvesting: Harvest -s -c collection -t harvest_type -a oai_source -i oai_set_id -m metadata_format");
+ System.out.println("RUN harvest once: Harvest -r -e eperson -c collection");
+ System.out.println("START harvest scheduler: Harvest -S");
+ System.out.println("RESET all harvest status: Harvest -R");
+ System.out.println("PURGE a collection of items and settings: Harvest -p -e eperson -c collection");
+ System.out.println("PURGE all harvestable collections: Harvest -P -e eperson");
@@ -147,7 +145,7 @@ public class Harvest
if (line.hasOption('t')) {
harvestType = Integer.parseInt(line.getOptionValue('t'));
} else {
- harvestType = 0;
+ harvestType = 0;
}
if (line.hasOption('a')) {
oaiSource = line.getOptionValue('a');
@@ -188,31 +186,31 @@ public class Harvest
// start the harvest loop
else if ("start".equals(command))
{
- startHarvester();
+ startHarvester();
}
// reset harvesting status
else if ("reset".equals(command))
{
- resetHarvesting();
+ resetHarvesting();
}
// purge all collections that are set up for harvesting (obviously for testing purposes only)
else if ("purgeAll".equals(command))
{
- if (eperson == null)
+ if (eperson == null)
{
System.out
.println("Error - an eperson must be provided");
System.out.println(" (run with -h flag for details)");
System.exit(1);
}
-
- List harvestedCollections = harvestedCollectionService.findAll(context);
- for (HarvestedCollection harvestedCollection : harvestedCollections)
- {
+
+ List harvestedCollections = harvestedCollectionService.findAll(context);
+ for (HarvestedCollection harvestedCollection : harvestedCollections)
+ {
System.out.println("Purging the following collections (deleting items and resetting harvest status): " + harvestedCollection.getCollection().getID().toString());
harvester.purgeCollection(harvestedCollection.getCollection().getID().toString(), eperson);
- }
- context.complete();
+ }
+ context.complete();
}
// Delete all items in a collection. Useful for testing fresh harvests.
else if ("purge".equals(command))
@@ -247,9 +245,9 @@ public class Harvest
}
if (metadataKey == null)
{
- System.out.println("Error - a metadata key (commonly the prefix) must be specified for this collection");
+ System.out.println("Error - a metadata key (commonly the prefix) must be specified for this collection");
System.out.println(" (run with -h flag for details)");
- System.exit(1);
+ System.exit(1);
}
harvester.configureCollection(collection, harvestType, oaiSource, oaiSetID, metadataKey);
@@ -272,13 +270,13 @@ public class Harvest
* the collection, if not, bail out.
*/
private Collection resolveCollection(String collectionID) {
-
- DSpaceObject dso;
- Collection targetCollection = null;
-
- try {
- // is the ID a handle?
- if (collectionID != null)
+
+ DSpaceObject dso;
+ Collection targetCollection = null;
+
+ try {
+ // is the ID a handle?
+ if (collectionID != null)
{
if (collectionID.indexOf('/') != -1)
{
@@ -309,45 +307,45 @@ public class Harvest
System.out.println("Cannot resolve " + collectionID + " to collection");
System.exit(1);
}
- }
- catch (SQLException se) {
- se.printStackTrace();
- }
-
- return targetCollection;
+ }
+ catch (SQLException se) {
+ se.printStackTrace();
+ }
+
+ return targetCollection;
}
private void configureCollection(String collectionID, int type, String oaiSource, String oaiSetId, String mdConfigId) {
- System.out.println("Running: configure collection");
-
- Collection collection = resolveCollection(collectionID);
- System.out.println(collection.getID());
-
- try {
- HarvestedCollection hc = harvestedCollectionService.find(context, collection);
- if (hc == null) {
- hc = harvestedCollectionService.create(context, collection);
- }
-
- context.turnOffAuthorisationSystem();
- hc.setHarvestParams(type, oaiSource, oaiSetId, mdConfigId);
- hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
+ System.out.println("Running: configure collection");
+
+ Collection collection = resolveCollection(collectionID);
+ System.out.println(collection.getID());
+
+ try {
+ HarvestedCollection hc = harvestedCollectionService.find(context, collection);
+ if (hc == null) {
+ hc = harvestedCollectionService.create(context, collection);
+ }
+
+ context.turnOffAuthorisationSystem();
+ hc.setHarvestParams(type, oaiSource, oaiSetId, mdConfigId);
+ hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
harvestedCollectionService.update(context, hc);
- context.restoreAuthSystemState();
- context.complete();
- }
- catch (Exception e) {
- System.out.println("Changes could not be committed");
- e.printStackTrace();
- System.exit(1);
- }
- finally {
+ context.restoreAuthSystemState();
+ context.complete();
+ }
+ catch (Exception e) {
+ System.out.println("Changes could not be committed");
+ e.printStackTrace();
+ System.exit(1);
+ }
+ finally {
if (context != null)
{
- context.restoreAuthSystemState();
+ context.restoreAuthSystemState();
}
- }
+ }
}
@@ -358,49 +356,49 @@ public class Harvest
* @param email
*/
private void purgeCollection(String collectionID, String email) {
- System.out.println("Purging collection of all items and resetting last_harvested and harvest_message: " + collectionID);
- Collection collection = resolveCollection(collectionID);
-
- try
- {
- EPerson eperson = ePersonService.findByEmail(context, email);
- context.setCurrentUser(eperson);
- context.turnOffAuthorisationSystem();
+ System.out.println("Purging collection of all items and resetting last_harvested and harvest_message: " + collectionID);
+ Collection collection = resolveCollection(collectionID);
+
+ try
+ {
+ EPerson eperson = ePersonService.findByEmail(context, email);
+ context.setCurrentUser(eperson);
+ context.turnOffAuthorisationSystem();
ItemService itemService = ContentServiceFactory.getInstance().getItemService();
Iterator- it = itemService.findByCollection(context, collection);
- int i=0;
- while (it.hasNext()) {
- i++;
- Item item = it.next();
- System.out.println("Deleting: " + item.getHandle());
+ int i=0;
+ while (it.hasNext()) {
+ i++;
+ Item item = it.next();
+ System.out.println("Deleting: " + item.getHandle());
collectionService.removeItem(context, collection, item);
- // Dispatch events every 50 items
- if (i%50 == 0) {
- context.dispatchEvents();
- i=0;
- }
- }
-
- HarvestedCollection hc = harvestedCollectionService.find(context, collection);
- if (hc != null) {
- hc.setLastHarvested(null);
+ // Dispatch events every 50 items
+ if (i%50 == 0) {
+ context.dispatchEvents();
+ i=0;
+ }
+ }
+
+ HarvestedCollection hc = harvestedCollectionService.find(context, collection);
+ if (hc != null) {
+ hc.setLastHarvested(null);
hc.setHarvestMessage("");
- hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
- hc.setHarvestStartTime(null);
+ hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
+ hc.setHarvestStartTime(null);
harvestedCollectionService.update(context, hc);
- }
- context.restoreAuthSystemState();
+ }
+ context.restoreAuthSystemState();
context.dispatchEvents();
- }
- catch (Exception e) {
- System.out.println("Changes could not be committed");
- e.printStackTrace();
- System.exit(1);
- }
- finally {
- context.restoreAuthSystemState();
- }
+ }
+ catch (Exception e) {
+ System.out.println("Changes could not be committed");
+ e.printStackTrace();
+ System.exit(1);
+ }
+ finally {
+ context.restoreAuthSystemState();
+ }
}
@@ -408,34 +406,34 @@ public class Harvest
* Run a single harvest cycle on the specified collection under the authorization of the supplied EPerson
*/
private void runHarvest(String collectionID, String email) {
- System.out.println("Running: a harvest cycle on " + collectionID);
-
- System.out.print("Initializing the harvester... ");
- OAIHarvester harvester = null;
- try {
- Collection collection = resolveCollection(collectionID);
- HarvestedCollection hc = harvestedCollectionService.find(context, collection);
- harvester = new OAIHarvester(context, collection, hc);
- System.out.println("success. ");
- }
- catch (HarvestingException hex) {
- System.out.print("failed. ");
- System.out.println(hex.getMessage());
- throw new IllegalStateException("Unable to harvest", hex);
- } catch (SQLException se) {
+ System.out.println("Running: a harvest cycle on " + collectionID);
+
+ System.out.print("Initializing the harvester... ");
+ OAIHarvester harvester = null;
+ try {
+ Collection collection = resolveCollection(collectionID);
+ HarvestedCollection hc = harvestedCollectionService.find(context, collection);
+ harvester = new OAIHarvester(context, collection, hc);
+ System.out.println("success. ");
+ }
+ catch (HarvestingException hex) {
+ System.out.print("failed. ");
+ System.out.println(hex.getMessage());
+ throw new IllegalStateException("Unable to harvest", hex);
+ } catch (SQLException se) {
System.out.print("failed. ");
System.out.println(se.getMessage());
throw new IllegalStateException("Unable to access database", se);
- }
-
- try {
- // Harvest will not work for an anonymous user
- EPerson eperson = ePersonService.findByEmail(context, email);
- System.out.println("Harvest started... ");
- context.setCurrentUser(eperson);
- harvester.runHarvest();
- context.complete();
- }
+ }
+
+ try {
+ // Harvest will not work for an anonymous user
+ EPerson eperson = ePersonService.findByEmail(context, email);
+ System.out.println("Harvest started... ");
+ context.setCurrentUser(eperson);
+ harvester.runHarvest();
+ context.complete();
+ }
catch (SQLException e) {
throw new IllegalStateException("Failed to run harvester", e);
}
@@ -453,10 +451,10 @@ public class Harvest
* Resets harvest_status and harvest_start_time flags for all collections that have a row in the harvested_collections table
*/
private static void resetHarvesting() {
- System.out.print("Resetting harvest status flag on all collections... ");
+ System.out.print("Resetting harvest status flag on all collections... ");
- try
- {
+ try
+ {
List harvestedCollections = harvestedCollectionService.findAll(context);
for (HarvestedCollection harvestedCollection : harvestedCollections)
{
@@ -466,11 +464,11 @@ public class Harvest
harvestedCollectionService.update(context, harvestedCollection);
}
System.out.println("success. ");
- }
- catch (Exception ex) {
+ }
+ catch (Exception ex) {
System.out.println("failed. ");
ex.printStackTrace();
- }
+ }
}
/**
@@ -483,10 +481,10 @@ public class Harvest
System.out.print("Starting harvest loop... ");
HarvestServiceFactory.getInstance().getHarvestSchedulingService().startNewScheduler();
System.out.println("running. ");
- }
- catch (Exception ex) {
+ }
+ catch (Exception ex) {
ex.printStackTrace();
- }
+ }
}
/**
diff --git a/dspace-api/src/main/java/org/dspace/app/itemupdate/BitstreamFilterByFilename.java b/dspace-api/src/main/java/org/dspace/app/itemupdate/BitstreamFilterByFilename.java
index 292db98897..4613540252 100644
--- a/dspace-api/src/main/java/org/dspace/app/itemupdate/BitstreamFilterByFilename.java
+++ b/dspace-api/src/main/java/org/dspace/app/itemupdate/BitstreamFilterByFilename.java
@@ -16,38 +16,38 @@ import org.dspace.content.Bitstream;
*
*/
public class BitstreamFilterByFilename extends BitstreamFilter {
-
- protected Pattern pattern;
+
+ protected Pattern pattern;
protected String filenameRegex;
-
- public BitstreamFilterByFilename()
- {
- //empty
- }
+
+ public BitstreamFilterByFilename()
+ {
+ //empty
+ }
- /**
- * Tests bitstream by matching the regular expression in the
- * properties against the bitstream name
- *
- * @param bitstream Bitstream
- * @return whether bitstream name matches the regular expression
- * @exception BitstreamFilterException if filter error
- */
- @Override
+ /**
+ * Tests bitstream by matching the regular expression in the
+ * properties against the bitstream name
+ *
+ * @param bitstream Bitstream
+ * @return whether bitstream name matches the regular expression
+ * @throws BitstreamFilterException if filter error
+ */
+ @Override
public boolean accept(Bitstream bitstream) throws BitstreamFilterException
- {
- if (filenameRegex == null)
- {
- filenameRegex = props.getProperty("filename");
- if (filenameRegex == null)
- {
- throw new BitstreamFilterException("BitstreamFilter property 'filename' not found.");
- }
- pattern = Pattern.compile(filenameRegex);
- }
-
- Matcher m = pattern.matcher(bitstream.getName());
- return m.matches();
- }
+ {
+ if (filenameRegex == null)
+ {
+ filenameRegex = props.getProperty("filename");
+ if (filenameRegex == null)
+ {
+ throw new BitstreamFilterException("BitstreamFilter property 'filename' not found.");
+ }
+ pattern = Pattern.compile(filenameRegex);
+ }
+
+ Matcher m = pattern.matcher(bitstream.getName());
+ return m.matches();
+ }
}
diff --git a/dspace-api/src/main/java/org/dspace/app/itemupdate/ItemUpdate.java b/dspace-api/src/main/java/org/dspace/app/itemupdate/ItemUpdate.java
index 9963e20256..06dc02a2e2 100644
--- a/dspace-api/src/main/java/org/dspace/app/itemupdate/ItemUpdate.java
+++ b/dspace-api/src/main/java/org/dspace/app/itemupdate/ItemUpdate.java
@@ -34,7 +34,7 @@ import org.dspace.eperson.service.EPersonService;
/**
*
* Provides some batch editing capabilities for items in DSpace:
- * Metadata fields - Add, Delete
+ * Metadata fields - Add, Delete
* Bitstreams - Add, Delete
*
* The design has been for compatibility with ItemImporter
@@ -62,33 +62,33 @@ import org.dspace.eperson.service.EPersonService;
*
*/
public class ItemUpdate {
-
- public static final String SUPPRESS_UNDO_FILENAME = "suppress_undo";
+
+ public static final String SUPPRESS_UNDO_FILENAME = "suppress_undo";
- public static final String CONTENTS_FILE = "contents";
- public static final String DELETE_CONTENTS_FILE = "delete_contents";
+ public static final String CONTENTS_FILE = "contents";
+ public static final String DELETE_CONTENTS_FILE = "delete_contents";
- public static String HANDLE_PREFIX = null;
- public static final Map filterAliases = new HashMap();
-
- public static boolean verbose = false;
+ public static String HANDLE_PREFIX = null;
+ public static final Map filterAliases = new HashMap();
+
+ public static boolean verbose = false;
protected static final EPersonService epersonService = EPersonServiceFactory.getInstance().getEPersonService();
protected static final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
- static
- {
- filterAliases.put("ORIGINAL", "org.dspace.app.itemupdate.OriginalBitstreamFilter");
- filterAliases.put("ORIGINAL_AND_DERIVATIVES", "org.dspace.app.itemupdate.OriginalWithDerivativesBitstreamFilter");
- filterAliases.put("TEXT", "org.dspace.app.itemupdate.DerivativeTextBitstreamFilter");
- filterAliases.put("THUMBNAIL", "org.dspace.app.itemupdate.ThumbnailBitstreamFilter");
- }
-
+ static
+ {
+ filterAliases.put("ORIGINAL", "org.dspace.app.itemupdate.OriginalBitstreamFilter");
+ filterAliases.put("ORIGINAL_AND_DERIVATIVES", "org.dspace.app.itemupdate.OriginalWithDerivativesBitstreamFilter");
+ filterAliases.put("TEXT", "org.dspace.app.itemupdate.DerivativeTextBitstreamFilter");
+ filterAliases.put("THUMBNAIL", "org.dspace.app.itemupdate.ThumbnailBitstreamFilter");
+ }
+
// File listing filter to check for folders
static FilenameFilter directoryFilter = new FilenameFilter()
{
@Override
- public boolean accept(File dir, String n)
+ public boolean accept(File dir, String n)
{
File f = new File(dir.getAbsolutePath() + File.separatorChar + n);
return f.isDirectory();
@@ -99,7 +99,7 @@ public class ItemUpdate {
static FilenameFilter fileFilter = new FilenameFilter()
{
@Override
- public boolean accept(File dir, String n)
+ public boolean accept(File dir, String n)
{
File f = new File(dir.getAbsolutePath() + File.separatorChar + n);
return (f.isFile());
@@ -113,7 +113,7 @@ public class ItemUpdate {
/**
*
- * @param argv commandline args
+ * @param argv the command line arguments given
*/
public static void main(String[] argv)
{
@@ -122,11 +122,11 @@ public class ItemUpdate {
Options options = new Options();
- //processing basis for determining items
+ //processing basis for determining items
//item-specific changes with metadata in source directory with dublin_core.xml files
options.addOption("s", "source", true, "root directory of source dspace archive ");
- //actions on items
+ //actions on items
options.addOption("a", "addmetadata", true, "add metadata specified for each item; multiples separated by semicolon ';'");
options.addOption("d", "deletemetadata", true, "delete metadata specified for each item");
@@ -138,13 +138,13 @@ public class ItemUpdate {
delBitstreamOption.setArgName("BitstreamFilter");
options.addOption(delBitstreamOption);
-//other params
+ //other params
options.addOption("e", "eperson", true, "email of eperson doing the update");
options.addOption("i", "itemfield", true, "optional metadata field that containing item identifier; default is dc.identifier.uri");
options.addOption("F", "filter-properties", true, "filter class name; only for deleting bitstream");
options.addOption("v", "verbose", false, "verbose logging");
-//special run states
+ //special run states
options.addOption("t", "test", false, "test run - do not actually import items");
options.addOption("P", "provenance", false, "suppress altering provenance field for bitstream changes");
options.addOption("h", "help", false, "help");
@@ -156,216 +156,216 @@ public class ItemUpdate {
String metadataIndexName = null;
Context context = null;
- ItemUpdate iu = new ItemUpdate();
+ ItemUpdate iu = new ItemUpdate();
try
{
- CommandLine line = parser.parse(options, argv);
-
- if (line.hasOption('h'))
- {
- HelpFormatter myhelp = new HelpFormatter();
- myhelp.printHelp("ItemUpdate", options);
- pr("");
- pr("Examples:");
- pr(" adding metadata: ItemUpdate -e jsmith@mit.edu -s sourcedir -a dc.contributor -a dc.subject ");
- pr(" deleting metadata: ItemUpdate -e jsmith@mit.edu -s sourcedir -d dc.description.other");
- pr(" adding bitstreams: ItemUpdate -e jsmith@mit.edu -s sourcedir -A -i dc.identifier");
- pr(" deleting bitstreams: ItemUpdate -e jsmith@mit.edu -s sourcedir -D ORIGINAL ");
- pr("");
-
- System.exit(0);
- }
-
- if (line.hasOption('v'))
- {
- verbose = true;
- }
+ CommandLine line = parser.parse(options, argv);
+
+ if (line.hasOption('h'))
+ {
+ HelpFormatter myhelp = new HelpFormatter();
+ myhelp.printHelp("ItemUpdate", options);
+ pr("");
+ pr("Examples:");
+ pr(" adding metadata: ItemUpdate -e jsmith@mit.edu -s sourcedir -a dc.contributor -a dc.subject ");
+ pr(" deleting metadata: ItemUpdate -e jsmith@mit.edu -s sourcedir -d dc.description.other");
+ pr(" adding bitstreams: ItemUpdate -e jsmith@mit.edu -s sourcedir -A -i dc.identifier");
+ pr(" deleting bitstreams: ItemUpdate -e jsmith@mit.edu -s sourcedir -D ORIGINAL ");
+ pr("");
+
+ System.exit(0);
+ }
+
+ if (line.hasOption('v'))
+ {
+ verbose = true;
+ }
- if (line.hasOption('P'))
- {
- alterProvenance = false;
- pr("Suppressing changes to Provenance field option");
- }
+ if (line.hasOption('P'))
+ {
+ alterProvenance = false;
+ pr("Suppressing changes to Provenance field option");
+ }
- iu.eperson = line.getOptionValue('e'); // db ID or email
-
- if (!line.hasOption('s')) // item specific changes from archive dir
- {
- pr("Missing source archive option");
- System.exit(1);
- }
- String sourcedir = line.getOptionValue('s');
-
- if (line.hasOption('t')) //test
- {
- isTest = true;
- pr("**Test Run** - not actually updating items.");
-
- }
-
- if (line.hasOption('i'))
- {
- itemField = line.getOptionValue('i');
- }
+ iu.eperson = line.getOptionValue('e'); // db ID or email
+
+ if (!line.hasOption('s')) // item specific changes from archive dir
+ {
+ pr("Missing source archive option");
+ System.exit(1);
+ }
+ String sourcedir = line.getOptionValue('s');
+
+ if (line.hasOption('t')) //test
+ {
+ isTest = true;
+ pr("**Test Run** - not actually updating items.");
+
+ }
+
+ if (line.hasOption('i'))
+ {
+ itemField = line.getOptionValue('i');
+ }
- if (line.hasOption('d'))
- {
- String[] targetFields = line.getOptionValues('d');
-
- DeleteMetadataAction delMetadataAction = (DeleteMetadataAction) iu.actionMgr.getUpdateAction(DeleteMetadataAction.class);
- delMetadataAction.addTargetFields(targetFields);
-
- //undo is an add
- for (String field : targetFields)
- {
- iu.undoActionList.add(" -a " + field + " ");
- }
-
- pr("Delete metadata for fields: ");
- for (String s : targetFields)
- {
- pr(" " + s);
- }
- }
-
- if (line.hasOption('a'))
- {
- String[] targetFields = line.getOptionValues('a');
-
- AddMetadataAction addMetadataAction = (AddMetadataAction) iu.actionMgr.getUpdateAction(AddMetadataAction.class);
- addMetadataAction.addTargetFields(targetFields);
-
- //undo is a delete followed by an add of a replace record for target fields
- for (String field : targetFields)
- {
- iu.undoActionList.add(" -d " + field + " ");
- }
-
- for (String field : targetFields)
- {
- iu.undoActionList.add(" -a " + field + " ");
- }
-
- pr("Add metadata for fields: ");
- for (String s : targetFields)
- {
- pr(" " + s);
- }
- }
-
- if (line.hasOption('D')) // undo not supported
- {
- pr("Delete bitstreams ");
-
- String[] filterNames = line.getOptionValues('D');
- if ((filterNames != null) && (filterNames.length > 1))
- {
- pr("Error: Only one filter can be a used at a time.");
- System.exit(1);
- }
-
- String filterName = line.getOptionValue('D');
- pr("Filter argument: " + filterName);
-
- if (filterName == null) // indicates using delete_contents files
- {
- DeleteBitstreamsAction delAction = (DeleteBitstreamsAction) iu.actionMgr.getUpdateAction(DeleteBitstreamsAction.class);
- delAction.setAlterProvenance(alterProvenance);
- }
- else
- {
- // check if param is on ALIAS list
- String filterClassname = filterAliases.get(filterName);
-
- if (filterClassname == null)
- {
- filterClassname = filterName;
- }
-
- BitstreamFilter filter = null;
+ if (line.hasOption('d'))
+ {
+ String[] targetFields = line.getOptionValues('d');
+
+ DeleteMetadataAction delMetadataAction = (DeleteMetadataAction) iu.actionMgr.getUpdateAction(DeleteMetadataAction.class);
+ delMetadataAction.addTargetFields(targetFields);
+
+ //undo is an add
+ for (String field : targetFields)
+ {
+ iu.undoActionList.add(" -a " + field + " ");
+ }
+
+ pr("Delete metadata for fields: ");
+ for (String s : targetFields)
+ {
+ pr(" " + s);
+ }
+ }
+
+ if (line.hasOption('a'))
+ {
+ String[] targetFields = line.getOptionValues('a');
+
+ AddMetadataAction addMetadataAction = (AddMetadataAction) iu.actionMgr.getUpdateAction(AddMetadataAction.class);
+ addMetadataAction.addTargetFields(targetFields);
+
+ //undo is a delete followed by an add of a replace record for target fields
+ for (String field : targetFields)
+ {
+ iu.undoActionList.add(" -d " + field + " ");
+ }
+
+ for (String field : targetFields)
+ {
+ iu.undoActionList.add(" -a " + field + " ");
+ }
+
+ pr("Add metadata for fields: ");
+ for (String s : targetFields)
+ {
+ pr(" " + s);
+ }
+ }
+
+ if (line.hasOption('D')) // undo not supported
+ {
+ pr("Delete bitstreams ");
+
+ String[] filterNames = line.getOptionValues('D');
+ if ((filterNames != null) && (filterNames.length > 1))
+ {
+ pr("Error: Only one filter can be a used at a time.");
+ System.exit(1);
+ }
+
+ String filterName = line.getOptionValue('D');
+ pr("Filter argument: " + filterName);
+
+ if (filterName == null) // indicates using delete_contents files
+ {
+ DeleteBitstreamsAction delAction = (DeleteBitstreamsAction) iu.actionMgr.getUpdateAction(DeleteBitstreamsAction.class);
+ delAction.setAlterProvenance(alterProvenance);
+ }
+ else
+ {
+ // check if param is on ALIAS list
+ String filterClassname = filterAliases.get(filterName);
+
+ if (filterClassname == null)
+ {
+ filterClassname = filterName;
+ }
+
+ BitstreamFilter filter = null;
- try
- {
- Class> cfilter = Class.forName(filterClassname);
- pr("BitstreamFilter class to instantiate: " + cfilter.toString());
-
- filter = (BitstreamFilter) cfilter.newInstance(); //unfortunate cast, an erasure consequence
- }
- catch(Exception e)
- {
- pr("Error: Failure instantiating bitstream filter class: " + filterClassname);
- System.exit(1);
- }
-
- String filterPropertiesName = line.getOptionValue('F');
- if (filterPropertiesName != null) //not always required
- {
- try
- {
- // TODO try multiple relative locations, e.g. source dir
- if (!filterPropertiesName.startsWith("/"))
- {
- filterPropertiesName = sourcedir + File.separator + filterPropertiesName;
- }
-
- filter.initProperties(filterPropertiesName);
- }
- catch(Exception e)
- {
- pr("Error: Failure finding properties file for bitstream filter class: " + filterPropertiesName);
- System.exit(1);
- }
- }
-
- DeleteBitstreamsByFilterAction delAction =
- (DeleteBitstreamsByFilterAction) iu.actionMgr.getUpdateAction(DeleteBitstreamsByFilterAction.class);
- delAction.setAlterProvenance(alterProvenance);
- delAction.setBitstreamFilter(filter);
- //undo not supported
- }
- }
+ try
+ {
+ Class> cfilter = Class.forName(filterClassname);
+ pr("BitstreamFilter class to instantiate: " + cfilter.toString());
+
+ filter = (BitstreamFilter) cfilter.newInstance(); //unfortunate cast, an erasure consequence
+ }
+ catch(Exception e)
+ {
+ pr("Error: Failure instantiating bitstream filter class: " + filterClassname);
+ System.exit(1);
+ }
+
+ String filterPropertiesName = line.getOptionValue('F');
+ if (filterPropertiesName != null) //not always required
+ {
+ try
+ {
+ // TODO try multiple relative locations, e.g. source dir
+ if (!filterPropertiesName.startsWith("/"))
+ {
+ filterPropertiesName = sourcedir + File.separator + filterPropertiesName;
+ }
+
+ filter.initProperties(filterPropertiesName);
+ }
+ catch(Exception e)
+ {
+ pr("Error: Failure finding properties file for bitstream filter class: " + filterPropertiesName);
+ System.exit(1);
+ }
+ }
+
+ DeleteBitstreamsByFilterAction delAction =
+ (DeleteBitstreamsByFilterAction) iu.actionMgr.getUpdateAction(DeleteBitstreamsByFilterAction.class);
+ delAction.setAlterProvenance(alterProvenance);
+ delAction.setBitstreamFilter(filter);
+ //undo not supported
+ }
+ }
- if (line.hasOption('A'))
- {
- pr("Add bitstreams ");
- AddBitstreamsAction addAction = (AddBitstreamsAction) iu.actionMgr.getUpdateAction(AddBitstreamsAction.class);
- addAction.setAlterProvenance(alterProvenance);
-
- iu.undoActionList.add(" -D "); // delete_contents file will be written, no arg required
- }
-
- if (!iu.actionMgr.hasActions())
- {
+ if (line.hasOption('A'))
+ {
+ pr("Add bitstreams ");
+ AddBitstreamsAction addAction = (AddBitstreamsAction) iu.actionMgr.getUpdateAction(AddBitstreamsAction.class);
+ addAction.setAlterProvenance(alterProvenance);
+
+ iu.undoActionList.add(" -D "); // delete_contents file will be written, no arg required
+ }
+
+ if (!iu.actionMgr.hasActions())
+ {
pr("Error - an action must be specified");
System.exit(1);
- }
- else
- {
- pr("Actions to be performed: ");
-
- for (UpdateAction ua : iu.actionMgr)
- {
- pr(" " + ua.getClass().getName());
- }
- }
-
- pr("ItemUpdate - initializing run on " + (new Date()).toString());
-
- context = new Context();
- iu.setEPerson(context, iu.eperson);
- context.turnOffAuthorisationSystem();
-
- HANDLE_PREFIX = ConfigurationManager.getProperty("handle.canonical.prefix");
- if (HANDLE_PREFIX == null || HANDLE_PREFIX.length() == 0)
- {
- HANDLE_PREFIX = "http://hdl.handle.net/";
- }
-
- iu.processArchive(context, sourcedir, itemField, metadataIndexName, alterProvenance, isTest);
+ }
+ else
+ {
+ pr("Actions to be performed: ");
+
+ for (UpdateAction ua : iu.actionMgr)
+ {
+ pr(" " + ua.getClass().getName());
+ }
+ }
+
+ pr("ItemUpdate - initializing run on " + (new Date()).toString());
+
+ context = new Context();
+ iu.setEPerson(context, iu.eperson);
+ context.turnOffAuthorisationSystem();
+
+ HANDLE_PREFIX = ConfigurationManager.getProperty("handle.canonical.prefix");
+ if (HANDLE_PREFIX == null || HANDLE_PREFIX.length() == 0)
+ {
+ HANDLE_PREFIX = "http://hdl.handle.net/";
+ }
+
+ iu.processArchive(context, sourcedir, itemField, metadataIndexName, alterProvenance, isTest);
- context.complete(); // complete all transactions
+ context.complete(); // complete all transactions
}
catch (Exception e)
{
@@ -378,7 +378,7 @@ public class ItemUpdate {
status = 1;
}
finally {
- context.restoreAuthSystemState();
+ context.restoreAuthSystemState();
}
if (isTest)
@@ -387,14 +387,15 @@ public class ItemUpdate {
}
else
{
- pr("End.");
-
+ pr("End.");
+
}
System.exit(status);
}
/**
* process an archive
+ *
* @param context DSpace Context
* @param sourceDirPath source path
* @param itemField item field
@@ -404,7 +405,7 @@ public class ItemUpdate {
* @throws Exception if error
*/
protected void processArchive(Context context, String sourceDirPath, String itemField,
- String metadataIndexName, boolean alterProvenance, boolean isTest)
+ String metadataIndexName, boolean alterProvenance, boolean isTest)
throws Exception
{
// open and process the source directory
@@ -424,89 +425,89 @@ public class ItemUpdate {
File fSuppressUndo = new File(sourceDir, SUPPRESS_UNDO_FILENAME);
if (fSuppressUndo.exists())
{
- suppressUndo = true;
+ suppressUndo = true;
}
File undoDir = null; //sibling directory of source archive
- if (!suppressUndo && !isTest)
- {
- undoDir = initUndoArchive(sourceDir);
- }
+ if (!suppressUndo && !isTest)
+ {
+ undoDir = initUndoArchive(sourceDir);
+ }
+
+ int itemCount = 0;
+ int successItemCount = 0;
- int itemCount = 0;
- int successItemCount = 0;
-
for (String dirname : dircontents)
{
- itemCount++;
- pr("");
- pr("processing item " + dirname);
-
- try
- {
- ItemArchive itarch = ItemArchive.create(context, new File(sourceDir, dirname), itemField);
-
- for (UpdateAction action : actionMgr)
- {
- pr("action: " + action.getClass().getName());
- action.execute(context, itarch, isTest, suppressUndo);
- if (!isTest && !suppressUndo)
+ itemCount++;
+ pr("");
+ pr("processing item " + dirname);
+
+ try
+ {
+ ItemArchive itarch = ItemArchive.create(context, new File(sourceDir, dirname), itemField);
+
+ for (UpdateAction action : actionMgr)
+ {
+ pr("action: " + action.getClass().getName());
+ action.execute(context, itarch, isTest, suppressUndo);
+ if (!isTest && !suppressUndo)
{
itarch.writeUndo(undoDir);
}
- }
- if (!isTest)
- {
- Item item = itarch.getItem();
+ }
+ if (!isTest)
+ {
+ Item item = itarch.getItem();
itemService.update(context, item); //need to update before commit
- }
- ItemUpdate.pr("Item " + dirname + " completed");
- successItemCount++;
- }
- catch(Exception e)
- {
- pr("Exception processing item " + dirname + ": " + e.toString());
+ }
+ ItemUpdate.pr("Item " + dirname + " completed");
+ successItemCount++;
+ }
+ catch(Exception e)
+ {
+ pr("Exception processing item " + dirname + ": " + e.toString());
e.printStackTrace();
- }
+ }
}
if (!suppressUndo && !isTest)
- {
- StringBuilder sb = new StringBuilder("dsrun org.dspace.app.itemupdate.ItemUpdate ");
- sb.append(" -e ").append(this.eperson);
- sb.append(" -s ").append(undoDir);
-
- if (itemField != null)
- {
- sb.append(" -i ").append(itemField);
- }
-
- if (!alterProvenance)
- {
- sb.append(" -P ");
- }
- if (isTest)
- {
- sb.append(" -t ");
- }
-
- for (String actionOption : undoActionList)
- {
- sb.append(actionOption);
- }
-
- PrintWriter pw = null;
- try
- {
- File cmdFile = new File (undoDir.getParent(), undoDir.getName() + "_command.sh");
- pw = new PrintWriter(new BufferedWriter(new FileWriter(cmdFile)));
- pw.println(sb.toString());
- }
- finally
- {
- pw.close();
- }
+ {
+ StringBuilder sb = new StringBuilder("dsrun org.dspace.app.itemupdate.ItemUpdate ");
+ sb.append(" -e ").append(this.eperson);
+ sb.append(" -s ").append(undoDir);
+
+ if (itemField != null)
+ {
+ sb.append(" -i ").append(itemField);
+ }
+
+ if (!alterProvenance)
+ {
+ sb.append(" -P ");
+ }
+ if (isTest)
+ {
+ sb.append(" -t ");
+ }
+
+ for (String actionOption : undoActionList)
+ {
+ sb.append(actionOption);
+ }
+
+ PrintWriter pw = null;
+ try
+ {
+ File cmdFile = new File (undoDir.getParent(), undoDir.getName() + "_command.sh");
+ pw = new PrintWriter(new BufferedWriter(new FileWriter(cmdFile)));
+ pw.println(sb.toString());
+ }
+ finally
+ {
+ pw.close();
+ }
}
pr("");
@@ -516,7 +517,6 @@ public class ItemUpdate {
/**
- *
* to avoid overwriting the undo source tree on repeated processing
* sequence numbers are added and checked
*
@@ -526,45 +526,45 @@ public class ItemUpdate {
* @throws IOException if IO error
*/
protected File initUndoArchive(File sourceDir)
- throws FileNotFoundException, IOException
- {
- File parentDir = sourceDir.getCanonicalFile().getParentFile();
- if (parentDir == null)
- {
- throw new FileNotFoundException("Parent directory of archive directory not found; unable to write UndoArchive; no processing performed");
- }
-
- String sourceDirName = sourceDir.getName();
- int seqNo = 1;
-
- File undoDir = new File(parentDir, "undo_" + sourceDirName + "_" + seqNo);
- while (undoDir.exists())
- {
- undoDir = new File(parentDir, "undo_" + sourceDirName+ "_" + ++seqNo); //increment
- }
-
- // create root directory
- if (!undoDir.mkdir())
- {
- pr("ERROR creating Undo Archive directory " + undoDir.getCanonicalPath());
- throw new IOException("ERROR creating Undo Archive directory " + undoDir.getCanonicalPath());
- }
-
+ throws FileNotFoundException, IOException
+ {
+ File parentDir = sourceDir.getCanonicalFile().getParentFile();
+ if (parentDir == null)
+ {
+ throw new FileNotFoundException("Parent directory of archive directory not found; unable to write UndoArchive; no processing performed");
+ }
+
+ String sourceDirName = sourceDir.getName();
+ int seqNo = 1;
+
+ File undoDir = new File(parentDir, "undo_" + sourceDirName + "_" + seqNo);
+ while (undoDir.exists())
+ {
+ undoDir = new File(parentDir, "undo_" + sourceDirName+ "_" + ++seqNo); //increment
+ }
+
+ // create root directory
+ if (!undoDir.mkdir())
+ {
+ pr("ERROR creating Undo Archive directory " + undoDir.getCanonicalPath());
+ throw new IOException("ERROR creating Undo Archive directory " + undoDir.getCanonicalPath());
+ }
+
//Undo is suppressed to prevent undo of undo
File fSuppressUndo = new File(undoDir, ItemUpdate.SUPPRESS_UNDO_FILENAME);
try
{
- fSuppressUndo.createNewFile();
+ fSuppressUndo.createNewFile();
}
catch(IOException e)
{
- pr("ERROR creating Suppress Undo File " + e.toString());
- throw e;
+ pr("ERROR creating Suppress Undo File " + e.toString());
+ throw e;
}
- return undoDir;
- }
-
- //private void write
+ return undoDir;
+ }
+
+ //private void write
/**
* Set EPerson doing import
@@ -603,14 +603,15 @@ public class ItemUpdate {
}
/**
- * poor man's logging
- * As with ItemImport, API logging goes through log4j to the DSpace.log files
- * whereas the batch logging goes to the console to be captured there.
+ * poor man's logging
+ * As with ItemImport, API logging goes through log4j to the DSpace.log files
+ * whereas the batch logging goes to the console to be captured there.
+ *
* @param s String
*/
static void pr(String s)
{
- System.out.println(s);
+ System.out.println(s);
}
/**
@@ -619,10 +620,10 @@ public class ItemUpdate {
*/
static void prv(String s)
{
- if (verbose)
- {
- System.out.println(s);
- }
+ if (verbose)
+ {
+ System.out.println(s);
+ }
}
} //end of class
diff --git a/dspace-api/src/main/java/org/dspace/app/launcher/CommandRunner.java b/dspace-api/src/main/java/org/dspace/app/launcher/CommandRunner.java
index 5d7a05ead5..33b21e5c61 100644
--- a/dspace-api/src/main/java/org/dspace/app/launcher/CommandRunner.java
+++ b/dspace-api/src/main/java/org/dspace/app/launcher/CommandRunner.java
@@ -25,7 +25,7 @@ public class CommandRunner
{
/**
*
- * @param args commandline args
+ * @param args the command line arguments given
* @throws IOException if IO error
* @throws FileNotFoundException if file doesn't exist
*/
diff --git a/dspace-api/src/main/java/org/dspace/app/launcher/ScriptLauncher.java b/dspace-api/src/main/java/org/dspace/app/launcher/ScriptLauncher.java
index ede7ac4622..eeec55d1c5 100644
--- a/dspace-api/src/main/java/org/dspace/app/launcher/ScriptLauncher.java
+++ b/dspace-api/src/main/java/org/dspace/app/launcher/ScriptLauncher.java
@@ -92,8 +92,9 @@ public class ScriptLauncher
/**
* Recognize and execute a single command.
+ *
* @param doc Document
- * @param args arguments
+ * @param args the command line arguments given
*/
static int runOneCommand(Document commandConfigs, String[] args)
{
diff --git a/dspace-api/src/main/java/org/dspace/app/mediafilter/MediaFilter.java b/dspace-api/src/main/java/org/dspace/app/mediafilter/MediaFilter.java
index 8e60a68155..f8ecf67e21 100644
--- a/dspace-api/src/main/java/org/dspace/app/mediafilter/MediaFilter.java
+++ b/dspace-api/src/main/java/org/dspace/app/mediafilter/MediaFilter.java
@@ -61,7 +61,7 @@ public abstract class MediaFilter implements FormatFilter
* @param generatedBitstream
* the bitstream which was generated by
* this filter.
- * @throws java.lang.Exception
+ * @throws Exception if error
*/
@Override
public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)
diff --git a/dspace-api/src/main/java/org/dspace/app/requestitem/service/RequestItemService.java b/dspace-api/src/main/java/org/dspace/app/requestitem/service/RequestItemService.java
index b3ac1b5004..92876c5dba 100644
--- a/dspace-api/src/main/java/org/dspace/app/requestitem/service/RequestItemService.java
+++ b/dspace-api/src/main/java/org/dspace/app/requestitem/service/RequestItemService.java
@@ -24,13 +24,20 @@ public interface RequestItemService {
/**
* Generate a request item representing the request and put it into the DB
- * @param context context
- * @param bitstream bitstream
- * @param item item
- * @param reqMessage message
- * @param allFiles all files flag
+ * @param context
+ * The relevant DSpace Context.
+ * @param bitstream
+ * The requested bitstream
+ * @param item
+ * The requested item
+ * @param reqMessage
+ * Request message text
+ * @param allFiles
+ * true indicates that all bitstreams of this item are requested
* @param reqEmail email
- * @param reqName name
+ * Requester email
+ * @param reqName
+ * Requester name
* @return the token of the request item
* @throws SQLException if database error
*/
@@ -41,8 +48,11 @@ public interface RequestItemService {
/**
* Save updates to the record. Only accept_request, and decision_date are set-able.
+ *
* @param context
+ * The relevant DSpace Context.
* @param requestItem
+ * requested item
*/
public void update(Context context, RequestItem requestItem);
diff --git a/dspace-api/src/main/java/org/dspace/app/statistics/LogAnalyser.java b/dspace-api/src/main/java/org/dspace/app/statistics/LogAnalyser.java
index c48958ca9f..ec60e87901 100644
--- a/dspace-api/src/main/java/org/dspace/app/statistics/LogAnalyser.java
+++ b/dspace-api/src/main/java/org/dspace/app/statistics/LogAnalyser.java
@@ -212,7 +212,7 @@ public class LogAnalyser
/**
* main method to be run from command line. See usage information for
* details as to how to use the command line flags (-help)
- * @param argv arguments
+ * @param argv the command line arguments given
* @throws Exception if error
* @throws SQLException if database error
*/
@@ -1051,7 +1051,7 @@ public class LogAnalyser
{
// Use SimpleDateFormat
SimpleDateFormat sdf = new SimpleDateFormat("yyyy'-'MM'-'dd'T'hh:mm:ss'Z'");
- sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
return sdf.format(date);
}
@@ -1187,13 +1187,13 @@ public class LogAnalyser
// that
DiscoverQuery discoverQuery = new DiscoverQuery();
- if(StringUtils.isNotBlank(type))
+ if (StringUtils.isNotBlank(type))
{
discoverQuery.addFilterQueries("dc.type=" + type +"*");
}
StringBuilder accessionedQuery = new StringBuilder();
accessionedQuery.append("dc.date.accessioned_dt:[");
- if(startDate != null)
+ if (startDate != null)
{
accessionedQuery.append(unParseDate(startDate));
}
@@ -1202,7 +1202,7 @@ public class LogAnalyser
accessionedQuery.append("*");
}
accessionedQuery.append(" TO ");
- if(endDate != null)
+ if (endDate != null)
{
accessionedQuery.append(unParseDate(endDate));
}
@@ -1242,44 +1242,44 @@ public class LogAnalyser
public static void usage()
{
String usage = "Usage Information:\n" +
- "LogAnalyser [options [parameters]]\n" +
- "-log [log directory]\n" +
- "\tOptional\n" +
- "\tSpecify a directory containing log files\n" +
- "\tDefault uses [dspace.dir]/log from dspace.cfg\n" +
- "-file [file name regex]\n" +
- "\tOptional\n" +
- "\tSpecify a regular expression as the file name template.\n" +
- "\tCurrently this needs to be correctly escaped for Java string handling (FIXME)\n" +
- "\tDefault uses dspace.log*\n" +
- "-cfg [config file path]\n" +
- "\tOptional\n" +
- "\tSpecify a config file to be used\n" +
- "\tDefault uses dstat.cfg in dspace config directory\n" +
- "-out [output file path]\n" +
- "\tOptional\n" +
- "\tSpecify an output file to write results into\n" +
- "\tDefault uses dstat.dat in dspace log directory\n" +
- "-start [YYYY-MM-DD]\n" +
- "\tOptional\n" +
- "\tSpecify the start date of the analysis\n" +
- "\tIf a start date is specified then no attempt to gather \n" +
- "\tcurrent database statistics will be made unless -lookup is\n" +
- "\talso passed\n" +
- "\tDefault is to start from the earliest date records exist for\n" +
- "-end [YYYY-MM-DD]\n" +
- "\tOptional\n" +
- "\tSpecify the end date of the analysis\n" +
- "\tIf an end date is specified then no attempt to gather \n" +
- "\tcurrent database statistics will be made unless -lookup is\n" +
- "\talso passed\n" +
- "\tDefault is to work up to the last date records exist for\n" +
- "-lookup\n" +
- "\tOptional\n" +
- "\tForce a lookup of the current database statistics\n" +
- "\tOnly needs to be used if date constraints are also in place\n" +
- "-help\n" +
- "\tdisplay this usage information\n";
+ "LogAnalyser [options [parameters]]\n" +
+ "-log [log directory]\n" +
+ "\tOptional\n" +
+ "\tSpecify a directory containing log files\n" +
+ "\tDefault uses [dspace.dir]/log from dspace.cfg\n" +
+ "-file [file name regex]\n" +
+ "\tOptional\n" +
+ "\tSpecify a regular expression as the file name template.\n" +
+ "\tCurrently this needs to be correctly escaped for Java string handling (FIXME)\n" +
+ "\tDefault uses dspace.log*\n" +
+ "-cfg [config file path]\n" +
+ "\tOptional\n" +
+ "\tSpecify a config file to be used\n" +
+ "\tDefault uses dstat.cfg in dspace config directory\n" +
+ "-out [output file path]\n" +
+ "\tOptional\n" +
+ "\tSpecify an output file to write results into\n" +
+ "\tDefault uses dstat.dat in dspace log directory\n" +
+ "-start [YYYY-MM-DD]\n" +
+ "\tOptional\n" +
+ "\tSpecify the start date of the analysis\n" +
+ "\tIf a start date is specified then no attempt to gather \n" +
+ "\tcurrent database statistics will be made unless -lookup is\n" +
+ "\talso passed\n" +
+ "\tDefault is to start from the earliest date records exist for\n" +
+ "-end [YYYY-MM-DD]\n" +
+ "\tOptional\n" +
+ "\tSpecify the end date of the analysis\n" +
+ "\tIf an end date is specified then no attempt to gather \n" +
+ "\tcurrent database statistics will be made unless -lookup is\n" +
+ "\talso passed\n" +
+ "\tDefault is to work up to the last date records exist for\n" +
+ "-lookup\n" +
+ "\tOptional\n" +
+ "\tForce a lookup of the current database statistics\n" +
+ "\tOnly needs to be used if date constraints are also in place\n" +
+ "-help\n" +
+ "\tdisplay this usage information\n";
System.out.println(usage);
}
diff --git a/dspace-api/src/main/java/org/dspace/app/statistics/ReportGenerator.java b/dspace-api/src/main/java/org/dspace/app/statistics/ReportGenerator.java
index c39ae388c2..b8a8143af0 100644
--- a/dspace-api/src/main/java/org/dspace/app/statistics/ReportGenerator.java
+++ b/dspace-api/src/main/java/org/dspace/app/statistics/ReportGenerator.java
@@ -125,14 +125,14 @@ public class ReportGenerator
private static Pattern real = Pattern.compile("^(.+)=(.+)");
//////////////////////////
- // Miscellaneous variables
- //////////////////////////
-
- /** process timing clock */
- private static Calendar startTime = null;
-
- /** a map from log file action to human readable action */
- private static Map actionMap = null;
+ // Miscellaneous variables
+ //////////////////////////
+
+ /** process timing clock */
+ private static Calendar startTime = null;
+
+ /** a map from log file action to human readable action */
+ private static Map actionMap = null;
/////////////////
// report generator config data
@@ -141,9 +141,9 @@ public class ReportGenerator
/** the input file to build the report from */
private static String input = null;
- /** the log file action to human readable action map */
- private static String map = ConfigurationManager.getProperty("dspace.dir") +
- File.separator + "config" + File.separator + "dstat.map";
+ /** the log file action to human readable action map */
+ private static String map = ConfigurationManager.getProperty("dspace.dir") +
+ File.separator + "config" + File.separator + "dstat.map";
private static final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
private static final HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
@@ -152,9 +152,10 @@ public class ReportGenerator
/**
* main method to be run from command line. See usage information for
* details as to how to use the command line flags
- * @param argv
- * @throws java.lang.Exception
- * @throws java.sql.SQLException
+ * @param argv the command line arguments given
+ * @throws Exception on generic exception
+ * @throws SQLException
+ * An exception that provides information on a database access error or other errors.
*/
public static void main(String [] argv)
throws Exception, SQLException
diff --git a/dspace-api/src/main/java/org/dspace/app/util/CollectionDropDown.java b/dspace-api/src/main/java/org/dspace/app/util/CollectionDropDown.java
index 06f4ce5276..8a32986ca8 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/CollectionDropDown.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/CollectionDropDown.java
@@ -24,14 +24,16 @@ import org.dspace.core.Context;
public class CollectionDropDown {
- private static final CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
+ private static final CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
/**
* Get full path starting from a top-level community via subcommunities down to a collection.
* The full path will not be truncated.
*
+ * @param context
+ * The relevant DSpace Context.
* @param col
- * Get full path for this collection
+ * Get full path for this collection
* @return Full path to the collection
* @throws SQLException if database error
*/
@@ -44,10 +46,12 @@ public class CollectionDropDown {
* Get full path starting from a top-level community via subcommunities down to a collection.
* The full cat will be truncated to the specified number of characters and prepended with an ellipsis.
*
+ * @param context
+ * The relevant DSpace Context.
* @param col
- * Get full path for this collection
+ * Get full path for this collection
* @param maxchars
- * Truncate the full path to maxchar characters. 0 means do not truncate.
+ * Truncate the full path to maxchar characters. 0 means do not truncate.
* @return Full path to the collection (truncated)
* @throws SQLException if database error
*/
@@ -82,62 +86,64 @@ public class CollectionDropDown {
return name.toString();
}
- /**
- * Annotates an array of collections with their respective full paths (@see #collectionPath() method in this class).
- * @param collections An array of collections to annotate with their hierarchical paths.
- * The array and all its entries must be non-null.
- * @return A sorted array of collection path entries (essentially collection/path pairs).
- * @throws SQLException In case there are problems annotating a collection with its path.
- */
- public static CollectionPathEntry[] annotateWithPaths(Context context, List collections) throws SQLException
- {
- CollectionPathEntry[] result = new CollectionPathEntry[collections.size()];
- for (int i = 0; i < collections.size(); i++)
- {
- Collection collection = collections.get(i);
- CollectionPathEntry entry = new CollectionPathEntry(collection, collectionPath(context, collection));
- result[i] = entry;
- }
- Arrays.sort(result);
- return result;
- }
+ /**
+ * Annotates an array of collections with their respective full paths (@see #collectionPath() method in this class).
+ * @param context
+ * The relevant DSpace Context.
+ * @param collections An array of collections to annotate with their hierarchical paths.
+ * The array and all its entries must be non-null.
+ * @return A sorted array of collection path entries (essentially collection/path pairs).
+ * @throws SQLException In case there are problems annotating a collection with its path.
+ */
+ public static CollectionPathEntry[] annotateWithPaths(Context context, List collections) throws SQLException
+ {
+ CollectionPathEntry[] result = new CollectionPathEntry[collections.size()];
+ for (int i = 0; i < collections.size(); i++)
+ {
+ Collection collection = collections.get(i);
+ CollectionPathEntry entry = new CollectionPathEntry(collection, collectionPath(context, collection));
+ result[i] = entry;
+ }
+ Arrays.sort(result);
+ return result;
+ }
- /**
- * A helper class to hold (collection, full path) pairs. Instances of the helper class are sortable:
- * two instances will be compared first on their full path and if those are equal,
- * the comparison will fall back to comparing collection IDs.
- */
- public static class CollectionPathEntry implements Comparable
- {
- public Collection collection;
- public String path;
+ /**
+ * A helper class to hold (collection, full path) pairs. Instances of the helper class are sortable:
+ * two instances will be compared first on their full path and if those are equal,
+ * the comparison will fall back to comparing collection IDs.
+ */
+ public static class CollectionPathEntry implements Comparable
+ {
+ public Collection collection;
+ public String path;
- public CollectionPathEntry(Collection collection, String path)
- {
- this.collection = collection;
- this.path = path;
- }
+ public CollectionPathEntry(Collection collection, String path)
+ {
+ this.collection = collection;
+ this.path = path;
+ }
- @Override
- public int compareTo(CollectionPathEntry other)
- {
- if (!this.path.equals(other.path))
- {
- return this.path.compareTo(other.path);
- }
- return this.collection.getID().compareTo(other.collection.getID());
- }
+ @Override
+ public int compareTo(CollectionPathEntry other)
+ {
+ if (!this.path.equals(other.path))
+ {
+ return this.path.compareTo(other.path);
+ }
+ return this.collection.getID().compareTo(other.collection.getID());
+ }
- @Override
- public boolean equals(Object o)
- {
- return o != null && o instanceof CollectionPathEntry && this.compareTo((CollectionPathEntry) o) == 0;
- }
+ @Override
+ public boolean equals(Object o)
+ {
+ return o != null && o instanceof CollectionPathEntry && this.compareTo((CollectionPathEntry) o) == 0;
+ }
- @Override
- public int hashCode()
- {
- return Objects.hash(path, collection.getID());
- }
- }
+ @Override
+ public int hashCode()
+ {
+ return Objects.hash(path, collection.getID());
+ }
+ }
}
diff --git a/dspace-api/src/main/java/org/dspace/app/util/Configuration.java b/dspace-api/src/main/java/org/dspace/app/util/Configuration.java
index b5d945479f..249c38b00e 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/Configuration.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/Configuration.java
@@ -36,8 +36,7 @@ public class Configuration
*
* If the property does not exist, nothing is written.
*
- * @param argv
- * command-line arguments
+ * @param argv the command line arguments given
*/
public static void main(String[] argv)
{
diff --git a/dspace-api/src/main/java/org/dspace/app/util/DCInput.java b/dspace-api/src/main/java/org/dspace/app/util/DCInput.java
index f3281d284b..f094c67805 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/DCInput.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/DCInput.java
@@ -94,8 +94,10 @@ public class DCInput
* a HashMap
*
* @param fieldMap
- * ???
+ * named field values.
+ *
* @param listMap
+ * value-pairs map, computed from the forms definition XML file
*/
public DCInput(Map fieldMap, Map> listMap)
{
diff --git a/dspace-api/src/main/java/org/dspace/app/util/DCInputSet.java b/dspace-api/src/main/java/org/dspace/app/util/DCInputSet.java
index 752fcb1cfe..0a888b7ad4 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/DCInputSet.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/DCInputSet.java
@@ -20,80 +20,80 @@ import java.util.Map;
public class DCInputSet
{
- /** name of the input set */
- private String formName = null;
- /** the inputs ordered by page and row position */
- private DCInput[][] inputPages = null;
-
+ /** name of the input set */
+ private String formName = null;
+ /** the inputs ordered by page and row position */
+ private DCInput[][] inputPages = null;
+
/** constructor
* @param formName form name
* @param pages pages
* @param listMap map
*/
- public DCInputSet(String formName, List
>> pages, Map> listMap)
- {
- this.formName = formName;
- inputPages = new DCInput[pages.size()][];
- for ( int i = 0; i < inputPages.length; i++ )
- {
- List