KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mckoi > store > JournalledResource


1 /**
2  * com.mckoi.store.JournalledResource 11 Jun 2003
3  *
4  * Mckoi SQL Database ( http://www.mckoi.com/database )
5  * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * Version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License Version 2 for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * Version 2 along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  * Change Log:
21  *
22  *
23  */

24
25 package com.mckoi.store;
26
27 import java.io.IOException JavaDoc;
28
29 /**
30  * An interface that allows for the reading and writing of pages to/from a
31  * journalled.
32  *
33  * @author Tobias Downer
34  */

35
36 interface JournalledResource {
37
38   /**
39    * Returns the page size.
40    */

41   int getPageSize();
42
43   /**
44    * Returns a unique id for this resource.
45    */

46   long getID();
47   
48   /**
49    * Reads a page of some previously specified size into the byte array.
50    */

51   void read(long page_number, byte[] buf, int off) throws IOException JavaDoc;
52
53   /**
54    * Writes a page of some previously specified size to the top log. This will
55    * add a single entry to the log and any 'read' operations after will contain
56    * the written data.
57    */

58   void write(long page_number, byte[] buf, int off, int len) throws IOException JavaDoc;
59
60   /**
61    * Sets the new size of the resource. This will add a single entry to the
62    * log.
63    */

64   void setSize(long size) throws IOException JavaDoc;
65   
66   /**
67    * Returns the current size of this resource.
68    */

69   long getSize() throws IOException JavaDoc;
70   
71   /**
72    * Opens the resource.
73    */

74   void open(boolean read_only) throws IOException JavaDoc;
75   
76   /**
77    * Closes the resource. This will actually simply log that the resource has
78    * been closed.
79    */

80   void close() throws IOException JavaDoc;
81
82   /**
83    * Deletes the resource. This will actually simply log that the resource has
84    * been deleted.
85    */

86   void delete() throws IOException JavaDoc;
87
88   /**
89    * Returns true if the resource currently exists.
90    */

91   boolean exists();
92   
93 }
94
95
Popular Tags