1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 package com.sun.star.report;
24 
25 import java.io.IOException;
26 import java.io.OutputStream;
27 
28 /**
29  * A repository for writing. Providing a repository always assumes,
30  * that more than one stream can be written.
31  *
32  * @author Thomas Morgner
33  */
34 public interface OutputRepository
35 {
36 
37     /**
38      * Creates an output stream for writing the data. If there is an entry with
39      * that name already contained in the repository, try to overwrite it.
40      *
41      * @param name
42      *    the name of the output stream
43      * @param mimeType
44      *    the mime type of the to-be-created output stream. Repository implementations which do not support
45      *    associating a mime time with a stream might ignore this parameter.
46      * @return the outputstream
47      * @throws IOException if opening the stream fails
48      */
createOutputStream(final String name, final String mimeType)49     OutputStream createOutputStream(final String name, final String mimeType) throws IOException;
50 
51     /** allows to access sub repositories inside this repository
52      *
53      * @param name describes the path to the sub repository
54      * @param mimeType
55      * @return the sub repository
56      * @throws java.io.IOException when the sub repository doesn't exist.
57      */
openOutputRepository(final String name, final String mimeType)58     OutputRepository openOutputRepository(final String name, final String mimeType) throws IOException;
59 
exists(final String name)60     boolean exists(final String name);
61 
existsStorage(final String name)62     boolean existsStorage(final String name);
63 
isWritable(final String name)64     boolean isWritable(final String name);
65 
closeOutputRepository()66     void closeOutputRepository();
67 }
68