KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > store > AbstractStore


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v 1.43.2.1 2004/10/18 09:13:10 luetzkendorf Exp $
3  * $Revision: 1.43.2.1 $
4  * $Date: 2004/10/18 09:13:10 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.store;
25
26 import java.util.Enumeration JavaDoc;
27 import java.util.Hashtable JavaDoc;
28
29 import javax.transaction.Transaction JavaDoc;
30 import javax.transaction.xa.XAException JavaDoc;
31 import javax.transaction.xa.Xid JavaDoc;
32
33 import org.apache.slide.authenticate.CredentialsToken;
34 import org.apache.slide.common.AbstractSimpleService;
35 import org.apache.slide.common.Namespace;
36 import org.apache.slide.common.NamespaceAccessToken;
37 import org.apache.slide.common.Scope;
38 import org.apache.slide.common.Service;
39 import org.apache.slide.common.ServiceAccessException;
40 import org.apache.slide.common.ServiceConnectionFailedException;
41 import org.apache.slide.common.ServiceDisconnectionFailedException;
42 import org.apache.slide.common.ServiceInitializationFailedException;
43 import org.apache.slide.common.ServiceParameterErrorException;
44 import org.apache.slide.common.ServiceParameterMissingException;
45 import org.apache.slide.common.ServiceResetFailedException;
46 import org.apache.slide.common.SlideToken;
47 import org.apache.slide.common.Uri;
48 import org.apache.slide.content.NodeRevisionContent;
49 import org.apache.slide.content.NodeRevisionDescriptor;
50 import org.apache.slide.content.NodeRevisionDescriptors;
51 import org.apache.slide.content.NodeRevisionNumber;
52 import org.apache.slide.content.RevisionAlreadyExistException;
53 import org.apache.slide.content.RevisionDescriptorNotFoundException;
54 import org.apache.slide.content.RevisionNotFoundException;
55 import org.apache.slide.lock.LockTokenNotFoundException;
56 import org.apache.slide.lock.NodeLock;
57 import org.apache.slide.security.NodePermission;
58 import org.apache.slide.structure.ObjectAlreadyExistsException;
59 import org.apache.slide.structure.ObjectNode;
60 import org.apache.slide.structure.ObjectNotFoundException;
61 import org.apache.slide.util.Messages;
62 import org.apache.slide.util.logger.Logger;
63
64 /**
65  * Abstract implementation of a store. Handles all caching operations.
66  *
67  * @version $Revision: 1.43.2.1 $
68  */

69 public abstract class AbstractStore extends AbstractSimpleService
70     implements Store {
71     
72     
73     // ----------------------------------------------------------- Constructors
74

75     
76     // ----------------------------------------------------- Instance Variables
77

78     
79     /**
80      * Node store.
81      */

82     protected NodeStore nodeStore;
83     
84     
85     /**
86      * Security store.
87      */

88     protected SecurityStore securityStore;
89     
90     
91     /**
92      * Lock store.
93      */

94     protected LockStore lockStore;
95     
96     
97     /**
98      * Revision descriptors store.
99      */

100     protected RevisionDescriptorsStore revisionDescriptorsStore;
101     
102     
103     /**
104      * Revision descriptor store.
105      */

106     protected RevisionDescriptorStore revisionDescriptorStore;
107     
108     
109     /**
110      * Content store.
111      */

112     protected ContentStore contentStore;
113     
114     /**
115      * DescriptorIndex store
116      */

117     protected IndexStore propertiesIndexer;
118     
119     /**
120      * ContentIndex store
121      */

122     protected IndexStore contentIndexer;
123     
124     /**
125      * Sequence store
126      */

127     protected SequenceStore sequenceStore = null;
128     
129     /**
130      * Active resource manager list.
131      */

132     protected Service resourceManagers[] = new Service[0];
133     
134     
135     
136     // the name of this store as specified in domain.xml
137
private String JavaDoc name;
138     
139     
140     /**
141      * Set the name of the store as specified in domain.xml.
142      */

143     public void setName(String JavaDoc name) {
144         this.name = name;
145     }
146     
147     
148     
149     /**
150      * Return the name of the store as specified in domain.xml.
151      */

152     public String JavaDoc getName() {
153         return this.name;
154     }
155     
156     
157     
158     /**
159      * Set the scope of the store as specified in domain.xml.
160      */

161     public void setScope(Scope scope) {
162         super.setScope(scope);
163         for (int i = 0; i < resourceManagers.length; i++) {
164             resourceManagers[i].setScope(scope);
165         }
166     }
167     
168     
169     
170     // ---------------------------------------------------- ServiceImpl Methods
171

172     
173     /**
174      * Namespace setter.
175      */

176     public void setNamespace(Namespace namespace) {
177         
178         super.setNamespace(namespace);
179         
180         for (int i = 0; i < resourceManagers.length; i++) {
181             resourceManagers[i].setNamespace(namespace);
182         }
183         
184     }
185     
186     
187     protected Hashtable JavaDoc parameters = null;
188     
189     /**
190      * Remeber the store parameters to initialise the default child stores on request
191      *
192      * @param parameters Hashtable containing the parameters' name
193      * and associated value
194      * @exception ServiceParameterErrorException Incorrect service parameter
195      * @exception ServiceParameterMissingException Service parameter missing
196      */

197     public void setParameters(Hashtable JavaDoc parameters)
198         throws ServiceParameterErrorException,
199         ServiceParameterMissingException {
200         this.parameters = parameters;
201     }
202     
203     public Object JavaDoc getParameter (Object JavaDoc key) {
204         return parameters.get (key);
205     }
206     
207     /**
208      * Connects to descriptors store.
209      *
210      * @exception DataException
211      */

212     public void connect(CredentialsToken crdtoken)
213         throws ServiceConnectionFailedException {
214         
215         for (int i = 0; i < resourceManagers.length; i++) {
216             resourceManagers[i].connect(crdtoken);
217         }
218         
219     }
220     
221     
222     
223     /**
224      * Connects to descriptors store.
225      *
226      * @exception DataException
227      */

228     public void connect()
229         throws ServiceConnectionFailedException {
230         
231         for (int i = 0; i < resourceManagers.length; i++) {
232             resourceManagers[i].connect();
233         }
234         
235     }
236     
237     
238     /**
239      * Disconnects from descriptors store.
240      *
241      * @exception ServiceDisconnectionFailedException
242      */

243     public void disconnect()
244         throws ServiceDisconnectionFailedException {
245         
246         for (int i = 0; i < resourceManagers.length; i++) {
247             resourceManagers[i].disconnect();
248         }
249         
250     }
251     
252     
253     /**
254      * Initializes descriptors store.
255      *
256      * @exception ServiceInitializationFailedException Throws an exception
257      * if the descriptors store has already been initialized before
258      */

259     public void initialize(NamespaceAccessToken token)
260         throws ServiceInitializationFailedException {
261         
262         super.initialize(token);
263         
264         for (int i = 0; i < resourceManagers.length; i++) {
265             resourceManagers[i].initialize(token);
266         }
267         
268     }
269     
270     
271     /**
272      * Deletes descriptors store. Should remove stored data if possible.
273      *
274      * @exception ServiceResetFailedException Reset failed
275      */

276     public void reset()
277         throws ServiceResetFailedException {
278         
279         for (int i = 0; i < resourceManagers.length; i++) {
280             resourceManagers[i].reset();
281         }
282         
283     }
284     
285     
286     /**
287      * This function tells whether or not the descriptors store is connected.
288      *
289      * @return boolean true if we are connected
290      * @exception ServiceAccessException Service access error
291      */

292     public boolean isConnected()
293         throws ServiceAccessException {
294         
295         for (int i = 0; i < resourceManagers.length; i++) {
296             if (!resourceManagers[i].isConnected())
297                 return false;
298         }
299         return true;
300         
301     }
302     
303     
304     // ----------------------------------------------------- XAResource Methods
305

306     
307     /**
308      * Commit the global transaction specified by xid.
309      *
310      * @param xid A global transaction identifier
311      * @param onePhase If true, the resource manager should use a one-phase
312      * commit protocol to commit the work done on behalf of xid.
313      * @exception XAException An error has occurred. Possible XAExceptions
314      * are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR,
315      * XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO. If the resource
316      * manager did not commit the transaction and the paramether onePhase is
317      * set to true, the resource manager may throw one of the XA_RB*
318      * exceptions. Upon return, the resource manager has rolled back the
319      * branch's work and has released all held resources.
320      */

321     public void commit(Xid JavaDoc xid, boolean onePhase)
322         throws XAException JavaDoc {
323         super.commit(xid, onePhase);
324     }
325     
326     
327     /**
328      * Ends the work performed on behalf of a transaction branch.
329      *
330      * @param xid A global transaction identifier that is the same as what
331      * was used previously in the start method.
332      * @param flags One of TMSUCCESS, TMFAIL, or TMSUSPEND
333      * @exception XAException An error has occurred. Possible XAException
334      * values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL,
335      * XAER_PROTO, or XA_RB*.
336      */

337     public void end(Xid JavaDoc xid, int flags)
338         throws XAException JavaDoc {
339         super.end(xid, flags);
340     }
341     
342     
343     /**
344      * Tell the resource manager to forget about a heuristically completed
345      * transaction branch.
346      *
347      * @param xid A global transaction identifier
348      * @exception XAException An error has occurred. Possible exception values
349      * are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
350      */

351     public void forget(Xid JavaDoc xid)
352         throws XAException JavaDoc {
353         super.forget(xid);
354     }
355     
356     
357     /**
358      * Ask the resource manager to prepare for a transaction commit of the
359      * transaction specified in xid.
360      *
361      * @param xid A global transaction identifier
362      * @return A value indicating the resource manager's vote on the outcome
363      * of the transaction. The possible values are: XA_RDONLY or XA_OK. If
364      * the resource manager wants to roll back the transaction, it should do
365      * so by raising an appropriate XAException in the prepare method.
366      * @exception XAException An error has occurred. Possible exception
367      * values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL,
368      * or XAER_PROTO.
369      */

370     public int prepare(Xid JavaDoc xid)
371         throws XAException JavaDoc {
372         return super.prepare(xid);
373     }
374     
375     
376     /**
377      * Inform the resource manager to roll back work done on behalf of a
378      * transaction branch.
379      *
380      * @param xid A global transaction identifier
381      * @exception XAException An error has occurred
382      */

383     public void rollback(Xid JavaDoc xid)
384         throws XAException JavaDoc {
385         super.rollback(xid);
386     }
387     
388     
389     /**
390      * Start work on behalf of a transaction branch specified in xid.
391      *
392      * @param xid A global transaction identifier to be associated with the
393      * resource
394      * @param flags One of TMNOFLAGS, TMJOIN, or TMRESUME
395      * @exception XAException An error has occurred. Possible exceptions are
396      * XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE, XAER_NOTA,
397      * XAER_INVAL, or XAER_PROTO.
398      */

399     public void start(Xid JavaDoc xid, int flags)
400         throws XAException JavaDoc {
401         super.start(xid, flags);
402     }
403     
404     
405     // ---------------------------------------------------------- Store Methods
406

407     
408     /**
409      * Set the node store associated with this store.
410      */

411     public void setNodeStore(NodeStore nodeStore) {
412         if (nodeStore == null) {
413             throw new IllegalArgumentException JavaDoc("Nodestore must not be null");
414         }
415         this.nodeStore = nodeStore;
416         addResourceManager(this.nodeStore);
417     }
418     
419     
420     /**
421      * Set the security store associated with this store.
422      */

423     public void setSecurityStore(SecurityStore securityStore) {
424         if (securityStore == null) {
425             throw new IllegalArgumentException JavaDoc("Securitystore must not be null");
426         }
427         this.securityStore = securityStore;
428         addResourceManager(this.securityStore);
429     }
430     
431     
432     /**
433      * Set the lock store associated with this store.
434      */

435     public void setLockStore(LockStore lockStore) {
436         if (lockStore == null) {
437             throw new IllegalArgumentException JavaDoc("Lockstore must not be null");
438         }
439         this.lockStore = lockStore;
440         addResourceManager(this.lockStore);
441     }
442     
443     
444     /**
445      * Set the revision descriptors store associated with this store.
446      */

447     public void setRevisionDescriptorsStore
448         (RevisionDescriptorsStore revisionDescriptorsStore) {
449         if (revisionDescriptorsStore == null) {
450             throw new IllegalArgumentException JavaDoc("Revisiondescriptorsstore must not be null");
451         }
452         this.revisionDescriptorsStore = revisionDescriptorsStore;
453         addResourceManager(this.revisionDescriptorsStore);
454     }
455     
456     
457     /**
458      * Set the revision descriptor store associated with this store.
459      */

460     public void setRevisionDescriptorStore
461         (RevisionDescriptorStore revisionDescriptorStore) {
462         if (revisionDescriptorStore == null) {
463             throw new IllegalArgumentException JavaDoc("Revisiondescriptorstore must not be null");
464         }
465         this.revisionDescriptorStore = revisionDescriptorStore;
466         addResourceManager(this.revisionDescriptorStore);
467     }
468     
469     
470     /**
471      * Set the content store associated with this store.
472      */

473     public void setContentStore(ContentStore contentStore) {
474         if (contentStore == null) {
475             
476         }
477         this.contentStore = contentStore;
478         addResourceManager(this.contentStore);
479     }
480     
481     
482     /**
483      * Set the Indexer associated to the properties store
484      *
485      * @param propertiesIndexer an IndexStore
486      *
487      */

488     public void setPropertiesIndexer (IndexStore propertiesIndexer) {
489         if (propertiesIndexer == null) {
490             throw new IllegalArgumentException JavaDoc("PropertiesIndexer must not be null");
491         }
492         this.propertiesIndexer = propertiesIndexer;
493         addResourceManager(this.propertiesIndexer);
494         
495     }
496     
497     
498     /**
499      * Set the Indexer associated to the conten store
500      *
501      * @param contentIndexer an IndexStore
502      *
503      */

504     public void setContentIndexer (IndexStore contentIndexer) {
505         if (contentIndexer == null) {
506             throw new IllegalArgumentException JavaDoc("ContentIndexer must not be null");
507         }
508         this.contentIndexer = contentIndexer;
509         addResourceManager(this.contentIndexer);
510         
511     }
512     
513     /**
514      * Method getContentIndexer
515      *
516      * @return an IndexStore
517      *
518      */

519     public IndexStore getContentIndexer () {
520         return contentIndexer;
521     }
522     
523     /**
524      * Method getPropertiesIndexer
525      *
526      * @return an IndexStore
527      *
528      */

529     public IndexStore getPropertiesIndexer () {
530         return propertiesIndexer;
531     }
532     
533     /**
534      * Set the sequence store associated with this store.
535      */

536     public void setSequenceStore(SequenceStore store) {
537         sequenceStore = store;
538     }
539         
540     //
541
// sequence methods
542
//
543

544     /**
545      * @see org.apache.slide.store.SequenceStore#isSequenceSupported()
546      */

547     public boolean isSequenceSupported() {
548         return (sequenceStore != null && sequenceStore.isSequenceSupported());
549     }
550
551     /**
552      * @see org.apache.slide.store.SequenceStore#sequenceExists(java.lang.String)
553      */

554     public boolean sequenceExists(String JavaDoc sequenceName) throws ServiceAccessException {
555         if (!isSequenceSupported()) {
556             throw new ServiceAccessException(this, "Sequences not supported");
557         }
558         return sequenceStore.sequenceExists(sequenceName);
559     }
560
561     /**
562      * @see org.apache.slide.store.SequenceStore#createSequence(java.lang.String)
563      */

564     public boolean createSequence(String JavaDoc sequenceName) throws ServiceAccessException {
565         if (!isSequenceSupported()) {
566             throw new ServiceAccessException(this, "Sequences not supported");
567         }
568         return sequenceStore.createSequence(sequenceName);
569     }
570
571     /**
572      * @see org.apache.slide.store.SequenceStore#nextSequenceValue(java.lang.String)
573      */

574     public long nextSequenceValue(String JavaDoc sequenceName) throws ServiceAccessException {
575         if (!isSequenceSupported()) {
576             throw new ServiceAccessException(this, "Sequences not supported");
577         }
578         return sequenceStore.nextSequenceValue(sequenceName);
579     }
580
581     /**
582      * Retrive an object from the Descriptors Store.
583      *
584      * @param uri Uri of the object we want to retrieve
585      * @exception ServiceAccessException Error accessing the Descriptors Store
586      * @exception ObjectNotFoundException The object to retrieve was not found
587      */

588     public ObjectNode retrieveObject(Uri uri)
589         throws ServiceAccessException, ObjectNotFoundException {
590         ObjectNode objectNode = null;
591         if (isForceStoreEnlistment(uri)) {
592             enlist(nodeStore);
593             try {
594                 objectNode = nodeStore.retrieveObject(uri);
595             } catch (ServiceAccessException e) {
596                 delist(nodeStore, false);
597                 throw e;
598             } catch (ObjectNotFoundException e) {
599                 // Note : Failed reads aren't considered fatal (ie, the
600
// transaction won't be always rolledback when committed)
601
delist(nodeStore);
602                 throw e;
603             } catch (Throwable JavaDoc t) {
604                 delist(nodeStore, false);
605                 // Wrap everything else in a ServiceAccessException
606
throw new ServiceAccessException(nodeStore, t);
607             }
608             delist(nodeStore);
609         } else {
610             try {
611                 objectNode = nodeStore.retrieveObject(uri);
612             } catch (ServiceAccessException e) {
613                 throw e;
614             } catch (ObjectNotFoundException e) {
615                 throw e;
616             } catch (Throwable JavaDoc t) {
617                 // Wrap everything else in a ServiceAccessException
618
throw new ServiceAccessException(nodeStore, t);
619             }
620         }
621         objectNode.validate(uri.toString());
622         return objectNode;
623     }
624     
625     
626     /**
627      * Store an object in the Descriptors Store.
628      *
629      * @param object Object to update
630      * @exception ServiceAccessException Error accessing the Descriptors Store
631      * @exception ObjectNotFoundException The object to update was not found
632      */

633     public void storeObject(Uri uri, ObjectNode object)
634         throws ServiceAccessException, ObjectNotFoundException {
635         ObjectNode tempObject = object.cloneObject();
636         tempObject.validate(uri.toString());
637         enlist(nodeStore);
638         try {
639             nodeStore.storeObject(uri, tempObject);
640         } catch (ServiceAccessException e) {
641             delist(nodeStore, false);
642             throw e;
643         } catch (ObjectNotFoundException e) {
644             delist(nodeStore);
645             throw e;
646         } catch (Throwable JavaDoc t) {
647             delist(nodeStore, false);
648             // Wrap everything else in a ServiceAccessException
649
throw new ServiceAccessException(contentStore, t);
650         }
651         delist(nodeStore);
652     }
653     
654     
655     /**
656      * Create a new object in the Descriptors Store.
657      *
658      * @param object SlideObject
659      * @param uri Uri of the object we want to create
660      * @exception ServiceAccessException Error accessing the Descriptors Store
661      * @exception ObjectAlreadyExistsException An object already exists
662      * at this Uri
663      */

664     public void createObject(Uri uri, ObjectNode object)
665         throws ServiceAccessException, ObjectAlreadyExistsException {
666         ObjectNode tempObject = object.cloneObject();
667         tempObject.validate(uri.toString());
668         enlist(nodeStore);
669         try {
670             nodeStore.createObject(uri, tempObject);
671             if (useBinding()) {
672                 String JavaDoc uuri = tempObject.getUuri();
673                 if (uuri == null) {
674                     throw new IllegalStateException JavaDoc();
675                 }
676                 object.setUuri(uuri);
677             } else {
678                 object.setUuri(tempObject.getUri());
679             }
680         } catch (ServiceAccessException e) {
681             delist(nodeStore, false);
682             throw e;
683         } catch (ObjectAlreadyExistsException e) {
684             delist(nodeStore);
685             throw e;
686         } catch (Throwable JavaDoc t) {
687             delist(nodeStore, false);
688             // Wrap everything else in a ServiceAccessException
689
throw new ServiceAccessException(nodeStore, t);
690         }
691         delist(nodeStore);
692     }
693     
694     
695     /**
696      * Remove an object from the Descriptors Store.
697      *
698      * @param object Object to remove
699      * @exception ServiceAccessException Error accessing the Descriptors Store
700      * @exception ObjectNotFoundException The object to remove was not found
701      */

702     public void removeObject(Uri uri, ObjectNode object)
703         throws ServiceAccessException, ObjectNotFoundException {
704         object.validate(uri.toString());
705         enlist(nodeStore);
706         try {
707             nodeStore.removeObject(uri, object);
708         } catch (ServiceAccessException e) {
709             delist(nodeStore, false);
710             throw e;
711         } catch (ObjectNotFoundException e) {
712             delist(nodeStore);
713             throw e;
714         } catch (Throwable JavaDoc t) {
715             delist(nodeStore, false);
716             // Wrap everything else in a ServiceAccessException
717
throw new ServiceAccessException(nodeStore, t);
718         }
719         delist(nodeStore);
720     }
721     
722     
723     /**
724      * Store an object permissions in the Descriptors Store.
725      *
726      * @param permission Permission we want to create
727      * @exception ServiceAccessException Error accessing the Descriptors Store
728      */

729     public void grantPermission(Uri uri, NodePermission permission)
730         throws ServiceAccessException {
731         NodePermission tempPermission = permission.cloneObject();
732         tempPermission.validate(uri.toString());
733         enlist(securityStore);
734         try {
735             securityStore.grantPermission(uri, tempPermission);
736         } catch (ServiceAccessException e) {
737             delist(securityStore, false);
738             throw e;
739         } catch (Throwable JavaDoc t) {
740             delist(securityStore, false);
741             // Wrap everything else in a ServiceAccessException
742
throw new ServiceAccessException(securityStore, t);
743         }
744         delist(securityStore);
745     }
746     
747     
748     /**
749      * Store an object permissions in the Descriptors Store.
750      *
751      * @param permission Permission we want to create
752      * @exception ServiceAccessException Error accessing the Descriptors Store
753      */

754     public void revokePermission(Uri uri, NodePermission permission)
755         throws ServiceAccessException {
756         permission.validate(uri.toString());
757         enlist(securityStore);
758         try {
759             securityStore.revokePermission(uri, permission);
760         } catch (ServiceAccessException e) {
761             delist(securityStore, false);
762             throw e;
763         } catch (Throwable JavaDoc t) {
764             delist(securityStore, false);
765             // Wrap everything else in a ServiceAccessException
766
throw new ServiceAccessException(securityStore, t);
767         }
768         delist(securityStore);
769     }
770     
771     
772     /**
773      * Revoke all the permissions on the object.
774      *
775      * @param uri Uri of the object
776      * @exception ServiceAccessException Error accessing the Descriptors Store
777      */

778     public void revokePermissions(Uri uri)
779         throws ServiceAccessException {
780         enlist(securityStore);
781         try {
782             securityStore.revokePermissions(uri);
783         } catch (ServiceAccessException e) {
784             delist(securityStore, false);
785             throw e;
786         } catch (Throwable JavaDoc t) {
787             delist(securityStore, false);
788             // Wrap everything else in a ServiceAccessException
789
throw new ServiceAccessException(securityStore, t);
790         }
791         delist(securityStore);
792     }
793     
794     
795     /**
796      * Enumerate locks on an object.
797      *
798      * @param uri Uri of the subject
799      * @return Enumeration List of {@link org.apache.slide.lock.NodeLock locks}
800      * which have been put on the subject
801      * @exception ServiceAccessException Service access error
802      */

803     public Enumeration JavaDoc enumeratePermissions(Uri uri)
804         throws ServiceAccessException {
805         // TODO : The vectors elements MUST be cloned
806
if (isForceStoreEnlistment(uri)) {
807             enlist(securityStore);
808             Enumeration JavaDoc permissions = null;
809             try {
810                 permissions = securityStore.enumeratePermissions(uri);
811             } catch (ServiceAccessException e) {
812                 delist(securityStore, false);
813                 throw e;
814             } catch (Throwable JavaDoc t) {
815                 delist(securityStore, false);
816                 // Wrap everything else in a ServiceAccessException
817
throw new ServiceAccessException
818                     (securityStore, t);
819             }
820             delist(securityStore);
821             return permissions;
822         } else {
823             try {
824                 return securityStore.enumeratePermissions(uri);
825             } catch (ServiceAccessException e) {
826                 throw e;
827             } catch (Throwable JavaDoc t) {
828                 // Wrap everything else in a ServiceAccessException
829
throw new ServiceAccessException
830                     (securityStore, t);
831             }
832         }
833     }
834     
835     
836     /**
837      * Puts a lock on a subject.
838      *
839      * @param lock Lock token
840      * @exception ServiceAccessException Service access error
841      */

842     public void putLock(Uri uri, NodeLock lock)
843         throws ServiceAccessException {
844         lock.validate(uri.toString());
845         enlist(lockStore);
846         try {
847             lockStore.putLock(uri, lock);
848         } catch (ServiceAccessException e) {
849             delist(lockStore, false);
850             throw e;
851         } catch (Throwable JavaDoc t) {
852             delist(lockStore, false);
853             // Wrap everything else in a ServiceAccessException
854
throw new ServiceAccessException(lockStore, t);
855         }
856         delist(lockStore);
857     }
858     
859     
860     /**
861      * Renews a lock.
862      *
863      * @param lock Token to renew
864      * @exception ServiceAccessException Service access error
865      * @exception LockTokenNotFoundException Lock token was not found
866      */

867     public void renewLock(Uri uri, NodeLock lock)
868         throws ServiceAccessException, LockTokenNotFoundException {
869         lock.validate(uri.toString());
870         enlist(lockStore);
871         try {
872             lockStore.renewLock(uri, lock);
873         } catch (ServiceAccessException e) {
874             delist(lockStore, false);
875             throw e;
876         } catch (LockTokenNotFoundException e) {
877             delist(lockStore);
878             throw e;
879         } catch (Throwable JavaDoc t) {
880             delist(lockStore, false);
881             // Wrap everything else in a ServiceAccessException
882
throw new ServiceAccessException(lockStore, t);
883         }
884         delist(lockStore);
885     }
886     
887     
888     /**
889      * Removes (cancels) a lock.
890      *
891      * @param lock Token to re