org.apache.slide.store
Interface MacroStore

All Superinterfaces:
Service, javax.transaction.xa.XAResource
All Known Subinterfaces:
Store
All Known Implementing Classes:
AbstractStore

public interface MacroStore
extends Service

Store for macro opertations support. This store executes compound operations on hierarchical data. A recursive copy, a recursive delete and a recursive move resp. rename are supported provided the isMacroCopySupported(), isMacroMoveSupported()and/or isMacroDeleteSupported() indicate this. By having checks for all three macro opertations stores can dynamically decide which kind of operations they support. E.g. This allows for stores that only support recursive deletes.

Version:
$Revision: 1.2 $

Field Summary
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Method Summary
 boolean isMacroCopySupported()
          Checks if this store instance actually supports macro copy operation.
 boolean isMacroDeleteSupported()
          Checks if this store instance actually supports macro delete operation.
 boolean isMacroMoveSupported()
          Checks if this store instance actually supports macro move operation.
 void macroCopy(Uri sourceUri, Uri targetUri, boolean overwrite, boolean recursive)
          Recursively copies an object.
 void macroDelete(Uri targetUri)
          Deletes an object recursively.
 void macroMove(Uri sourceUri, Uri targetUri, boolean overwrite)
          Recursively moves an object.
 
Methods inherited from interface org.apache.slide.common.Service
cacheResults, connect, connect, connectIfNeeded, connectIfNeeded, disconnect, getLogger, initialize, isConnected, reset, setNamespace, setParameters, setScope
 
Methods inherited from interface javax.transaction.xa.XAResource
commit, end, forget, getTransactionTimeout, isSameRM, prepare, recover, rollback, setTransactionTimeout, start
 

Method Detail

isMacroDeleteSupported

public boolean isMacroDeleteSupported()
Checks if this store instance actually supports macro delete operation. It may seem clear this store supports sequences as it implements this interface, but a request to the underlying persistence store might be needed to dynamically find out.

Returns:
true if the store supports the macro delete operation, false otherwise

macroDelete

public void macroDelete(Uri targetUri)
                 throws ServiceAccessException,
                        ObjectNotFoundException
Deletes an object recursively.

Parameters:
targetUri - Uri of the object to delete
Throws:
ObjectNotFoundException - if the object to delete was not found
ServiceAccessException - if anything else goes wrong while deleting the object

isMacroCopySupported

public boolean isMacroCopySupported()
Checks if this store instance actually supports macro copy operation. It may seem clear this store supports sequences as it implements this interface, but a request to the underlying persistence store might be needed to dynamically find out.

Returns:
true if the store supports the macro copy operation, false otherwise

macroCopy

public void macroCopy(Uri sourceUri,
                      Uri targetUri,
                      boolean overwrite,
                      boolean recursive)
               throws ServiceAccessException,
                      ObjectNotFoundException,
                      ObjectAlreadyExistsException
Recursively copies an object.

Parameters:
sourceUri - the source URI of the copy
targetUri - the destination URI of the copy
overwrite - true if the target shall be copied to even if it already exsis
recursive - true if all descendants of the source should be copied as well
Throws:
ObjectNotFoundException - if the object to copy from was not found
ObjectAlreadyExistsException - if the object to copy to to was already there
ServiceAccessException - if anything else goes wrong while copying the object

isMacroMoveSupported

public boolean isMacroMoveSupported()
Checks if this store instance actually supports macro move operation. It may seem clear this store supports sequences as it implements this interface, but a request to the underlying persistence store might be needed to dynamically find out.

Returns:
true if the store supports the macro move operation, false otherwise

macroMove

public void macroMove(Uri sourceUri,
                      Uri targetUri,
                      boolean overwrite)
               throws ServiceAccessException,
                      ObjectNotFoundException,
                      ObjectAlreadyExistsException
Recursively moves an object.

Parameters:
sourceUri - the source URI of the move
targetUri - the destination URI of the move
overwrite - true if the target shall be copied to even if it already exsis
Throws:
ObjectNotFoundException - if the object to move from was not found
ObjectAlreadyExistsException - if the object to move to to was already there
ServiceAccessException - if anything else goes wrong while moving the object