Added copy and delete of registry keys

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5557 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-04-26 08:27:23 +00:00
parent 27beca2047
commit 6d39078356
4 changed files with 355 additions and 39 deletions

View File

@@ -41,26 +41,60 @@ public interface RegistryService
* @param key the registry key.
* @param value any value that can be stored in the repository.
*/
void addValue(RegistryKey key, Serializable value);
void addProperty(RegistryKey key, Serializable value);
/**
* @param key the registry key.
* @return Returns the value stored in the key.
* @return Returns the value stored in the key or <tt>null</tt> if
* no value exists at the path and name provided
*
* @see #addValue(String, Serializable)
* @see #addProperty(String, Serializable)
*/
Serializable getValue(RegistryKey key);
Serializable getProperty(RegistryKey key);
/**
* Fetches all child elements for the given path. So for a registry key <b>key=/a/b/ignored</b>, the
* results of <code>getChildElements(key)</b> would be <code>b</code>. The key's last path
* element represents the key's property name, and can therefore be any value without affecting
* the outcome of the call.
* Fetches all child elements for the given path. The key's property should be
* <tt>null</tt> as it is completely ignored.
* <code><pre>
* ...
* registryService.addValue(KEY_A_B_C_1, VALUE_ONE);
* registryService.addValue(KEY_A_B_C_2, VALUE_TWO);
* ...
* assertTrue(registryService.getChildElements(KEY_A_B_null).contains("C"));
* ...
* </pre></code>
*
* @param key the registry key with the path. The last element in the path
* will be ignored, and can be any acceptable property localname.
* will be ignored, and can be any acceptable value localname or <tt>null</tt>.
* @return Returns all child elements (not values) for the given key, ignoring
* the last element in the key.
*
* @see RegistryKey#getPath()
*/
Collection<String> getChildElements(RegistryKey key);
/**
* Copies the path or value from the source to the target location. The source and target
* keys <b>must</b> be both either path-specific or property-specific. If the source doesn't
* exist, then nothing will be done; there is no guarantee that the target will exist after
* the call.
* <p>
* This is essentially a merge operation. Use {@link #delete(RegistryKey) delete} first
* if the target must be cleaned.
*
* @param sourceKey the source registry key to take values from
* @param targetKey the target registyr key to move the path or value to
*/
void copy(RegistryKey sourceKey, RegistryKey targetKey);
/**
* Delete the path element or value described by the key. If the key points to nothing,
* then nothing is done.
* <code>delete(/a/b/c)</code> will remove value <b>c</b> from path <b>/a/b</b>.<br/>
* <code>delete(/a/b/null)</code> will remove node <b>/a/b</b> along with all values and child
* elements.
*
* @param key the path or value to delete
*/
void delete(RegistryKey key);
}