01: /*
02: * Copyright (c) 2000 by Matt Welsh and The Regents of the University of
03: * California. All rights reserved.
04: *
05: * Permission to use, copy, modify, and distribute this software and its
06: * documentation for any purpose, without fee, and without written agreement is
07: * hereby granted, provided that the above copyright notice and the following
08: * two paragraphs appear in all copies of this software.
09: *
10: * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
11: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
12: * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
13: * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14: *
15: * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
16: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17: * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
18: * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
19: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
20: *
21: * Author: Matt Welsh <mdw@cs.berkeley.edu>
22: *
23: */
24:
25: package seda.sandStorm.lib.aDisk;
26:
27: import seda.sandStorm.api.*;
28: import seda.sandStorm.core.*;
29: import java.io.*;
30:
31: /**
32: * Package-access only abstract class representing an implementation of
33: * the AFile interface. By creating a subclass of AFileImpl and tying it
34: * into the implementation-selection code in AFile, you can introduce new
35: * implementations of AFile behind this interface.
36: *
37: * @author Matt Welsh
38: * @see AFile
39: */
40: abstract class AFileImpl extends SimpleSink {
41:
42: /**
43: * Enqueues the given request (which must be an AFileRequest)
44: * to the file.
45: */
46: public abstract void enqueue(QueueElementIF req)
47: throws SinkException;
48:
49: /**
50: * Enqueues the given request (which must be an AFileRequest)
51: * to the file.
52: */
53: public abstract boolean enqueue_lossy(QueueElementIF req);
54:
55: /**
56: * Enqueues the given requests (which must be AFileRequests)
57: * to the file.
58: */
59: public abstract void enqueue_many(QueueElementIF[] elements)
60: throws SinkException;
61:
62: /**
63: * Return information on the properties of the file.
64: */
65: abstract AFileStat stat();
66:
67: /**
68: * Close the file after all enqueued requests have completed.
69: * Disallows any additional requests to be enqueued on this file.
70: * A SinkClosedEvent will be posted on the file's completion queue
71: * when the close is complete.
72: */
73: public abstract void close();
74:
75: /**
76: * Causes a SinkFlushedEvent to be posted on the file's completion queue
77: * when all pending requests have completed.
78: */
79: public abstract void flush();
80:
81: }
|