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 java.io.*;
29:
30: /**
31: * Abstract base class of I/O requests which can be posted to the
32: * AFile enqueue() methods.
33: *
34: * @author Matt Welsh
35: * @see AFileReadRequest
36: * @see AFileWriteRequest
37: * @see AFileSeekRequest
38: * @see AFileFlushRequest
39: * @see AFileCloseRequest
40: */
41: public abstract class AFileRequest implements QueueElementIF {
42:
43: AFile afile;
44: SinkIF compQ;
45:
46: protected AFileRequest(SinkIF compQ) {
47: this .compQ = compQ;
48: }
49:
50: protected AFileRequest(AFile afile, SinkIF compQ) {
51: this .afile = afile;
52: this .compQ = compQ;
53: }
54:
55: AFile getFile() {
56: return afile;
57: }
58:
59: AFileImpl getImpl() {
60: return afile.getImpl();
61: }
62:
63: SinkIF getCompQ() {
64: return compQ;
65: }
66:
67: void complete(QueueElementIF comp) {
68: if (compQ != null)
69: compQ.enqueue_lossy(comp);
70: }
71:
72: }
|