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.query;
17:
18: import org.outerj.daisy.repository.schema.*;
19: import org.outerj.daisy.repository.RepositoryException;
20: import org.outerj.daisy.repository.DocumentCollection;
21: import org.outerj.daisy.repository.Document;
22: import org.outerj.daisy.repository.VariantKey;
23: import org.outerj.daisy.repository.namespace.Namespace;
24: import org.outerj.daisy.repository.namespace.NamespaceNotFoundException;
25: import org.outerj.daisy.repository.commonimpl.DocId;
26: import org.outerj.daisy.repository.variant.Branch;
27: import org.outerj.daisy.repository.variant.Language;
28:
29: /**
30: * Query context offers functionality to the query execution engine.
31: * It doesn't offer access to the full repository as queries shouldn't
32: * be allowed to have side-effects.
33: */
34: public interface QueryContext {
35: Document getDocument(VariantKey variantKey)
36: throws RepositoryException;
37:
38: FieldType getFieldTypeByName(String name)
39: throws RepositoryException;
40:
41: PartType getPartTypeByName(String name) throws RepositoryException;
42:
43: DocumentType getDocumentTypeById(long id)
44: throws RepositoryException;
45:
46: DocumentType getDocumentTypeByName(String name)
47: throws RepositoryException;
48:
49: DocumentCollection getCollection(String name)
50: throws RepositoryException;
51:
52: String getUserDisplayName(long userId) throws RepositoryException;
53:
54: long getUserId(String login) throws RepositoryException;
55:
56: long getUserId();
57:
58: String getUserLogin(long userId) throws RepositoryException;
59:
60: Language getLanguageByName(String name) throws RepositoryException;
61:
62: Language getLanguage(long languageId) throws RepositoryException;
63:
64: Language getLanguage(String languageIdOrName)
65: throws RepositoryException;
66:
67: Branch getBranchByName(String name) throws RepositoryException;
68:
69: Branch getBranch(long branchId) throws RepositoryException;
70:
71: Branch getBranch(String branchIdOrName) throws RepositoryException;
72:
73: DocId parseDocId(String documentId);
74:
75: Namespace getNamespace(String namespaceName)
76: throws NamespaceNotFoundException;
77:
78: String getRepositoryNamespace();
79: }
|