KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > io > WritableStorageFactory


1 /*
2
3    Derby - Class org.apache.derby.io.WritableStorageFactory
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.io;
23
24 import java.io.OutputStream JavaDoc;
25 import java.io.IOException JavaDoc;
26 import java.io.SyncFailedException JavaDoc;
27
28 /**
29  * This interface extends StorageFactory to provide read/write access to storage.
30  *<p>
31  * The database engine will call this interface's methods from its own privilege blocks.
32  *<p>
33  * Each WritableStorageFactory instance may be concurrently used by multiple threads.
34  *
35  */

36 public interface WritableStorageFactory extends StorageFactory
37 {
38
39
40     /**
41      * Force the data of an output stream out to the underlying storage. That is, ensure that
42      * it has been made persistent. If the database is to be transient, that is, if the database
43      * does not survive a restart, then the sync method implementation need not do anything.
44      *
45      * @param stream The stream to be synchronized.
46      * @param metaData If true then this method must force both changes to the file's
47      * contents and metadata to be written to storage; if false, it need only force file content changes
48      * to be written. The implementation is allowed to ignore this parameter and always force out
49      * metadata changes.
50      *
51      * @exception IOException if an I/O error occurs.
52      * @exception SyncFailedException Thrown when the buffers cannot be flushed,
53      * or because the system cannot guarantee that all the buffers have been
54      * synchronized with physical media.
55      */

56     public void sync( OutputStream JavaDoc stream, boolean metaData) throws IOException JavaDoc, SyncFailedException JavaDoc;
57
58     /**
59      * This method tests whether the StorageRandomAccessFile "rws" and "rwd" modes
60      * are implemented. If the "rws" method is supported then the database
61      * engine will conclude that the write methods of "rws" mode
62      * StorageRandomAccessFiles are slow but the sync method is fast and optimize
63      * accordingly.
64      *
65      * @return <b>true</b> if an StIRandomAccess file opened with "rws" or "rwd" modes immediately writes data to the
66      * underlying storage, <b>false</b> if not.
67      */

68     public boolean supportsRws();
69 }
70
Popular Tags