KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > common > domains > registry > LockingStore


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.common.domains.registry;
25
26 import java.io.IOException JavaDoc;
27
28
29 import java.io.Serializable JavaDoc;
30
31
32 /**
33  * Implementors of this interface represent a store which can be
34  * locked and which will store and retrieve a single data object
35  *
36  * @author <a HREF="mailto:toby.h.ferguson@sun.com">Toby H Ferguson</a>
37  * @version 1.0
38  */

39 public interface LockingStore
40 {
41
42       /**
43          Write the given object to the store via serialization.
44          <p>
45          Precondition - store is locked
46          <p>
47          Postcondition - store contains this object, and only this
48          object.
49          @param o the object to be put into the store. Must implement
50          {@link Serializable}
51          @throws IOException if there was a problem writing to the
52          store. Store will no longer be locked.
53          @throws IllegalStateException if the store is not
54          locked. Store will no longer be locked.
55       */

56   void writeObject(Object JavaDoc o) throws IOException JavaDoc, IllegalStateException JavaDoc;
57       /**
58          Read the object from the store.
59          <p>
60          precondition - true
61          <p>
62          postcondition - store has not been modified
63          @return the single object that was in the store (or null if
64          the store is empty)
65          @throws TimeoutException if a lock on the store couldn't be
66          obtained in a reasonable time.
67          @throws IOException if there was a problem reading from the
68          store
69          @throws ClassNotFoundException if the object could not be
70          restored from the store
71       */

72   Object JavaDoc readObject() throws IOException JavaDoc, TimeoutException, ClassNotFoundException JavaDoc;
73       /**
74          lock the store.
75          <p>
76          precondition - true
77          <p>
78          postcondition - the store is locked
79          @throws IOException if there was a problem initializing the
80          store
81          @throws TimeoutException if there was a problem obtaining a
82          lock in a reasonable amount of time
83       */

84   void lock() throws IOException JavaDoc, TimeoutException;
85       /**
86          unlock the store.
87          <p>
88          precondition - store is not locked, or the store has been
89          locked by the caller.
90          <p>
91          postcondition - store is closed and all resources released
92       */

93   void unlock();
94       /**
95          get the last time this store was modified
96          @return the time that this store was last modified, as per
97          {@link java.io.File#lastModified()}
98       */

99   long lastModified();
100 }
101
Popular Tags