collection_manager.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2006-2011 The FLWOR Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef ZORBA_COLLECTIONMANAGER_API_H
00017 #define ZORBA_COLLECTIONMANAGER_API_H
00018 
00019 #include <zorba/config.h>
00020 #include <zorba/api_shared_types.h>
00021 
00022 namespace zorba {
00023 
00024   /** \brief This class defines a set of functions for managing persistent
00025    *         collections.
00026    *
00027    */
00028   class ZORBA_DLL_PUBLIC CollectionManager
00029   {
00030   public:
00031     /**
00032      * This function creates the collection with the given name.
00033      *
00034      * @param aName The name of the collection to create.
00035      *
00036      * @throw XDDY0002 if a collection with the given name already exists.
00037      *
00038      */
00039     virtual void
00040     createCollection(const Item& aName) = 0;
00041 
00042     /**
00043      * This function creates the collection with the given name.
00044      * Moreover, it adds copies of the sequence aContents to the new collection.
00045      *
00046      * @param aName The name of the collection to create.
00047      * @param aContents The sequence of items.
00048      *
00049      * @throw XDDY0002 if a collection with the given name already exists.
00050      *
00051      */
00052     virtual void
00053     createCollection(
00054         const Item& aName,
00055         const ItemSequence_t& aContents) = 0;
00056 
00057     /**
00058      * This function removes the collection with the given name.
00059      *
00060      * @param aName The name of the collection to delete.
00061      *
00062      * @throw XDDY0003 if the collection does not exist.
00063      */
00064     virtual void
00065     deleteCollection(const Item& aName) = 0;
00066 
00067     /**
00068      * Returns a instance of the Collection class which can
00069      * be used to modify and retrieve the contents of the collection
00070      * identified by the given name.
00071      *
00072      * @param aName The name of the collection to retrieve.
00073      *
00074      * @throw XDDY0003 if the collection does not exist.
00075      */
00076     virtual Collection_t
00077     getCollection(const Item& aName) const = 0;
00078 
00079     /**
00080      * This function returns a sequence of names of the collections that are available.
00081      *
00082      * @return The list of names of the available collections.
00083      *
00084      */
00085     virtual ItemSequence_t
00086     availableCollections() const = 0;
00087 
00088     /**
00089      * This function returns true if a collection with the given name is available.
00090      *
00091      * @param aName The name of the collection that is being checked.
00092      *
00093      * @return true if the collection is available and false otherwise.
00094      *
00095      */
00096     virtual bool
00097     isAvailableCollection(const Item& aName) const = 0;
00098 
00099     /** \brief Destructor
00100      *
00101      */
00102     virtual ~CollectionManager() {}
00103 
00104   }; /* class CollectionManager */
00105 
00106 } /* namespace zorba */
00107 #endif
00108 
00109 /* vim:set et sw=2 ts=2: */
blog comments powered by Disqus