KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > repository > variant > VariantManager


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.variant;
17
18 import org.outerj.daisy.repository.RepositoryException;
19
20 /**
21  * Allows to manage the branch and language definitions.
22  *
23  * <p>Note that this is only about defining branches and languages, the actual creation
24  * of documents on these branches and languages is done through the
25  * {@link org.outerj.daisy.repository.Repository Repository} API.
26  */

27 public interface VariantManager {
28     /**
29      * Creates a new branch definition. The branch is not immediately created
30      * in the repository, you need to call the save() method of the returned
31      * object to do this.
32      *
33      * @param name a unique name satisfying the regexp "[a-zA-Z][a-zA-Z\-_0-9]*"
34      */

35     Branch createBranch(String JavaDoc name);
36
37     /**
38      * Retrieves a branch by ID.
39      */

40     Branch getBranch(long id, boolean updateable) throws RepositoryException;
41
42     /**
43      * Retrieves a branch by ID or by name depending on whether the branch parameter
44      * starts with a digit.
45      */

46     Branch getBranch(String JavaDoc branch, boolean updateable) throws RepositoryException;
47
48     /**
49      * Retrieves a branch by name.
50      */

51     Branch getBranchByName(String JavaDoc name, boolean updateable) throws RepositoryException;
52
53     Branches getAllBranches(boolean updateable) throws RepositoryException;
54
55     /**
56      * Deletes a branch. A branch can only be deleted if no document exists on the branch.
57      * Thus before deleting a branch, all document variants on this branch must be deleted.
58      * This can be easily done by performing a query that searches all documents on
59      * the branch -- see QueryManager -- and then deletes them one by one in a loop.
60      */

61     void deleteBranch(long id) throws RepositoryException;
62
63     Language createLanguage(String JavaDoc name);
64
65     Language getLanguage(long id, boolean updateable) throws RepositoryException;
66
67     Language getLanguage(String JavaDoc language, boolean updateable) throws RepositoryException;
68
69     Language getLanguageByName(String JavaDoc name, boolean updateable) throws RepositoryException;
70
71     Languages getAllLanguages(boolean updateable) throws RepositoryException;
72
73     void deleteLanguage(long id) throws RepositoryException;
74 }
75
Popular Tags