// Path: src/main/java/com/tfsinc/ilabs/olap/OlapClientManager.java
// public class OlapClientManager {
// 
// 	/**
// 	 * Root logger instance.
// 	 */
// 	private static final Logger LOGGER = Logger.getLogger(
// 			OlapClientManager.class);
// 
// 	/**
// 	 * Initializes everything.
// 	 * @param configFile Name and path of configuration file.
// 	 */
// 	public static final void initialize(final String configFile) {
// 		OlapConfigReferences.initialize(configFile);
// 		OlapConnectionPoolManager.initialize(configFile);
// 	}
// 
// 	/**
// 	 * Shuts down everything.
// 	 * @param forceClose Whether to close active connections forcibly.
// 	 */
// 	public static final void shutdown(final boolean forceClose) {
// 		OlapConnectionPoolManager.shutdown(forceClose);
// 	}
// 
// 	/**
// 	 * @return An OLAP connection from the POOL.
// 	 */
// 	public static WrappedOlapConnection getConnection() {
// 		return OlapConnectionPoolManager.getConnection();
// 	}
// 
// 	/**
// 	 * @param connection OLAP connection to be returned to the pool.
// 	 * @return Whether the connection was returned successfully.
// 	 */
// 	public static final boolean returnConnection(
// 			final WrappedOlapConnection connection) {
// 		return OlapConnectionPoolManager.returnConnection(connection);
// 	}
// 
// 	/**
// 	 * @param query String MDX query to be executed.
// 	 * @return Cell set of the query.
// 	 */
// 	public static final CellSet executeMdxQuery(final String query) {
// 		final WrappedOlapConnection connection = getConnection();
// 		try {
// 			final long start = System.currentTimeMillis();
// 			final CellSet cellSet = connection.getResource()
// 					.createStatement().executeOlapQuery(query);
// 			if (LOGGER.isDebugEnabled()) {
// 				LOGGER.debug("Query execution time: " + (System.currentTimeMillis() - start) + " ms.");
// 			}
// 
// 			returnConnection(connection);
// 			return cellSet;
// 		} catch (OlapException e) {
// 			LOGGER.error("Unable to execute query.", e);
// 			returnConnection(connection);
// 			return null;
// 		}
// 	}
// 
// 	/**
// 	 * @param query Parsed select MDX query.
// 	 * @return Cell set of the query.
// 	 */
// 	public static final CellSet executeMdxQuery(final SelectNode query) {
// 		final WrappedOlapConnection connection = getConnection();
// 		try {
// 			final long start = System.currentTimeMillis();
// 			final CellSet cellSet = connection.getResource()
// 					.createStatement().executeOlapQuery(query);
// 			if (LOGGER.isDebugEnabled()) {
// 				LOGGER.debug("Query execution time: " + (System.currentTimeMillis() - start) + " ms.");
// 			}
// 			returnConnection(connection);
// 			return cellSet;
// 		} catch (OlapException e) {
// 			LOGGER.error("Unable to execute query.", e);
// 			returnConnection(connection);
// 			return null;
// 		}
// 	}
// 
// }


import java.sql.SQLException;
import java.util.List;
import org.apache.log4j.Logger;
import org.olap4j.Axis;
import org.olap4j.Cell;
import org.olap4j.CellSet;
import org.olap4j.CellSetAxis;
import org.olap4j.Position;
import org.olap4j.metadata.Member;
import com.tfsinc.ilabs.olap.OlapClientManager;
package com.tfsinc.ilabs.mdx.test;




public class IterationExample {

	private static final Logger LOGGER = Logger.getLogger(
			IterationExample.class);

	private static final void start() {
		OlapClientManager.initialize("olapconfig.properties");
	}

	public static void main(String[] args) throws SQLException {
		start();

// Path: src/main/java/com/tfsinc/ilabs/olap/OlapClientManager.java
// public class OlapClientManager {
// 
// 	/**
// 	 * Root logger instance.
// 	 */
// 	private static final Logger LOGGER = Logger.getLogger(
// 			OlapClientManager.class);
// 
// 	/**
// 	 * Initializes everything.
// 	 * @param configFile Name and path of configuration file.
// 	 */
// 	public static final void initialize(final String configFile) {
// 		OlapConfigReferences.initialize(configFile);
// 		OlapConnectionPoolManager.initialize(configFile);
// 	}
// 
// 	/**
// 	 * Shuts down everything.
// 	 * @param forceClose Whether to close active connections forcibly.
// 	 */
// 	public static final void shutdown(final boolean forceClose) {
// 		OlapConnectionPoolManager.shutdown(forceClose);
// 	}
// 
// 	/**
// 	 * @return An OLAP connection from the POOL.
// 	 */
// 	public static WrappedOlapConnection getConnection() {
// 		return OlapConnectionPoolManager.getConnection();
// 	}
// 
// 	/**
// 	 * @param connection OLAP connection to be returned to the pool.
// 	 * @return Whether the connection was returned successfully.
// 	 */
// 	public static final boolean returnConnection(
// 			final WrappedOlapConnection connection) {
// 		return OlapConnectionPoolManager.returnConnection(connection);
// 	}
// 
// 	/**
// 	 * @param query String MDX query to be executed.
// 	 * @return Cell set of the query.
// 	 */
// 	public static final CellSet executeMdxQuery(final String query) {
// 		final WrappedOlapConnection connection = getConnection();
// 		try {
// 			final long start = System.currentTimeMillis();
// 			final CellSet cellSet = connection.getResource()
// 					.createStatement().executeOlapQuery(query);
// 			if (LOGGER.isDebugEnabled()) {
// 				LOGGER.debug("Query execution time: " + (System.currentTimeMillis() - start) + " ms.");
// 			}
// 
// 			returnConnection(connection);
// 			return cellSet;
// 		} catch (OlapException e) {
// 			LOGGER.error("Unable to execute query.", e);
// 			returnConnection(connection);
// 			return null;
// 		}
// 	}
// 
// 	/**
// 	 * @param query Parsed select MDX query.
// 	 * @return Cell set of the query.
// 	 */
// 	public static final CellSet executeMdxQuery(final SelectNode query) {
// 		final WrappedOlapConnection connection = getConnection();
// 		try {
// 			final long start = System.currentTimeMillis();
// 			final CellSet cellSet = connection.getResource()
// 					.createStatement().executeOlapQuery(query);
// 			if (LOGGER.isDebugEnabled()) {
// 				LOGGER.debug("Query execution time: " + (System.currentTimeMillis() - start) + " ms.");
// 			}
// 			returnConnection(connection);
// 			return cellSet;
// 		} catch (OlapException e) {
// 			LOGGER.error("Unable to execute query.", e);
// 			returnConnection(connection);
// 			return null;
// 		}
// 	}
// 
// }


// Path: src/test/java/com/tfsinc/ilabs/mdx/test/IterationExample.java
import java.sql.SQLException;
import java.util.List;
import org.apache.log4j.Logger;
import org.olap4j.Axis;
import org.olap4j.Cell;
import org.olap4j.CellSet;
import org.olap4j.CellSetAxis;
import org.olap4j.Position;
import org.olap4j.metadata.Member;
import com.tfsinc.ilabs.olap.OlapClientManager;

package com.tfsinc.ilabs.mdx.test;




public class IterationExample {

	private static final Logger LOGGER = Logger.getLogger(
			IterationExample.class);

	private static final void start() {
		OlapClientManager.initialize("olapconfig.properties");
	}

	public static void main(String[] args) throws SQLException {
		start();

		CellSet cellSet = OlapClientManager.executeMdxQuery("SELECT {[Measures].[Chats],[Measures].[InteractiveChats],[Measures].[WaitTime]} ON 0, NON EMPTY ([DimScenario].[Scenario].CHILDREN,[DimQueue].[Queue].CHILDREN,[DimRuleCategory].[RuleCategory].CHILDREN,[DimChatCancelled].[ChatCancelled].CHILDREN,[DimVisitorGroup].[VisitorGroup].CHILDREN,[DimChatType].[ChatType].CHILDREN,[DimAgent].[Agent].CHILDREN,[DimScope].[Scope].CHILDREN,[DimApplication].[Application].CHILDREN,[DimBrowser].[Browser].CHILDREN,[DimOs].[Os].CHILDREN,[DimTargetpopulation].[Targetpopulation].CHILDREN,[DimCancelReason].[CancelReason].CHILDREN,[DimTerminatedBy].[TerminatedBy].CHILDREN) ON 1 FROM (SELECT [DimTime].[Calendermonth].&[2014]&[7] ON 0 FROM (SELECT [DimClient].[Client].&[1015] ON 0 FROM [247OLAP]))");