001 /*
002 // $Id: //open/mondrian-release/3.2/src/main/mondrian/olap/Schema.java#2 $
003 // This software is subject to the terms of the Eclipse Public License v1.0
004 // Agreement, available at the following URL:
005 // http://www.eclipse.org/legal/epl-v10.html.
006 // Copyright (C) 2006-2009 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-release/3.2/src/main/mondrian/olap/Schema.java#2 $
020 */
021 public interface Schema extends Annotated {
022
023 /**
024 * Returns the name of this schema.
025 * @post return != null
026 * @post return.length() > 0
027 */
028 String getName();
029
030 /**
031 * Returns the uniquely generated id of this schema.
032 */
033 String getId();
034
035 /**
036 * Finds a cube called <code>cube</code> in this schema; if no cube
037 * exists, <code>failIfNotFound</code> controls whether to raise an error
038 * or return <code>null</code>.
039 */
040 Cube lookupCube(String cube, boolean failIfNotFound);
041
042 /**
043 * Returns a list of all cubes in this schema.
044 */
045 Cube[] getCubes();
046
047 /**
048 * Returns a list of shared dimensions in this schema.
049 */
050 Hierarchy[] getSharedHierarchies();
051
052 /**
053 * Creates a dimension in the given cube by parsing an XML string. The XML
054 * string must be either a <Dimension> or a <DimensionUsage>.
055 * Returns the dimension created.
056 */
057 Dimension createDimension(Cube cube, String xml);
058
059 /**
060 * Creates a cube by parsing an XML string. Returns the cube created.
061 */
062 Cube createCube(String xml);
063
064 /**
065 * Removes a cube.
066 *
067 * @return Whether cube was removed
068 */
069 boolean removeCube(String cubeName);
070
071 /**
072 * Creates a {@link SchemaReader} without any access control.
073 */
074 SchemaReader getSchemaReader();
075
076 /**
077 * Finds a role with a given name in the current catalog, or returns
078 * <code>null</code> if no such role exists.
079 */
080 Role lookupRole(String role);
081
082 /**
083 * Returns this schema's function table.
084 */
085 FunTable getFunTable();
086
087 /**
088 * Returns this schema's parameters.
089 */
090 Parameter[] getParameters();
091
092 /**
093 * Returns when this schema was last loaded.
094 *
095 * @return Date and time when this schema was last loaded
096 */
097 Date getSchemaLoadDate();
098
099 /**
100 * Returns a list of warnings and errors that occurred while loading this
101 * schema.
102 *
103 * @return list of warnings
104 */
105 List<Exception> getWarnings();
106 }
107
108 // End Schema.java