KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > source > ModifiableSource


1 /*
2  * Copyright 2002-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.excalibur.source;
18
19 import java.io.IOException JavaDoc;
20 import java.io.OutputStream JavaDoc;
21
22 /**
23  * A {@link Source} that can be written to.
24  * <p>
25  * As far a possible, implementations should provide a kind of transaction or
26  * buffering of data written to the source. This is especially important in
27  * stream-based systems such as Cocoon where an error that occurs during the
28  * processing should lead to cancelling data written to the source.
29  * <p>
30  * This is the role of the {@link #canCancel(OutputStream)} and
31  * {@link #cancel(OutputStream)} methods.
32  *
33  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
34  * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:26 $
35  */

36 public interface ModifiableSource
37     extends Source
38 {
39     /**
40      * Return an {@link OutputStream} to write to.
41      */

42     OutputStream JavaDoc getOutputStream() throws IOException JavaDoc;
43     
44     /**
45      * Delete the source
46      */

47     void delete() throws SourceException;
48
49     /**
50      * Can the data sent to an <code>OutputStream</code> returned by
51      * {@link #getOutputStream()} be cancelled ?
52      *
53      * @return true if the stream can be cancelled
54      */

55     boolean canCancel(OutputStream JavaDoc stream);
56
57     /**
58      * Cancel the data sent to an <code>OutputStream</code> returned by
59      * {@link #getOutputStream()}.
60      *
61      * <p>After cancelling, the stream should no longer be used.</p>
62      */

63     void cancel(OutputStream JavaDoc stream) throws IOException JavaDoc;
64     
65 }
66
Popular Tags