KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > mapper > metadata > PathMetadata


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 /*
24  * PathMetadata.java
25  *
26  * Created on 18 septembre 2001, 18:11
27  */

28 package org.xquark.mapper.metadata;
29
30 import java.util.Collection JavaDoc;
31 import java.util.List JavaDoc;
32
33 import org.xquark.mapper.mapping.ColumnMapping;
34
35 /**
36  * Common interface for accessing an XML collection metadata for a particular
37  * path. Should be used both by both storage and query modules.
38  *
39  */

40 public interface PathMetadata extends StoragePathMetadata
41 {
42     /**
43      * Get the column mapping corresponding to one of the table mappings
44      * passed as a parameter.
45      * @param tableMappingIndexes an array containing the mapping numerical IDs
46      * (index) of table mappings
47      * @return the reference one if no table or multiple mapping match. Null if
48      * no column mappings available
49      * @see org.xquark.mapper.mapping.TableMapping
50      * @see org.xquark.mapper.mapping.ColumnMapping
51      */

52      ColumnMapping getColumnMapping(int[] tableMappingIndexes);
53      
54      /**
55       * Get the MetadataNode on which the table mapping corresponding to
56       * the 'read' column mapping is defined.
57       * @return null if no column mapping is defined on the current path
58       */

59      PathMetadata getTableMappingPath(); // to perform at run-time (pre-compilation could be processed using mapping loader method)
60

61      /**
62       * Get the MetadataNode on which the table mapping corresponding to the
63       * specified column mapping is defined.
64       * @param column the column mapping which the table mapping path is searched
65       * for
66       * @return the path of the node on which the table mapping is defined
67       * @see org.xquark.mapper.mapping.ColumnMapping
68       */

69      PathMetadata getTableMappingPath(ColumnMapping column); // to perform a run-time (pre-compilation could be processed using mapping loader method)
70

71      /**
72       * Get the depth of the node in the metadata tree.
73       * @return an int value where the tree root has 0 value.
74       */

75      int getDepth();
76      
77      /** Flag to indicate if the node can be removed from the storage
78       * model (no OID allocated).
79       * i.e., getStorageMode() == DISCARDED
80       * @return true if node can be optimized
81       */

82     boolean isDiscardable();
83     
84     /** Indicate if the path may have extra-data (xsi and xmlns attributes)
85      * regarding the documents stored in the database.
86      * @return True if a some paths have extra-data (but not all.
87      */

88     boolean hasExtraData();
89     
90     /** Indicate if the position of the node children is enforced
91      * by schema information.
92      * @return True if positon of the node can be enforced by schema information.
93      */

94     boolean isChildrenPositionEnforced();
95     
96     /** Get the table mappings needed to build the element (default included
97      * if necessary).
98      * @return null if the node cannot be built from itself but using its
99      * builder ancestor node.
100      */

101     Collection JavaDoc getBuildMappings();
102     
103      /**
104       * Get the first ancestor having in scope all the tables to build itself
105       * and the current node.
106       * @return a PathMetadata node.
107       */

108      PathMetadata getBuildableAncestor(); // TO PRECOMPILE ?
109

110      /**
111       * Get the first ancestor having in scope all the tables to build the
112       * current node (even if itself is not buildable).
113       * @return a PathMetadata node.
114       */

115      PathMetadata getBuilderAncestor(); // TO PRECOMPILE ?
116

117      /**
118       * Get the first ancestor having a structure tuple.
119       * <I>Potentially useless.</I>
120       * @return a PathMetadata node.
121       */

122      PathMetadata getStructAncestor(); // USE ?
123

124      /**
125       * Get the first ancestor having an OID.
126       * @return a PathMetadata node.
127       */

128      PathMetadata getModelAncestor();
129      
130      /**
131       * Get the minimum & maximum number of occurences of this path
132       * in an ancestor.
133       * @param ancestor the ancestor PathMetadata node which the occurrence is
134       * calculated in . If the parameter node is not
135       * encountered as one of the current node ancestor,
136       * calculation is performed relatively to the metadata
137       * tree root.
138       * @return a two int arrays where first if the minimum number of
139       * occurence, and the second is the maximum.
140       */

141     int[] getOccurenceCount(PathMetadata ancestor); // to perform at run-time (pre-compilation could be processed using mapping loader method)
142

143     /** Return true if the element can only appear one time in its parent.
144      * @return true if monovaluated
145      */

146     boolean isMonoValuated();
147     
148     /** Return true if the element can appear several times in its parent.
149      * @return true if multivaluated
150      */

151     boolean isMultiValuated();
152     
153     /** Return true if the element can be missing if its parent exists.
154      * @return true if optional
155      */

156     boolean isOptional();
157     
158     /** Return a list of the path nodes with an OID contained in the subtree.
159      * @return null if the path is of root type.
160      */

161     public List JavaDoc getModelSubPaths();
162     
163     /** Return a list of the path nodes with or without an OID contained in
164      * the subtree.
165      * @return null if the path is of root type.
166      */

167     public List JavaDoc getSubPaths();
168     
169     /** get column mapping used for reconstruction and queries (that may be
170      * different than the user-defined ones). Data may or may not exist.
171      * This method returns a value only if node type is TEXT_ONLY. For MIXED,
172      * use the {@link getTextColumnMapping()} method.
173      */

174     public ColumnMapping getReadColumnMapping();
175     
176     /** get Table mapping used for reconstruction and queries (that may be
177      * different than the user-defined ones). Data may or may not exist.
178      * This method returns a value only if node type is TEXT_ONLY. For MIXED,
179      * use the {@link getTextTableMapping()} method.
180      */

181     public CollectionMappingInfo getReadTableMapping();
182
183     /** Shortcut to the schema content type.
184      * @return true if elemnt is mixed.
185      */

186     boolean isMixed();
187     
188     /** get column mapping used for text nodes. This method returns a value only
189      * if {@link isMixed()} is true
190      */

191     public ColumnMapping getTextColumnMapping();
192     
193     /** get table mapping used for text nodes. This method returns a value only
194      * if {@link isMixed()} is true
195      */

196     public CollectionMappingInfo getTextTableMapping();
197
198 }
199
200
Popular Tags