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 2.3
22   */
23  public interface JDOMetadata extends Metadata {
24      /**
25       * Method to set the catalog (ORM) to apply to all classes in this JDO Metadata.
26       * 
27       * @param catalog Catalog name
28       */
29      JDOMetadata setCatalog(String catalog);
30  
31      /**
32       * Accessor for the catalog (ORM) that all classes in this JDO Metadata
33       * default to.
34       * 
35       * @return The catalog
36       */
37      String getCatalog();
38  
39      /**
40       * Method to set the schema (ORM) to apply to all classes in this JDO
41       * Metadata.
42       * 
43       * @param schema Schema name
44       */
45      JDOMetadata setSchema(String schema);
46  
47      /**
48       * Accessor for the schema (ORM) that all classes in this JDO Metadata
49       * default to.
50       * 
51       * @return The schema
52       */
53      String getSchema();
54  
55      /**
56       * Accessor for all packages defined on the JDO Metadata.
57       * 
58       * @return The packages
59       */
60      PackageMetadata[] getPackages();
61  
62      /**
63       * Add a new package to this JDO Metadata.
64       * 
65       * @param pkgName Name of the package
66       * @return The PackageMetadata
67       */
68      PackageMetadata newPackageMetadata(String pkgName);
69  
70      /**
71       * Add a new package to this JDO Metadata.
72       * 
73       * @param pkg The package
74       * @return The PackageMetadata
75       */
76      PackageMetadata newPackageMetadata(Package pkg);
77  
78      /**
79       * Accessor for the number of packages defined in this JDO Metadata.
80       * 
81       * @return The number of packages.
82       */
83      int getNumberOfPackages();
84  
85      /**
86       * Add a new class to this JDO Metadata.
87       * Adds its package also if not yet existing.
88       * 
89       * @param cls Class to add
90       * @return The ClassMetadata
91       */
92      ClassMetadata newClassMetadata(Class cls);
93  
94      /**
95       * Add a new interface to this JDO Metadata.
96       * Adds its package also if not yet existing.
97       * 
98       * @param cls Class to add
99       * @return The InterfaceMetadata
100      */
101     InterfaceMetadata newInterfaceMetadata(Class cls);
102 
103     /**
104      * Accessor for any named queries defined on the JDO Metadata.
105      * 
106      * @return The queries
107      */
108     QueryMetadata[] getQueries();
109 
110     /**
111      * Add a new named query to this JDO Metadata.
112      * 
113      * @param name Name of the query
114      * @return The QueryMetadata
115      */
116     QueryMetadata newQueryMetadata(String name);
117 
118     /**
119      * Accessor for the number of named queries defined in this JDO Metadata.
120      * 
121      * @return The number of queries.
122      */
123     int getNumberOfQueries();
124 
125     /**
126      * Accessor for any fetch plans defined on the JDO Metadata.
127      * 
128      * @return The fetch plans
129      */
130     FetchPlanMetadata[] getFetchPlans();
131 
132     /**
133      * Add a new fetch plan to this JDO Metadata.
134      * 
135      * @param name Name of the query
136      * @return The FetchPlanMetadata
137      */
138     FetchPlanMetadata newFetchPlanMetadata(String name);
139 
140     /**
141      * Accessor for the number of fetch plans defined in this JDO Metadata.
142      * 
143      * @return The number of fetch plans.
144      */
145     int getNumberOfFetchPlans();
146 }