View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package javax.jdo.metadata;
18  
19  /**
20   * Represents the top-level JDO metadata.
21   * @since 3.0
22   */
23  public interface JDOMetadata extends Metadata {
24      /**
25       * Method to set the catalog (ORM) to apply to all classes in this
26       * JDO Metadata.
27       * 
28       * @param catalog Catalog name
29       */
30      JDOMetadata setCatalog(String catalog);
31  
32      /**
33       * Accessor for the catalog (ORM) that all classes in this JDO Metadata
34       * default to.
35       * 
36       * @return The catalog
37       */
38      String getCatalog();
39  
40      /**
41       * Method to set the schema (ORM) to apply to all classes in this JDO
42       * Metadata.
43       * 
44       * @param schema Schema name
45       */
46      JDOMetadata setSchema(String schema);
47  
48      /**
49       * Accessor for the schema (ORM) that all classes in this JDO Metadata
50       * default to.
51       * 
52       * @return The schema
53       */
54      String getSchema();
55  
56      /**
57       * Accessor for all packages defined on the JDO Metadata.
58       * 
59       * @return The packages
60       */
61      PackageMetadata[] getPackages();
62  
63      /**
64       * Add a new package to this JDO Metadata.
65       * 
66       * @param pkgName Name of the package
67       * @return The PackageMetadata
68       */
69      PackageMetadata newPackageMetadata(String pkgName);
70  
71      /**
72       * Add a new package to this JDO Metadata.
73       * 
74       * @param pkg The package
75       * @return The PackageMetadata
76       */
77      PackageMetadata newPackageMetadata(Package pkg);
78  
79      /**
80       * Accessor for the number of packages defined in this JDO Metadata.
81       * 
82       * @return The number of packages.
83       */
84      int getNumberOfPackages();
85  
86      /**
87       * Add a new class to this JDO Metadata.
88       * Adds its package also if not yet existing.
89       * 
90       * @param cls Class to add
91       * @return The ClassMetadata
92       */
93      ClassMetadata newClassMetadata(Class cls);
94  
95      /**
96       * Add a new interface to this JDO Metadata.
97       * Adds its package also if not yet existing.
98       * 
99       * @param cls Class to add
100      * @return The InterfaceMetadata
101      */
102     InterfaceMetadata newInterfaceMetadata(Class cls);
103 
104     /**
105      * Accessor for any named queries defined on the JDO Metadata.
106      * 
107      * @return The queries
108      */
109     QueryMetadata[] getQueries();
110 
111     /**
112      * Add a new named query to this JDO Metadata.
113      * 
114      * @param name Name of the query
115      * @return The QueryMetadata
116      */
117     QueryMetadata newQueryMetadata(String name);
118 
119     /**
120      * Accessor for the number of named queries defined in this JDO Metadata.
121      * 
122      * @return The number of queries.
123      */
124     int getNumberOfQueries();
125 
126     /**
127      * Accessor for any fetch plans defined on the JDO Metadata.
128      * 
129      * @return The fetch plans
130      */
131     FetchPlanMetadata[] getFetchPlans();
132 
133     /**
134      * Add a new fetch plan to this JDO Metadata.
135      * 
136      * @param name Name of the query
137      * @return The FetchPlanMetadata
138      */
139     FetchPlanMetadata newFetchPlanMetadata(String name);
140 
141     /**
142      * Accessor for the number of fetch plans defined in this JDO Metadata.
143      * 
144      * @return The number of fetch plans.
145      */
146     int getNumberOfFetchPlans();
147 }