org.dspace.content.packager
Class PackageParameters

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.dspace.content.packager.PackageParameters
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class PackageParameters
extends Properties

Parameter list for SIP and DIP packagers. It's really just a Java Properties object extended so each parameter can have multiple values. This was necessary so it can represent Servlet parameters, which have multiple values. It is also helpful to indicate e.g. metadata choices for package formats like METS that allow many different metadata segments.

Version:
$Revision$
Author:
Larry Stone
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
PackageParameters()
           
PackageParameters(Properties defaults)
           
 
Method Summary
 Object addProperty(String key, String value)
          Adds a value to a property; if property already has value(s), this is tacked onto the end, otherwise it acts like setProperty().
static PackageParameters create(javax.servlet.ServletRequest request)
          Creates new parameters object with the parameter values from a servlet request object.
 boolean getBooleanProperty(String key, boolean defaultAnswer)
          Returns boolean form of property with selectable default
 String[] getProperties(String key)
          Returns multiple property values in an array.
 boolean keepExistingModeEnabled()
          Utility method to tell if 'keep-existing' mode is enabled.
 boolean recursiveModeEnabled()
          Utility method to tell if recursive mode is enabled.
 boolean replaceModeEnabled()
          Utility method to tell if replace mode is enabled.
 boolean restoreModeEnabled()
          Utility method to tell if restore mode is enabled.
 void setKeepExistingModeEnabled(boolean value)
          Utility method to enable/disable 'keep-existing' mode.
 void setRecursiveModeEnabled(boolean value)
          Utility method to enable/disable recursive mode.
 void setReplaceModeEnabled(boolean value)
          Utility method to enable/disable replace mode.
 void setRestoreModeEnabled(boolean value)
          Utility method to enable/disable restore mode.
 void setUseCollectionTemplate(boolean value)
          Utility method to enable/disable Collection Template for Item ingestion.
 void setWorkflowEnabled(boolean value)
          Utility method to enable/disable workflow for Item ingestion.
 boolean useCollectionTemplate()
          Utility method to tell if Items should use a Collection's template when they are created.
 boolean workflowEnabled()
          Utility method to tell if workflow is enabled for Item ingestion.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PackageParameters

public PackageParameters()

PackageParameters

public PackageParameters(Properties defaults)
Method Detail

create

public static PackageParameters create(javax.servlet.ServletRequest request)
Creates new parameters object with the parameter values from a servlet request object.

Parameters:
request - - the request from which to take the values
Returns:
new parameters object.

addProperty

public Object addProperty(String key,
                          String value)
Adds a value to a property; if property already has value(s), this is tacked onto the end, otherwise it acts like setProperty().

Parameters:
key - - the key to be placed into this property list.
value - - the new value to add, corresponding to this key.
Returns:
the previous value of the specified key in this property list, or null if it did not have one.

getProperties

public String[] getProperties(String key)
Returns multiple property values in an array.

Parameters:
key - - the key to look for in this property list.
Returns:
all values in an array, or null if this property is unset.

getBooleanProperty

public boolean getBooleanProperty(String key,
                                  boolean defaultAnswer)
Returns boolean form of property with selectable default

Parameters:
key - the key to look for in this property list.
defaultAnswer - default to return if there is no such property
Returns:
the boolean derived from the value of property, or default if it was not specified.

workflowEnabled

public boolean workflowEnabled()
Utility method to tell if workflow is enabled for Item ingestion. Checks the Packager parameters.

Defaults to 'true' if previously unset, as by default all DSpace Workflows should be enabled.

Returns:
boolean result

setWorkflowEnabled

public void setWorkflowEnabled(boolean value)
Utility method to enable/disable workflow for Item ingestion.

Parameters:
value - boolean value (true = workflow enabled, false = workflow disabled)

restoreModeEnabled

public boolean restoreModeEnabled()
Utility method to tell if restore mode is enabled. Checks the Packager parameters.

Restore mode attempts to restore an missing/deleted object completely (including handle), based on contents of a package.

NOTE: restore mode should throw an error if it attempts to restore an object which already exists. Use 'keep-existing' or 'replace' mode to either skip-over (keep) or replace existing objects.

Defaults to 'false' if previously unset. NOTE: 'replace' mode and 'keep-existing' mode are special types of "restores". So, when either replaceModeEnabled() or keepExistingModeEnabled() is true, this method should also return true.

Returns:
boolean result

setRestoreModeEnabled

public void setRestoreModeEnabled(boolean value)
Utility method to enable/disable restore mode.

Restore mode attempts to restore an missing/deleted object completely (including handle), based on a given package's contents.

NOTE: restore mode should throw an error if it attempts to restore an object which already exists. Use 'keep-existing' or 'replace' mode to either skip-over (keep) or replace existing objects.

Parameters:
value - boolean value (true = restore enabled, false = restore disabled)

replaceModeEnabled

public boolean replaceModeEnabled()
Utility method to tell if replace mode is enabled. Checks the Packager parameters.

Replace mode attempts to overwrite an existing object and replace it with the contents of a package. Replace mode is considered a special type of "restore", where the current object is being restored to a previous state.

Defaults to 'false' if previously unset.

Returns:
boolean result

setReplaceModeEnabled

public void setReplaceModeEnabled(boolean value)
Utility method to enable/disable replace mode.

Replace mode attempts to overwrite an existing object and replace it with the contents of a package. Replace mode is considered a special type of "restore", where the current object is being restored to a previous state.

Parameters:
value - boolean value (true = replace enabled, false = replace disabled)

keepExistingModeEnabled

public boolean keepExistingModeEnabled()
Utility method to tell if 'keep-existing' mode is enabled. Checks the Packager parameters.

Keep-Existing mode is identical to 'restore' mode, except that it skips over any objects which are found to already be existing. It essentially restores all missing objects, but keeps existing ones intact.

Defaults to 'false' if previously unset.

Returns:
boolean result

setKeepExistingModeEnabled

public void setKeepExistingModeEnabled(boolean value)
Utility method to enable/disable 'keep-existing' mode.

Keep-Existing mode is identical to 'restore' mode, except that it skips over any objects which are found to already be existing. It essentially restores all missing objects, but keeps existing ones intact.

Parameters:
value - boolean value (true = replace enabled, false = replace disabled)

useCollectionTemplate

public boolean useCollectionTemplate()
Utility method to tell if Items should use a Collection's template when they are created.

Defaults to 'false' if previously unset.

Returns:
boolean result

setUseCollectionTemplate

public void setUseCollectionTemplate(boolean value)
Utility method to enable/disable Collection Template for Item ingestion.

When enabled, the Item will be installed using the parent collection's Item Template

Parameters:
value - boolean value (true = template enabled, false = template disabled)

recursiveModeEnabled

public boolean recursiveModeEnabled()
Utility method to tell if recursive mode is enabled. Checks the Packager parameters.

Recursive mode should be enabled anytime one of the *All() methods is called (e.g. ingestAll(), replaceAll() or disseminateAll()). It recursively performs the same action on all related objects.

Defaults to 'false' if previously unset.

Returns:
boolean result

setRecursiveModeEnabled

public void setRecursiveModeEnabled(boolean value)
Utility method to enable/disable recursive mode.

Recursive mode should be enabled anytime one of the *All() methods is called (e.g. ingestAll(), replaceAll() or disseminateAll()). It recursively performs the same action on all related objects.

Parameters:
value - boolean value (true = recursion enabled, false = recursion disabled)


Copyright © 2012 DuraSpace. All Rights Reserved.