001    /*
002    // $Id: //open/mondrian/src/main/mondrian/olap/Schema.java#18 $
003    // This software is subject to the terms of the Common Public License
004    // Agreement, available at the following URL:
005    // http://www.opensource.org/licenses/cpl.html.
006    // Copyright (C) 2006-2008 Julian Hyde
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package mondrian.olap;
011    
012    import java.util.Date;
013    import java.util.List;
014    
015    /**
016     * A <code>Schema</code> is a collection of cubes, shared dimensions, and roles.
017     *
018     * @author jhyde
019     * @version $Id: //open/mondrian/src/main/mondrian/olap/Schema.java#18 $
020     */
021    public interface Schema {
022    
023        /**
024         * Returns the name of this schema.
025         * @post return != null
026         * @post return.length() > 0
027         */
028        String getName();
029        /**
030         * Finds a cube called <code>cube</code> in this schema; if no cube
031         * exists, <code>failIfNotFound</code> controls whether to raise an error
032         * or return <code>null</code>.
033         */
034        Cube lookupCube(String cube,boolean failIfNotFound);
035    
036        /**
037         * Returns a list of all cubes in this schema.
038         */
039        Cube[] getCubes();
040    
041        /**
042         * Returns a list of shared dimensions in this schema.
043         */
044        Hierarchy[] getSharedHierarchies();
045    
046        /**
047         * Creates a dimension in the given cube by parsing an XML string. The XML
048         * string must be either a &lt;Dimension&gt; or a &lt;DimensionUsage&gt;.
049         * Returns the dimension created.
050         */
051        Dimension createDimension(Cube cube, String xml);
052    
053        /**
054         * Creates a cube by parsing an XML string. Returns the cube created.
055         */
056        Cube createCube(String xml);
057    
058        /**
059         * Removes a cube.
060         *
061         * @return Whether cube was removed
062         */
063        boolean removeCube(String cubeName);
064    
065        /**
066         * Creates a {@link SchemaReader} without any access control.
067         */
068        SchemaReader getSchemaReader();
069    
070        /**
071         * Finds a role with a given name in the current catalog, or returns
072         * <code>null</code> if no such role exists.
073         */
074        Role lookupRole(String role);
075    
076        /**
077         * Returns this schema's function table.
078         */
079        FunTable getFunTable();
080    
081        /**
082         * Returns this schema's parameters.
083         */
084        Parameter[] getParameters();
085    
086        /**
087         * Returns when this schema was last loaded.
088         *
089         * @return Date and time when this schema was last loaded
090         */
091        Date getSchemaLoadDate();
092    
093        /**
094         * Returns a list of warnings and errors that occurred while loading this
095         * schema.
096         *
097         * @return list of warnings
098         */
099        List<Exception> getWarnings();
100    }
101    
102    // End Schema.java