static_collection_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2011 The FLWOR Foundation.
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 #ifndef ZORBA_STATICCOLLECTIONMANAGER_API_H
17 #define ZORBA_STATICCOLLECTIONMANAGER_API_H
18 
19 #include <zorba/config.h>
20 #include <zorba/api_shared_types.h>
22 
23 namespace zorba {
24 
25  /** \brief Using the StaticCollectionManager one can retrieve information
26  * about statically declared collections and indexes as well as manage them.
27  *
28  * The StaticCollectionManager can be retrieved from (1) a compiled XQuery
29  * or (2) a StaticContext object. In both cases, this class provides access
30  * to information for the collections and indexes that are declared in (1) all the
31  * modules (transitively) imported by the main query or (2) the module
32  * that resulted in the compilation of the StaticContext, respectively.
33  * Moreover, this class allows to create or delete such collections and indexes.
34  *
35  */
36  class ZORBA_DLL_PUBLIC StaticCollectionManager : public CollectionManager
37  {
38  public:
39  /**
40  * List all the collections that are declared in the XQuery or the
41  * StaticContext that was used to retrieve this StaticCollectionManager.
42  *
43  * @return a sequence of QNames of all said collections
44  */
45  virtual ItemSequence_t
46  declaredCollections() const = 0;
47 
48  /**
49  * Checks if a collection with a given QName is declared in the XQuery
50  * or the StaticContext that was used to retrieve this
51  * StaticCollectionManager.
52  *
53  * @return true if a collection with the given name is declared,
54  * false otherwise.
55  */
56  virtual bool
57  isDeclaredCollection(const Item& aQName) const = 0;
58 
59  /**
60  * Create the index with the given name.
61  *
62  * @param aQName The name of the index to create.
63  *
64  * @throw zerr:ZDDY0021 if a index with the given name is not declared.
65  *
66  * @throw zerr:ZDDY0022 if a index with the given name already exists.
67  */
68  virtual void
69  createIndex(const Item& aQName) = 0;
70 
71  /**
72  * Create the index with the given name.
73  *
74  * @param aQName The name of the index to create.
75  *
76  * @throw zerr:ZDDY0021 if a index with the given name is not declared.
77  *
78  * @throw zerr:ZDDY0009 if a index with the given name does not exist
79  */
80  virtual void
81  deleteIndex(const Item& aQName) = 0;
82 
83  /**
84  * This function returns a sequence of names of the indexes
85  * that are available.
86  *
87  * @return The list of names of the available indexes.
88  */
89  virtual ItemSequence_t
90  availableIndexes() const = 0;
91 
92  /**
93  * This function returns true if a index with the given name is available.
94  *
95  * @param aQName The name of the index that is being checked.
96  *
97  * @return true if the index is available and false otherwise.
98  */
99  virtual bool
100  isAvailableIndex(const Item& aQName) const = 0;
101 
102  /**
103  * List all the indexes that are declared in the XQuery or the
104  * StaticContext that was used to retrieve this StaticCollectionManager.
105  *
106  * @return a sequence of QNames of all said indexes
107  */
108  virtual ItemSequence_t
109  declaredIndexes() const = 0;
110 
111  /**
112  * Checks if a index with a given QName is declared in the XQuery
113  * or the StaticContext that was used to retrieve this
114  * StaticCollectionManager.
115  *
116  * @return true if a collection with the given name is declared,
117  * false otherwise.
118  */
119  virtual bool
120  isDeclaredIndex(const Item& aQName) const = 0;
121 
123 
124  }; /* class StaticCollectionManager */
125 
126 } /* namespace zorba */
127 #endif
128 /* vim:set et sw=2 ts=2: */