diff --git a/src/main/java/mondrian/olap/Category.java b/src/main/java/mondrian/olap/Category.java deleted file mode 100644 index f9d0051..0000000 --- a/src/main/java/mondrian/olap/Category.java +++ /dev/null @@ -1,146 +0,0 @@ -/* -// This software is subject to the terms of the Eclipse Public License v1.0 -// Agreement, available at the following URL: -// http://www.eclipse.org/legal/epl-v10.html. -// You must accept the terms of that agreement to use this software. -// -// Copyright (C) 2003-2005 Julian Hyde -// Copyright (C) 2005-2009 Pentaho -// All Rights Reserved. -*/ -package mondrian.olap; - -/** - * Cut-down version of mondrian.olap.Category. - */ -public class Category { - /** - * The singleton instance of Category. - */ - public static final Category instance = new Category(); - - private Category() { - } - - public static final int Unknown = 0; - - /** - * Array is an expression of array type. - */ - public static final int Array = 1; - - /** - * Dimension is a dimension expression. - */ - public static final int Dimension = 2; - - /** - * Hierarchy is a hierarchy expression. - */ - public static final int Hierarchy = 3; - - /** - * Level is a level expression. - */ - public static final int Level = 4; - - /** - * Logical is a boolean expression. - */ - public static final int Logical = 5; - - /** - * Member is a member expression. - */ - public static final int Member = 6; - - /** - * Numeric is a numeric expression. - */ - public static final int Numeric = 7; - - /** - * Set is a set of members or tuples. - */ - public static final int Set = 8; - - /** - * String is a string expression. - */ - public static final int String = 9; - - /** - * Tuple is a tuple expression. - */ - public static final int Tuple = 10; - - /** - * Symbol is a symbol, for example the BASC - * keyword to the Order() function. - */ - public static final int Symbol = 11; - - /** - * Cube is a cube expression. - */ - public static final int Cube = 12; - - /** - * Value is any expression yielding a string or numeric value. - */ - public static final int Value = 13; - - /** - * Integer is an integer expression. This is a subtype of - * {@link #Numeric}. - */ - public static final int Integer = 15; - - /** - * Represents a Null value - */ - public static final int Null = 16; - - /** - * Represents an empty expression. - */ - public static final int Empty = 17; - - /** - * Represents a DataTime expression. - */ - public static final int DateTime = 18; - - /** - * Expression is a flag which, when bitwise-OR-ed with a - * category value, indicates an expression (as opposed to a constant). - */ - public static final int Expression = 0; - /** Constant is a flag which, when bitwise-OR-ed with a - * category value, indicates a constant (as opposed to an expression). */ - public static final int Constant = 64; - /** Mask is a mask to remove flags. */ - public static final int Mask = 31; - - /** - * Returns whether a category represents a scalar type. - * - * @param category Category - * @return Whether is scalar - */ - public static boolean isScalar(int category) { - switch (category & Mask) { - case Value: - case Logical: - case Numeric: - case Integer: - case String: - case DateTime: - return true; - default: - return false; - } - } -} - -// End Category.java diff --git a/src/main/java/mondrian/olap/MondrianException.java b/src/main/java/mondrian/olap/MondrianException.java deleted file mode 100644 index 26df0a3..0000000 --- a/src/main/java/mondrian/olap/MondrianException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* -// This software is subject to the terms of the Eclipse Public License v1.0 -// Agreement, available at the following URL: -// http://www.eclipse.org/legal/epl-v10.html. -// You must accept the terms of that agreement to use this software. -// -// Copyright (C) 2002-2005 Julian Hyde -// Copyright (C) 2005-2005 Pentaho and others -// All Rights Reserved. -*/ -package mondrian.olap; - -/** - * Cut-down version of MondrianException. - */ -public class MondrianException extends RuntimeException { - public MondrianException(String message, Throwable cause) { - super(message, cause); - } - - public String getLocalizedMessage() { - return getMessage(); - } - - public String getMessage() { - return "Mondrian Error:" + super.getMessage(); - } -} - -// End MondrianException.java diff --git a/src/main/java/mondrian/olap/MondrianProperties.java b/src/main/java/mondrian/olap/MondrianProperties.java deleted file mode 100644 index e07a6cd..0000000 --- a/src/main/java/mondrian/olap/MondrianProperties.java +++ /dev/null @@ -1,53 +0,0 @@ -// Generated from MondrianProperties.xml. -package mondrian.olap; - -import org.eigenbase.util.property.*; - -/** - * Cut-down version of MondrianProperties. - */ -public class MondrianProperties extends MondrianPropertiesBase { - /** - * Properties, drawn from {@link System#getProperties}, - * plus the contents of "mondrian.properties" if it - * exists. A singleton. - */ - private static final MondrianProperties instance = - new MondrianProperties(); - - private MondrianProperties() { - } - - /** - * Returns the singleton. - * - * @return Singleton instance - */ - public static MondrianProperties instance() { - // NOTE: We used to instantiate on demand, but - // synchronization overhead was significant. See - // MONDRIAN-978. - return instance; - } - - /** - * If enabled, first row in the result of an XML/A drill-through request - * will be filled with the total count of rows in underlying database. - */ - public transient final BooleanProperty EnableTotalCount = - new BooleanProperty( - this, "mondrian.xmla.drillthroughTotalCount.enable", true); - - /** - *

Property that defines - * whether to enable new naming behavior.

- * - *

If true, hierarchies are named [Dimension].[Hierarchy]; if false, - * [Dimension.Hierarchy].

- */ - public transient final BooleanProperty SsasCompatibleNaming = - new BooleanProperty( - this, "mondrian.olap.SsasCompatibleNaming", true); -} - -// End MondrianProperties.java diff --git a/src/main/java/mondrian/olap/MondrianPropertiesBase.java b/src/main/java/mondrian/olap/MondrianPropertiesBase.java deleted file mode 100644 index 76c469e..0000000 --- a/src/main/java/mondrian/olap/MondrianPropertiesBase.java +++ /dev/null @@ -1,21 +0,0 @@ -/* -// This software is subject to the terms of the Eclipse Public License v1.0 -// Agreement, available at the following URL: -// http://www.eclipse.org/legal/epl-v10.html. -// You must accept the terms of that agreement to use this software. -// -// Copyright (C) 2001-2005 Julian Hyde -// Copyright (C) 2005-2011 Pentaho and others -// All Rights Reserved. -*/ -package mondrian.olap; - -import org.eigenbase.util.property.TriggerableProperties; - -/** - * Cut-down version of MondrianPropertiesBase. - */ -public abstract class MondrianPropertiesBase extends TriggerableProperties { -} - -// End MondrianPropertiesBase.java diff --git a/src/main/java/mondrian/olap/MondrianServer.java b/src/main/java/mondrian/olap/MondrianServer.java deleted file mode 100644 index e169a22..0000000 --- a/src/main/java/mondrian/olap/MondrianServer.java +++ /dev/null @@ -1,117 +0,0 @@ -/* -// This software is subject to the terms of the Eclipse Public License v1.0 -// Agreement, available at the following URL: -// http://www.eclipse.org/legal/epl-v10.html. -// You must accept the terms of that agreement to use this software. -// -// Copyright (C) 2006-2010 Pentaho -// All Rights Reserved. -*/ -package mondrian.olap; - -import java.util.*; - -/** - * Cut down version of MondrianServer to make olap4j-xmlaserver happy. - * Will obsolete soon. - */ -public class MondrianServer { - private static final MondrianServer INSTANCE = new MondrianServer(); - - private MondrianVersion version = new MondrianVersion() { - public String getVersionString() { - return null; - } - - public int getMajorVersion() { - return 0; - } - - public int getMinorVersion() { - return 0; - } - - public String getProductName() { - return null; - } - }; - - /** - * Returns the server with the given id. - * - *

If id is null, returns the catalog-less server. (The catalog-less - * server can also be acquired using its id.)

- * - *

If server is not found, returns null.

- * - * @param instanceId Server instance id - * @return Server, or null if no server with this id - */ - public static MondrianServer forId(String instanceId) { - return INSTANCE; - } - - /** - * Returns the version of this MondrianServer. - * - * @return Server's version - */ - public MondrianVersion getVersion() { - return version; - } - - /** - * Returns a list of MDX keywords. - * @return list of MDX keywords - */ - public List getKeywords() { - return Collections.emptyList(); - } - - /** - * Description of the version of the server. - */ - public interface MondrianVersion { - /** - * Returns the version string, for example "2.3.0". - * - * @see java.sql.DatabaseMetaData#getDatabaseProductVersion() - * @return Version of this server - */ - String getVersionString(); - - /** - * Returns the major part of the version number. - * - *

For example, if the full version string is "2.3.0", the major - * version is 2. - * - * @return major part of the version number - * @see java.sql.DatabaseMetaData#getDatabaseMajorVersion() - */ - int getMajorVersion(); - - /** - * Returns the minor part of the version number. - * - *

For example, if the full version string is "2.3.0", the minor - * version is 3. - * - * @return minor part of the version number - * - * @see java.sql.DatabaseMetaData#getDatabaseProductVersion() - */ - int getMinorVersion(); - - /** - * Retrieves the name of this database product. - * - * @return database product name - * @see java.sql.DatabaseMetaData#getDatabaseProductName() - */ - String getProductName(); - } - -} - -// End MondrianServer.java diff --git a/src/main/java/mondrian/xmla/DataSourcesConfig.java b/src/main/java/mondrian/xmla/DataSourcesConfig.java deleted file mode 100644 index e042702..0000000 --- a/src/main/java/mondrian/xmla/DataSourcesConfig.java +++ /dev/null @@ -1,370 +0,0 @@ -/* -// This java file was automatically generated -// from XOM model 'datasourcesconfig' -// on Tue Jul 17 22:05:45 PDT 2012 -// Do not edit this file by hand. -*/ - -package mondrian.xmla; -/** - * This is the XML model for XMLA DataSources Configuration. - *

This class was generated from XOM model 'datasourcesconfig' on Tue Jul 17 22:05:45 PDT 2012 - */ -public class DataSourcesConfig { - - public static java.lang.Class getXMLDefClass() - { - return DataSourcesConfig.class; - } - - public static String[] _elements = { - "DataSources", - "DataSource", - "DataSourceName", - "DataSourceDescription", - "URL", - "DataSourceInfo", - "ProviderName", - "ProviderType", - "AuthenticationMode", - "Definition", - "Catalogs", - "Catalog" - }; - - /** - * The list of data sources supported by XMLA service. - */ - public static class DataSources extends org.eigenbase.xom.ElementDef - { - public DataSources() - { - } - - public DataSources(org.eigenbase.xom.DOMWrapper _def) - throws org.eigenbase.xom.XOMException - { - try { - org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DataSourcesConfig.class); - org.eigenbase.xom.NodeDef[] _tempArray; - _tempArray = _parser.getArray(DataSource.class, 0, 0); - dataSources = new DataSource[_tempArray.length]; - for (int _i = 0; _i < dataSources.length; _i++) - dataSources[_i] = (DataSource)_tempArray[_i]; - } catch(org.eigenbase.xom.XOMException _ex) { - throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage()); - } - } - - - /** - * The list of data sources supported by XMLA service. - */ - public DataSource[] dataSources; //optional array - - public String getName() - { - return "DataSources"; - } - - public void display(java.io.PrintWriter _out, int _indent) - { - _out.println(getName()); - displayElementArray(_out, "dataSources", dataSources, _indent+1); - } - public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent) - { - _out.beginTag("DataSources", new org.eigenbase.xom.XMLAttrVector() - ); - displayXMLElementArray(_out, dataSources); - _out.endTag("DataSources"); - } - public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent) - { - DataSources _cother = (DataSources)_other; - boolean _diff = displayElementArrayDiff("dataSources", dataSources, _cother.dataSources, _out, _indent+1); - return _diff; - } - } - - /** - * Definition of a data source. - */ - public static class DataSource extends org.eigenbase.xom.ElementDef - { - public DataSource() - { - } - - public DataSource(org.eigenbase.xom.DOMWrapper _def) - throws org.eigenbase.xom.XOMException - { - try { - org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DataSourcesConfig.class); - name = _parser.getString(DataSourceName, true); - description = _parser.getString(DataSourceDescription, true); - url = _parser.getString(URL, true); - dataSourceInfo = _parser.getString(DataSourceInfo, true); - providerName = _parser.getString(ProviderName, true); - providerType = _parser.getString(ProviderType, true); - authenticationMode = _parser.getString(AuthenticationMode, true); - catalogs = (Catalogs)_parser.getElement(Catalogs.class, true); - } catch(org.eigenbase.xom.XOMException _ex) { - throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage()); - } - } - - - /** - * Name. - */ - public String name; //required element - /** - * Description. - */ - public String description; //required element - /** - * URL of Web Services invocation. - */ - public String url; //required element - /** - * ConnectString of Mondrian (minus the catalog entry). - * Required, but catalog may override. - */ - public String dataSourceInfo; //required element - /** - * Customized Service Provider Name. - */ - public String providerName; //required element - /** - * Ignored. Only return "MDP" for DISCOVER_DATASOURCES. - */ - public String providerType; //required element - /** - * Ignored. Only return "Unauthenticated" for DISCOVER_DATASOURCES. - */ - public String authenticationMode; //required element - /** - * One or more Catalogs. - */ - public Catalogs catalogs; //required element - - public String getName() - { - return "DataSource"; - } - - public void display(java.io.PrintWriter _out, int _indent) - { - _out.println(getName()); - displayString(_out, "name", name, _indent+1); - displayString(_out, "description", description, _indent+1); - displayString(_out, "url", url, _indent+1); - displayString(_out, "dataSourceInfo", dataSourceInfo, _indent+1); - displayString(_out, "providerName", providerName, _indent+1); - displayString(_out, "providerType", providerType, _indent+1); - displayString(_out, "authenticationMode", authenticationMode, _indent+1); - displayElement(_out, "catalogs", (org.eigenbase.xom.ElementDef) catalogs, _indent+1); - } - public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent) - { - _out.beginTag("DataSource", new org.eigenbase.xom.XMLAttrVector() - ); - displayXMLString(_out, "DataSourceName", name); - displayXMLString(_out, "DataSourceDescription", description); - displayXMLString(_out, "URL", url); - displayXMLString(_out, "DataSourceInfo", dataSourceInfo); - displayXMLString(_out, "ProviderName", providerName); - displayXMLString(_out, "ProviderType", providerType); - displayXMLString(_out, "AuthenticationMode", authenticationMode); - displayXMLElement(_out, (org.eigenbase.xom.ElementDef) catalogs); - _out.endTag("DataSource"); - } - public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent) - { - DataSource _cother = (DataSource)_other; - boolean _diff = displayStringDiff("name", name, _cother.name, _out, _indent+1); - _diff = _diff && displayStringDiff("description", description, _cother.description, _out, _indent+1); - _diff = _diff && displayStringDiff("url", url, _cother.url, _out, _indent+1); - _diff = _diff && displayStringDiff("dataSourceInfo", dataSourceInfo, _cother.dataSourceInfo, _out, _indent+1); - _diff = _diff && displayStringDiff("providerName", providerName, _cother.providerName, _out, _indent+1); - _diff = _diff && displayStringDiff("providerType", providerType, _cother.providerType, _out, _indent+1); - _diff = _diff && displayStringDiff("authenticationMode", authenticationMode, _cother.authenticationMode, _out, _indent+1); - _diff = _diff && displayElementDiff("catalogs", catalogs, _cother.catalogs, _out, _indent+1); - return _diff; - } - // BEGIN pass-through code block --- -public static final String PROVIDER_TYPE_TDP = "TDP"; - public static final String PROVIDER_TYPE_MDP = "MDP"; - public static final String PROVIDER_TYPE_DMP = "DMP"; - public static final String AUTH_MODE_UNAUTHENTICATED = "Unauthenticated"; - public static final String AUTH_MODE_AUTHENTICATED = "Authenticated"; - public static final String AUTH_MODE_INTEGRATED = "Integrated"; - - public String getDataSourceName() { - return name; - } - - public String getDataSourceDescription() { - return description; - } - - public String getURL() { - return url; - } - - public String getDataSourceInfo() { - return dataSourceInfo; - } - - public String getProviderName() { - return providerName; - } - - public String[] getProviderType() { - return new String[] {PROVIDER_TYPE_MDP}; - } - - public String getAuthenticationMode() { - return authenticationMode; - } - // END pass-through code block --- - } - - public static final String DataSourceName = "DataSourceName"; - - public static final String DataSourceDescription = "DataSourceDescription"; - - public static final String URL = "URL"; - - public static final String DataSourceInfo = "DataSourceInfo"; - - public static final String ProviderName = "ProviderName"; - - public static final String ProviderType = "ProviderType"; - - public static final String AuthenticationMode = "AuthenticationMode"; - - public static final String Definition = "Definition"; - - /** - * The list of catalogs associated with a data source. - */ - public static class Catalogs extends org.eigenbase.xom.ElementDef - { - public Catalogs() - { - } - - public Catalogs(org.eigenbase.xom.DOMWrapper _def) - throws org.eigenbase.xom.XOMException - { - try { - org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DataSourcesConfig.class); - org.eigenbase.xom.NodeDef[] _tempArray; - _tempArray = _parser.getArray(Catalog.class, 0, 0); - catalogs = new Catalog[_tempArray.length]; - for (int _i = 0; _i < catalogs.length; _i++) - catalogs[_i] = (Catalog)_tempArray[_i]; - } catch(org.eigenbase.xom.XOMException _ex) { - throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage()); - } - } - - - /** - * The list of catalogs. - */ - public Catalog[] catalogs; //optional array - - public String getName() - { - return "Catalogs"; - } - - public void display(java.io.PrintWriter _out, int _indent) - { - _out.println(getName()); - displayElementArray(_out, "catalogs", catalogs, _indent+1); - } - public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent) - { - _out.beginTag("Catalogs", new org.eigenbase.xom.XMLAttrVector() - ); - displayXMLElementArray(_out, catalogs); - _out.endTag("Catalogs"); - } - public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent) - { - Catalogs _cother = (Catalogs)_other; - boolean _diff = displayElementArrayDiff("catalogs", catalogs, _cother.catalogs, _out, _indent+1); - return _diff; - } - } - - public static class Catalog extends org.eigenbase.xom.ElementDef - { - public Catalog() - { - } - - public Catalog(org.eigenbase.xom.DOMWrapper _def) - throws org.eigenbase.xom.XOMException - { - try { - org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DataSourcesConfig.class); - name = (String)_parser.getAttribute("name", "String", null, null, true); - dataSourceInfo = _parser.getString(DataSourceInfo, false); - definition = _parser.getString(Definition, true); - } catch(org.eigenbase.xom.XOMException _ex) { - throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage()); - } - } - - public String name; // required attribute - - /** - * ConnectString of Mondrian (minus the catalog entry). - * This entry is optional; if present, it overrides the - * DataSourceInfo within the DataSource. - */ - public String dataSourceInfo; //optional element - /** - * URI of the schema definition file, for example - * "/WEB-INF/schema/Marketing.xml". - */ - public String definition; //required element - - public String getName() - { - return "Catalog"; - } - - public void display(java.io.PrintWriter _out, int _indent) - { - _out.println(getName()); - displayAttribute(_out, "name", name, _indent+1); - displayString(_out, "dataSourceInfo", dataSourceInfo, _indent+1); - displayString(_out, "definition", definition, _indent+1); - } - public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent) - { - _out.beginTag("Catalog", new org.eigenbase.xom.XMLAttrVector() - .add("name", name) - ); - displayXMLString(_out, "DataSourceInfo", dataSourceInfo); - displayXMLString(_out, "Definition", definition); - _out.endTag("Catalog"); - } - public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent) - { - Catalog _cother = (Catalog)_other; - boolean _diff = displayAttributeDiff("name", name, _cother.name, _out, _indent+1); - _diff = _diff && displayStringDiff("dataSourceInfo", dataSourceInfo, _cother.dataSourceInfo, _out, _indent+1); - _diff = _diff && displayStringDiff("definition", definition, _cother.definition, _out, _indent+1); - return _diff; - } - } - - -} diff --git a/src/main/java/mondrian/xmla/DataSourcesConfig.xml b/src/main/java/mondrian/xmla/DataSourcesConfig.xml deleted file mode 100644 index 59bffe1..0000000 --- a/src/main/java/mondrian/xmla/DataSourcesConfig.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - -This is the XML model for XMLA DataSources Configuration. - - - - - -

The list of data sources supported by XMLA service.

- - - - The list of data sources supported by XMLA service. - - - - - - - - Definition of a data source. - - - - Name. - - - - - Description. - - - - - URL of Web Services invocation. - - - - - ConnectString of Mondrian (minus the catalog entry). - Required, but catalog may override. - - - - - Customized Service Provider Name. - - - - - Ignored. Only return "MDP" for DISCOVER_DATASOURCES. - - - - - Ignored. Only return "Unauthenticated" for DISCOVER_DATASOURCES. - - - - - One or more Catalogs. - - - - - - - - - - - - - - - - - - -

The list of catalogs associated with a data source.

-
- - - The list of catalogs. - - -
- - - - - - Name of the catalog. - - - - - ConnectString of Mondrian (minus the catalog entry). - This entry is optional; if present, it overrides the - DataSourceInfo within the DataSource. - - - - - URI of the schema definition file, for example - "/WEB-INF/schema/Marketing.xml". - - - - - - - diff --git a/src/main/java/mondrian/xmla/PropertyDefinition.java b/src/main/java/mondrian/xmla/PropertyDefinition.java index 538fe36..21980da 100644 --- a/src/main/java/mondrian/xmla/PropertyDefinition.java +++ b/src/main/java/mondrian/xmla/PropertyDefinition.java @@ -5,13 +5,11 @@ // You must accept the terms of that agreement to use this software. // // Copyright (C) 2003-2005 Julian Hyde -// Copyright (C) 2005-2011 Pentaho +// Copyright (C) 2005-2012 Pentaho // All Rights Reserved. */ package mondrian.xmla; -import mondrian.olap.MondrianServer; - import org.olap4j.impl.Olap4jUtil; import org.olap4j.metadata.XmlaConstants; @@ -150,7 +148,7 @@ public enum PropertyDefinition { RowsetDefinition.Type.String, null, XmlaConstants.Access.Read, - "Mondrian XML for Analysis Provider", + "olap4j-xmlaserver", XmlaConstants.Method.DISCOVER, "The XML for Analysis Provider name."), @@ -158,7 +156,7 @@ public enum PropertyDefinition { RowsetDefinition.Type.String, null, XmlaConstants.Access.Read, - MondrianServer.forId(null).getVersion().getVersionString(), + "0.1", XmlaConstants.Method.DISCOVER, "The version of the Mondrian XMLA Provider"), diff --git a/src/main/java/mondrian/xmla/Rowset.java b/src/main/java/mondrian/xmla/Rowset.java index a8b8961..9440f89 100644 --- a/src/main/java/mondrian/xmla/Rowset.java +++ b/src/main/java/mondrian/xmla/Rowset.java @@ -10,7 +10,7 @@ */ package mondrian.xmla; -import mondrian.olap.Util; +import org.olap4j.xmla.server.impl.Util; import org.apache.log4j.Logger; @@ -378,7 +378,7 @@ protected void populate( * Creates a condition functor based on the restrictions on a given metadata * column specified in an XMLA request. * - *

A condition is a {@link mondrian.olap.Util.Function1} whose return + *

A condition is a {@link org.olap4j.xmla.server.impl.Util.Function1} whose return * type is boolean. * * Restrictions are used in each Rowset's discovery request. If there is no diff --git a/src/main/java/mondrian/xmla/RowsetDefinition.java b/src/main/java/mondrian/xmla/RowsetDefinition.java index 6282cac..c1d8679 100644 --- a/src/main/java/mondrian/xmla/RowsetDefinition.java +++ b/src/main/java/mondrian/xmla/RowsetDefinition.java @@ -10,8 +10,8 @@ */ package mondrian.xmla; -import mondrian.olap.*; -import mondrian.util.Composite; +import org.olap4j.xmla.server.impl.Composite; +import org.olap4j.xmla.server.impl.Util; import org.olap4j.OlapConnection; import org.olap4j.OlapException; @@ -37,7 +37,8 @@ import java.text.SimpleDateFormat; import java.util.*; -import static mondrian.olap.Util.filter; +import static org.olap4j.xmla.server.impl.Util.filter; + import static mondrian.xmla.XmlaConstants.*; import static mondrian.xmla.XmlaHandler.getExtra; @@ -1814,6 +1815,7 @@ public void populateImpl( XmlaResponse response, OlapConnection connection, List rows) throws XmlaException { + final XmlaHandler.XmlaExtra extra = getExtra(connection); for (PropertyDefinition propertyDefinition : PropertyDefinition.class.getEnumConstants()) { @@ -1827,7 +1829,7 @@ public void populateImpl( row.set(PropertyType.name, propertyDefinition.type.getName()); row.set(PropertyAccessType.name, propertyDefinition.access); row.set(IsRequired.name, false); - row.set(Value.name, propertyDefinition.value); + row.set(Value.name, extra.getPropertyValue(propertyDefinition)); addRow(row, rows); } } @@ -2005,8 +2007,8 @@ public void populateImpl( XmlaResponse response, OlapConnection connection, List rows) throws XmlaException { - MondrianServer mondrianServer = MondrianServer.forId(null); - for (String keyword : mondrianServer.getKeywords()) { + final XmlaHandler.XmlaExtra extra = getExtra(connection); + for (String keyword : extra.getKeywords()) { Row row = new Row(); row.set(Keyword.name, keyword); addRow(row, rows); @@ -3031,6 +3033,7 @@ public void populateImpl( List rows) throws XmlaException, OlapException { + final XmlaHandler.XmlaExtra extra = getExtra(connection); for (Catalog catalog : catIter(connection, catNameCond(), tableCatalogCond)) { @@ -3071,7 +3074,7 @@ public void populateImpl( : dimension.getHierarchies()) { populateHierarchy( - cube, hierarchy, rows); + extra, cube, hierarchy, rows); } } } @@ -3080,7 +3083,10 @@ public void populateImpl( } private void populateHierarchy( - Cube cube, Hierarchy hierarchy, List rows) + XmlaHandler.XmlaExtra extra, + Cube cube, + Hierarchy hierarchy, + List rows) { if (hierarchy.getName().endsWith("$Parent")) { // We don't return generated Parent-Child @@ -3088,11 +3094,12 @@ private void populateHierarchy( return; } for (Level level : hierarchy.getLevels()) { - populateLevel(cube, hierarchy, level, rows); + populateLevel(extra, cube, hierarchy, level, rows); } } private void populateLevel( + XmlaHandler.XmlaExtra extra, Cube cube, Hierarchy hierarchy, Level level, @@ -3100,7 +3107,7 @@ private void populateLevel( { String schemaName = cube.getSchema().getName(); String cubeName = cube.getName(); - String hierarchyName = getHierarchyName(hierarchy); + String hierarchyName = extra.getHierarchyName(hierarchy); String levelName = level.getName(); String tableName = @@ -4017,41 +4024,6 @@ public enum VarType { Byte("Byte subtype"), Array("Array subtype"); - public static VarType forCategory(int category) { - switch (category) { - case Category.Unknown: - // expression == unknown ??? - // case Category.Expression: - return Empty; - case Category.Array: - return Array; - case Category.Dimension: - case Category.Hierarchy: - case Category.Level: - case Category.Member: - case Category.Set: - case Category.Tuple: - case Category.Cube: - case Category.Value: - return Variant; - case Category.Logical: - return Boolean; - case Category.Numeric: - return Double; - case Category.String: - case Category.Symbol: - case Category.Constant: - return String; - case Category.DateTime: - return Date; - case Category.Integer: - case Category.Mask: - return Integer; - } - // NOTE: this should never happen - return Empty; - } - VarType(String description) { Util.discard(description); } @@ -4488,7 +4460,7 @@ protected void populateHierarchy( if (desc == null) { desc = cube.getName() + " Cube - " - + getHierarchyName(hierarchy) + " Hierarchy"; + + extra.getHierarchyName(hierarchy) + " Hierarchy"; } Row row = new Row(); @@ -4853,7 +4825,7 @@ protected boolean outputLevel( if (desc == null) { desc = cube.getName() + " Cube - " - + getHierarchyName(hierarchy) + " Hierarchy - " + + extra.getHierarchyName(hierarchy) + " Hierarchy - " + level.getName() + " Level"; } @@ -6054,8 +6026,7 @@ private void populateCell(List rows) { private void populateMember(List rows) throws SQLException { OlapConnection connection = handler.getConnection( - request, - Collections.emptyMap()); + request, Collections.emptyMap()); for (Catalog catalog : catIter(connection, catNameCond(), catalogCond)) { @@ -6153,11 +6124,12 @@ private void populateLevel( continue; } outputProperty( - property, catalog, cube, level, rows); + extra, property, catalog, cube, level, rows); } } private void outputProperty( + XmlaHandler.XmlaExtra extra, Property property, Catalog catalog, Cube cube, @@ -6193,7 +6165,7 @@ private void outputProperty( String desc = cube.getName() + " Cube - " - + getHierarchyName(hierarchy) + " Hierarchy - " + + extra.getHierarchyName(hierarchy) + " Hierarchy - " + level.getName() + " Level - " + property.getName() + " Property"; row.set(Description.name, desc); @@ -6310,17 +6282,6 @@ static Iterable filteredCubes( iterable); } - private static String getHierarchyName(Hierarchy hierarchy) { - String hierarchyName = hierarchy.getName(); - if (MondrianProperties.instance().SsasCompatibleNaming.get() - && !hierarchyName.equals(hierarchy.getDimension().getName())) - { - hierarchyName = - hierarchy.getDimension().getName() + "." + hierarchyName; - } - return hierarchyName; - } - private static XmlaRequest wrapRequest( XmlaRequest request, Map map) { diff --git a/src/main/java/mondrian/xmla/XmlaException.java b/src/main/java/mondrian/xmla/XmlaException.java index dce3a6c..efe5036 100644 --- a/src/main/java/mondrian/xmla/XmlaException.java +++ b/src/main/java/mondrian/xmla/XmlaException.java @@ -4,13 +4,11 @@ // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // -// Copyright (C) 2006-2009 Pentaho and others +// Copyright (C) 2006-2012 Pentaho and others // All Rights Reserved. */ package mondrian.xmla; -import mondrian.olap.MondrianException; - /** * An exception thrown while processing an XMLA request. The faultcode * corresponds to the SOAP Fault faultcode and the faultstring @@ -18,7 +16,7 @@ * * @author Richard M. Emberson */ -public class XmlaException extends MondrianException { +public class XmlaException extends RuntimeException { public static String formatFaultCode(XmlaException xex) { return formatFaultCode(xex.getFaultCode(), xex.getCode()); diff --git a/src/main/java/mondrian/xmla/XmlaHandler.java b/src/main/java/mondrian/xmla/XmlaHandler.java index 095cf2f..4b8c52c 100644 --- a/src/main/java/mondrian/xmla/XmlaHandler.java +++ b/src/main/java/mondrian/xmla/XmlaHandler.java @@ -10,11 +10,11 @@ */ package mondrian.xmla; -import mondrian.olap.MondrianProperties; -import mondrian.olap.Util; -import mondrian.util.CompositeList; import mondrian.xmla.impl.DefaultSaxWriter; +import org.olap4j.xmla.server.impl.CompositeList; +import org.olap4j.xmla.server.impl.Util; + import org.apache.log4j.Logger; import org.olap4j.*; @@ -1345,9 +1345,6 @@ private QueryResult executeDrillThroughQuery(XmlaRequest request) final String advancedFlag = properties.get(PropertyDefinition.AdvancedFlag.name()); final boolean advanced = Boolean.parseBoolean(advancedFlag); - final boolean enableRowCount = - MondrianProperties.instance().EnableTotalCount.booleanValue(); - final int[] rowCountSlot = enableRowCount ? new int[]{0} : null; OlapConnection connection = null; OlapStatement statement = null; ResultSet resultSet = null; @@ -1355,8 +1352,11 @@ private QueryResult executeDrillThroughQuery(XmlaRequest request) connection = getConnection(request, Collections.emptyMap()); statement = connection.createStatement(); + final XmlaExtra extra = getExtra(connection); + final boolean enableRowCount = extra.isTotalCountEnabled(); + final int[] rowCountSlot = enableRowCount ? new int[]{0} : null; resultSet = - getExtra(connection).executeDrillthrough( + extra.executeDrillthrough( statement, request.getStatement(), advanced, @@ -3047,6 +3047,38 @@ List> getDataSources(OlapConnection connection) Map getAnnotationMap(MetadataElement element) throws SQLException; + /** + * Returns how the name of a hierarchy is to be printed in the + * response to an XMLA metadata request. + * + * @param hierarchy Hierarchy + * @return Formatted hierarchy name + */ + String getHierarchyName(Hierarchy hierarchy); + + /** + * Returns whether the first row in the result of an XML/A drill-through + * request will be filled with the total count of rows in underlying + * database. + */ + boolean isTotalCountEnabled(); + + /** + * Returns the value of a property. + * + * @param propertyDefinition Property definition + * + * @return Value of the property + */ + String getPropertyValue(PropertyDefinition propertyDefinition); + + /** + * Returns a list of MDX keywords. + * + * @return list of MDX keywords + */ + List getKeywords(); + class FunctionDefinition { public final String functionName; public final String description; @@ -3174,18 +3206,41 @@ public List> getDataSources( final String providerTypes = createCsv(olapDb.getProviderTypes()); return Collections.singletonList( Olap4jUtil.mapOf( - "DataSourceName", (Object) olapDb.getName(), - "DataSourceDescription", olapDb.getDescription(), - "URL", olapDb.getURL(), - "DataSourceInfo", olapDb.getDataSourceInfo(), - "ProviderName", olapDb.getProviderName(), - "ProviderType", providerTypes, - "AuthenticationMode", modes)); + "DataSourceName", + (Object) olapDb.getName(), + "DataSourceDescription", + olapDb.getDescription(), + "URL", + olapDb.getURL(), + "DataSourceInfo", + olapDb.getDataSourceInfo(), + "ProviderName", + olapDb.getProviderName(), + "ProviderType", + providerTypes, + "AuthenticationMode", + modes)); } public Map getAnnotationMap(MetadataElement element) { return Collections.emptyMap(); } + + public String getHierarchyName(Hierarchy hierarchy) { + return hierarchy.getName(); + } + + public boolean isTotalCountEnabled() { + return false; + } + + public String getPropertyValue(PropertyDefinition propertyDefinition) { + return propertyDefinition.value; + } + + public List getKeywords() { + return Collections.emptyList(); + } } private static String createCsv(Iterable iterable) { diff --git a/src/main/java/mondrian/xmla/XmlaUtil.java b/src/main/java/mondrian/xmla/XmlaUtil.java index 21a5734..d8c3ff5 100644 --- a/src/main/java/mondrian/xmla/XmlaUtil.java +++ b/src/main/java/mondrian/xmla/XmlaUtil.java @@ -5,15 +5,15 @@ // You must accept the terms of that agreement to use this software. // // Copyright (C) 2003-2005 Julian Hyde -// Copyright (C) 2005-2011 Pentaho +// Copyright (C) 2005-2012 Pentaho // All Rights Reserved. */ package mondrian.xmla; -import mondrian.olap.MondrianException; -import mondrian.olap.Util; import mondrian.xmla.impl.DefaultXmlaResponse; +import org.olap4j.xmla.server.impl.Util; + import org.olap4j.OlapConnection; import org.olap4j.OlapException; @@ -235,7 +235,7 @@ public static String textInElement(Element elem) { public static Throwable rootThrowable(Throwable throwable) { Throwable rootThrowable = throwable.getCause(); if (rootThrowable != null - && rootThrowable instanceof MondrianException) + && rootThrowable instanceof XmlaException) { return rootThrowable(rootThrowable); } diff --git a/src/main/java/mondrian/xmla/datasourcesconfig.dtd b/src/main/java/mondrian/xmla/datasourcesconfig.dtd deleted file mode 100644 index 9dce29f..0000000 --- a/src/main/java/mondrian/xmla/datasourcesconfig.dtd +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/mondrian/xmla/impl/DefaultSaxWriter.java b/src/main/java/mondrian/xmla/impl/DefaultSaxWriter.java index e922a2f..4cf1cbb 100644 --- a/src/main/java/mondrian/xmla/impl/DefaultSaxWriter.java +++ b/src/main/java/mondrian/xmla/impl/DefaultSaxWriter.java @@ -4,15 +4,16 @@ // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // -// Copyright (C) 2005-2011 Pentaho +// Copyright (C) 2005-2012 Pentaho // All Rights Reserved. */ package mondrian.xmla.impl; -import mondrian.olap.Util; -import mondrian.util.ArrayStack; import mondrian.xmla.SaxWriter; +import org.olap4j.xmla.server.impl.ArrayStack; +import org.olap4j.xmla.server.impl.Util; + import org.eigenbase.xom.XMLUtil; import org.eigenbase.xom.XOMUtil; diff --git a/src/main/java/mondrian/xmla/impl/DefaultXmlaRequest.java b/src/main/java/mondrian/xmla/impl/DefaultXmlaRequest.java index 447dc04..1d373f9 100644 --- a/src/main/java/mondrian/xmla/impl/DefaultXmlaRequest.java +++ b/src/main/java/mondrian/xmla/impl/DefaultXmlaRequest.java @@ -4,14 +4,15 @@ // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // -// Copyright (C) 2005-2011 Pentaho +// Copyright (C) 2005-2012 Pentaho // All Rights Reserved. */ package mondrian.xmla.impl; -import mondrian.olap.Util; import mondrian.xmla.*; +import org.olap4j.xmla.server.impl.Util; + import org.apache.log4j.Logger; import org.w3c.dom.*; diff --git a/src/main/java/mondrian/xmla/impl/DefaultXmlaResponse.java b/src/main/java/mondrian/xmla/impl/DefaultXmlaResponse.java index 708db34..f64799d 100644 --- a/src/main/java/mondrian/xmla/impl/DefaultXmlaResponse.java +++ b/src/main/java/mondrian/xmla/impl/DefaultXmlaResponse.java @@ -4,14 +4,15 @@ // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // -// Copyright (C) 2005-2010 Pentaho +// Copyright (C) 2005-2012 Pentaho // All Rights Reserved. */ package mondrian.xmla.impl; -import mondrian.olap.Util; import mondrian.xmla.*; +import org.olap4j.xmla.server.impl.Util; + import java.io.OutputStream; import java.io.UnsupportedEncodingException; diff --git a/src/main/java/mondrian/xmla/impl/JsonSaxWriter.java b/src/main/java/mondrian/xmla/impl/JsonSaxWriter.java index 784b23d..9ec8b2c 100644 --- a/src/main/java/mondrian/xmla/impl/JsonSaxWriter.java +++ b/src/main/java/mondrian/xmla/impl/JsonSaxWriter.java @@ -4,15 +4,16 @@ // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // -// Copyright (C) 2010-2010 Pentaho +// Copyright (C) 2010-2012 Pentaho // All Rights Reserved. */ package mondrian.xmla.impl; -import mondrian.olap.Util; -import mondrian.util.ArrayStack; import mondrian.xmla.SaxWriter; +import org.olap4j.xmla.server.impl.ArrayStack; +import org.olap4j.xmla.server.impl.Util; + import java.io.IOException; import java.io.OutputStream; import java.util.Arrays; diff --git a/src/main/java/mondrian/xmla/impl/Olap4jXmlaServlet.java b/src/main/java/mondrian/xmla/impl/Olap4jXmlaServlet.java index 2dae467..82c469f 100644 --- a/src/main/java/mondrian/xmla/impl/Olap4jXmlaServlet.java +++ b/src/main/java/mondrian/xmla/impl/Olap4jXmlaServlet.java @@ -9,10 +9,11 @@ */ package mondrian.xmla.impl; -import mondrian.olap.Util; import mondrian.xmla.XmlaHandler; import mondrian.xmla.XmlaRequest; +import org.olap4j.xmla.server.impl.Util; + import org.apache.commons.dbcp.BasicDataSource; import org.apache.commons.dbcp.DelegatingConnection; import org.apache.log4j.Logger; diff --git a/src/main/java/mondrian/util/ArrayStack.java b/src/main/java/org/olap4j/xmla/server/impl/ArrayStack.java similarity index 95% rename from src/main/java/mondrian/util/ArrayStack.java rename to src/main/java/org/olap4j/xmla/server/impl/ArrayStack.java index bbbfd0c..50694a3 100644 --- a/src/main/java/mondrian/util/ArrayStack.java +++ b/src/main/java/org/olap4j/xmla/server/impl/ArrayStack.java @@ -4,10 +4,10 @@ // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // -// Copyright (C) 2009-2010 Pentaho +// Copyright (C) 2009-2012 Pentaho // All Rights Reserved. */ -package mondrian.util; +package org.olap4j.xmla.server.impl; import java.util.ArrayList; import java.util.EmptyStackException; diff --git a/src/main/java/mondrian/util/Composite.java b/src/main/java/org/olap4j/xmla/server/impl/Composite.java similarity index 98% rename from src/main/java/mondrian/util/Composite.java rename to src/main/java/org/olap4j/xmla/server/impl/Composite.java index f1165ef..1ecdea0 100644 --- a/src/main/java/mondrian/util/Composite.java +++ b/src/main/java/org/olap4j/xmla/server/impl/Composite.java @@ -4,10 +4,10 @@ // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // -// Copyright (C) 2011-2011 Pentaho +// Copyright (C) 2011-2012 Pentaho // All Rights Reserved. */ -package mondrian.util; +package org.olap4j.xmla.server.impl; import java.util.*; diff --git a/src/main/java/mondrian/util/CompositeList.java b/src/main/java/org/olap4j/xmla/server/impl/CompositeList.java similarity index 95% rename from src/main/java/mondrian/util/CompositeList.java rename to src/main/java/org/olap4j/xmla/server/impl/CompositeList.java index db371dc..d2ce2b6 100644 --- a/src/main/java/mondrian/util/CompositeList.java +++ b/src/main/java/org/olap4j/xmla/server/impl/CompositeList.java @@ -4,10 +4,10 @@ // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // -// Copyright (C) 2009-2010 Pentaho +// Copyright (C) 2009-2012 Pentaho // All Rights Reserved. */ -package mondrian.util; +package org.olap4j.xmla.server.impl; import java.util.AbstractList; import java.util.List; diff --git a/src/main/java/mondrian/olap/Util.java b/src/main/java/org/olap4j/xmla/server/impl/Util.java similarity index 96% rename from src/main/java/mondrian/olap/Util.java rename to src/main/java/org/olap4j/xmla/server/impl/Util.java index 3c25c52..ee7cd7e 100644 --- a/src/main/java/mondrian/olap/Util.java +++ b/src/main/java/org/olap4j/xmla/server/impl/Util.java @@ -8,12 +8,10 @@ // Copyright (C) 2005-2012 Pentaho and others // All Rights Reserved. */ -package mondrian.olap; +package org.olap4j.xmla.server.impl; import org.apache.commons.collections.Predicate; -import org.eigenbase.xom.XOMUtil; - import java.math.BigDecimal; import java.math.MathContext; import java.util.*; @@ -22,10 +20,41 @@ /** * Cut-down version of mondrian.olap.Util. */ -public class Util extends XOMUtil { +public class Util { public static final String nl = System.getProperty("line.separator"); + /** + * When the compiler is complaining that you are not using a variable, just + * call one of these routines with it. + **/ + public static void discard(boolean b) { + } + + public static void discard(byte b) { + } + + public static void discard(char c) { + } + + public static void discard(double d) { + } + + public static void discard(float d) { + } + + public static void discard(int i) { + } + + public static void discard(long l) { + } + + public static void discard(Object o) { + } + + public static void discard(short s) { + } + /** * Appends a double-quoted string to a string builder. */