KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > mapper > RepositoryConnection


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.mapper;
24
25 import java.util.List JavaDoc;
26
27 import org.xquark.xml.xdbc.XMLDBCException;
28
29 /** Provide functions for manipulating XML collections and performing XQueries
30  * on the XML repository to which it is connected.
31  * <p>In case of multithread use, a RepositoryConnection must be created per
32  * thread.</p>
33  * @see org.xquark.mapper.AccessManager
34  * @see org.xquark.mapper.XMLCollection
35  */

36 public interface RepositoryConnection
37 extends org.xquark.xml.xdbc.XMLConnection
38 {
39     ///////////////////////////////////////////////////////////////////////////
40
// API Constants
41
///////////////////////////////////////////////////////////////////////////
42

43     public static final String JavaDoc TEXT_LENGTH_PROPERTY
44         = "http://www.xquark.org/repository/collection/properties/maxTextDataLength";
45     public static final String JavaDoc EXTRA_DATA_LENGTH_PROPERTY
46         = "http://www.xquark.org/repository/collection/properties/maxExtraDataLength";
47     public static final String JavaDoc MAPPING_ID_PROPERTY
48         = "http://www.xquark.org/repository/collection/properties/mappingId";
49     public static final String JavaDoc DESC_PROPERTY
50         = "http://www.xquark.org/repository/collection/properties/description";
51     public static final String JavaDoc DOC_OID_SIZE_PROPERTY
52         = "http://www.xquark.org/repository/collection/properties/docOIDSizeInBits";
53     public static final String JavaDoc DOC_OID_PREALLOCATION_SIZE
54         = "http://www.xquark.org/repository/collection/properties/docOIDPreallocationSize";
55     
56     /////////////////////////
57
// FEATURES
58
/////////////////////////
59
public static final String JavaDoc USE_SCHEMA_PREFIXES_FEATURE
60         = "http://www.xquark.org/repository/collection/features/storePrefixes";
61
62     //
63
// SYSTEM COLLECTIONS
64
//
65
/** The name of the system repository used to store XML Schemas */
66     public static final String JavaDoc SCHEMA_COLLECTION = "SCHEMA$";
67     /** The name of the system repository used to store mapping files */
68     public static final String JavaDoc MAPPING_COLLECTION = "MAPPING$";
69
70     ///////////////////////////////////////////////////////////////////////////
71
// CONNECTION FUNCTIONS
72
///////////////////////////////////////////////////////////////////////////
73

74     /** Remove <b>XMLCollection</b> configuration from the underlying database,
75      * but not the collection tables. All collections must have been previously
76      * destroyed before this function is able to work.
77      * <B>Warning !</B> {@link #close() close()} is automatically called and
78      * another connection is to be opened.
79      * @throws RepositoryException API exception.
80      * @see AccessManager
81      */

82     public void deleteConfiguration() throws XMLDBCException;
83     
84     /** Remove the whole repository from the underlying database, including the
85      * the XML collections.
86      * <B>Warning !</B> {@link #close() close()} is automatically called and
87      * another connection is to be opened.
88      * @throws RepositoryException API exception.
89      * @see AccessManager
90      */

91     public void deleteRepository() throws XMLDBCException;
92     
93     /** Remove the whole repository from the underlying database, including the
94      * the XML collections but a new one is created so that the connection is
95      * still alive.
96      * @throws RepositoryException API exception.
97      * @see AccessManager
98      */

99     public void resetRepository() throws XMLDBCException;
100     
101     /** Open the system collection where XML schemas are stored.
102      * <B>You cannot use the DOM methods to store schemas with includes</B>
103      * @return an {@link XMLCollection XMLCollection} object.
104      * @throws RepositoryException API exception.
105      * @see RepositoryCollection
106      */

107     public RepositoryCollection getSchemaCollection() throws XMLDBCException;
108     
109     /** Open the system collection where mapping files are stored.
110      * @param name the string identifier of the collection.
111      * @return an {@link XMLCollection XMLCollection} object.
112      * @throws RepositoryException API exception.
113      * @see RepositoryCollection
114      */

115     public RepositoryCollection getMappingCollection() throws XMLDBCException;
116     
117     /** Open an existing user collection. Compared to the XDBC
118      * {@link XMLConnection#getCollection(String) getCollection()} method, this
119      * method avoids the cast operation
120      * @return a {@link RepositoryCollection XMLCollection} object.
121      * @throws RepositoryException API exception.
122      */

123     public RepositoryCollection getRepositoryCollection(String JavaDoc name) throws XMLDBCException;
124     
125     /** Set the interactive mode for queries executed with this object. The
126      * interactive mode supplies more performance on selective queries. When
127      * the interactive mode is off, the queries are executed in batch mode with
128      * is faster for queries retrieving many results.
129      * @param interactive if true, the interactive mode is enabled and used for
130      * the following query executions.
131      */

132     public void setInteractiveMode(boolean interactive);
133     
134     /** Get the current interactive mode used for queries executed with this
135      * object.
136      * @return true if the interactive mode is on. False if the batch is on.
137      */

138     public boolean getInteractiveMode();
139     
140     ///////////////////////////////////////////////////////////////////////////
141
// DEPENDENCES
142
///////////////////////////////////////////////////////////////////////////
143

144     /** Get the list of XML collection Ithat are currently using a given
145      * mapping.
146      * @param mappingID the String mapping ID
147      * @return a List of String collection IDs.
148      */

149     public List JavaDoc getCollectionsUsingMapping(String JavaDoc mappingID)
150     throws XMLDBCException;
151     
152     /** Get the list of XML collection that are currently using a given
153      * namespace.
154      * @param namespace the namespace URI
155      * @return a List of String collection IDs.
156      */

157     public List JavaDoc getCollectionsUsingNamespace(String JavaDoc namespace)
158     throws XMLDBCException;
159
160     /** Get the list of mappings that are currently using a given
161      * namespace.
162      * @param namespace the namespace URI
163      * @return a List of String mapping IDs.
164      */

165     public List JavaDoc getMappingsUsingNamespace(String JavaDoc namespace)
166     throws XMLDBCException;
167 }
168
169
170
Popular Tags