01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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>The CollectionManager can be retrieved via {@link Repository#getCollectionManager()}.
23: *
24: * <p>Collections are named sets of documents. The same document can
25: * be part of multiple collections, thus collections can overlap.
26: *
27: * <p>Assigning documents to collections is done through the
28: * {@link Document} API.
29: *
30: */
31: public interface CollectionManager {
32: /**
33: * Creates a new collection. This does not immediately create the
34: * collection in the repository, you need to call the save() method
35: * on the returned DocumentCollection object to do this.
36: *
37: * @param name the name of the new collection
38: */
39: DocumentCollection createCollection(String name)
40: throws RepositoryException;
41:
42: /**
43: * Retrieves a collection by its ID.
44: *
45: */
46: DocumentCollection getCollection(long collectionId,
47: boolean updateable) throws RepositoryException;
48:
49: /**
50: * Retrieves a collection by ID or by name. If the collection parameter consists of digits only (0-9), it
51: * will be considered to be an ID (even though entirely numeric collection names are allowed, which
52: * for this reason are not recommended).
53: */
54: DocumentCollection getCollection(String collection,
55: boolean updateable) throws RepositoryException;
56:
57: /**
58: * Retrieves a collection by its name.
59: */
60: DocumentCollection getCollectionByName(String name,
61: boolean updateable) throws RepositoryException;
62:
63: /**
64: * Deletes a collection from the repository.
65: *
66: * <p>If any documents were associated with (contained by) this collection,
67: * these associations will be removed, but the documents themselves are not
68: * removed. Note that this can be done even if there are locks on documents
69: * contained by this collection, and that the last modified timestamp of the
70: * documents will remain untouched.
71: *
72: * @param collectionId the ID of the collection to remove
73: */
74: void deleteCollection(long collectionId) throws RepositoryException;
75:
76: /**
77: * Gets all collections, in no specific order.
78: */
79: DocumentCollections getCollections(boolean updateable)
80: throws RepositoryException;
81: }
|