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.variant;
17:
18: import org.outerj.daisy.repository.RepositoryException;
19:
20: /**
21: * Allows to manage the branch and language definitions.
22: *
23: * <p>The VariantManager can be retrieved via {@link org.outerj.daisy.repository.Repository#getVariantManager()}.
24: *
25: * <p>Note that this is only about defining branches and languages, the actual creation
26: * of documents on these branches and languages is done through the
27: * {@link org.outerj.daisy.repository.Repository Repository} API.
28: */
29: public interface VariantManager {
30: /**
31: * Creates a new branch definition. The branch is not immediately created
32: * in the repository, you need to call the save() method of the returned
33: * object to do this.
34: *
35: * @param name a unique name satisfying the regexp "[a-zA-Z][a-zA-Z\-_0-9]*"
36: */
37: Branch createBranch(String name);
38:
39: /**
40: * Retrieves a branch by ID.
41: */
42: Branch getBranch(long id, boolean updateable)
43: throws RepositoryException;
44:
45: /**
46: * Retrieves a branch by ID or by name depending on whether the branch parameter
47: * starts with a digit.
48: */
49: Branch getBranch(String branch, boolean updateable)
50: throws RepositoryException;
51:
52: /**
53: * Retrieves a branch by name.
54: */
55: Branch getBranchByName(String name, boolean updateable)
56: throws RepositoryException;
57:
58: Branches getAllBranches(boolean updateable)
59: throws RepositoryException;
60:
61: /**
62: * Deletes a branch. A branch can only be deleted if no document exists on the branch.
63: * Thus before deleting a branch, all document variants on this branch must be deleted.
64: * This can be easily done by performing a query that searches all documents on
65: * the branch -- see QueryManager -- and then deletes them one by one in a loop.
66: */
67: void deleteBranch(long id) throws RepositoryException;
68:
69: Language createLanguage(String name);
70:
71: Language getLanguage(long id, boolean updateable)
72: throws RepositoryException;
73:
74: Language getLanguage(String language, boolean updateable)
75: throws RepositoryException;
76:
77: Language getLanguageByName(String name, boolean updateable)
78: throws RepositoryException;
79:
80: Languages getAllLanguages(boolean updateable)
81: throws RepositoryException;
82:
83: void deleteLanguage(long id) throws RepositoryException;
84: }
|