KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > repository > CollectionManager


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

16 package org.outerj.daisy.repository;
17
18 /**
19  * The CollectionManager is responsible for all tasks related
20  * to collection management (creation, deletion, listing).
21  *
22  * <p>Collections are named sets of documents. The same document can
23  * be part of multiple collections, thus collections can overlap.
24  *
25  * <p>Assigning documents to collections is done through the
26  * {@link Document} API.
27  *
28  */

29 public interface CollectionManager {
30     /**
31      * Creates a new collection. This does not immediately create the
32      * collection in the repository, you need to call the save() method
33      * on the returned DocumentCollection object to do this.
34      *
35      * @param name the name of the new collection
36      */

37     DocumentCollection createCollection(String JavaDoc name) throws RepositoryException;
38     
39     /**
40      * Retrieves a collection by its ID.
41      *
42      */

43     DocumentCollection getCollection(long collectionId, boolean updateable) throws RepositoryException;
44
45     /**
46      * Retrieves a collection by ID or by name depending on whether the collection parameter
47      * starts with a digit.
48      */

49     DocumentCollection getCollection(String JavaDoc collection, boolean updateable) throws RepositoryException;
50
51     /**
52      * Retrieves a collection by its name.
53      */

54     DocumentCollection getCollectionByName(String JavaDoc name, boolean updateable) throws RepositoryException;
55
56     /**
57      * Deletes a collection from the repository.
58      *
59      * <p>If any documents were associated with (contained by) this collection,
60      * these associations will be removed, but the documents themselves are not
61      * removed. Note that this can be done even if there are locks on documents
62      * contained by this collection, and that the last modified timestamp of the
63      * documents will remain untouched.
64      *
65      * @param collectionId the ID of the collection to remove
66      */

67     void deleteCollection(long collectionId) throws RepositoryException;
68     
69     /**
70      * Gets all collections, in no specific order.
71      */

72     DocumentCollections getCollections(boolean updateable) throws RepositoryException;
73 }
74
Popular Tags