• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OlapWrapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.olap4j.OlapWrapper的典型用法代码示例。如果您正苦于以下问题:Java OlapWrapper类的具体用法?Java OlapWrapper怎么用?Java OlapWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OlapWrapper类属于org.olap4j包,在下文中一共展示了OlapWrapper类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testCannedProcedure

import org.olap4j.OlapWrapper; //导入依赖的package包/类
@Test public void testCannedProcedure() throws Exception {
	String ddl = "create foreign procedure proc(arg integer, arg1 date) returns table (x string) options (\"teiid_rel:native-query\" '$2 $1 something')";
	String query = "exec proc(2, {d'1970-01-01'})";
	
	TransformationMetadata tm = RealMetadataFactory.fromDDL(ddl, "x", "phy");
	
	CommandBuilder commandBuilder = new CommandBuilder(tm);
       Command obj = commandBuilder.getCommand(query);
        
	OlapExecutionFactory oef = new OlapExecutionFactory();
	Connection mock = Mockito.mock(java.sql.Connection.class);
	OlapWrapper mock2 = Mockito.mock(OlapWrapper.class);
	OlapConnection mock3 = Mockito.mock(OlapConnection.class);
	OlapStatement mock4 = Mockito.mock(OlapStatement.class);
	Mockito.stub(mock4.executeOlapQuery(Mockito.anyString())).toThrow(new TeiidRuntimeException());
	Mockito.stub(mock3.createStatement()).toReturn(mock4);
	Mockito.stub(mock2.unwrap(OlapConnection.class)).toReturn(mock3);
	Mockito.stub(mock.unwrap(OlapWrapper.class)).toReturn(mock2);
	ProcedureExecution pe = oef.createProcedureExecution((Call)obj, Mockito.mock(ExecutionContext.class), new RuntimeMetadataImpl(tm), mock);
	try {
		pe.execute();
		fail();
	} catch (TeiidRuntimeException e) {
		Mockito.verify(mock4).executeOlapQuery("'1970-01-01' 2 something");
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:27,代码来源:TestOlapTranslator.java


示例2: unwrap

import org.olap4j.OlapWrapper; //导入依赖的package包/类
private OlapConnection unwrap(Connection conn) throws TranslatorException {
   	try {
   		OlapWrapper wrapper = conn.unwrap(OlapWrapper.class);
   		OlapConnection olapConn = wrapper.unwrap(OlapConnection.class);
   		return olapConn;
   	} catch(SQLException e) {
   		throw new TranslatorException(e);
   	}		
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:10,代码来源:OlapExecutionFactory.java


示例3: getOlapConnection

import org.olap4j.OlapWrapper; //导入依赖的package包/类
/**
 * Gets an olap4j connection, creating a new one if fresh is true.
 *
 * @return mondrian Connection.
 */
public synchronized OlapConnection getOlapConnection() throws SQLException {
    if (this.connectString == null) {
        makeConnectString();
    }
    final String olapConnectString = "jdbc:mondrian:" + connectString;
    final java.sql.Connection jdbcConnection =
        java.sql.DriverManager.getConnection(olapConnectString);
    // Cast to OlapWrapper lets code work on JDK1.5, before java.sql.Wrapper
    //noinspection RedundantCast
    return ((OlapWrapper) jdbcConnection).unwrap(OlapConnection.class);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:17,代码来源:CmdRunner.java


示例4: getConnection

import org.olap4j.OlapWrapper; //导入依赖的package包/类
OlapConnection getConnection(
    CatalogInfo catalogInfo,
    MondrianServer server,
    String roleName,
    Properties props)
    throws SQLException
{
  String connectString = catalogInfo.olap4jConnectString;

  // Save the server for the duration of the call to 'getConnection'.
  final LockBox.Entry entry =
      MondrianServerRegistry.INSTANCE.lockBox.register(server);

  final Properties properties = new Properties();
  properties.setProperty(
      RolapConnectionProperties.Instance.name(),
      entry.getMoniker());
  if (roleName != null) {
      properties.setProperty(
          RolapConnectionProperties.Role.name(),
          roleName);
  }
  properties.putAll(props);
  // Make sure we load the Mondrian driver into
  // the ClassLoader.
  try {
    ClassResolver.INSTANCE.forName(
        MondrianOlap4jDriver.class.getName(), true);
  } catch (ClassNotFoundException e) {
      throw new OlapException("Cannot find mondrian olap4j driver.");
  }

  final java.sql.Connection connection =
      java.sql.DriverManager.getConnection(connectString, properties);
  return ((OlapWrapper) connection).unwrap(OlapConnection.class);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:37,代码来源:FileRepository.java



注:本文中的org.olap4j.OlapWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IRegistryConfigurator类代码示例发布时间:2022-05-22
下一篇:
Java DoStmt类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap