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.InputStream;
27 
28 /**
29  * This allows the job processor to load data from a repository. It is assumed,
30  * that all resource names are given as strings and furthermore, that the names
31  * identify a resource uniquely within the input repository.
32  *
33  * An input repository connects the report processing to the xml definitions.
34  * Unless defined otherwise, it is assumed, that the input-name is 'content.xml';
35  * possible other files are 'settings.xml' and 'styles.xml' (see the Oasis standard
36  * for details on these files and their contents).
37  *
38  * @author Thomas Morgner
39  */
40 public interface InputRepository
41 {
42 
43     /**
44      * Returns a unique identifier for this repository. Two repositories accessing
45      * the same location should return the same id. The identifier must never
46      * be null.
47      *
48      * @return the repository id
49      */
getId()50     Object getId();
51 
createInputStream(final String name)52     InputStream createInputStream(final String name) throws IOException;
53 
54     /** allows to acces sub repositories inside this repository
55      *
56      * @param name describes the path to the sub repository
57      * @return the sub repository
58      * @throws java.io.IOException when the sub repository doesn't exist.
59      */
openInputRepository(final String name)60     InputRepository openInputRepository(final String name) throws IOException;
61 
62     /**
63      * This returns an version number for the given resource. Return zero, if
64      * the resource is not versionable, else return a unique number for each version.
65      * As rule of thumb: Increase the version number by at least one for each change
66      * made to the resource.
67      *
68      * @param name the name of the resource
69      * @return the version number
70      */
getVersion(final String name)71     long getVersion(final String name);
72 
exists(final String name)73     boolean exists(final String name);
74 
isReadable(final String name)75     boolean isReadable(final String name);
76 
closeInputRepository()77     void closeInputRepository();
78 
79     /** returns the URL of the database document
80      *
81      * @return the URL of the database document
82      */
getRootURL()83     String getRootURL();
84 }
85