Package org.duracloud.mill.dup
Class DuplicationPolicy
- java.lang.Object
-
- org.duracloud.mill.dup.DuplicationPolicy
-
public class DuplicationPolicy extends Object
A set of data showing, for a single DuraCloud account, which spaces from which providers should be duplicated to another space on another provider. This class also handles the work of loading this data set from a file stream, allowing it to be stored in a DuraCloud account and be read here.- Author:
- Bill Branan Date: 10/18/13
-
-
Constructor Summary
Constructors Constructor Description DuplicationPolicy()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddDuplicationStorePolicy(String spaceId, DuplicationStorePolicy dupStore)Adds a DuplicationStorePolicy for the specified space ID.LinkedHashSet<DuplicationStorePolicy>getDefaultPolicies()A set of default policies.Set<DuplicationStorePolicy>getDuplicationStorePolicies(String spaceId)Retrieve the duplication store policies associated with a space.Map<String,LinkedHashSet<DuplicationStorePolicy>>getSpaceDuplicationStorePolicies()Set<String>getSpaces()A set of spaces which have policies associated with them.List<String>getSpacesToIgnore()A list of spaces that should be ignored by the duplication task generator.static Stringmarshall(DuplicationPolicy duplicationPolicy)Unmarshals a duplication policy into a json string.static DuplicationPolicyunmarshall(InputStream policyStream)Marshals a json stream into a duplication policy object.
-
-
-
Method Detail
-
getDefaultPolicies
public LinkedHashSet<DuplicationStorePolicy> getDefaultPolicies()
A set of default policies.- Returns:
-
getSpacesToIgnore
public List<String> getSpacesToIgnore()
A list of spaces that should be ignored by the duplication task generator.- Returns:
-
getSpaceDuplicationStorePolicies
public Map<String,LinkedHashSet<DuplicationStorePolicy>> getSpaceDuplicationStorePolicies()
-
getSpaces
public Set<String> getSpaces()
A set of spaces which have policies associated with them.- Returns:
-
getDuplicationStorePolicies
public Set<DuplicationStorePolicy> getDuplicationStorePolicies(String spaceId)
Retrieve the duplication store policies associated with a space. If no policies are set explicitly for that space, the method returns the default store policies. An empty set is returned if any of the following conditions are true: 1) the space starts with "x-" 2) the space is not configured explicitly and there are no default store policies configured. 3) the space is defined in spacesToIgnore- Parameters:
spaceId-- Returns:
-
addDuplicationStorePolicy
public boolean addDuplicationStorePolicy(String spaceId, DuplicationStorePolicy dupStore)
Adds a DuplicationStorePolicy for the specified space ID.- Parameters:
spaceId- the space ID to add the DuplicationStorePolicy fordupStore- the DuplicationStorePolicy- Returns:
- true if added, false otherwise. False will be returned if the
Set
for the specified space already contains the dupStore.
-
unmarshall
public static DuplicationPolicy unmarshall(InputStream policyStream) throws IOException
Marshals a json stream into a duplication policy object.- Parameters:
policyStream-- Returns:
- Throws:
IOException
-
marshall
public static String marshall(DuplicationPolicy duplicationPolicy) throws IOException
Unmarshals a duplication policy into a json string.- Parameters:
duplicationPolicy-- Returns:
- Throws:
IOException
-
-