|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.slide.common.AbstractServiceBase | +--org.apache.slide.common.AbstractSimpleService | +--org.apache.slide.store.AbstractStore
Abstract implementation of a store. Handles all caching operations.
Field Summary | |
protected ContentStore |
contentStore
Content store. |
protected java.lang.String |
defaultStore
Default store classname. |
protected Service |
defaultStoreInstance
Default store instance. |
protected LockStore |
lockStore
Lock store. |
protected NodeStore |
nodeStore
Node store. |
protected Service[] |
resourceManagers
Active resource manager list. |
protected RevisionDescriptorsStore |
revisionDescriptorsStore
Revision descriptors store. |
protected RevisionDescriptorStore |
revisionDescriptorStore
Revision descriptor store. |
protected SecurityStore |
securityStore
Security store. |
Fields inherited from class org.apache.slide.common.AbstractSimpleService |
currentContext, rollbackOnly, status, transactionTimeout, TX_IDLE, TX_PREPARED, TX_SUSPENDED |
Fields inherited from class org.apache.slide.common.AbstractServiceBase |
LOG_CHANNEL, namespace, scope |
Fields inherited from interface javax.transaction.xa.XAResource |
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Constructor Summary | |
AbstractStore()
|
Method Summary | |
protected void |
addResourceManager(Service service)
Add a new resource manager. |
void |
commit(javax.transaction.xa.Xid xid,
boolean onePhase)
Commit the global transaction specified by xid. |
void |
connect()
Connects to descriptors store. |
void |
createObject(Uri uri,
ObjectNode object)
Create a new object in the Descriptors Store. |
void |
createRevisionContent(Uri uri,
NodeRevisionDescriptor revisionDescriptor,
NodeRevisionContent revisionContent)
Create a new revision |
void |
createRevisionDescriptor(Uri uri,
NodeRevisionDescriptor revisionDescriptor)
Create new revision descriptor. |
void |
createRevisionDescriptors(Uri uri,
NodeRevisionDescriptors revisionDescriptors)
Create new revision descriptors. |
protected void |
delist(boolean success)
Delist (suspend) the resource manager in the current transaction. |
protected void |
delist(Service service)
Delist (suspend) the resource manager in the current transaction. |
protected void |
delist(Service service,
boolean success)
Delist (suspend) the resource manager in the current transaction. |
void |
disconnect()
Disconnects from descriptors store. |
void |
end(javax.transaction.xa.Xid xid,
int flags)
Ends the work performed on behalf of a transaction branch. |
protected void |
enlist()
Enlist the resource manager in the current transaction. |
protected void |
enlist(Service service)
Enlist the resource manager in the current transaction. |
java.util.Enumeration |
enumerateLocks(Uri uri)
Returns the list of locks put on a subject. |
java.util.Enumeration |
enumeratePermissions(Uri uri)
Read an object permissions. |
void |
forget(javax.transaction.xa.Xid xid)
Tell the resource manager to forget about a heuristically completed transaction branch. |
protected Service |
getDefaultStoreInstance()
Return the default store instance. |
java.lang.String |
getName()
Return the name of the store as specified in domain.xml. |
void |
grantPermission(Uri uri,
NodePermission permission)
Store an object permissions in the Descriptors Store. |
void |
initialize(NamespaceAccessToken token)
Initializes descriptors store. |
boolean |
isConnected()
This function tells whether or not the descriptors store is connected. |
protected boolean |
isForceStoreEnlistment(Uri uri)
Return true if the store should also be enlisted for a read operation. |
void |
killLock(Uri uri,
NodeLock lock)
Kills a lock. |
int |
prepare(javax.transaction.xa.Xid xid)
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid. |
void |
putLock(Uri uri,
NodeLock lock)
Puts a lock on a subject. |
void |
removeLock(Uri uri,
NodeLock lock)
Removes (cancels) a lock. |
void |
removeObject(Uri uri,
ObjectNode object)
Remove an object from the Descriptors Store. |
void |
removeRevisionContent(Uri uri,
NodeRevisionDescriptor revisionDescriptor)
Remove revision. |
void |
removeRevisionDescriptor(Uri uri,
NodeRevisionNumber number)
Remove revision descriptor. |
void |
removeRevisionDescriptors(Uri uri)
Remove revision descriptors. |
void |
renewLock(Uri uri,
NodeLock lock)
Renews a lock. |
void |
reset()
Deletes descriptors store. |
ObjectNode |
retrieveObject(Uri uri)
Retrive an object from the Descriptors Store. |
NodeRevisionContent |
retrieveRevisionContent(Uri uri,
NodeRevisionDescriptor revisionDescriptor)
Retrive revision content. |
NodeRevisionDescriptor |
retrieveRevisionDescriptor(Uri uri,
NodeRevisionNumber revisionNumber)
Retrieve revision descriptor. |
NodeRevisionDescriptors |
retrieveRevisionDescriptors(Uri uri)
Retrieve a revision descriptors. |
void |
revokePermission(Uri uri,
NodePermission permission)
Store an object permissions in the Descriptors Store. |
void |
revokePermissions(Uri uri)
Revoke all the permissions on the object. |
void |
rollback(javax.transaction.xa.Xid xid)
Inform the resource manager to roll back work done on behalf of a transaction branch. |
void |
setContentStore(ContentStore contentStore)
Set the content store associated with this store. |
void |
setLockStore(LockStore lockStore)
Set the lock store associated with this store. |
void |
setName(java.lang.String name)
Set the name of the store as specified in domain.xml. |
void |
setNamespace(Namespace namespace)
Namespace setter. |
void |
setNodeStore(NodeStore nodeStore)
Set the node store associated with this store. |
void |
setParameters(java.util.Hashtable parameters)
Remeber the store parameters to initialise the default child stores on request |
void |
setRevisionDescriptorsStore(RevisionDescriptorsStore revisionDescriptorsStore)
Set the revision descriptors store associated with this store. |
void |
setRevisionDescriptorStore(RevisionDescriptorStore revisionDescriptorStore)
Set the revision descriptor store associated with this store. |
protected void |
setRollbackOnly()
Mark transaction as rollback in case of enlistment failure. |
void |
setScope(Scope scope)
Set the scope of the store as specified in domain.xml. |
void |
setSecurityStore(SecurityStore securityStore)
Set the security store associated with this store. |
void |
start(javax.transaction.xa.Xid xid,
int flags)
Start work on behalf of a transaction branch specified in xid. |
void |
storeObject(Uri uri,
ObjectNode object)
Store an object in the Descriptors Store. |
void |
storeRevisionContent(Uri uri,
NodeRevisionDescriptor revisionDescriptor,
NodeRevisionContent revisionContent)
Modify the latest revision of an object. |
void |
storeRevisionDescriptor(Uri uri,
NodeRevisionDescriptor revisionDescriptor)
Update revision descriptor. |
void |
storeRevisionDescriptors(Uri uri,
NodeRevisionDescriptors revisionDescriptors)
Update revision descriptors. |
Methods inherited from class org.apache.slide.common.AbstractSimpleService |
getTransactionTimeout, isSameRM, recover, setTransactionTimeout |
Methods inherited from class org.apache.slide.common.AbstractServiceBase |
cacheResults, connectIfNeeded, getLogger |
Methods inherited from class java.lang.Object |
|
Methods inherited from interface org.apache.slide.common.Service |
cacheResults, connectIfNeeded, getLogger |
Methods inherited from interface javax.transaction.xa.XAResource |
getTransactionTimeout, isSameRM, recover, setTransactionTimeout |
Field Detail |
protected java.lang.String defaultStore
protected Service defaultStoreInstance
protected NodeStore nodeStore
protected SecurityStore securityStore
protected LockStore lockStore
protected RevisionDescriptorsStore revisionDescriptorsStore
protected RevisionDescriptorStore revisionDescriptorStore
protected ContentStore contentStore
protected Service[] resourceManagers
Constructor Detail |
public AbstractStore()
Method Detail |
public void setName(java.lang.String name)
setName
in interface Store
public java.lang.String getName()
getName
in interface Store
public void setScope(Scope scope)
setScope
in interface Store
setScope
in class AbstractServiceBase
public void setNamespace(Namespace namespace)
setNamespace
in interface Service
setNamespace
in class AbstractServiceBase
public void setParameters(java.util.Hashtable parameters) throws ServiceParameterErrorException, ServiceParameterMissingException
setParameters
in interface Service
setParameters
in class AbstractServiceBase
parameters
- Hashtable containing the parameters' name
and associated valueServiceParameterErrorException
- Incorrect service parameterServiceParameterMissingException
- Service parameter missingpublic void connect() throws ServiceConnectionFailedException
connect
in interface Service
connect
in class AbstractServiceBase
DataException
- public void disconnect() throws ServiceDisconnectionFailedException
disconnect
in interface Service
disconnect
in class AbstractServiceBase
ServiceDisconnectionFailedException
- public void initialize(NamespaceAccessToken token) throws ServiceInitializationFailedException
initialize
in interface Service
initialize
in class AbstractServiceBase
ServiceInitializationFailedException
- Throws an exception
if the descriptors store has already been initialized beforepublic void reset() throws ServiceResetFailedException
reset
in interface Service
reset
in class AbstractServiceBase
ServiceResetFailedException
- Reset failedpublic boolean isConnected() throws ServiceAccessException
isConnected
in interface Service
isConnected
in class AbstractServiceBase
ServiceAccessException
- Service access errorpublic void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
commit
in class AbstractSimpleService
xid
- A global transaction identifieronePhase
- If true, the resource manager should use a one-phase
commit protocol to commit the work done on behalf of xid.javax.transaction.xa.XAException
- An error has occurred. Possible XAExceptions
are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR,
XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO. If the resource
manager did not commit the transaction and the paramether onePhase is
set to true, the resource manager may throw one of the XA_RB*
exceptions. Upon return, the resource manager has rolled back the
branch's work and has released all held resources.public void end(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
end
in interface javax.transaction.xa.XAResource
end
in class AbstractSimpleService
xid
- A global transaction identifier that is the same as what
was used previously in the start method.flags
- One of TMSUCCESS, TMFAIL, or TMSUSPENDjavax.transaction.xa.XAException
- An error has occurred. Possible XAException
values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL,
XAER_PROTO, or XA_RB*.public void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
forget
in interface javax.transaction.xa.XAResource
forget
in class AbstractSimpleService
xid
- A global transaction identifierjavax.transaction.xa.XAException
- An error has occurred. Possible exception values
are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.public int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
prepare
in interface javax.transaction.xa.XAResource
prepare
in class AbstractSimpleService
xid
- A global transaction identifierjavax.transaction.xa.XAException
- An error has occurred. Possible exception
values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL,
or XAER_PROTO.public void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
rollback
in class AbstractSimpleService
xid
- A global transaction identifierjavax.transaction.xa.XAException
- An error has occurredpublic void start(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
start
in class AbstractSimpleService
xid
- A global transaction identifier to be associated with the
resourceflags
- One of TMNOFLAGS, TMJOIN, or TMRESUMEjavax.transaction.xa.XAException
- An error has occurred. Possible exceptions are
XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE, XAER_NOTA,
XAER_INVAL, or XAER_PROTO.public void setNodeStore(NodeStore nodeStore)
setNodeStore
in interface Store
public void setSecurityStore(SecurityStore securityStore)
setSecurityStore
in interface Store
public void setLockStore(LockStore lockStore)
setLockStore
in interface Store
public void setRevisionDescriptorsStore(RevisionDescriptorsStore revisionDescriptorsStore)
setRevisionDescriptorsStore
in interface Store
public void setRevisionDescriptorStore(RevisionDescriptorStore revisionDescriptorStore)
setRevisionDescriptorStore
in interface Store
public void setContentStore(ContentStore contentStore)
setContentStore
in interface Store
public ObjectNode retrieveObject(Uri uri) throws ServiceAccessException, ObjectNotFoundException
retrieveObject
in interface NodeStore
uri
- Uri of the object we want to retrieveServiceAccessException
- Error accessing the Descriptors StoreObjectNotFoundException
- The object to retrieve was not foundpublic void storeObject(Uri uri, ObjectNode object) throws ServiceAccessException, ObjectNotFoundException
storeObject
in interface NodeStore
object
- Object to updateServiceAccessException
- Error accessing the Descriptors StoreObjectNotFoundException
- The object to update was not foundpublic void createObject(Uri uri, ObjectNode object) throws ServiceAccessException, ObjectAlreadyExistsException
createObject
in interface NodeStore
object
- SlideObjecturi
- Uri of the object we want to createServiceAccessException
- Error accessing the Descriptors StoreObjectAlreadyExistsException
- An object already exists
at this Uripublic void removeObject(Uri uri, ObjectNode object) throws ServiceAccessException, ObjectNotFoundException
removeObject
in interface NodeStore
object
- Object to removeServiceAccessException
- Error accessing the Descriptors StoreObjectNotFoundException
- The object to remove was not foundpublic void grantPermission(Uri uri, NodePermission permission) throws ServiceAccessException
grantPermission
in interface SecurityStore
permission
- Permission we want to createServiceAccessException
- Error accessing the Descriptors Storepublic void revokePermission(Uri uri, NodePermission permission) throws ServiceAccessException
revokePermission
in interface SecurityStore
permission
- Permission we want to createServiceAccessException
- Error accessing the Descriptors Storepublic void revokePermissions(Uri uri) throws ServiceAccessException
revokePermissions
in interface SecurityStore
permission
- Permission we want to createServiceAccessException
- Error accessing the Descriptors Storepublic java.util.Enumeration enumeratePermissions(Uri uri) throws ServiceAccessException
enumeratePermissions
in interface SecurityStore
permission
- Permission we want to createServiceAccessException
- Error accessing the Descriptors Storepublic void putLock(Uri uri, NodeLock lock) throws ServiceAccessException
putLock
in interface LockStore
lock
- Lock tokenServiceAccessException
- Service access errorpublic void renewLock(Uri uri, NodeLock lock) throws ServiceAccessException, LockTokenNotFoundException
renewLock
in interface LockStore
lock
- Token to renewServiceAccessException
- Service access errorLockTokenNotFoundException
- Lock token was not foundpublic void removeLock(Uri uri, NodeLock lock) throws ServiceAccessException, LockTokenNotFoundException
removeLock
in interface LockStore
lock
- Token to removeServiceAccessException
- Service access errorLockTokenNotFoundException
- Lock token was not foundpublic void killLock(Uri uri, NodeLock lock) throws ServiceAccessException, LockTokenNotFoundException
killLock
in interface LockStore
lock
- Token to removeServiceAccessException
- Service access errorLockTokenNotFoundException
- Lock token was not foundpublic java.util.Enumeration enumerateLocks(Uri uri) throws ServiceAccessException
enumerateLocks
in interface LockStore
subject
- SubjectServiceAccessException
- Service access errorpublic NodeRevisionDescriptors retrieveRevisionDescriptors(Uri uri) throws ServiceAccessException, RevisionDescriptorNotFoundException
retrieveRevisionDescriptors
in interface RevisionDescriptorsStore
uri
- UriServiceAccessException
- Service access errorRevisionDescriptorNotFoundException
- Revision descriptor
was not foundpublic void createRevisionDescriptors(Uri uri, NodeRevisionDescriptors revisionDescriptors) throws ServiceAccessException
createRevisionDescriptors
in interface RevisionDescriptorsStore
uri
- UrirevisionDescriptors
- Node revision descriptorsServiceAccessException
- Service access errorpublic void storeRevisionDescriptors(Uri uri, NodeRevisionDescriptors revisionDescriptors) throws ServiceAccessException, RevisionDescriptorNotFoundException
storeRevisionDescriptors
in interface RevisionDescriptorsStore
uri
- UrirevisionDescriptors
- Node revision descriptorsServiceAccessException
- Service access errorRevisionDescriptorNotFoundException
- Revision descriptor
was not foundpublic void removeRevisionDescriptors(Uri uri) throws ServiceAccessException
removeRevisionDescriptors
in interface RevisionDescriptorsStore
uri
- UriServiceAccessException
- Service access errorpublic NodeRevisionDescriptor retrieveRevisionDescriptor(Uri uri, NodeRevisionNumber revisionNumber) throws ServiceAccessException, RevisionDescriptorNotFoundException
retrieveRevisionDescriptor
in interface RevisionDescriptorStore
Uri
- urirevisionNumber
- Node revision numberpublic void createRevisionDescriptor(Uri uri, NodeRevisionDescriptor revisionDescriptor) throws ServiceAccessException
createRevisionDescriptor
in interface RevisionDescriptorStore
uri
- UrirevisionDescriptor
- Node revision descriptorServiceAccessException
- Service access errorpublic void storeRevisionDescriptor(Uri uri, NodeRevisionDescriptor revisionDescriptor) throws ServiceAccessException, RevisionDescriptorNotFoundException
storeRevisionDescriptor
in interface RevisionDescriptorStore
uri
- UrirevisionDescriptors
- Node revision descriptorServiceAccessException
- Service access errorRevisionDescriptorNotFoundException
- Revision descriptor
was not foundpublic void removeRevisionDescriptor(Uri uri, NodeRevisionNumber number) throws ServiceAccessException
removeRevisionDescriptor
in interface RevisionDescriptorStore
uri
- UrirevisionNumber
- Revision numberServiceAccessException
- Service access errorpublic NodeRevisionContent retrieveRevisionContent(Uri uri, NodeRevisionDescriptor revisionDescriptor) throws ServiceAccessException, RevisionNotFoundException
retrieveRevisionContent
in interface ContentStore
uri
- UrirevisionNumber
- Node revision numberpublic void createRevisionContent(Uri uri, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent) throws ServiceAccessException, RevisionAlreadyExistException
createRevisionContent
in interface ContentStore
uri
- UrirevisionDescriptor
- Node revision descriptorrevisionContent
- Node revision contentpublic void storeRevisionContent(Uri uri, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent) throws ServiceAccessException, RevisionNotFoundException
storeRevisionContent
in interface ContentStore
uri
- UrirevisionDescriptor
- Node revision descriptorrevisionContent
- Node revision contentpublic void removeRevisionContent(Uri uri, NodeRevisionDescriptor revisionDescriptor) throws ServiceAccessException
removeRevisionContent
in interface ContentStore
uri
- UrirevisionNumber
- Node revision numberprotected boolean isForceStoreEnlistment(Uri uri)
protected Service getDefaultStoreInstance()
protected void addResourceManager(Service service)
service
- New resource managerprotected void enlist() throws ServiceAccessException
protected void enlist(Service service) throws ServiceAccessException
protected void delist(boolean success) throws ServiceAccessException
protected void delist(Service service) throws ServiceAccessException
protected void delist(Service service, boolean success) throws ServiceAccessException
protected void setRollbackOnly()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |