Merge remote-tracking branch 'upstream/master' into DS-3179-jspui-remove-file

Conflicts:
	dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java
This commit is contained in:
philip Vissenaekens
2016-06-20 15:48:12 +02:00
671 changed files with 11528 additions and 7483 deletions

View File

@@ -38,9 +38,10 @@ script:
# -P !assembly => Skip normal assembly (as it can be memory intensive)
# -B => Maven batch/non-interactive mode (recommended for CI)
# -V => Display Maven version info before build
- "mvn clean install license:check -Dmaven.test.skip=false -DskipITs=false -P !assembly -B -V"
# -Dsurefire.rerunFailingTestsCount=2 => try again for flakey tests, and keep track of/report on number of retries
- "mvn clean install license:check -Dmaven.test.skip=false -DskipITs=false -P !assembly -B -V -Dsurefire.rerunFailingTestsCount=2"
# 2. [Assemble DSpace] Ensure assembly process works (from [src]/dspace/), including Mirage 2
# -Dmirage2.on=true => Build Mirage2
# -Dmirage2.deps.included=false => Don't include Mirage2 build dependencies (We installed them in before_install)
# -P !assembly => SKIP the actual building of [src]/dspace/dspace-installer (as it can be memory intensive)
- "cd dspace && mvn package -Dmirage2.on=true -Dmirage2.deps.included=false -P !assembly -B -V"
- "cd dspace && mvn package -Dmirage2.on=true -Dmirage2.deps.included=false -P !assembly -B -V -Dsurefire.rerunFailingTestsCount=2"

View File

@@ -12,7 +12,7 @@
<parent>
<groupId>org.dspace</groupId>
<artifactId>dspace-parent</artifactId>
<version>6.0-rc2-SNAPSHOT</version>
<version>6.0-rc3-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -683,13 +683,15 @@
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.17</version>
<!-- NOTE: SWORDv2 needs 1.2.14, required by Abdera: https://abdera.apache.org/ -->
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.17</version>
<!-- NOTE: SWORDv2 needs 1.2.14, required by Abdera: https://abdera.apache.org/ -->
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>

View File

@@ -36,7 +36,7 @@ public interface ExtractingParams {
/**
* The param prefix for mapping Tika metadata to Solr fields.
* <p/>
* <p>
* To map a field, add a name like:
* <pre>fmap.title=solr.title</pre>
*
@@ -48,7 +48,7 @@ public interface ExtractingParams {
/**
* The boost value for the name of the field. The boost can be specified by a name mapping.
* <p/>
* <p>
* For example
* <pre>
* map.title=solr.title
@@ -73,9 +73,9 @@ 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}.
* <p/>
* <p>
* See Tika's docs for what the extracted document looks like.
* <p/>
* <p>
* @see #CAPTURE_ELEMENTS
*/
public static final String XPATH_EXPRESSION = "xpath";
@@ -104,11 +104,11 @@ 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.
* <p/>
* <p>
* The Capture field is based on the localName returned to the {@link SolrContentHandler}
* by Tika, not to be confused by the mapped field. The field name can then
* be mapped into the index schema.
* <p/>
* <p>
* For instance, a Tika document may look like:
* <pre>
* &lt;html&gt;

View File

@@ -46,6 +46,11 @@ public class CommunityFiliator
handleService = HandleServiceFactory.getInstance().getHandleService();
}
/**
*
* @param argv arguments
* @throws Exception if error
*/
public static void main(String[] argv) throws Exception
{
// create an options object and populate it
@@ -174,6 +179,15 @@ public class CommunityFiliator
}
}
/**
*
* @param c context
* @param parent parent Community
* @param child child community
* @throws SQLException if database error
* @throws AuthorizeException if authorize error
* @throws IOException if IO error
*/
public void filiate(Context c, Community parent, Community child)
throws SQLException, AuthorizeException, IOException
{
@@ -212,6 +226,15 @@ public class CommunityFiliator
+ "' is parent of community: '" + child.getID() + "'");
}
/**
*
* @param c context
* @param parent parent Community
* @param child child community
* @throws SQLException if database error
* @throws AuthorizeException if authorize error
* @throws IOException if IO error
*/
public void defiliate(Context c, Community parent, Community child)
throws SQLException, AuthorizeException, IOException
{
@@ -250,6 +273,13 @@ public class CommunityFiliator
+ "'");
}
/**
* Find a community by ID
* @param c context
* @param communityID community ID
* @return Community object
* @throws SQLException if database error
*/
protected Community resolveCommunity(Context c, String communityID)
throws SQLException
{

View File

@@ -59,6 +59,7 @@ public final class CreateAdministrator
*
* @param argv
* command-line arguments
* @throws Exception if error
*/
public static void main(String[] argv)
throws Exception
@@ -92,7 +93,7 @@ public final class CreateAdministrator
/**
* constructor, which just creates and object with a ready context
*
* @throws Exception
* @throws Exception if error
*/
protected CreateAdministrator()
throws Exception
@@ -106,7 +107,7 @@ public final class CreateAdministrator
* Method which will negotiate with the user via the command line to
* obtain the administrator's details
*
* @throws Exception
* @throws Exception if error
*/
protected void negotiateAdministratorDetails()
throws Exception
@@ -228,7 +229,7 @@ public final class CreateAdministrator
* @param language preferred language
* @param pw desired password
*
* @throws Exception
* @throws Exception if error
*/
protected void createAdministrator(String email, String first, String last,
String language, String pw)

View File

@@ -7,19 +7,7 @@
*/
package org.dspace.administer;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.cli.*;
import org.apache.xml.serialize.Method;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
@@ -31,6 +19,14 @@ import org.dspace.content.service.MetadataSchemaService;
import org.dspace.core.Context;
import org.xml.sax.SAXException;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Graham Triggs
@@ -39,13 +35,14 @@ import org.xml.sax.SAXException;
* from the metadata schemas for the repository.
*
* The form of the XML is as follows
*
* {@code
* <metadata-schemas>
* <schema>
* <name>dc</name>
* <namespace>http://dublincore.org/documents/dcmi-terms/</namespace>
* </schema>
* </metadata-schemas>
* }
*/
public class MetadataExporter
{
@@ -54,12 +51,12 @@ public class MetadataExporter
protected static MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
/**
* @param args
* @throws ParseException
* @throws SAXException
* @throws IOException
* @throws SQLException
* @throws RegistryExportException
* @param args commandline arguments
* @throws ParseException if parser error
* @throws SAXException if XML parse error
* @throws IOException if IO error
* @throws SQLException if database error
* @throws RegistryExportException if export error
*/
public static void main(String[] args) throws ParseException, SQLException, IOException, SAXException, RegistryExportException
{
@@ -91,6 +88,15 @@ public class MetadataExporter
saveRegistry(file, schema);
}
/**
* Save a registry to a filepath
* @param file filepath
* @param schema schema definition to save
* @throws SQLException if database error
* @throws IOException if IO error
* @throws SAXException if XML error
* @throws RegistryExportException if export error
*/
public static void saveRegistry(String file, String schema) throws SQLException, IOException, SAXException, RegistryExportException
{
// create a context
@@ -145,12 +151,12 @@ public class MetadataExporter
/**
* Serialize the schema registry. If the parameter 'schema' is null or empty, save all schemas
* @param context
* @param xmlSerializer
* @param schema
* @throws SQLException
* @throws SAXException
* @throws RegistryExportException
* @param context DSpace Context
* @param xmlSerializer XML serializer
* @param schema schema (may be null to save all)
* @throws SQLException if database error
* @throws SAXException if XML error
* @throws RegistryExportException if export error
*/
public static void saveSchema(Context context, XMLSerializer xmlSerializer, String schema) throws SQLException, SAXException, RegistryExportException
{
@@ -176,10 +182,10 @@ public class MetadataExporter
/**
* Serialize a single schema (namespace) registry entry
*
* @param xmlSerializer
* @param mdSchema
* @throws SAXException
* @throws RegistryExportException
* @param xmlSerializer XML serializer
* @param mdSchema DSpace metadata schema
* @throws SAXException if XML error
* @throws RegistryExportException if export error
*/
private static void saveSchema(XMLSerializer xmlSerializer, MetadataSchema mdSchema) throws SAXException, RegistryExportException
{
@@ -223,13 +229,13 @@ public class MetadataExporter
/**
* Serialize a single metadata field registry entry to xml
*
* @param context
* @param xmlSerializer
* @param mdField
* @throws SAXException
* @throws RegistryExportException
* @throws SQLException
* @throws IOException
* @param context DSpace context
* @param xmlSerializer xml serializer
* @param mdField DSpace metadata field
* @throws SAXException if XML error
* @throws RegistryExportException if export error
* @throws SQLException if database error
* @throws IOException if IO error
*/
private static void saveType(Context context, XMLSerializer xmlSerializer, MetadataField mdField) throws SAXException, RegistryExportException, SQLException, IOException
{
@@ -291,24 +297,29 @@ public class MetadataExporter
xmlSerializer.endElement("dc-type");
}
static Map<Integer, String> schemaMap = new HashMap<Integer, String>();
/**
* Helper method to retrieve a schema name for the field.
* Caches the name after looking up the id.
* @param context DSpace Context
* @param mdField DSpace metadata field
* @return name of schema
* @throws SQLException if database error
* @throws RegistryExportException if export error
*/
static Map<Integer, String> schemaMap = new HashMap<Integer, String>();
private static String getSchemaName(Context context, MetadataField mdField) throws SQLException, RegistryExportException
{
// Get name from cache
String name = schemaMap.get(mdField.getMetadataSchema().getSchemaID());
String name = schemaMap.get(mdField.getMetadataSchema().getID());
if (name == null)
{
// Name not retrieved before, so get the schema now
MetadataSchema mdSchema = metadataSchemaService.find(context, mdField.getMetadataSchema().getSchemaID());
MetadataSchema mdSchema = metadataSchemaService.find(context, mdField.getMetadataSchema().getID());
if (mdSchema != null)
{
name = mdSchema.getName();
schemaMap.put(mdSchema.getSchemaID(), name);
schemaMap.put(mdSchema.getID(), name);
}
else
{

View File

@@ -47,6 +47,7 @@ import org.xml.sax.SAXException;
*
* The format of the XML file is as follows:
*
* {@code
* <dspace-dc-types>
* <dc-type>
* <schema>icadmin</schema>
@@ -58,6 +59,7 @@ import org.xml.sax.SAXException;
* [....]
*
* </dspace-dc-types>
* }
*/
public class MetadataImporter
{
@@ -69,7 +71,17 @@ public class MetadataImporter
/**
* main method for reading user input from the command line
*/
* @param args arguments
* @throws ParseException if parse error
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws ParserConfigurationException if config error
* @throws AuthorizeException if authorization error
* @throws SAXException if parser error
* @throws NonUniqueMetadataException if duplicate metadata
* @throws RegistryImportException if import fails
**/
public static void main(String[] args)
throws ParseException, SQLException, IOException, TransformerException,
ParserConfigurationException, AuthorizeException, SAXException,
@@ -103,6 +115,15 @@ public class MetadataImporter
* Load the data from the specified file path into the database
*
* @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
* @throws TransformerException if transformer error
* @throws ParserConfigurationException if config error
* @throws AuthorizeException if authorization error
* @throws SAXException if parser error
* @throws NonUniqueMetadataException if duplicate metadata
* @throws RegistryImportException if import fails
*/
public static void loadRegistry(String file, boolean forceUpdate)
throws SQLException, IOException, TransformerException, ParserConfigurationException,
@@ -158,7 +179,12 @@ public class MetadataImporter
* DSpace context object
* @param node
* the node in the DOM tree
* @throws NonUniqueMetadataException
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws AuthorizeException if authorization error
* @throws NonUniqueMetadataException if duplicate metadata
* @throws RegistryImportException if import fails
*/
private static void loadSchema(Context context, Node node, boolean updateExisting)
throws SQLException, IOException, TransformerException,
@@ -221,7 +247,12 @@ public class MetadataImporter
* DSpace context object
* @param node
* the node in the DOM tree
* @throws NonUniqueMetadataException
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws AuthorizeException if authorization error
* @throws NonUniqueMetadataException if duplicate metadata
* @throws RegistryImportException if import fails
*/
private static void loadType(Context context, Node node)
throws SQLException, IOException, TransformerException,

View File

@@ -25,7 +25,7 @@ public class RegistryExportException extends Exception
/**
* create an exception with only a message
*
* @param message
* @param message exception message
*/
public RegistryExportException(String message)
{
@@ -35,8 +35,8 @@ public class RegistryExportException extends Exception
/**
* create an exception with an inner exception and a message
*
* @param message
* @param e
* @param message exception message
* @param e reference to Throwable
*/
public RegistryExportException(String message, Throwable e)
{
@@ -46,7 +46,7 @@ public class RegistryExportException extends Exception
/**
* create an exception with an inner exception
*
* @param e
* @param e reference to Throwable
*/
public RegistryExportException(Throwable e)
{

View File

@@ -25,7 +25,7 @@ public class RegistryImportException extends Exception
/**
* create an exception with only a message
*
* @param message
* @param message error message
*/
public RegistryImportException(String message)
{
@@ -35,8 +35,8 @@ public class RegistryImportException extends Exception
/**
* create an exception with an inner exception and a message
*
* @param message
* @param e
* @param message error message
* @param e throwable
*/
public RegistryImportException(String message, Throwable e)
{
@@ -46,7 +46,7 @@ public class RegistryImportException extends Exception
/**
* create an exception with an inner exception
*
* @param e
* @param e throwable
*/
public RegistryImportException(Throwable e)
{

View File

@@ -40,6 +40,9 @@ public class RegistryImporter
* the filename to load from
*
* @return the DOM representation of the XML file
* @throws IOException if IO error
* @throws ParserConfigurationException if configuration parse error
* @throws SAXException if XML parse error
*/
public static Document loadXML(String filename)
throws IOException, ParserConfigurationException, SAXException
@@ -68,7 +71,7 @@ public class RegistryImporter
* the element, whose child element you want the CDATA from
* @param childName
* the name of the element you want the CDATA from
*
* @throws TransformerException if error
* @return the CDATA as a <code>String</code>
*/
public static String getElementData(Node parentElement, String childName)
@@ -116,7 +119,7 @@ public class RegistryImporter
* the element, whose child element you want the CDATA from
* @param childName
* the name of the element you want the CDATA from
*
* @throws TransformerException if error
* @return the CDATA as a <code>String</code>
*/
public static String[] getRepeatedElementData(Node parentElement,

View File

@@ -56,6 +56,7 @@ public class RegistryLoader
*
* @param argv
* command-line arguments
* @throws Exception if error
*/
public static void main(String[] argv) throws Exception
{
@@ -121,6 +122,12 @@ public class RegistryLoader
* DSpace context object
* @param filename
* the filename of the XML file to load
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws ParserConfigurationException if config error
* @throws AuthorizeException if authorization error
* @throws SAXException if parser error
*/
public static void loadBitstreamFormats(Context context, String filename)
throws SQLException, IOException, ParserConfigurationException,
@@ -151,6 +158,10 @@ public class RegistryLoader
* DSpace context object
* @param node
* the node in the DOM tree
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws AuthorizeException if authorization error
*/
private static void loadFormat(Context context, Node node)
throws SQLException, IOException, TransformerException,
@@ -206,7 +217,9 @@ public class RegistryLoader
*
* @param filename
* the filename to load from
*
* @throws IOException if IO error
* @throws ParserConfigurationException if config error
* @throws SAXException if parser error
* @return the DOM representation of the XML file
*/
private static Document loadXML(String filename) throws IOException,
@@ -234,7 +247,7 @@ public class RegistryLoader
* the element, whose child element you want the CDATA from
* @param childName
* the name of the element you want the CDATA from
*
* @throws TransformerException if transformer error
* @return the CDATA as a <code>String</code>
*/
private static String getElementData(Node parentElement, String childName)
@@ -282,7 +295,7 @@ public class RegistryLoader
* the element, whose child element you want the CDATA from
* @param childName
* the name of the element you want the CDATA from
*
* @throws TransformerException if transformer error
* @return the CDATA as a <code>String</code>
*/
private static String[] getRepeatedElementData(Node parentElement,

View File

@@ -46,7 +46,7 @@ import org.xml.sax.SAXException;
* an XML file.
*
* The XML file structure needs to be:
*
* {@code
* <import_structure>
* <community>
* <name>....</name>
@@ -56,7 +56,7 @@ import org.xml.sax.SAXException;
* </collection>
* </community>
* </import_structure>
*
* }
* it can be arbitrarily deep, and supports all the metadata elements
* that make up the community and collection metadata. See the system
* documentation for more details
@@ -88,10 +88,12 @@ public class StructBuilder
*
* This is of the form:
*
* StructBuilder -f [xml source] -e [administrator email] -o [output file]
* {@code StructBuilder -f [xml source] -e [administrator email] -o [output file]}
*
* 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
* @throws Exception if an error occurs
*/
public static void main(String[] argv)
throws Exception
@@ -203,7 +205,7 @@ public class StructBuilder
* fails it generates an error and ceases execution
*
* @param document the XML document object
* @throws TransformerException
* @throws TransformerException if transformer error
*
*/
private static void validate(org.w3c.dom.Document document)

View File

@@ -150,7 +150,7 @@ public class DSpaceCSVLine implements Serializable
* Write this line out as a CSV formatted string, in the order given by the headings provided
*
* @param headings The headings which define the order the elements must be presented in
* @param fieldSeparator
* @param fieldSeparator field separator
* @return The CSV formatted String
*/
protected String toCSV(List<String> headings, String fieldSeparator)
@@ -179,7 +179,7 @@ public class DSpaceCSVLine implements Serializable
* Internal method to create a CSV formatted String joining a given set of elements
*
* @param values The values to create the string from
* @param valueSeparator
* @param valueSeparator value separator
* @return The line as a CSV formatted String
*/
protected String valueToCSV(List<String> values, String valueSeparator)

View File

@@ -71,7 +71,7 @@ public class MetadataExport
try
{
// Try to export the community
this.toExport = buildFromCommunity(c, toExport, new ArrayList<Integer>(), 0);
this.toExport = buildFromCommunity(c, toExport, 0);
this.exportAll = exportAll;
}
catch (SQLException sqle)
@@ -86,13 +86,13 @@ public class MetadataExport
/**
* Build an array list of item ids that are in a community (include sub-communities and collections)
*
* @param context DSpace context
* @param community The community to build from
* @param itemIDs The itemID (used for recursion - use an empty ArrayList)
* @param indent How many spaces to use when writing out the names of items added
* @return The list of item ids
* @throws SQLException
* @throws SQLException if database error
*/
protected Iterator<Item> buildFromCommunity(Context context, Community community, List<Integer> itemIDs, int indent)
protected Iterator<Item> buildFromCommunity(Context context, Community community, int indent)
throws SQLException
{
// Add all the collections
@@ -106,12 +106,7 @@ public class MetadataExport
}
Iterator<Item> items = itemService.findByCollection(context, collection);
if(result == null)
{
result = items;
}else{
result = Iterators.concat(result, items);
}
result = addItemsToResult(result,items);
}
// Add all the sub-communities
@@ -122,7 +117,19 @@ public class MetadataExport
{
System.out.print(" ");
}
buildFromCommunity(context, subCommunity, itemIDs, indent + 1);
Iterator<Item> items = buildFromCommunity(context, subCommunity, indent + 1);
result = addItemsToResult(result,items);
}
return result;
}
private Iterator<Item> addItemsToResult(Iterator<Item> result, Iterator<Item> items) {
if(result == null)
{
result = items;
}else{
result = Iterators.concat(result, items);
}
return result;
@@ -176,6 +183,7 @@ public class MetadataExport
* main method to run the metadata exporter
*
* @param argv the command line arguments given
* @throws Exception if error occurs
*/
public static void main(String[] argv) throws Exception
{

View File

@@ -420,8 +420,7 @@ public class MetadataImport
* @param change Whether or not to make the update
* @param md The element to compare
* @param changes The changes object to populate
*
* @param line
* @param line line in CSV file
* @throws SQLException if there is a problem accessing a Collection from the database, from its handle
* @throws AuthorizeException if there is an authorization problem with permissions
*/

View File

@@ -41,6 +41,7 @@ public class MetadataImportInvalidHeadingException extends Exception
*
* @param message the error message
* @param theType the type of the error
* @param theColumn column number
*/
public MetadataImportInvalidHeadingException(String message, int theType, int theColumn)
{

View File

@@ -9,7 +9,6 @@
/**
* <p>The DSpace Batch Metadata Editor, which uses a CSV file to export/import
* item metadata.</p>
* <p>
* <ul>
* <li>works on items, communities, collections or the whole site</li>
* <li>can also create new items, delete items and withdraw/restore them</li>

View File

@@ -29,7 +29,7 @@ import org.dspace.core.Utils;
/**
* Command line access to the checksum checker. Options are listed in the
* documentation for the main method.</p>
* documentation for the main method.
*
* @author Jim Downing
* @author Grace Carpenter
@@ -72,6 +72,7 @@ public final class ChecksumChecker
* <dt>-p</dt>
* <dd>Don't prune results before running checker</dd>
* </dl>
* @throws SQLException if error
*/
public static void main(String[] args) throws SQLException {
// set up command line parser

View File

@@ -391,6 +391,7 @@ public class Harvest
harvestedCollectionService.update(context, hc);
}
context.restoreAuthSystemState();
context.dispatchEvents();
}
catch (Exception e) {
System.out.println("Changes could not be committed");

View File

@@ -34,8 +34,8 @@ import java.util.*;
* core in RDF schema / contents - text file, listing one file per line / file1
* - files contained in the item / file2 / ...
* <P>
* issues -doesn't handle special characters in metadata (needs to turn &'s into
* &amp;, etc.)
* issues -doesn't handle special characters in metadata (needs to turn {@code &'s} into
* {@code &amp;}, etc.)
* <P>
* Modified by David Little, UCSD Libraries 12/21/04 to allow the registration
* of files (bitstreams) into DSpace.

View File

@@ -57,8 +57,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* core in RDF schema / contents - text file, listing one file per line / file1
* - files contained in the item / file2 / ...
* <P>
* issues -doesn't handle special characters in metadata (needs to turn &'s into
* &amp;, etc.)
* issues -doesn't handle special characters in metadata (needs to turn {@code &'s} into
* {@code &amp;}, etc.)
* <P>
* Modified by David Little, UCSD Libraries 12/21/04 to allow the registration
* of files (bitstreams) into DSpace.
@@ -180,10 +180,11 @@ public class ItemExportServiceImpl implements ItemExportService
* Discover the different schemas in use and output a separate metadata XML
* file for each schema.
*
* @param c
* @param i
* @param destDir
* @throws Exception
* @param c DSpace context
* @param i DSpace Item
* @param destDir destination directory
* @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/
protected void writeMetadata(Context c, Item i, File destDir, boolean migrate)
throws Exception
@@ -202,7 +203,15 @@ public class ItemExportServiceImpl implements ItemExportService
}
}
// output the item's dublin core into the item directory
/**
* output the item's dublin core into the item directory
* @param c DSpace context
* @param schema schema
* @param i DSpace Item
* @param destDir destination directory
* @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/
protected void writeMetadata(Context c, String schema, Item i,
File destDir, boolean migrate) throws Exception
{
@@ -318,7 +327,13 @@ public class ItemExportServiceImpl implements ItemExportService
}
}
// create the file 'handle' which contains the handle assigned to the item
/**
* create the file 'handle' which contains the handle assigned to the item
* @param c DSpace Context
* @param i DSpace Item
* @param destDir destination directory
* @throws Exception if error
*/
protected void writeHandle(Context c, Item i, File destDir)
throws Exception
{
@@ -358,7 +373,9 @@ public class ItemExportServiceImpl implements ItemExportService
* the item being exported
* @param destDir
* the item's export directory
* @throws Exception
* @param excludeBitstreams
* whether to exclude bitstreams
* @throws Exception if error
* if there is any problem writing to the export directory
*/
protected void writeBitstreams(Context c, Item i, File destDir,
@@ -531,7 +548,8 @@ public class ItemExportServiceImpl implements ItemExportService
* - the dspace context
* @param additionalEmail
* - email address to cc in addition the the current user email
* @throws Exception
* @param toMigrate Whether to use the migrate option or not
* @throws Exception if error
*/
protected void processDownloadableExport(List<DSpaceObject> dsObjects,
Context context, final String additionalEmail, boolean toMigrate) throws Exception
@@ -808,7 +826,7 @@ public class ItemExportServiceImpl implements ItemExportService
"A dspace.cfg entry for 'org.dspace.app.itemexport.download.dir' does not exist.");
}
File result = new File(downloadDir + System.getProperty("file.separator") + ePerson.getID());
if(!result.exists())
if(!result.exists() && ePerson.getLegacyId()!=null)
{
//Check for the old identifier
result = new File(downloadDir + System.getProperty("file.separator") + ePerson.getLegacyId());
@@ -868,6 +886,13 @@ public class ItemExportServiceImpl implements ItemExportService
return file.length();
}
/**
* Attempt to find an EPerson based on string ID
* @param context DSpace context
* @param strID string identifier
* @return EPerson object (if found)
* @throws SQLException if database error
*/
protected EPerson getEPersonFromString(Context context, String strID) throws SQLException {
EPerson eperson;
try{
@@ -1105,6 +1130,14 @@ public class ItemExportServiceImpl implements ItemExportService
}
}
/**
*
* @param cpFile file
* @param strSource source location
* @param strTarget target location
* @param cpZipOutputStream current zip outputstream
* @throws Exception if error
*/
protected void zipFiles(File cpFile, String strSource,
String strTarget, ZipOutputStream cpZipOutputStream)
throws Exception
@@ -1158,6 +1191,11 @@ public class ItemExportServiceImpl implements ItemExportService
}
}
/**
* Delete a directory
* @param path directory path
* @return true if successful, false otherwise
*/
protected boolean deleteDirectory(File path)
{
if (path.exists())

View File

@@ -30,8 +30,8 @@ import java.util.List;
* core in RDF schema / contents - text file, listing one file per line / file1
* - files contained in the item / file2 / ...
* <P>
* issues -doesn't handle special characters in metadata (needs to turn &'s into
* &amp;, etc.)
* issues -doesn't handle special characters in metadata (needs to turn {@code &'s} into
* {@code &amp;}, etc.)
* <P>
* Modified by David Little, UCSD Libraries 12/21/04 to allow the registration
* of files (bitstreams) into DSpace.
@@ -59,7 +59,8 @@ public interface ItemExportService {
* @param zipFileName The name to save the zip file as
* @param seqStart The first number in the sequence
* @param migrate Whether to use the migrate option or not
* @throws Exception
* @param excludeBitstreams Whether to exclude bitstreams or not
* @throws Exception if error
*/
public void exportAsZip(Context context, Iterator<Item> items,
String destDirName, String zipFileName,
@@ -74,7 +75,8 @@ public interface ItemExportService {
* - the dspace object to export
* @param context
* - the dspace context
* @throws Exception
* @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/
public void createDownloadableExport(DSpaceObject dso,
Context context, boolean migrate) throws Exception;
@@ -87,7 +89,8 @@ public interface ItemExportService {
* - List containing dspace objects
* @param context
* - the dspace context
* @throws Exception
* @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/
public void createDownloadableExport(List<DSpaceObject> dsObjects,
Context context, boolean migrate) throws Exception;
@@ -102,7 +105,8 @@ public interface ItemExportService {
* - the dspace context
* @param additionalEmail
* - cc email to use
* @throws Exception
* @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/
public void createDownloadableExport(DSpaceObject dso,
Context context, String additionalEmail, boolean migrate) throws Exception;
@@ -117,7 +121,8 @@ public interface ItemExportService {
* - the dspace context
* @param additionalEmail
* - cc email to use
* @throws Exception
* @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/
public void createDownloadableExport(List<DSpaceObject> dsObjects,
Context context, String additionalEmail, boolean migrate) throws Exception;
@@ -126,13 +131,14 @@ public interface ItemExportService {
/**
* Create a file name based on the date and eperson
*
* @param type Type of object (as string)
* @param eperson
* - eperson who requested export and will be able to download it
* @param date
* - the date the export process was created
* @return String representing the file name in the form of
* 'export_yyy_MMM_dd_count_epersonID'
* @throws Exception
* @throws Exception if error
*/
public String assembleFileName(String type, EPerson eperson,
Date date) throws Exception;
@@ -146,7 +152,7 @@ public interface ItemExportService {
* - the eperson who requested export archive
* @return String representing a directory in the form of
* org.dspace.app.itemexport.download.dir/epersonID
* @throws Exception
* @throws Exception if error
*/
public String getExportDownloadDirectory(EPerson ePerson)
throws Exception;
@@ -157,7 +163,7 @@ public interface ItemExportService {
*
* @return String representing config file entry for
* org.dspace.app.itemexport.work.dir
* @throws Exception
* @throws Exception if error
*/
public String getExportWorkDirectory() throws Exception;
@@ -169,7 +175,7 @@ public interface ItemExportService {
* @param eperson
* the eperson requesting the download
* @return an input stream of the file to be downloaded
* @throws Exception
* @throws Exception if error
*/
public InputStream getExportDownloadInputStream(String fileName,
EPerson eperson) throws Exception;
@@ -177,12 +183,24 @@ public interface ItemExportService {
/**
* Get the file size of the export archive represented by the file name.
*
* @param context DSpace context
* @param fileName
* name of the file to get the size.
* @throws Exception
* @throws Exception if error
* @return size as long
*/
public long getExportFileSize(Context context, String fileName) throws Exception;
/**
* Get the last modified date of the export archive represented by the file name.
*
* @param context DSpace context
* @param fileName
* name of the file to get the size.
* @return date as long
* @see java.io.File#lastModified()
* @throws Exception if error
*/
public long getExportFileLastModified(Context context, String fileName)
throws Exception;
@@ -203,10 +221,10 @@ public interface ItemExportService {
* Reads the download directory for the eperson to see if any export
* archives are available
*
* @param eperson
* @param eperson EPerson object
* @return a list of file names representing export archives that have been
* processed
* @throws Exception
* @throws Exception if error
*/
public List<String> getExportsAvailable(EPerson eperson)
throws Exception;
@@ -218,7 +236,7 @@ public interface ItemExportService {
*
* @param eperson
* - the eperson to clean up
* @throws Exception
* @throws Exception if error
*/
public void deleteOldExportArchives(EPerson eperson) throws Exception;
@@ -228,7 +246,7 @@ public interface ItemExportService {
* determine if the current exports are too old and need purgeing
* Removes all old exports, not just those for the person doing the export.
*
* @throws Exception
* @throws Exception if error
*/
public void deleteOldExportArchives() throws Exception;
@@ -245,7 +263,7 @@ public interface ItemExportService {
* @param fileName
* - the file name to be downloaded. It is added to the url in
* the email
* @throws MessagingException
* @throws MessagingException if error
*/
public void emailSuccessMessage(Context context, EPerson eperson,
String fileName) throws MessagingException;
@@ -260,11 +278,17 @@ public interface ItemExportService {
* - EPerson to send the error message to
* @param error
* - the error message
* @throws MessagingException
* @throws MessagingException if error
*/
public void emailErrorMessage(EPerson eperson, String error)
throws MessagingException;
/**
* Zip source to target
* @param strSource source file
* @param target target file
* @throws Exception if error
*/
public void zip(String strSource, String target) throws Exception;
}

View File

@@ -20,7 +20,7 @@ import java.util.Map;
/**
* This class acts as a Service in the procedure ot batch import using the Biblio-Transformation-Engine
* This class acts as a Service in the procedure to batch import using the Biblio-Transformation-Engine
*/
public class BTEBatchImportService
{
@@ -39,7 +39,7 @@ public class BTEBatchImportService
/**
* Setter method for dataLoaders parameter
* @param dataLoaders
* @param dataLoaders map of data loaders
*/
public void setDataLoaders(Map<String, DataLoader> dataLoaders)
{
@@ -47,7 +47,7 @@ public class BTEBatchImportService
}
/**
*
* Get data loaders
* @return the map of DataLoaders
*/
public Map<String, DataLoader> getDataLoaders()
@@ -56,7 +56,7 @@ public class BTEBatchImportService
}
/**
*
* Get output map
* @return the outputMapping
*/
public Map<String, String> getOutputMap() {
@@ -65,20 +65,32 @@ public class BTEBatchImportService
/**
* Setter method for the outputMapping
* @param outputMapping
* @param outputMap the output mapping
*/
public void setOutputMap(Map<String, String> outputMap) {
this.outputMap = outputMap;
}
/**
* Get transformation engine
* @return transformation engine
*/
public TransformationEngine getTransformationEngine() {
return transformationEngine;
}
/**
* set transformation engine
* @param transformationEngine transformation engine
*/
public void setTransformationEngine(TransformationEngine transformationEngine) {
this.transformationEngine = transformationEngine;
}
/**
* Getter of file data loaders
* @return List of file data loaders
*/
public List<String> getFileDataLoaders(){
List<String> result = new ArrayList<String>();

View File

@@ -7,9 +7,7 @@
*/
package org.dspace.app.itemimport;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
@@ -19,7 +17,6 @@ import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Scanner;
/**
* @author kstamatis
@@ -37,7 +34,8 @@ public class BatchUpload {
private String errorMsgHTML = "";
/**
*
* Initialize with directory
* @param dirPath directory path
*/
public BatchUpload(String dirPath) {
@@ -45,13 +43,20 @@ public class BatchUpload {
}
/**
* Initialize with directory
* @param dir directory path
*/
public BatchUpload(File dir) {
this.initializeWithFile(dir);
}
/**
* Initialize with directory
* @param dir directory path
*/
private void initializeWithFile(File dir){
this.dir = dir;
@@ -89,6 +94,12 @@ public class BatchUpload {
}
}
/**
* Count lines in file
* @param filename file name
* @return lines in file
* @throws IOException if IO error
*/
private int countLines(String filename) throws IOException {
LineNumberReader reader = new LineNumberReader(new FileReader(filename));
int cnt = 0;
@@ -106,6 +117,11 @@ public class BatchUpload {
return cnt;
}
/**
* Read a file
* @param filename file name
* @throws IOException if IO error
*/
private void readFile(String filename) throws IOException {
LineNumberReader reader = new LineNumberReader(new FileReader(filename));
String lineRead = "";
@@ -125,40 +141,76 @@ public class BatchUpload {
reader.close();
}
/**
* Get date
* @return Date
*/
public Date getDate() {
return date;
}
/**
* Get path to directory
* @return directory
*/
public File getDir() {
return dir;
}
/**
* Whether successulf
* @return true or false
*/
public boolean isSuccessful() {
return successful;
}
/**
* Get items imported
* @return number of items
*/
public int getItemsImported() {
return itemsImported;
}
/**
* Get total items
* @return total
*/
public int getTotalItems() {
return totalItems;
}
/**
* Get formatted date (DD/MM/YY)
* @return date as string
*/
public String getDateFormatted(){
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy - HH:mm");
return df.format(date);
}
/**
* Get handles of imported files
* @return list of handles
*/
public List<String> getHandlesImported() {
return handlesImported;
}
/**
* Get error message
* @return error message
*/
public String getErrorMsg() {
return errorMsg;
}
/**
* Get error message as HTML
* @return error message string as HTML
*/
public String getErrorMsgHTML() {
return errorMsgHTML;
}

View File

@@ -175,10 +175,10 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* @param mycollections The collections the items are inserted to
* @param sourceDir The filepath to the file to read data from
* @param mapFile The filepath to mapfile to be generated
* @param template
* @param template whether to use collection template item as starting point
* @param inputType The type of the input data (bibtex, csv, etc.)
* @param workingDir The path to create temporary files (for command line or UI based)
* @throws Exception
* @throws Exception if error occurs
*/
@Override
public void addBTEItems(Context c, List<Collection> mycollections,
@@ -457,10 +457,14 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/**
* item? try and add it to the archive.
* @param c current Context
* @param mycollections - add item to these Collections.
* @param path - directory containing the item directories.
* @param itemname handle - non-null means we have a pre-defined handle already
* @param mapOut - mapfile we're writing
* @param template whether to use collection template item as starting point
* @return Item
* @throws Exception if error occurs
*/
protected Item addItem(Context c, List<Collection> mycollections, String path,
String itemname, PrintWriter mapOut, boolean template) throws Exception
@@ -765,6 +769,8 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* @param path The path to the data directory for this item
* @param filename The collections file filename. Should be "collections"
* @return A list of collections in which to insert the item or null
* @throws IOException if IO error
* @throws SQLException if database error
*/
protected List<Collection> processCollectionFile(Context c, String path, String filename) throws IOException, SQLException
@@ -827,7 +833,12 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
}
/**
* Read in the handle file or return null if empty or doesn't exist
* Read in the handle file contents or return null if empty or doesn't exist
* @param c DSpace context
* @param i DSpace item
* @param path path to handle file
* @param filename name of file
* @return handle file contents or null if doesn't exist
*/
protected String processHandleFile(Context c, Item i, String path, String filename)
{
@@ -886,6 +897,14 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* Given a contents file and an item, stuffing it with bitstreams from the
* contents file Returns a List of Strings with lines from the contents
* file that request non-default bitstream permission
* @param c DSpace Context
* @param i DSpace item
* @param path path as string
* @param filename file name
* @return List of Strings
* @throws SQLException if database error
* @throws IOException if IO error
* @throws AuthorizeException if authorization error
*/
protected List<String> processContentsFile(Context c, Item i, String path,
String filename) throws SQLException, IOException,
@@ -1129,14 +1148,15 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/**
* each entry represents a bitstream....
* @param c
* @param i
* @param path
* @param fileName
* @param bundleName
* @throws SQLException
* @throws IOException
* @throws AuthorizeException
* @param c DSpace Context
* @param i Dspace Item
* @param path path to file
* @param fileName file name
* @param bundleName bundle name
* @param primary if primary bitstream
* @throws SQLException if database error
* @throws IOException if IO error
* @throws AuthorizeException if authorization error
*/
protected void processContentFileEntry(Context c, Item i, String path,
String fileName, String bundleName, boolean primary) throws SQLException,
@@ -1209,14 +1229,15 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/**
* Register the bitstream file into DSpace
*
* @param c
* @param i
* @param assetstore
* @param c DSpace Context
* @param i DSpace Item
* @param assetstore assetstore number
* @param bitstreamPath the full filepath expressed in the contents file
* @param bundleName
* @throws SQLException
* @throws IOException
* @throws AuthorizeException
* @param bundleName bundle name
* @param description bitstream description
* @throws SQLException if database error
* @throws IOException if IO error
* @throws AuthorizeException if authorization error
*/
protected void registerBitstream(Context c, Item i, int assetstore,
String bitstreamPath, String bundleName, String description )
@@ -1281,19 +1302,21 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* Process the Options to apply to the Item. The options are tab delimited
*
* Options:
* {@code
* 48217870-MIT.pdf permissions: -r 'MIT Users' description: Full printable version (MIT only)
* permissions:[r|w]-['group name']
* description: 'the description of the file'
*
* }
* where:
* {@code
* [r|w] (meaning: read|write)
* ['MIT Users'] (the group name)
*
* @param c
* @param myItem
* @param options
* @throws SQLException
* @throws AuthorizeException
* }
* @param c DSpace Context
* @param myItem DSpace Item
* @param options List of option strings
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
protected void processOptions(Context c, Item myItem, List<String> options)
throws SQLException, AuthorizeException
@@ -1447,12 +1470,13 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/**
* Set the Permission on a Bitstream.
*
* @param c
* @param g
* @param actionID
* @param bs
* @throws SQLException
* @throws AuthorizeException
* @param c DSpace Context
* @param g Dspace Group
* @param actionID action identifier
* @param bs Bitstream
* @see org.dspace.core.Constants
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
protected void setPermission(Context c, Group g, int actionID, Bitstream bs)
throws SQLException, AuthorizeException
@@ -1488,9 +1512,9 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
// XML utility methods
/**
* Lookup an attribute from a DOM node.
* @param n
* @param name
* @return
* @param n node
* @param name attribute name
* @return attribute value
*/
private String getAttributeValue(Node n, String name)
{
@@ -1512,8 +1536,8 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/**
* Return the String value of a Node.
* @param node
* @return
* @param node node
* @return string value
*/
protected String getStringValue(Node node)
{
@@ -1539,6 +1563,9 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* the filename to load from
*
* @return the DOM representation of the XML file
* @throws IOException if IO error
* @throws ParserConfigurationException if config error
* @throws SAXException if XML error
*/
protected Document loadXML(String filename) throws IOException,
ParserConfigurationException, SAXException
@@ -1721,7 +1748,8 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* @param resumeDir In case of a resume request, the directory that containsthe old mapfile and data
* @param inputType The input type of the data (bibtex, csv, etc.), in case of local file
* @param context The context
* @throws Exception
* @param template whether to use template item
* @throws Exception if error
*/
@Override
public void processUIImport(String filepath, Collection owningCollection, String[] otherCollections, String resumeDir, String inputType, Context context, final boolean template) throws Exception

View File

@@ -36,15 +36,53 @@ import java.util.List;
public interface ItemImportService {
/**
*
* @param c DSpace Context
* @param mycollections List of Collections
* @param sourceDir source location
* @param mapFile map file
* @param template whether to use template item
* @throws Exception if error
*/
public void addItemsAtomic(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template) throws Exception;
/**
* Add items
* @param c DSpace Context
* @param mycollections List of Collections
* @param sourceDir source location
* @param mapFile map file
* @param template whether to use template item
* @throws Exception if error
*/
public void addItems(Context c, List<Collection> mycollections,
String sourceDir, String mapFile, boolean template) throws Exception;
/**
* Unzip a file
* @param zipfile file
* @return unzip location
* @throws IOException if error
*/
public String unzip(File zipfile) throws IOException;
/**
* Unzip a file to a destination
* @param zipfile file
* @param destDir destination directory
* @return unzip location
* @throws IOException if error
*/
public String unzip(File zipfile, String destDir) throws IOException;
/**
* Unzip a file in a specific source directory
* @param sourcedir source directory
* @param zipfilename file name
* @return unzip location
* @throws IOException if error
*/
public String unzip(String sourcedir, String zipfilename) throws IOException;
/**
@@ -54,8 +92,10 @@ public interface ItemImportService {
* @param owningCollection The owning collection the items will belong to
* @param collections The collections the created items will be inserted to, apart from the owning one
* @param resumeDir In case of a resume request, the directory that containsthe old mapfile and data
* @param inputType The input type of the data (bibtex, csv, etc.), in case of local file
* @param context The context
* @throws Exception
* @param template whether to use template item
* @throws Exception if error
*/
public void processUIImport(String url, Collection owningCollection, String[] collections, String resumeDir, String inputType, Context context, boolean template) throws Exception;
@@ -71,7 +111,7 @@ public interface ItemImportService {
* - eperson to send the email to
* @param fileName
* - the filepath to the mapfile created by the batch import
* @throws javax.mail.MessagingException
* @throws MessagingException if error
*/
public void emailSuccessMessage(Context context, EPerson eperson,
String fileName) throws MessagingException;
@@ -86,39 +126,113 @@ public interface ItemImportService {
* - EPerson to send the error message to
* @param error
* - the error message
* @throws MessagingException
* @throws MessagingException if error
*/
public void emailErrorMessage(EPerson eperson, String error)
throws MessagingException;
/**
* Get imports available for a person
* @param eperson EPerson object
* @return List of batch uploads
* @throws Exception if error
*/
public List<BatchUpload> getImportsAvailable(EPerson eperson)
throws Exception;
/**
* Get import upload directory
* @param ePerson EPerson object
* @return directory
* @throws Exception if error
*/
public String getImportUploadableDirectory(EPerson ePerson)
throws Exception;
/**
* Delete a batch by ID
* @param c DSpace Context
* @param uploadId identifier
* @throws Exception if error
*/
public void deleteBatchUpload(Context c, String uploadId) throws Exception;
/**
* Replace items
* @param c DSpace Context
* @param mycollections List of Collections
* @param sourcedir source directory
* @param mapfile map file
* @param template whether to use template item
* @throws Exception if error
*/
public void replaceItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template) throws Exception;
/**
* Delete items via mapfile
* @param c DSpace Context
* @param mapfile map file
* @throws Exception if error
*/
public void deleteItems(Context c, String mapfile) throws Exception;
/**
* Add items
* @param c DSpace Context
* @param mycollections List of Collections
* @param sourcedir source directory
* @param mapfile map file
* @param template whether to use template item
* @param bteInputType The input type of the data (bibtex, csv, etc.), in case of local file
* @param workingDir working directory
* @throws Exception if error
*/
public void addBTEItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template, String bteInputType, String workingDir) throws Exception;
/**
* Get temporary work directory
* @return directory as string
*/
public String getTempWorkDir();
/**
* Get temporary work directory (as File)
* @return directory as File
*/
public File getTempWorkDirFile();
/**
* Cleanup
*/
public void cleanupZipTemp();
/**
* Set test flag
* @param isTest true or false
*/
public void setTest(boolean isTest);
/**
* Set resume flag
* @param isResume true or false
*/
public void setResume(boolean isResume);
/**
* Set use workflow
* @param useWorkflow whether to enable workflow
*/
public void setUseWorkflow(boolean useWorkflow);
public void setUseWorkflowSendEmail(boolean useWorkflow);
/**
* @param useWorkflowSendMail whether to send mail
*/
public void setUseWorkflowSendEmail(boolean useWorkflowSendMail);
/**
* Set quiet flag
* @param isQuiet true or false
*/
public void setQuiet(boolean isQuiet);
}

View File

@@ -24,6 +24,13 @@ public class ActionManager implements Iterable<UpdateAction> {
protected Map<Class<? extends UpdateAction>, UpdateAction> registry
= new LinkedHashMap<Class<? extends UpdateAction>, UpdateAction>();
/**
* Get update action
* @param actionClass UpdateAction class
* @return instantiation of UpdateAction class
* @throws InstantiationException if instantiation error
* @throws IllegalAccessException if illegal access error
*/
public UpdateAction getUpdateAction(Class<? extends UpdateAction> actionClass)
throws InstantiationException, IllegalAccessException
{

View File

@@ -48,15 +48,15 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction {
/**
* Adds bitstreams from the archive as listed in the contents file.
*
* @param context
* @param itarch
* @param isTest
* @param suppressUndo
* @throws IllegalArgumentException
* @throws ParseException
* @throws IOException
* @throws AuthorizeException
* @throws SQLException
* @param context DSpace Context
* @param itarch Item Archive
* @param isTest test flag
* @param suppressUndo undo flag
* @throws IOException if IO error
* @throws IllegalArgumentException if arg exception
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
* @throws ParseException if parse error
*/
@Override
public void execute(Context context, ItemArchive itarch, boolean isTest,
@@ -117,6 +117,22 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction {
}
}
/**
* Add bitstream
* @param context DSpace Context
* @param itarch Item Archive
* @param item DSpace Item
* @param dir directory
* @param ce contents entry for bitstream
* @param suppressUndo undo flag
* @param isTest test flag
* @return bundle name
* @throws IOException if IO error
* @throws IllegalArgumentException if arg exception
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
* @throws ParseException if parse error
*/
protected String addBitstream(Context context, ItemArchive itarch, Item item, File dir,
ContentsEntry ce, boolean suppressUndo, boolean isTest)
throws IOException, IllegalArgumentException, SQLException, AuthorizeException, ParseException

View File

@@ -33,12 +33,12 @@ public class AddMetadataAction extends UpdateMetadataAction {
/**
* Adds metadata specified in the source archive
*
* @param context
* @param itarch
* @param isTest
* @param suppressUndo
* @throws AuthorizeException
* @throws SQLException
* @param context DSpace Context
* @param itarch item archive
* @param isTest test flag
* @param suppressUndo undo flag
* @throws AuthorizeException if authorization error
* @throws SQLException if database error
*/
@Override
public void execute(Context context, ItemArchive itarch, boolean isTest,

View File

@@ -26,16 +26,16 @@ public abstract class BitstreamFilter {
/**
* The filter method
*
* @param bitstream
* @param bitstream Bitstream
* @return whether the bitstream matches the criteria
* @throws BitstreamFilterException
* @throws BitstreamFilterException if filter error
*/
public abstract boolean accept(Bitstream bitstream) throws BitstreamFilterException;
/**
*
* @param filepath - The complete path for the properties file
* @throws IOException
* @throws IOException if IO error
*/
public void initProperties(String filepath)
throws IOException

View File

@@ -29,8 +29,8 @@ public class BitstreamFilterByBundleName extends BitstreamFilter {
/**
* Filter bitstream based on bundle name found in properties file
*
* @param bitstream
* @throws BitstreamFilterException
* @param bitstream Bitstream
* @throws BitstreamFilterException if filter error
* @return whether bitstream is in bundle
*
*/

View File

@@ -29,7 +29,9 @@ public class BitstreamFilterByFilename extends BitstreamFilter {
* 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
public boolean accept(Bitstream bitstream) throws BitstreamFilterException

View File

@@ -17,10 +17,18 @@ public class BitstreamFilterException extends Exception
private static final long serialVersionUID = 1L;
public BitstreamFilterException() {}
/**
*
* @param msg exception message
*/
public BitstreamFilterException(String msg)
{
super(msg);
}
/**
*
* @param e exception
*/
public BitstreamFilterException(Exception e)
{
super(e);

View File

@@ -21,9 +21,11 @@ import org.dspace.core.Constants;
* it looks from the source code that the ordering or elements is not fixed
*
* e.g.:
* {@code
* 48217870-MIT.pdf\tbundle: bundlename\tpermissions: -r 'MIT Users'\tdescription: Full printable version (MIT only)
* permissions: -[r|w] ['group name']
* description: <the description of the file>
* }
*
*
*/
@@ -57,9 +59,9 @@ public class ContentsEntry
/**
* Factory method parses a line from the Contents Entry file
*
* @param line
* @param line line as string
* @return the parsed ContentsEntry object
* @throws ParseException
* @throws ParseException if parse error
*/
public static ContentsEntry parse(String line)
throws ParseException

View File

@@ -30,15 +30,15 @@ public class DeleteBitstreamsAction extends UpdateBitstreamsAction
/**
* Delete bitstream from item
*
* @param context
* @param itarch
* @param isTest
* @param suppressUndo
* @throws IllegalArgumentException
* @throws ParseException
* @throws IOException
* @throws AuthorizeException
* @throws SQLException
* @param context DSpace Context
* @param itarch item archive
* @param isTest test flag
* @param suppressUndo undo flag
* @throws IOException if IO error
* @throws IllegalArgumentException if arg exception
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
* @throws ParseException if parse error
*/
@Override
public void execute(Context context, ItemArchive itarch, boolean isTest,

View File

@@ -35,7 +35,7 @@ public class DeleteBitstreamsByFilterAction extends UpdateBitstreamsAction {
/**
* Set filter
*
* @param filter
* @param filter BitstreamFilter
*/
public void setBitstreamFilter(BitstreamFilter filter)
{
@@ -54,15 +54,15 @@ public class DeleteBitstreamsByFilterAction extends UpdateBitstreamsAction {
/**
* Delete bitstream
*
* @param context
* @param itarch
* @param isTest
* @param suppressUndo
* @throws IllegalArgumentException
* @throws ParseException
* @throws IOException
* @throws AuthorizeException
* @throws SQLException
* @param context DSpace Context
* @param itarch item archive
* @param isTest test flag
* @param suppressUndo undo flag
* @throws IOException if IO error
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
* @throws ParseException if parse error
* @throws BitstreamFilterException if filter error
*/
@Override
public void execute(Context context, ItemArchive itarch, boolean isTest,

View File

@@ -28,12 +28,13 @@ public class DeleteMetadataAction extends UpdateMetadataAction {
/**
* Delete metadata from item
*
* @param context
* @param itarch
* @param isTest
* @param suppressUndo
* @throws ParseException
* @throws AuthorizeException
* @param context DSpace Context
* @param itarch Item Archive
* @param isTest test flag
* @param suppressUndo undo flag
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
* @throws ParseException if parse error
*/
@Override
public void execute(Context context, ItemArchive itarch, boolean isTest,

View File

@@ -16,7 +16,7 @@ import org.dspace.content.Item;
*
* Adds some utility methods
*
* Really not at all general enough but supports Dublin Core and the compound form notation <schema>.<element>[.<qualifier>]
* Really not at all general enough but supports Dublin Core and the compound form notation {@code <schema>.<element>[.<qualifier>]}
*
* Does not support wildcard for qualifier
*
@@ -47,8 +47,9 @@ class DtoMetadata
* @param element not null, not empty
* @param qualifier null; don't allow empty string or * indicating 'any'
* @param language null or empty
* @param value
* @param value value
* @return DtoMetadata object
* @throws IllegalArgumentException if arg error
*/
public static DtoMetadata create(String schema,
String element,
@@ -70,7 +71,9 @@ class DtoMetadata
*
* @param compoundForm of the form <schema>.<element>[.<qualifier>]
* @param language null or empty
* @param value
* @param value value
* @throws ParseException if parse error
* @throws IllegalArgumentException if arg error
*/
public static DtoMetadata create(String compoundForm, String language, String value)
throws ParseException, IllegalArgumentException

View File

@@ -85,6 +85,8 @@ public class ItemArchive {
* @param dir - The directory File in the source archive
* @param itemField - The metadata field in which the Item identifier is located
* if null, the default is the handle in the dc.identifier.uri field
* @return ItemArchive object
* @throws Exception if error
*
*/
public static ItemArchive create(Context context, File dir, String itemField)
@@ -137,6 +139,11 @@ public class ItemArchive {
return builder;
}
/**
* Getter for Transformer
* @return Transformer
* @throws TransformerConfigurationException if config error
*/
protected Transformer getTransformer()
throws TransformerConfigurationException
{
@@ -176,7 +183,7 @@ public class ItemArchive {
/**
* Add metadata field to undo list
* @param dtom
* @param dtom DtoMetadata (represents metadata field)
*/
public void addUndoMetadataField(DtoMetadata dtom)
{
@@ -194,7 +201,7 @@ public class ItemArchive {
/**
* Add bitstream id to delete contents file
* @param bitstreamId
* @param bitstreamId bitstream ID
*/
public void addUndoDeleteContents(UUID bitstreamId)
{
@@ -207,7 +214,9 @@ public class ItemArchive {
* This is the default implementation
* that uses the dc.identifier.uri metadatafield
* that contains the item handle as its value
*
* @param context DSpace Context
* @throws SQLException if database error
* @throws Exception if error
*/
private Item itemFromHandleInput(Context context)
throws SQLException, Exception
@@ -250,8 +259,8 @@ public class ItemArchive {
*
* @param context - the DSpace context
* @param itemField - the compound form of the metadata element <schema>.<element>.<qualifier>
* @throws SQLException
* @throws Exception
* @throws SQLException if database error
* @throws Exception if error
*/
private Item itemFromMetadataField(Context context, String itemField)
throws SQLException, AuthorizeException, Exception
@@ -285,7 +294,11 @@ public class ItemArchive {
return item;
}
/**
* Get DtoMetadata field
* @param compoundForm compound form
* @return DtoMetadata field
*/
private DtoMetadata getMetadataField(String compoundForm)
{
for (DtoMetadata dtom : dtomList)
@@ -301,8 +314,12 @@ public class ItemArchive {
/**
* write undo directory and files to Disk in archive format
*
*
* @param undoDir - the root directory of the undo archive
* @throws IOException if IO error
* @throws ParserConfigurationException if config error
* @throws TransformerConfigurationException if transformer config error
* @throws TransformerException if transformer error
* @throws FileNotFoundException if file not found
*/
public void writeUndo(File undoDir)
throws IOException, ParserConfigurationException, TransformerConfigurationException,

View File

@@ -113,7 +113,7 @@ public class ItemUpdate {
/**
*
* @param argv
* @param argv commandline args
*/
public static void main(String[] argv)
{
@@ -392,6 +392,16 @@ public class ItemUpdate {
System.exit(status);
}
/**
* process an archive
* @param context DSpace Context
* @param sourceDirPath source path
* @param itemField item field
* @param metadataIndexName index name
* @param alterProvenance whether to alter provenance
* @param isTest test flag
* @throws Exception if error
*/
protected void processArchive(Context context, String sourceDirPath, String itemField,
String metadataIndexName, boolean alterProvenance, boolean isTest)
throws Exception
@@ -511,8 +521,8 @@ public class ItemUpdate {
*
* @param sourceDir - the original source directory
* @return the directory of the undo archive
* @throws FileNotFoundException
* @throws IOException
* @throws FileNotFoundException if file doesn't exist
* @throws IOException if IO error
*/
protected File initUndoArchive(File sourceDir)
throws FileNotFoundException, IOException
@@ -555,6 +565,12 @@ public class ItemUpdate {
//private void write
/**
* Set EPerson doing import
* @param context DSpace Context
* @param eperson EPerson obj
* @throws Exception if error
*/
protected void setEPerson(Context context, String eperson)
throws Exception
{
@@ -589,7 +605,7 @@ 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.
* @param s
* @param s String
*/
static void pr(String s)
{
@@ -598,7 +614,7 @@ public class ItemUpdate {
/**
* print if verbose flag is set
* @param s
* @param s String
*/
static void prv(String s)
{

View File

@@ -68,11 +68,11 @@ public class MetadataUtilities {
clear (i.e. delete) all of these DCValues
* add them back, minus the one to actually delete
*
*
* @param item
* @param dtom
* @param isLanguageStrict -
*
* @param context DSpace Context
* @param item Item Object
* @param dtom metadata field
* @param isLanguageStrict whether strict or not
* @throws SQLException if database error
* @return true if metadata field is found with matching value and was deleted
*/
public static boolean deleteMetadataByValue(Context context, Item item, DtoMetadata dtom, boolean isLanguageStrict) throws SQLException {
@@ -122,11 +122,13 @@ public class MetadataUtilities {
/**
* Append text to value metadata field to item
*
* @param item
* @param dtom
* @param isLanguageStrict
* @param textToAppend
* @param context DSpace Context
* @param item DSpace Item
* @param dtom metadata field
* @param isLanguageStrict if strict
* @param textToAppend text to append
* @throws IllegalArgumentException - When target metadata field is not found
* @throws SQLException if database error
*/
public static void appendMetadata(Context context, Item item, DtoMetadata dtom, boolean isLanguageStrict,
String textToAppend)
@@ -184,15 +186,15 @@ public class MetadataUtilities {
* Modification of method from ItemImporter.loadDublinCore
* as a Factory method
*
* @param docBuilder -
* @param docBuilder DocumentBuilder
* @param is - InputStream of dublin_core.xml
* @return list of DtoMetadata representing the metadata fields relating to an Item
* @throws SQLException
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
* @throws AuthorizeException
* @throws SQLException if database error
* @throws IOException if IO error
* @throws ParserConfigurationException if parser config error
* @throws SAXException if XML error
* @throws TransformerException if transformer error
* @throws AuthorizeException if authorization error
*/
public static List<DtoMetadata> loadDublinCore(DocumentBuilder docBuilder, InputStream is)
throws SQLException, IOException, ParserConfigurationException,
@@ -269,12 +271,12 @@ public class MetadataUtilities {
/**
* Write dublin_core.xml
*
* @param docBuilder
* @param dtomList
* @param docBuilder DocumentBuilder
* @param dtomList List of metadata fields
* @return xml document
* @throws ParserConfigurationException
* @throws TransformerConfigurationException
* @throws TransformerException
* @throws ParserConfigurationException if parser config error
* @throws TransformerConfigurationException if transformer config error
* @throws TransformerException if transformer error
*/
public static Document writeDublinCore(DocumentBuilder docBuilder, List<DtoMetadata> dtomList)
throws ParserConfigurationException, TransformerConfigurationException, TransformerException
@@ -313,11 +315,11 @@ public class MetadataUtilities {
/**
* write xml document to output stream
* @param doc
* @param transformer
* @param out
* @throws IOException
* @throws TransformerException
* @param doc XML Document
* @param transformer XML Transformer
* @param out OutputStream
* @throws IOException if IO Error
* @throws TransformerException if Transformer error
*/
public static void writeDocument(Document doc, Transformer transformer, OutputStream out)
throws IOException, TransformerException
@@ -332,9 +334,9 @@ public class MetadataUtilities {
// XML utility methods
/**
* Lookup an attribute from a DOM node.
* @param n
* @param name
* @return
* @param n Node
* @param name name
* @return attribute value
*/
private static String getAttributeValue(Node n, String name)
{
@@ -355,8 +357,8 @@ public class MetadataUtilities {
/**
* Return the String value of a Node.
* @param node
* @return
* @param node node
* @return string value
*/
private static String getStringValue(Node node)
{
@@ -379,7 +381,11 @@ public class MetadataUtilities {
* Rewrite of ItemImport's functionality
* but just the parsing of the file, not the processing of its elements.
*
* @validate flag to verify matching files in tree
* @param f file
* @return list of ContentsEntry
* @throws FileNotFoundException if file doesn't exist
* @throws IOException if IO error
* @throws ParseException if parse error
*/
public static List<ContentsEntry> readContentsFile(File f)
throws FileNotFoundException, IOException, ParseException
@@ -421,9 +427,10 @@ public class MetadataUtilities {
/**
*
* @param f
* @throws FileNotFoundException
* @throws IOException
* @param f file
* @return list of lines as strings
* @throws FileNotFoundException if file doesn't exist
* @throws IOException if IO Error
*/
public static List<String> readDeleteContentsFile(File f)
throws FileNotFoundException, IOException
@@ -466,7 +473,7 @@ public class MetadataUtilities {
/**
* Get display of Metadatum
*
* @param dcv
* @param dcv MetadataValue
* @return string displaying elements of the Metadatum
*/
public static String getDCValueString(MetadataValue dcv)
@@ -478,7 +485,10 @@ public class MetadataUtilities {
}
/**
*
* Return compound form of a metadata field (i.e. schema.element.qualifier)
* @param schema schema
* @param element element
* @param qualifier qualifier
* @return a String representation of the two- or three-part form of a metadata element
* e.g. dc.identifier.uri
*/
@@ -495,9 +505,10 @@ public class MetadataUtilities {
}
/**
* Parses metadata field given in the form <schema>.<element>[.<qualifier>|.*]
* Parses metadata field given in the form {@code <schema>.<element>[.<qualifier>|.*]}
* checks for correct number of elements (2 or 3) and for empty strings
*
* @param compoundForm compound form of metadata field
* @return String Array
* @throws ParseException if validity checks fail
*

View File

@@ -27,10 +27,10 @@ public class OriginalBitstreamFilter extends BitstreamFilterByBundleName
/**
* Tests bitstreams for containment in an ORIGINAL bundle
*
* @param bitstream Bitstream
* @return true if the bitstream is in the ORIGINAL bundle
*
* @throws BitstreamFilterException
* @throws BitstreamFilterException if filter error
*/
@Override
public boolean accept(Bitstream bitstream)

View File

@@ -30,8 +30,8 @@ public class OriginalWithDerivativesBitstreamFilter extends BitstreamFilter
/**
* Tests bitstream for membership in specified bundles (ORIGINAL, TEXT, THUMBNAIL)
*
* @param bitstream
* @throws BitstreamFilterException
* @param bitstream Bitstream
* @throws BitstreamFilterException if error
* @return true if bitstream is in specified bundles
*/
@Override

View File

@@ -23,11 +23,11 @@ public interface UpdateAction
/**
* Action to update item
*
* @param context
* @param itarch
* @param isTest
* @param suppressUndo
* @throws Exception
* @param context DSpace context
* @param itarch item archive
* @param isTest test flag
* @param suppressUndo undo flag
* @throws Exception if error
*/
public void execute(Context context, ItemArchive itarch, boolean isTest, boolean suppressUndo)
throws Exception;

View File

@@ -27,7 +27,7 @@ public abstract class UpdateBitstreamsAction implements UpdateAction {
/**
* Set variable to indicate that the dc.description.provenance field may
* be changed as a result of Bitstream changes by ItemUpdate
* @param alterProvenance
* @param alterProvenance whether to alter provenance
*/
public void setAlterProvenance(boolean alterProvenance)
{

View File

@@ -13,7 +13,7 @@ import java.util.Set;
/**
* This abstract subclass for metadata actions
* maintains a collection for the target metadata fields
* expressed as a string in the compound notation ( <schema>.<element>.<qualifier> )
* expressed as a string in the compound notation ( {@code <schema>.<element>.<qualifier>} )
* on which to apply the action when the method execute is called.
*
* Implemented as a Set to avoid problems with duplicates
@@ -36,7 +36,7 @@ public abstract class UpdateMetadataAction implements UpdateAction {
/**
* Set target fields
*
* @param targetFields
* @param targetFields Set of target fields to update
*/
public void addTargetFields(Set<String> targetFields) {
for (String tf : targetFields)
@@ -48,7 +48,7 @@ public abstract class UpdateMetadataAction implements UpdateAction {
/**
* Add array of target fields to update
* @param targetFields
* @param targetFields array of target fields to update
*/
public void addTargetFields(String[] targetFields) {
for (String tf : targetFields)
@@ -61,7 +61,7 @@ public abstract class UpdateMetadataAction implements UpdateAction {
/**
* Add single field to update
*
* @param targetField
* @param targetField target field to update
*/
public void addTargetField(String targetField) {
this.targetFields.add(targetField);

View File

@@ -23,6 +23,12 @@ import org.jdom.Document;
*/
public class CommandRunner
{
/**
*
* @param args commandline args
* @throws IOException if IO error
* @throws FileNotFoundException if file doesn't exist
*/
public static void main(String[] args)
throws FileNotFoundException, IOException
{
@@ -46,11 +52,10 @@ public class CommandRunner
/**
* Read a file of command lines and execute each in turn.
*
* @param doc details of recognized commands.
* @param script the file of command lines to be executed.
* @return
* @throws FileNotFoundException
* @throws IOException
* @return status code
* @throws IOException if IO error
* @throws FileNotFoundException if file doesn't exist
*/
static int runManyCommands(String script)
throws FileNotFoundException, IOException

View File

@@ -34,6 +34,8 @@ public class ScriptLauncher
* Execute the DSpace script launcher
*
* @param args Any parameters required to be passed to the scripts it executes
* @throws IOException if IO error
* @throws FileNotFoundException if file doesn't exist
*/
public static void main(String[] args)
throws FileNotFoundException, IOException
@@ -90,8 +92,8 @@ public class ScriptLauncher
/**
* Recognize and execute a single command.
* @param doc
* @param args
* @param doc Document
* @param args arguments
*/
static int runOneCommand(Document commandConfigs, String[] args)
{
@@ -275,6 +277,7 @@ public class ScriptLauncher
/**
* Display the commands that the current launcher config file knows about
* @param commandConfigs configs as Document
*/
private static void display(Document commandConfigs)
{

View File

@@ -7,14 +7,7 @@
*/
package org.dspace.app.mediafilter;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.image.*;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.awt.Font;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import javax.imageio.ImageIO;
@@ -29,7 +22,7 @@ import org.dspace.app.mediafilter.JPEGFilter;
* thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be
* no bigger than. Creates only JPEGs.
*
* @author Jason Sherman <jsherman@usao.edu>
* @author Jason Sherman jsherman@usao.edu
*/
public class BrandedPreviewJPEGFilter extends MediaFilter
{
@@ -69,10 +62,13 @@ public class BrandedPreviewJPEGFilter extends MediaFilter
/**
* @param currentItem item
* @param source
* source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -73,11 +73,14 @@ public class ExcelFilter extends MediaFilter
}
/**
* @param source
* source input stream
* @param item item
* @param source source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item item, InputStream source, boolean verbose)
throws Exception
{

View File

@@ -50,10 +50,13 @@ public interface FormatFilter
public String getDescription();
/**
* @param item Item
* @param source
* input stream
* @param verbose verbosity flag
*
* @return result of filter's transformation, written out to a bitstream
* @throws Exception if error
*/
public InputStream getDestinationStream(Item item, InputStream source, boolean verbose)
throws Exception;
@@ -67,15 +70,14 @@ public interface FormatFilter
* for any reason.
*
*
* @param c
* context
* @param item
* item containing bitstream to process
* @param source
* source bitstream to be processed
* @param c context
* @param item item containing bitstream to process
* @param source source bitstream to be processed
* @param verbose verbose mode
*
* @return true if bitstream processing should continue,
* false if this bitstream should be skipped
* @throws Exception if error
*/
public boolean preProcessBitstream(Context c, Item item, Bitstream source, boolean verbose)
throws Exception;
@@ -96,6 +98,7 @@ public interface FormatFilter
* @param generatedBitstream
* the bitstream which was generated by
* this filter.
* @throws Exception if error
*/
public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)
throws Exception;

View File

@@ -59,10 +59,12 @@ public class HTMLFilter extends MediaFilter
}
/**
* @param source
* source input stream
* @param currentItem item
* @param source source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -24,10 +24,12 @@ public class ImageMagickImageThumbnailFilter extends ImageMagickThumbnailFilter
{
/**
* @param source
* source input stream
* @param currentItem item
* @param source source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -27,7 +27,7 @@ import org.dspace.core.ConfigurationManager;
* thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be
* no bigger than. Creates only JPEGs.
*
* @author Jason Sherman <jsherman@usao.edu>
* @author Jason Sherman jsherman@usao.edu
*/
public class JPEGFilter extends MediaFilter implements SelfRegisterInputFormats
{
@@ -66,10 +66,12 @@ public class JPEGFilter extends MediaFilter implements SelfRegisterInputFormats
}
/**
* @param source
* source input stream
* @param currentItem item
* @param source source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)
@@ -239,6 +241,8 @@ public class JPEGFilter extends MediaFilter implements SelfRegisterInputFormats
* Convenience method that returns a blurred instance of the
* provided {@code BufferedImage}.
*
* @param buf buffered image
* @return updated BufferedImage
*/
public BufferedImage getBlurredInstance(BufferedImage buf)
{

View File

@@ -29,15 +29,14 @@ public abstract class MediaFilter implements FormatFilter
* for any reason.
*
*
* @param c
* context
* @param item
* item containing bitstream to process
* @param source
* source bitstream to be processed
* @param c context
* @param item item containing bitstream to process
* @param source source bitstream to be processed
* @param verbose verbose mode
*
* @return true if bitstream processing should continue,
* false if this bitstream should be skipped
* @throws Exception if error
*/
@Override
public boolean preProcessBitstream(Context c, Item item, Bitstream source, boolean verbose)
@@ -62,6 +61,7 @@ public abstract class MediaFilter implements FormatFilter
* @param generatedBitstream
* the bitstream which was generated by
* this filter.
* @throws java.lang.Exception
*/
@Override
public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)

View File

@@ -7,13 +7,7 @@
*/
package org.dspace.app.mediafilter;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.image.*;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import javax.imageio.ImageIO;
@@ -22,7 +16,6 @@ import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.dspace.content.Item;
import org.dspace.core.ConfigurationManager;
import org.dspace.app.mediafilter.JPEGFilter;
@@ -33,8 +26,8 @@ import org.dspace.app.mediafilter.JPEGFilter;
* thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be
* no bigger than. Creates only JPEGs.
*
* @author Ivan Masár <helix84@centrum.sk>
* @author Jason Sherman <jsherman@usao.edu>
* @author Ivan Masár helix84@centrum.sk
* @author Jason Sherman jsherman@usao.edu
*/
public class PDFBoxThumbnail extends MediaFilter implements SelfRegisterInputFormats
{
@@ -73,10 +66,12 @@ public class PDFBoxThumbnail extends MediaFilter implements SelfRegisterInputFor
}
/**
* @param source
* source input stream
* @param currentItem item
* @param source source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -68,10 +68,12 @@ public class PDFFilter extends MediaFilter
}
/**
* @param source
* source input stream
* @param currentItem item
* @param source source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -64,10 +64,12 @@ public class PowerPointFilter extends MediaFilter
}
/**
* @param source
* source input stream
* @param currentItem item
* @param source source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -63,10 +63,12 @@ public class WordFilter extends MediaFilter
}
/**
* @param source
* source input stream
* @param currentItem item
* @param source source input stream
* @param verbose verbose mode
*
* @return InputStream the resulting input stream
* @throws Exception if error
*/
@Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -48,8 +48,11 @@ public interface MediaFilterService {
* Iterate through the item's bitstreams in the ORIGINAL bundle, applying
* filters if possible.
*
* @param context context
* @param myItem item
* @return true if any bitstreams processed,
* false if none
* @throws Exception if error
*/
public boolean filterItem(Context context, Item myItem) throws Exception;
@@ -60,8 +63,12 @@ public interface MediaFilterService {
* instantiated. Exceptions from filtering will be logged to STDOUT and
* swallowed.
*
* @param c context
* @param myItem item
* @param myBitstream bitstream
* @return true if bitstream processed,
* false if no applicable filter or already processed
* @throws Exception if error
*/
public boolean filterBitstream(Context c, Item myItem, Bitstream myBitstream) throws Exception;
@@ -72,7 +79,7 @@ public interface MediaFilterService {
* already been filtered, and if not or if overWrite is set, invokes the
* filter.
*
* @param c
* @param context
* context
* @param item
* item containing bitstream to process
@@ -80,7 +87,7 @@ public interface MediaFilterService {
* source bitstream to process
* @param formatFilter
* FormatFilter to perform filtering
*
* @throws Exception if error occurs
* @return true if new rendition is created, false if rendition already
* exists and overWrite is not set
*/

View File

@@ -478,12 +478,12 @@ public class Packager
* @param pkgParams Parameters to pass to individual packager instances
* @param sourceFile location of the source package to ingest
* @param parentObjs Parent DSpace object(s) to attach new object to
* @throws IOException
* @throws SQLException
* @throws FileNotFoundException
* @throws AuthorizeException
* @throws CrosswalkException
* @throws PackageException
* @throws IOException if IO error
* @throws SQLException if database error
* @throws FileNotFoundException if file doesn't exist
* @throws AuthorizeException if authorization error
* @throws CrosswalkException if crosswalk error
* @throws PackageException if packaging error
*/
protected void ingest(Context context, PackageIngester sip, PackageParameters pkgParams, String sourceFile, DSpaceObject parentObjs[])
throws IOException, SQLException, FileNotFoundException, AuthorizeException, CrosswalkException, PackageException
@@ -617,12 +617,12 @@ public class Packager
* @param dso DSpace Object to disseminate as a package
* @param pkgParams Parameters to pass to individual packager instances
* @param outputFile File where final package should be saved
* @throws IOException
* @throws SQLException
* @throws FileNotFoundException
* @throws AuthorizeException
* @throws CrosswalkException
* @throws PackageException
* @throws IOException if IO error
* @throws SQLException if database error
* @throws FileNotFoundException if file doesn't exist
* @throws AuthorizeException if authorization error
* @throws CrosswalkException if crosswalk error
* @throws PackageException if packaging error
*/
protected void disseminate(Context context, PackageDisseminator dip,
DSpaceObject dso, PackageParameters pkgParams,
@@ -699,12 +699,12 @@ public class Packager
* @param pkgParams Parameters to pass to individual packager instances
* @param sourceFile location of the source package to ingest as the replacement
* @param objToReplace DSpace object to replace (may be null if it will be specified in the package itself)
* @throws IOException
* @throws SQLException
* @throws FileNotFoundException
* @throws AuthorizeException
* @throws CrosswalkException
* @throws PackageException
* @throws IOException if IO error
* @throws SQLException if database error
* @throws FileNotFoundException if file doesn't exist
* @throws AuthorizeException if authorization error
* @throws CrosswalkException if crosswalk error
* @throws PackageException if packaging error
*/
protected void replace(Context context, PackageIngester sip, PackageParameters pkgParams, String sourceFile, DSpaceObject objToReplace)
throws IOException, SQLException, FileNotFoundException, AuthorizeException, CrosswalkException, PackageException

View File

@@ -10,6 +10,7 @@ package org.dspace.app.requestitem;
import org.dspace.content.Bitstream;
import org.dspace.content.Item;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
import javax.persistence.*;
import java.util.Date;
@@ -19,7 +20,7 @@ import java.util.Date;
*/
@Entity
@Table(name="requestitem")
public class RequestItem {
public class RequestItem implements ReloadableEntity<Integer> {
@Id
@@ -76,7 +77,7 @@ public class RequestItem {
{
}
public int getID() {
public Integer getID() {
return requestitem_id;
}

View File

@@ -9,7 +9,6 @@ package org.dspace.app.requestitem;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Item;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
@@ -55,9 +54,10 @@ public class RequestItemHelpdeskStrategy extends RequestItemSubmitterStrategy {
* Return a RequestItemAuthor object for the specified helpdesk email address.
* It makes an attempt to find if there is a matching eperson for the helpdesk address, to use the name,
* Otherwise it falls back to a helpdeskname key in the Messages.props.
* @param context
* @param helpDeskEmail
* @return
* @param context context
* @param helpDeskEmail email
* @return RequestItemAuthor
* @throws SQLException if database error
*/
public RequestItemAuthor getHelpDeskPerson(Context context, String helpDeskEmail) throws SQLException{
EPerson helpdeskEPerson = null;

View File

@@ -16,7 +16,7 @@ import java.sql.SQLException;
/**
* Database Access Object interface class for the RequestItem object.
* The implementation of this class is responsible for all database calls for the RequestItem object and is autowired by spring
* This class should only be accessed from a single service & should never be exposed outside of the API
* This class should only be accessed from a single service and should never be exposed outside of the API
*
* @author kevinvandevelde at atmire.com
*/

View File

@@ -24,9 +24,15 @@ public interface RequestItemService {
/**
* Generate a request item representing the request and put it into the DB
* @param context
* @param context context
* @param bitstream bitstream
* @param item item
* @param reqMessage message
* @param allFiles all files flag
* @param reqEmail email
* @param reqName name
* @return the token of the request item
* @throws java.sql.SQLException
* @throws SQLException if database error
*/
public String createRequest(Context context, Bitstream bitstream, Item item, boolean allFiles, String reqEmail, String reqName, String reqMessage)
throws SQLException;
@@ -36,6 +42,7 @@ public interface RequestItemService {
/**
* Save updates to the record. Only accept_request, and decision_date are set-able.
* @param context
* @param requestItem
*/
public void update(Context context, RequestItem requestItem);

View File

@@ -140,7 +140,7 @@ public class SFXFileReaderServiceImpl implements SFXFileReaderService {
* @param e DOM node of the mapping pair in the XML file (field element)
* @param item The item to process, from which metadata values will be taken
* @return assembled OpenURL query.
* @throws IOException
* @throws IOException if IO error
*/
protected String processFields(Node e, Item item) throws IOException {
NodeList cl = e.getChildNodes();

View File

@@ -36,7 +36,7 @@ public interface SFXFileReaderService {
* @param item The item to process, from which metadata values will be taken
*
* @return the SFX string
* @throws java.io.IOException
* @throws IOException if IO error
*/
public String loadSFXFile(String fileName, Item item) throws IOException;
@@ -53,7 +53,7 @@ public interface SFXFileReaderService {
* @param node DOM node of the mapping pair in the XML file (field element)
* @param item The item to process, from which metadata values will be taken
* @return processed fields.
* @throws IOException
* @throws IOException if IO error
*/
public String doNodes(Node node, Item item) throws IOException;
@@ -67,17 +67,24 @@ public interface SFXFileReaderService {
/**
* Is Empty text Node *
* @param nd node
* @return true or false
*/
public boolean isEmptyTextNode(Node nd);
/**
* Returns the value of the node's attribute named <name>
* Returns the value of the node's attribute named {@code <name>}
* @param e node
* @param name name
* @return value
*/
public String getAttribute(Node e, String name);
/**
* Returns the value found in the Text node (if any) in the
* node list that's passed in.
* @param node node
* @return value
*/
public String getValue(Node node);
}

View File

@@ -37,7 +37,10 @@ public class MetadataAuthorityISSNExtractor implements ISSNItemExtractor
List<MetadataValue> dcvalues = itemService.getMetadataByMetadataString(item, metadata);
for (MetadataValue dcvalue : dcvalues)
{
values.add(dcvalue.getAuthority());
String authority = dcvalue.getAuthority();
if(authority !=null){
values.add(authority);
}
}
}
return values;

View File

@@ -74,7 +74,7 @@ public abstract class AbstractGenerator
/**
* Start writing a new sitemap file.
*
* @throws IOException
* @throws IOException if IO error
* if an error occurs creating the file
*/
protected void startNewFile() throws IOException
@@ -102,7 +102,7 @@ public abstract class AbstractGenerator
* Full URL to add
* @param lastMod
* Date URL was last modified, or {@code null}
* @throws IOException
* @throws IOException if IO error
* if an error occurs writing
*/
public void addURL(String url, Date lastMod) throws IOException
@@ -130,7 +130,7 @@ public abstract class AbstractGenerator
/**
* Finish with the current sitemap file.
*
* @throws IOException
* @throws IOException if IO error
* if an error occurs writing
*/
protected void closeCurrentFile() throws IOException
@@ -147,7 +147,7 @@ public abstract class AbstractGenerator
*
* @return number of sitemap files written.
*
* @throws IOException
* @throws IOException if IO error
* if an error occurs writing
*/
public int finish() throws IOException
@@ -246,7 +246,7 @@ public abstract class AbstractGenerator
* stream to write the index to
* @param sitemapCount
* number of sitemaps that were generated
* @throws IOException
* @throws IOException if IO error
* if an IO error occurs
*/
public abstract void writeIndex(PrintStream output, int sitemapCount)

View File

@@ -152,9 +152,9 @@ public class GenerateSitemaps
* if {@code true}, generate an HTML sitemap.
* @param makeSitemapOrg
* if {@code true}, generate an sitemap.org sitemap.
* @throws SQLException
* @throws SQLException if database error
* if a database error occurs.
* @throws IOException
* @throws IOException if IO error
* if IO error occurs.
*/
public static void generateSitemaps(boolean makeHTMLMap,

View File

@@ -25,9 +25,9 @@ import org.dspace.core.ConfigurationManager;
/**
* This class allows the running of the DSpace statistic tools
*
* Usage: java CreateStatReport -r <statistic to run>
* Available: <stat-initial> <stat-general> <stat-monthly> <stat-report-initial>
* <stat-report-general> <stat-report-monthly>
* Usage: {@code java CreateStatReport -r <statistic to run>}
* Available: {@code <stat-initial> <stat-general> <stat-monthly> <stat-report-initial>
* <stat-report-general> <stat-report-monthly>}
*
* @author Chris Yates
*
@@ -95,7 +95,7 @@ public class CreateStatReport {
context.setIgnoreAuthorization(true);
//get paths to directories
outputLogDirectory = ConfigurationManager.getProperty("log.dir") + File.separator;
outputLogDirectory = ConfigurationManager.getProperty("log.report.dir") + File.separator;
outputReportDirectory = ConfigurationManager.getProperty("report.dir") + File.separator;
//read in command line variable to determine which statistic to run
@@ -145,7 +145,7 @@ public class CreateStatReport {
/**
* This method generates a report from the first of the current month to the end of the current month.
*
* @throws Exception
* @throws Exception if error
*/
private static void statMonthly() throws Exception {
@@ -184,7 +184,7 @@ public class CreateStatReport {
/**
* This method generates a full report based on the full log period
*
* @throws Exception
* @throws Exception if error
*/
private static void statGeneral() throws Exception {
@@ -216,7 +216,7 @@ public class CreateStatReport {
* This script starts from the year and month specified below and loops each month until the current month
* generating a monthly aggregation files for the DStat system.
*
* @throws Exception
* @throws Exception if error
*/
private static void statInitial() throws Exception {
@@ -265,7 +265,7 @@ public class CreateStatReport {
/**
* This method generates a full report based on the full log period
*
* @throws Exception
* @throws Exception if error
*/
private static void statReportGeneral() throws Exception {
@@ -304,7 +304,7 @@ public class CreateStatReport {
* This script starts from the year and month specified below and loops each month until the current month
* generating monthly reports from the DStat aggregation files
*
* @throws Exception
* @throws Exception if error
*/
private static void statReportInitial() throws Exception {
@@ -349,7 +349,7 @@ public class CreateStatReport {
/**
* This method generates a report from the aggregation files which have been run for the most recent month
*
* @throws Exception
* @throws Exception if error
*/
private static void statReportMonthly() throws Exception
{

View File

@@ -334,7 +334,7 @@ public class HTMLReport implements Report
/**
* output the report block based on the passed mapping, where the mapping
* sould be "name of report element" => "value", where both sides of the
* should be "name of report element" to "value", where both sides of the
* mapping should be Strings. This class also assumes that the reference
* is a linkable URL to the resource
*

View File

@@ -9,7 +9,6 @@ package org.dspace.app.statistics;
import org.apache.commons.lang3.StringUtils;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.dspace.discovery.DiscoverQuery;
@@ -185,7 +184,7 @@ public class LogAnalyser
////////////////////////
/** the log directory to be analysed */
private static String logDir = ConfigurationManager.getProperty("log.dir");
private static String logDir = ConfigurationManager.getProperty("log.report.dir");
/** the regex to describe the file name format */
private static String fileTemplate = "dspace\\.log.*";
@@ -196,7 +195,7 @@ public class LogAnalyser
"dstat.cfg";
/** the output file to which to write aggregation data */
private static String outFile = ConfigurationManager.getProperty("log.dir") + File.separator + "dstat.dat";
private static String outFile = ConfigurationManager.getProperty("log.report.dir") + File.separator + "dstat.dat";
/** the starting date of the report */
private static Date startDate = null;
@@ -213,6 +212,9 @@ 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
* @throws Exception if error
* @throws SQLException if database error
*/
public static void main(String [] argv)
throws Exception, SQLException
@@ -294,6 +296,10 @@ public class LogAnalyser
* @param myStartDate the desired start of the analysis. Starts from the beginning otherwise
* @param myEndDate the desired end of the analysis. Goes to the end otherwise
* @param myLookUp force a lookup of the database
* @return aggregate output
* @throws IOException if IO error
* @throws SQLException if database error
* @throws SearchServiceException if search error
*/
public static String processLogs(Context context, String myLogDir,
String myFileTemplate, String myConfigFile,
@@ -587,6 +593,7 @@ public class LogAnalyser
/**
* generate the analyser's output to the specified out file
* @return output
*/
public static String createOutput()
{
@@ -866,6 +873,7 @@ public class LogAnalyser
/**
* Read in the current config file and populate the class globals.
* @throws IOException if IO error
*/
public static void readConfig() throws IOException
{
@@ -876,6 +884,7 @@ public class LogAnalyser
* Read in the given config file and populate the class globals.
*
* @param configFile the config file to read in
* @throws IOException if IO error
*/
public static void readConfig(String configFile) throws IOException
{
@@ -1166,6 +1175,8 @@ public class LogAnalyser
* @param type value for DC field 'type' (unqualified)
*
* @return an integer containing the relevant count
* @throws SQLException if database error
* @throws SearchServiceException if search error
*/
public static Integer getNumItems(Context context, String type)
throws SQLException, SearchServiceException {
@@ -1216,6 +1227,8 @@ public class LogAnalyser
*
* @return an Integer containing the number of items in the
* archive
* @throws SQLException if database error
* @throws SearchServiceException if search error
*/
public static Integer getNumItems(Context context)
throws SQLException, SearchServiceException {

View File

@@ -152,6 +152,9 @@ 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
*/
public static void main(String [] argv)
throws Exception, SQLException
@@ -210,6 +213,9 @@ public class ReportGenerator
* @param myFormat the desired output format (currently on HTML supported)
* @param myInput the aggregation file to be turned into a report
* @param myOutput the file into which to write the report
* @param myMap the map
* @throws Exception if error
* @throws SQLException if database error
*/
public static void processReport(Context context, String myFormat,
String myInput, String myOutput,
@@ -242,6 +248,11 @@ public class ReportGenerator
* using the pre-configuration information passed here, read in the
* aggregation data and output a file containing the report in the
* requested format
* @param context context
* @param report report
* @param myInput input
* @throws Exception if error
* @throws SQLException if database error
*/
public static void processReport(Context context, Report report,
String myInput)
@@ -527,6 +538,7 @@ public class ReportGenerator
* actions which are more understandable to humans
*
* @param map the map file
* @throws IOException if IO error
*/
public static void readMap(String map)
throws IOException
@@ -612,6 +624,8 @@ public class ReportGenerator
* The values that come from this file form the basis of the analysis report
*
* @param input the aggregator file
* @throws IOException if IO error
* @throws ParseException if parse error
*/
public static void readInput(String input)
throws IOException, ParseException
@@ -783,6 +797,7 @@ public class ReportGenerator
*
* @return a string containing a reference (almost citation) to the
* article
* @throws SQLException if database error
*/
public static String getItemInfo(Context context, String handle)
throws SQLException

View File

@@ -66,6 +66,7 @@ public class StatisticsLoader
/**
* Get an array of the dates of the report files.
* @return array of dates
*/
public static Date[] getMonthlyReportDates()
{
@@ -74,6 +75,7 @@ public class StatisticsLoader
/**
* Get an array of the dates of the analysis files.
* @return array of dates
*/
public static Date[] getMonthlyAnalysisDates()
{
@@ -82,7 +84,8 @@ public class StatisticsLoader
/**
* Convert the formatted dates that are the keys of the map into a date array.
* @param monthlyMap
* @param monthlyMap map
* @return array of dates
*/
protected static Date[] getDatesFromMap(Map<String, StatsFile> monthlyMap)
{
@@ -107,7 +110,7 @@ public class StatisticsLoader
/**
* Sort the date array in descending (reverse chronological) order.
* @param dates
* @param dates array of dates
* @return sorted dates.
*/
protected static Date[] sortDatesDescending(Date[] dates)
@@ -145,7 +148,8 @@ public class StatisticsLoader
/**
* Get the analysis file for a given date.
* @param date
* @param date date
* @return File
*/
public static File getAnalysisFor(String date)
{
@@ -156,7 +160,8 @@ public class StatisticsLoader
/**
* Get the report file for a given date.
* @param date
* @param date date
* @return File
*/
public static File getReportFor(String date)
{
@@ -167,6 +172,7 @@ public class StatisticsLoader
/**
* Get the current general analysis file.
* @return File
*/
public static File getGeneralAnalysis()
{
@@ -176,6 +182,7 @@ public class StatisticsLoader
/**
* Get the current general report file.
* @return File
*/
public static File getGeneralReport()
{
@@ -213,7 +220,7 @@ public class StatisticsLoader
/**
* Generate the cached file list from the array of files
* @param fileList
* @param fileList array of files
*/
private static synchronized void loadFileList(File[] fileList)
{
@@ -305,9 +312,10 @@ public class StatisticsLoader
* formatters are used to identify the file as a particular type,
* and extract the relevant information. If the file is not identified
* by the formatter provided, then we return null.
* @param thisFile
* @param thisPattern
* @param sdf
* @param thisFile file
* @param thisPattern patter
* @param sdf date format
* @return StatsFile
*/
private static StatsFile makeStatsFile(File thisFile, Pattern thisPattern, DateFormat sdf)
{
@@ -336,10 +344,11 @@ public class StatisticsLoader
/**
* Get an array of all the analysis and report files.
* @return array of files
*/
private static File[] getAnalysisAndReportFileList()
{
File reportDir = new File(ConfigurationManager.getProperty("log.dir"));
File reportDir = new File(ConfigurationManager.getProperty("log.report.dir"));
if (reportDir != null)
{
return reportDir.listFiles(new AnalysisAndReportFilter());

View File

@@ -43,10 +43,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param bitstream
* the bitstream that the policy refer to
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to
* manage the bitstream's policies
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageBitstreamPolicy(Context context,
@@ -64,10 +64,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param bundle
* the bundle that the policy refer to
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to
* manage the bundle's policies
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageBundlePolicy(Context context,
@@ -85,10 +85,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param item
* the item that the policy refer to
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to
* manage the item's policies
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageItemPolicy(Context context, Item item)
@@ -124,10 +124,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param collection
* the collection that the policy refer to
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to
* manage the collection's policies
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageCollectionPolicy(Context context,
@@ -159,10 +159,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param community
* the community that the policy refer to
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to
* manage the community's policies
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageCommunityPolicy(Context context,
@@ -185,9 +185,9 @@ public class AuthorizeUtil
*
* @param context
* the DSpace Context Object
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not a System Admin
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void requireAdminRole(Context context)
@@ -208,10 +208,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param item
* the item that the CC License refer to
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to
* manage the item's CC License
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageCCLicense(Context context, Item item)
@@ -254,10 +254,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param collection
* the collection
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to manage the collection's
* template item
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageTemplateItem(Context context,
@@ -296,10 +296,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param collection
* the collection
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to manage the collection's
* submitters group
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageSubmittersGroup(Context context,
@@ -331,10 +331,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param collection
* the collection
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to manage the collection's
* workflow groups
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageWorkflowsGroup(Context context,
@@ -368,10 +368,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param collection
* the collection
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to create/edit the
* collection's admins group
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageAdminGroup(Context context,
@@ -405,10 +405,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param collection
* the collection
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to remove the
* collection's admins group
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeRemoveAdminGroup(Context context,
@@ -439,10 +439,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param community
* the community
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to create/edit the
* community's admins group
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManageAdminGroup(Context context,
@@ -470,10 +470,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param community
* the community
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to remove the
* collection's admins group
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeRemoveAdminGroup(Context context,
@@ -505,10 +505,10 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param rp
* a resource policy
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to
* remove/edit the policy
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
*/
public static void authorizeManagePolicy(Context c, ResourcePolicy rp)
@@ -546,9 +546,9 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param item
* the item
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to perform the item
* withdraw
*/
@@ -589,9 +589,9 @@ public class AuthorizeUtil
* the DSpace Context Object
* @param item
* the item
* @throws SQLException
* @throws SQLException if database error
* if a db error occur
* @throws AuthorizeException
* @throws AuthorizeException if authorization error
* if the current user is not allowed to perform the item
* reinstatement
*/

View File

@@ -27,6 +27,7 @@ public class CollectionDropDown {
* @param col
* Get full path for this collection
* @return Full path to the collection
* @throws SQLException if database error
*/
public static String collectionPath(Collection col) throws SQLException
{
@@ -42,6 +43,7 @@ public class CollectionDropDown {
* @param maxchars
* Truncate the full path to maxchar characters. 0 means do not truncate.
* @return Full path to the collection (truncated)
* @throws SQLException if database error
*/
public static String collectionPath(Collection col, int maxchars) throws SQLException
{

View File

@@ -415,12 +415,12 @@ public class DCInput
* The closed attribute of the vocabulary tag for this field as set in
* input-forms.xml
*
* <code>
* {@code
* <field>
* .....
* <vocabulary closed="true">nsrc</vocabulary>
* </field>
* </code>
* }
* @return the closedVocabulary flags: true if the entry should be restricted
* only to vocabulary terms, false otherwise
*/

View File

@@ -25,7 +25,11 @@ public class DCInputSet
/** the inputs ordered by page and row position */
private DCInput[][] inputPages = null;
/** constructor */
/** constructor
* @param formName form name
* @param pages pages
* @param listMap map
*/
public DCInputSet(String formName, List<List<Map<String, String>>> pages, Map<String, List<String>> listMap)
{
this.formName = formName;
@@ -116,6 +120,7 @@ public class DCInputSet
* Does the current input set define the named field?
* Scan through every field in every page of the input set
*
* @param fieldName
* @return true if the current set has the named field
*/
public boolean isFieldPresent(String fieldName)
@@ -141,6 +146,8 @@ public class DCInputSet
* and is valid for the specified document type
* Scan through every field in every page of the input set
*
* @param fieldName field name
* @param documentType doc type
* @return true if the current set has the named field
*/
public boolean isFieldPresent(String fieldName, String documentType)

View File

@@ -82,6 +82,7 @@ public class DCInputsReader
* level structures: a map between collections and forms, the definition for
* each page of each form, and lists of pairs of values that populate
* selection boxes.
* @throws DCInputsReaderException if input reader error
*/
public DCInputsReader()

View File

@@ -15,15 +15,27 @@ package org.dspace.app.util;
*/
public interface DSpaceWebappMXBean
{
/** Is this webapp a user interface? False if machine interface such as SWORD. */
/**
* Is this webapp a user interface? False if machine interface such as SWORD.
* @return true/false
*/
public boolean isUI();
/** What kind of webapp? XMLUI, OAI, etc. */
/**
* What kind of webapp? XMLUI, OAI, etc.
* @return kind of webapp
*/
public String getKind();
/** What is the base URL of this application? */
/**
* What is the base URL of this application?
* @return base url
*/
public String getURL();
/** When did this application start? */
/**
* When did this application start?
* @return start time
*/
public String getStarted();
}

View File

@@ -235,7 +235,7 @@ public class DailyFileAppender extends FileAppender
/**
* This function is responsible for performing the actual file rollover.
* @param pstrName The name of the new folder based on current system date.
* @throws IOException
* @throws IOException if IO error
*/
private static boolean deletingFiles = false;
private void cleanupOldFiles()

View File

@@ -31,10 +31,8 @@ import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.dspace.core.Constants;
import org.dspace.core.Context;
@@ -212,8 +210,9 @@ public class GoogleMetadata
* Wrap the item, parse all configured fields and generate metadata field
* values.
*
* @param item
* - The item being viewed to extract metadata from
* @param context context
* @param item The item being viewed to extract metadata from
* @throws SQLException if database error
*/
public GoogleMetadata(Context context, Item item) throws SQLException
{
@@ -330,7 +329,7 @@ public class GoogleMetadata
*
* @param configFilter
* @param returnType
* @return Array of configuration -> item-field matches
* @return Array of configuration to item-field matches
*/
protected ArrayList<MetadataValue> resolveMetadata(String configFilter,
int returnType)
@@ -658,7 +657,7 @@ public class GoogleMetadata
/**
* Using metadata field mappings contained in the loaded configuration,
* parse through configured metadata fields, building valid Google metadata
* value strings. Field names & values contained in metadataMappings.
* value strings. Field names and values contained in metadataMappings.
*
*/
protected void parseItem()
@@ -769,8 +768,8 @@ public class GoogleMetadata
* Fetch retaining the order of the values for any given key in which they
* where added (like authors).
*
* Usage: GoogleMetadata gmd = new GoogleMetadata(item); for(Entry<String,
* String> mapping : googlemd.getMappings()) { ... }
* Usage: {@code GoogleMetadata gmd = new GoogleMetadata(item); for(Entry<String,
* String> mapping : googlemd.getMappings()) ...}
*
* @return Iterable of metadata fields mapped to Google-formatted values
*/
@@ -781,6 +780,7 @@ public class GoogleMetadata
/**
* Produce meta elements that can easily be put into the head.
* @return List of elements
*/
public List<Element> disseminateList()
{
@@ -1047,7 +1047,7 @@ public class GoogleMetadata
* Additionally, this bitstream must be publicly viewable.
* @param item
* @return
* @throws SQLException
* @throws SQLException if database error
*/
protected Bitstream findLinkableFulltext(Item item) throws SQLException {
Bitstream bestSoFar = null;
@@ -1089,9 +1089,9 @@ public class GoogleMetadata
/**
*
*
* @param FIELD
* @param field
* to aggregate all values of in a matching option
* @param delim
* @param delimiter
* to delimit field values with
*/
protected void addAggregateValues(String field, String delimiter)

View File

@@ -21,10 +21,10 @@ import org.apache.lucene.util.Version;
* so that they can be upgraded to the latest version.
* <p>
* You must pass it the full path of the index directory, e.g.
* [dspace]/solr/statistics/data/index/
* {@code [dspace]/solr/statistics/data/index/}
* <p>
* The response is simply a version number (e.g. 4.4), as this is utilized by
* the "ant update_solr_indexes" target in [src]/dspace/src/main/config/build.xml
* the {@code ant update_solr_indexes} target in {@code [src]/dspace/src/main/config/build.xml}
*
* @author tdonohue
*/
@@ -106,7 +106,7 @@ public class IndexVersion
* Full path of the Solr/Lucene index directory
* @return version as a string (e.g. "4.4"), empty string ("") if index directory is empty,
* or null if directory doesn't exist.
* @throws IOException
* @throws IOException if IO error
*/
public static String getIndexVersion(String indexDirPath)
throws IOException
@@ -218,14 +218,14 @@ public class IndexVersion
* <P>
* NOTE: In case it is not obvious, software version numbering does NOT
* behave like normal decimal numbers. For example, in software versions
* the following statement is TRUE: 4.1 < 4.4 < 4.5 < 4.10 < 4.21 < 4.51
* the following statement is TRUE: {@code 4.1 < 4.4 < 4.5 < 4.10 < 4.21 < 4.51}
*
* @param firstVersion
* First version to compare, as a String
* @param secondVersion
* Second version to compare as a String
* @return -1 if first < second, 1 if first > second, 0 if equal
* @throws IOException
* @return -1 if first less than second, 1 if first greater than second, 0 if equal
* @throws IOException if IO error
*/
public static int compareSoftwareVersions(String firstVersion, String secondVersion)
throws IOException

View File

@@ -127,7 +127,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
@Override
public String getResultsString(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results,
DSpaceObject scope, List<DSpaceObject> results,
Map<String, String> labels) throws IOException
{
try
@@ -143,7 +143,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
@Override
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results, Map<String, String> labels)
DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels)
throws IOException
{
try
@@ -158,7 +158,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
}
protected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results, Map<String, String> labels)
DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels)
{
// Encode results in requested format
if ("rss".equals(format))
@@ -283,7 +283,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
* Converts a JDOM document to a W3C one
* @param jdomDoc
* @return W3C Document object
* @throws IOException
* @throws IOException if IO error
*/
protected Document jDomToW3(org.jdom.Document jdomDoc) throws IOException
{

View File

@@ -88,6 +88,7 @@ public class SubmissionConfigReader
/**
* Load Submission Configuration from the
* item-submission.xml configuration file
* @throws ServletException if servlet error
*/
public SubmissionConfigReader() throws ServletException
{
@@ -206,7 +207,7 @@ public class SubmissionConfigReader
/**
* Returns a particular global step definition based on its ID.
* <P>
* Global step definitions are those defined in the <step-definitions>
* Global step definitions are those defined in the {@code <step-definitions>}
* section of the configuration file.
*
* @param stepID

View File

@@ -213,7 +213,7 @@ public class SubmissionInfo extends HashMap
/**
* Returns a particular global step definition based on its ID.
* <P>
* Global step definitions are those defined in the <step-definitions>
* Global step definitions are those defined in the {@code <step-definitions>}
* section of the configuration file.
*
* @param stepID

View File

@@ -100,8 +100,8 @@ public class SubmissionStepConfig implements Serializable
/**
* Get the ID for this step. An ID is only defined if the step exists in the
* <step-definitions> section. This ID field is used to reference special
* steps (like the required step with id="collection")
* {@code <step-definitions>} section. This ID field is used to reference special
* steps (like the required step with {@code id="collection"})
*
* @return the step ID
*/

View File

@@ -165,9 +165,14 @@ public class SyndicationFeed
/**
* Fills in the feed and entry-level metadata from DSpace objects.
* @param request request
* @param context context
* @param dso DSpaceObject
* @param items array of objects
* @param labels label map
*/
public void populate(HttpServletRequest request, Context context, DSpaceObject dso,
DSpaceObject items[], Map<String, String> labels)
List<?extends DSpaceObject> items, Map<String, String> labels)
{
String logoURL = null;
String objectURL = null;
@@ -450,6 +455,7 @@ public class SyndicationFeed
* Sets the feed type for XML delivery, e.g. "rss_1.0", "atom_1.0"
* Must match one of ROME's configured generators, see rome.properties
* (currently rss_1.0, rss_2.0, atom_1.0, atom_0.3)
* @param feedType feed type
*/
public void setType(String feedType)
{
@@ -463,6 +469,7 @@ public class SyndicationFeed
/**
* @return the feed we built as DOM Document
* @throws FeedException if feed error
*/
public Document outputW3CDom()
throws FeedException
@@ -481,6 +488,7 @@ public class SyndicationFeed
/**
* @return the feed we built as serialized XML string
* @throws FeedException if feed error
*/
public String outputString()
throws FeedException
@@ -491,6 +499,9 @@ public class SyndicationFeed
/**
* send the output to designated Writer
* @param writer Writer
* @throws FeedException if feed error
* @throws IOException if IO error
*/
public void output(java.io.Writer writer)
throws FeedException, IOException
@@ -501,6 +512,7 @@ public class SyndicationFeed
/**
* Add a ROME plugin module (e.g. for OpenSearch) at the feed level.
* @param m module
*/
public void addModule(Module m)
{
@@ -523,17 +535,17 @@ public class SyndicationFeed
logo.getID()+"/"+(name == null?"":name);
}
protected String baseURL = null; // cache the result for null
/**
* Return a url to the DSpace object, either use the official
* handle for the item or build a url based upon the current server.
*
* If the dspaceobject is null then a local url to the repository is generated.
*
* @param request current servlet request
* @param dso The object to reference, null if to the repository.
* @return
* @return URL
*/
protected String baseURL = null; // cache the result for null
protected String resolveURL(HttpServletRequest request, DSpaceObject dso)
{
// If no object given then just link to the whole repository,

View File

@@ -89,6 +89,7 @@ public class Util {
* @param encoding
* character encoding, e.g. UTF-8
* @return the encoded string
* @throws java.io.UnsupportedEncodingException if encoding error
*/
public static String encodeBitstreamName(String stringIn, String encoding) throws java.io.UnsupportedEncodingException {
// FIXME: This should be moved elsewhere, as it is used outside the UI
@@ -164,6 +165,7 @@ public class Util {
* @param stringIn
* input string to encode
* @return the encoded string
* @throws java.io.UnsupportedEncodingException if encoding error
*/
public static String encodeBitstreamName(String stringIn) throws java.io.UnsupportedEncodingException {
return encodeBitstreamName(stringIn, Constants.DEFAULT_ENCODING);
@@ -455,7 +457,10 @@ public class Util {
* A String with the element name of the metadata field
* @param qualifier
* A String with the qualifier name of the metadata field
* @param locale locale
* @return A list of the respective "displayed-values"
* @throws SQLException if database error
* @throws DCInputsReaderException if reader error
*/
public static List<String> getControlledVocabulariesDisplayValueLocalized(

View File

@@ -8,6 +8,7 @@
package org.dspace.app.util;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
import javax.persistence.*;
import java.util.Date;
@@ -19,7 +20,7 @@ import java.util.Date;
*/
@Entity
@Table(name="webapp")
public class WebApp {
public class WebApp implements ReloadableEntity<Integer> {
@Id
@@ -50,7 +51,7 @@ public class WebApp {
}
public Integer getId() {
public Integer getID() {
return id;
}

View File

@@ -25,9 +25,9 @@ public class XMLUtils
{
/**
*
* @param rootElement
* @param dataRoot
* the starting node
* @param subElementName
* @param name
* the name of the subelement to find
* @return the list of all DOM Element with the provided name direct child
* of the starting node

View File

@@ -13,7 +13,7 @@ import org.dspace.core.GenericDAO;
/**
* Database Access Object interface class for the WebApp object.
* The implementation of this class is responsible for all database calls for the WebApp object and is autowired by spring
* This class should only be accessed from a single service & should never be exposed outside of the API
* This class should only be accessed from a single service and should never be exposed outside of the API
*
* @author kevinvandevelde at atmire.com
*/

View File

@@ -58,7 +58,7 @@ public interface MetadataExposureService {
* @param qualifier metadata field qualifier
*
* @return true (hidden) or false (exposed)
* @throws java.sql.SQLException
* @throws SQLException if database error
*/
public boolean isHidden(Context context, String schema, String element, String qualifier)
throws SQLException;

View File

@@ -55,7 +55,7 @@ public interface OpenSearchService {
*
* @param scope - null for entire repository, or handle or community or collection
* @return document the service document
* @throws java.io.IOException
* @throws IOException if IO error
*/
public Document getDescriptionDoc(String scope) throws IOException;
@@ -71,6 +71,7 @@ public interface OpenSearchService {
/**
* Returns a formatted set of search results as a string
*
* @param context DSpace Context
* @param format results format - html, rss or atom
* @param query - the search query
* @param totalResults - the hit count
@@ -80,14 +81,15 @@ public interface OpenSearchService {
* @param results the retreived DSpace objects satisfying search
* @param labels labels to apply - format specific
* @return formatted search results
* @throws java.io.IOException
* @throws IOException if IO error
*/
public String getResultsString(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results,
DSpaceObject scope, List<DSpaceObject> results,
Map<String, String> labels) throws IOException;
/**
* Returns a formatted set of search results as a document
*
* @param context DSpace Context
* @param format results format - html, rss or atom
* @param query - the search query
* @param totalResults - the hit count
@@ -97,10 +99,10 @@ public interface OpenSearchService {
* @param results the retreived DSpace objects satisfying search
* @param labels labels to apply - format specific
* @return formatted search results
* @throws IOException
* @throws IOException if IO error
*/
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results, Map<String, String> labels)
DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels)
throws IOException;
public DSpaceObject resolveScope(Context context, String scope) throws SQLException;

View File

@@ -74,6 +74,7 @@ public interface AuthenticationMethod {
* @param username
* Username, if available. May be null.
* @return true if new ePerson should be created.
* @throws SQLException if database error
*/
public boolean canSelfRegister(Context context,
HttpServletRequest request,
@@ -92,6 +93,7 @@ public interface AuthenticationMethod {
* @param eperson
* newly created EPerson record - email + information from the
* registration form will have been filled out.
* @throws SQLException if database error
*/
public void initEPerson(Context context,
HttpServletRequest request,
@@ -111,6 +113,7 @@ public interface AuthenticationMethod {
* @param username
* Username, if available. May be null.
* @return true if this method allows user to change ePerson password.
* @throws SQLException if database error
*/
public boolean allowSetPassword(Context context,
HttpServletRequest request,
@@ -149,6 +152,7 @@ public interface AuthenticationMethod {
*
* @return array of EPerson-group IDs, possibly 0-length, but never
* <code>null</code>.
* @throws SQLException if database error
*/
public List<Group> getSpecialGroups(Context context, HttpServletRequest request)
throws SQLException;
@@ -185,6 +189,7 @@ public interface AuthenticationMethod {
* <br>CERT_REQUIRED - not allowed to login this way without X.509 cert.
* <br>NO_SUCH_USER - user not found using this method.
* <br>BAD_ARGS - user/pw not appropriate for this method
* @throws SQLException if database error
*/
public int authenticate(Context context,

View File

@@ -69,6 +69,7 @@ public class LDAPAuthentication
/**
* Let a real auth method return true if it wants.
* @throws SQLException if database error
*/
@Override
public boolean canSelfRegister(Context context,
@@ -82,6 +83,7 @@ public class LDAPAuthentication
/**
* Nothing here, initialization is done when auto-registering.
* @throws SQLException if database error
*/
@Override
public void initEPerson(Context context, HttpServletRequest request,
@@ -94,6 +96,7 @@ public class LDAPAuthentication
/**
* Cannot change LDAP password through dspace, right?
* @throws SQLException if database error
*/
@Override
public boolean allowSetPassword(Context context,

View File

@@ -59,6 +59,8 @@ public class PasswordAuthentication
* <p>
* Example - aber.ac.uk domain : @aber.ac.uk
* Example - MIT domain and all .ac.uk domains: @mit.edu, .ac.uk
* @param email email
* @throws SQLException if database error
*/
@Override
public boolean canSelfRegister(Context context,
@@ -95,6 +97,7 @@ public class PasswordAuthentication
/**
* Nothing extra to initialize.
* @throws SQLException if database error
*/
@Override
public void initEPerson(Context context, HttpServletRequest request,
@@ -105,6 +108,7 @@ public class PasswordAuthentication
/**
* We always allow the user to change their password.
* @throws SQLException if database error
*/
@Override
public boolean allowSetPassword(Context context,
@@ -196,6 +200,7 @@ public class PasswordAuthentication
* <br>CERT_REQUIRED - not allowed to login this way without X.509 cert.
* <br>NO_SUCH_USER - no EPerson with matching email address.
* <br>BAD_ARGS - missing username, or user matched but cannot login.
* @throws SQLException if database error
*/
@Override
public int authenticate(Context context,

View File

@@ -159,6 +159,7 @@ public class ShibAuthentication implements AuthenticationMethod
* <br>
* NO_SUCH_USER - user not found using this method. <br>
* BAD_ARGS - user/pw not appropriate for this method
* @throws SQLException if database error
*/
@Override
public int authenticate(Context context, String username, String password,
@@ -266,7 +267,7 @@ public class ShibAuthentication implements AuthenticationMethod
*
* The values extracted (a user may have multiple roles) will be used to look
* up which groups to place the user into. The groups are defined as
* "authentication.shib.role.<role-name>" which is a comma separated list of
* {@code authentication.shib.role.<role-name>} which is a comma separated list of
* DSpace groups.
*
* @param context
@@ -400,6 +401,7 @@ public class ShibAuthentication implements AuthenticationMethod
* HTTP request, in case anything in that is used to decide
* @param email
* e-mail address of user attempting to register
* @throws SQLException if database error
*
*/
@Override
@@ -434,6 +436,7 @@ public class ShibAuthentication implements AuthenticationMethod
* HTTP request, in case anything in that is used to decide
* @param username
* e-mail address of user attempting to register
* @throws SQLException if database error
*
*/
@Override
@@ -456,6 +459,7 @@ public class ShibAuthentication implements AuthenticationMethod
* @param eperson
* newly created EPerson record - email + information from the
* registration form will have been filled out.
* @throws SQLException if database error
*
*/
@Override
@@ -578,6 +582,8 @@ public class ShibAuthentication implements AuthenticationMethod
* @param context The DSpace database context
* @param request The current HTTP Request
* @return The EPerson identified or null.
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
protected EPerson findEPerson(Context context, HttpServletRequest request) throws SQLException, AuthorizeException {
@@ -676,6 +682,8 @@ public class ShibAuthentication implements AuthenticationMethod
* @param context The current DSpace database context
* @param request The current HTTP Request
* @return A new eperson object or null if unable to create a new eperson.
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
protected EPerson registerNewEPerson(Context context, HttpServletRequest request) throws SQLException, AuthorizeException {
@@ -765,6 +773,8 @@ public class ShibAuthentication implements AuthenticationMethod
* @param context The current DSpace database context
* @param request The current HTTP Request
* @param eperson The eperson object to update.
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
protected void updateEPerson(Context context, HttpServletRequest request, EPerson eperson) throws SQLException, AuthorizeException {
@@ -855,6 +865,7 @@ public class ShibAuthentication implements AuthenticationMethod
* @param password The password
* @param request The HTTP Request
* @return A valid DSpace Authentication Method status code.
* @throws SQLException if database error
*/
protected int swordCompatibility(Context context, String username, String password, HttpServletRequest request) throws SQLException {
@@ -902,7 +913,8 @@ public class ShibAuthentication implements AuthenticationMethod
* the field will be automatically created.
*
* It is safe to call this methods multiple times.
* @param context
* @param context context
* @throws SQLException if database error
*/
protected synchronized void initialize(Context context) throws SQLException {
@@ -964,8 +976,9 @@ public class ShibAuthentication implements AuthenticationMethod
* Check if a MetadataField for an eperson is available.
*
* @param metadataName The name of the metadata field.
* @param context
* @param context context
* @return True if a valid metadata field, otherwise false.
* @throws SQLException if database error
*/
protected synchronized boolean checkIfEpersonMetadataFieldExists(Context context, String metadataName) throws SQLException {
@@ -984,10 +997,12 @@ public class ShibAuthentication implements AuthenticationMethod
protected final String COLUMN_NAME_REGEX = "^[_A-Za-z0-9]+$";
/**
* Automattically create a new metadataField for an eperson
* Automatically create a new metadataField for an eperson
*
* @param context context
* @param metadataName The name of the new metadata field.
* @return True if successful, otherwise false.
* @throws SQLException if database error
*/
protected synchronized boolean autoCreateEpersonMetadataField(Context context, String metadataName) throws SQLException {

View File

@@ -387,6 +387,7 @@ public class X509Authentication implements AuthenticationMethod
* configuration value. You'll probably want this to be true to take
* advantage of a Web certificate infrastructure with many more users than
* are already known by DSpace.
* @throws SQLException if database error
*/
@Override
public boolean canSelfRegister(Context context, HttpServletRequest request,
@@ -398,6 +399,7 @@ public class X509Authentication implements AuthenticationMethod
/**
* Nothing extra to initialize.
* @throws SQLException if database error
*/
@Override
public void initEPerson(Context context, HttpServletRequest request,
@@ -407,6 +409,7 @@ public class X509Authentication implements AuthenticationMethod
/**
* We don't use EPerson password so there is no reason to change it.
* @throws SQLException if database error
*/
@Override
public boolean allowSetPassword(Context context,
@@ -486,11 +489,12 @@ public class X509Authentication implements AuthenticationMethod
* Return special groups configured in dspace.cfg for X509 certificate
* authentication.
*
* @param context
* @param context context
* @param request
* object potentially containing the cert
*
* @return An int array of group IDs
* @throws SQLException if database error
*
*/
@Override
@@ -558,6 +562,7 @@ public class X509Authentication implements AuthenticationMethod
* </ul>
*
* @return One of: SUCCESS, BAD_CREDENTIALS, NO_SUCH_USER, BAD_ARGS
* @throws SQLException if database error
*/
@Override
public int authenticate(Context context, String username, String password,

Some files were not shown because too many files have changed in this diff Show More