001    /*
002    // $Id: Schema.java 482 2012-01-05 23:27:27Z jhyde $
003    //
004    // Licensed to Julian Hyde under one or more contributor license
005    // agreements. See the NOTICE file distributed with this work for
006    // additional information regarding copyright ownership.
007    //
008    // Julian Hyde licenses this file to you under the Apache License,
009    // Version 2.0 (the "License"); you may not use this file except in
010    // compliance with the License. You may obtain a copy of the License at:
011    //
012    // http://www.apache.org/licenses/LICENSE-2.0
013    //
014    // Unless required by applicable law or agreed to in writing, software
015    // distributed under the License is distributed on an "AS IS" BASIS,
016    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017    // See the License for the specific language governing permissions and
018    // limitations under the License.
019    */
020    package org.olap4j.metadata;
021    
022    import org.olap4j.OlapException;
023    
024    import java.util.Collection;
025    import java.util.Locale;
026    
027    /**
028     * A collection of database objects that contain structural information, or
029     * metadata, about a database.
030     *
031     * <p>A Schema belongs to a {@link Catalog} and contains a number of
032     * {@link Cube}s and shared {@link Dimension}s.
033     *
034     * @author jhyde
035     * @version $Id: Schema.java 482 2012-01-05 23:27:27Z jhyde $
036     * @since Oct 13, 2006
037     */
038    public interface Schema {
039        /**
040         * Returns the {@link Catalog} this <code>Schema</code> belongs to.
041         *
042         * @return catalog this schema belongs to
043         */
044        Catalog getCatalog();
045    
046        /**
047         * Returns the name of this Schema.
048         *
049         * @return name of this Schema
050         */
051        String getName();
052    
053        /**
054         * Returns a list of cubes in this <code>Schema</code>.
055         *
056         * <p>The caller should assume that the list is immutable;
057         * if the caller modifies the list, behavior is undefined.</p>
058         *
059         * @see org.olap4j.OlapDatabaseMetaData#getCubes
060         * @return List of cubes in this Schema
061         *
062         * @throws OlapException if database error occurs
063         */
064        NamedList<Cube> getCubes() throws OlapException;
065    
066        /**
067         * Returns a list of shared {@link Dimension} objects in this
068         * <code>Schema</code>.
069         *
070         * <p>The caller should assume that the list is immutable;
071         * if the caller modifies the list, behavior is undefined.</p>
072         *
073         * @see org.olap4j.OlapDatabaseMetaData#getDimensions(String,String,String,String)
074         *
075         * @return list of shared dimensions
076         *
077         * @throws OlapException if database error occurs
078         */
079        NamedList<Dimension> getSharedDimensions() throws OlapException;
080    
081        /**
082         * Returns a collection of {@link java.util.Locale} objects for which this
083         * <code>Schema</code> has been localized.
084         *
085         * <p>Consider the following use case. Suppose one cube is available in
086         * English and French, and in French and Spanish, and both are shown in same
087         * portal. Clients typically say that seeing reports in a mixture of
088         * languages is confusing; the portal would figure out the best common
089         * language, in this case French. This method allows the client to choose
090         * the most appropriate locale.</p>
091         *
092         * <p>The list is advisory: a client is free to choose another locale,
093         * in which case, the server will probably revert to the base locale for
094         * locale-specific behavior such as captions and formatting.
095         *
096         * @see Cube#getSupportedLocales
097         *
098         * @return List of locales for which this <code>Schema</code> has been
099         * localized
100         *
101         * @throws OlapException if database error occurs
102         */
103        Collection<Locale> getSupportedLocales() throws OlapException;
104    }
105    
106    // End Schema.java