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

Java Util类代码示例

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

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



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

示例1: contributeParameters

import mondrian.olap.Util; //导入依赖的package包/类
@Override
public void contributeParameters(Map<String, Object> parameters)
		throws JRException {
	MondrianDataAdapter mda = getJdbcDataAdapter();
	if (mda != null) {
		Util.PropertyList props = new Util.PropertyList();
		props.put("Catalog", mda.getCatalogURI());
		props.put("Provider", "mondrian");
		props.put("Locale", Locale.getDefault().getLanguage());

		connection = DriverManager.getConnection(props, null,
				new SimpleSQLDataSource(this));

		parameters
				.put(JRMondrianQueryExecuterFactory.PARAMETER_MONDRIAN_CONNECTION,
						connection);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:MondrianDataAdapterService.java


示例2: filter

import mondrian.olap.Util; //导入依赖的package包/类
@Override
public String filter(String schemaUrl, Util.PropertyList connectInfo, InputStream stream)
	throws Exception {
		String schema = super.filter(schemaUrl, connectInfo, stream);
		System.out.println("[CUSTOM.DSP] *********** Started DSP Custom ***********");
		IPentahoSession session = PentahoSessionHolder.getSession();
		// if you need only the default Pentaho username session var, not a specific one,
		// you can change the code with: String usercode = session.getName().toString();
		// this avoid to use a startup kettle job
		String usercode = (String) session.getAttribute("USERNAME");
		try {
			System.out.println("[CUSTOM.DSP] Trying to replace '%USER_NAME%' with session value: "+usercode);
			LOG.info("Trying to replace '%USER_NAME%' with session value: "+usercode);
			schema = schema.replaceAll("%USER_NAME%", usercode);
		}
		catch (PatternSyntaxException pse) {
			System.out.println("[CUSTOM.DSP] Some error during custom schema processing: "+usercode);
			LOG.error("Some error during custom schema processing. " , pse);
			pse.printStackTrace();
		}
	LOG.info("DSP Ended correctly for "+usercode);
	System.out.println("[CUSTOM.DSP] *********** DSP Ended correctly for "+usercode+" ***********");
	return schema;
}
 
开发者ID:gioma68,项目名称:mondrian-dsp,代码行数:25,代码来源:DynamicSchemaProcessor.java


示例3: checkForParseError

import mondrian.olap.Util; //导入依赖的package包/类
/**
 * See if the DOMParser after parsing a Document has any errors and,
 * if so, throw a RuntimeException exception containing the errors.
 *
 */
private static void checkForParseError(
    final DOMParser parser,
    Throwable t)
{
    if (Util.IBM_JVM) {
        // IBM JDK returns lots of errors. Not sure whether they are
        // real errors, but ignore for now.
        return;
    }

    final ErrorHandler errorHandler = parser.getErrorHandler();
    if (errorHandler instanceof SaxErrorHandler) {
        final SaxErrorHandler saxEH = (SaxErrorHandler) errorHandler;
        final List<SaxErrorHandler.ErrorInfo> errors = saxEH.getErrors();

        if (errors != null && errors.size() > 0) {
            String errorStr = SaxErrorHandler.formatErrorInfos(saxEH);
            throw new RuntimeException(errorStr, t);
        }
    } else {
        System.out.println("errorHandler=" + errorHandler);
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:29,代码来源:XmlUtil.java


示例4: getAttributes

import mondrian.olap.Util; //导入依赖的package包/类
private Object[] getAttributes(Property prop, Hierarchy hierarchy) {
    Property longProp = longProps.get(prop.getName());
    if (longProp == null) {
        longProp = prop;
    }
    List<Object> values = new ArrayList<Object>();
    values.add("name");
    values.add(
        hierarchy.getUniqueName()
        + "."
        + Util.quoteMdxIdentifier(longProp.getName()));
    if (longProp == prop) {
        // Adding type attribute to the optional properties
        values.add("type");
        values.add(getXsdType(longProp));
    }
    return values.toArray();
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:19,代码来源:XmlaHandler.java


示例5: visit

import mondrian.olap.Util; //导入依赖的package包/类
public Object visit(ExecutionStartEvent event) {
    MutableStatementInfo stmt =
        statementMap.get(event.statementId);
    if (stmt == null) {
        return missing(event);
    }
    final MutableExecutionInfo exec =
        new MutableExecutionInfo(
            stmt, event.executionId, event.stack);
    executionMap.put(event.executionId, exec);

    foo(exec, event);
    foo(stmt.aggExec, event);
    foo(stmt.conn.aggExec, event);
    foo(server.aggExec, event);
    if (RolapUtil.MONITOR_LOGGER.isTraceEnabled()) {
        RolapUtil.MONITOR_LOGGER.trace(
            "Execution("
            + event.executionId
            + ") created. stack is:"
            + Util.nl
            + event.stack);
    }
    return null;
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:26,代码来源:MonitorImpl.java


示例6: compileScript

import mondrian.olap.Util; //导入依赖的package包/类
public <T> T compileScript(
    Class<T> iface,
    String script,
    String engineName)
{
    ScriptEngineManager factory = new ScriptEngineManager();
    ScriptEngine engine = factory.getEngineByName(engineName);
    try {
        engine.eval(script);
        Invocable inv = (Invocable) engine;
        return inv.getInterface(iface);
    } catch (ScriptException e) {
        throw Util.newError(
            e,
            "Error while compiling script to implement " + iface + " SPI");
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:18,代码来源:UtilCompatibleJdk16.java


示例7: removeEldestEntry

import mondrian.olap.Util; //导入依赖的package包/类
protected boolean removeEldestEntry(
    Map.Entry<Long, MutableSqlStatementInfo> e)
{
    if (size() > maxSize) {
        if (RolapUtil.MONITOR_LOGGER.isTraceEnabled()) {
            RolapUtil.MONITOR_LOGGER.trace(
                "StatementInfo("
                + e.getKey()
                + ") evicted. Stack is:"
                + Util.nl
                + e.getValue().stack);
        }
        return true;
    }
    return false;
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:17,代码来源:MonitorImpl.java


示例8: DefaultXmlaResponse

import mondrian.olap.Util; //导入依赖的package包/类
public DefaultXmlaResponse(
    OutputStream outputStream,
    String encoding,
    Enumeration.ResponseMimeType responseMimeType)
{
    try {
        switch (responseMimeType) {
        case JSON:
            writer = new JsonSaxWriter(outputStream);
            break;
        case SOAP:
        default:
            writer = new DefaultSaxWriter(outputStream, encoding);
            break;
        }
    } catch (UnsupportedEncodingException uee) {
        throw Util.newError(uee, MSG_ENCODING_ERROR + encoding);
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:20,代码来源:DefaultXmlaResponse.java


示例9: initCommand

import mondrian.olap.Util; //导入依赖的package包/类
private void initCommand(Element commandRoot) throws XmlaException {
    Element[] childElems =
        XmlaUtil.filterChildElements(
            commandRoot,
            NS_XMLA,
            "Statement");
    if (childElems.length != 1) {
        StringBuilder buf = new StringBuilder(100);
        buf.append(MSG_INVALID_XMLA);
        buf.append(": Wrong number of Statement elements: ");
        buf.append(childElems.length);
        throw new XmlaException(
            CLIENT_FAULT_FC,
            HSB_BAD_STATEMENT_CODE,
            HSB_BAD_STATEMENT_FAULT_FS,
            Util.newError(buf.toString()));
    }
    statement = XmlaUtil.textInElement(childElems[0]).replaceAll("\\r", "");
    drillthrough = statement.toUpperCase().indexOf("DRILLTHROUGH") != -1;
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:21,代码来源:DefaultXmlaRequest.java


示例10: filter

import mondrian.olap.Util; //导入依赖的package包/类
public String filter(
    String schemaUrl,
    Util.PropertyList connectInfo,
    InputStream stream) throws Exception
{
    setLocale(
        connectInfo.get("Locale") == null
            ? Locale.getDefault().toString()
            : connectInfo.get("Locale"));

    loadProperties();

    String schema = super.filter(schemaUrl, connectInfo, stream);
    if (bundle != null) {
        schema = doRegExReplacements(schema);
    }
    LOGGER.debug(schema);
    return schema;
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:20,代码来源:LocalizingDynamicSchemaProcessor.java


示例11: filter

import mondrian.olap.Util; //导入依赖的package包/类
/**
 * Reads the contents of a schema as a stream and returns the result as
 * a string.
 *
 * <p>The default implementation returns the contents of the schema
 * unchanged.
 *
 * @param schemaUrl the URL of the catalog
 * @param connectInfo Connection properties
 * @param stream Schema contents represented as a stream
 * @return the modified schema
 * @throws Exception if an error occurs
 */
protected String filter(
    String schemaUrl,
    Util.PropertyList connectInfo,
    InputStream stream)
    throws Exception
{
    BufferedReader in =
        new BufferedReader(
            new InputStreamReader(stream));
    try {
        StringBuilder builder = new StringBuilder();
        char[] buf = new char[2048];
        int readCount;
        while ((readCount = in.read(buf, 0, buf.length)) >= 0) {
            builder.append(buf, 0, readCount);
        }
        return builder.toString();
    } finally {
        in.close();
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:35,代码来源:FilterDynamicSchemaProcessor.java


示例12: testBasicSchemaFetch

import mondrian.olap.Util; //导入依赖的package包/类
public void testBasicSchemaFetch() {
    RolapSchemaPool schemaPool = RolapSchemaPool.instance();
    schemaPool.clear();

    String catalogUrl = getFoodmartCatalogUrl().toString();
    Util.PropertyList connectInfo =
        Util.parseConnectString(TestContext.getDefaultConnectString());

    RolapSchema schema =
        schemaPool.get(
            catalogUrl,
            "connectionKeyA",
            "joeTheUser",
            "aDataSource",
            connectInfo);
    RolapSchema schemaA =
        schemaPool.get(
            catalogUrl,
            "connectionKeyA",
            "joeTheUser",
            "aDataSource",
            connectInfo);
    //same arguments, same object
    assertTrue(schema == schemaA);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:26,代码来源:RolapSchemaPoolTest.java


示例13: mightIntersect

import mondrian.olap.Util; //导入依赖的package包/类
public boolean mightIntersect(StarPredicate other) {
    if (other instanceof LiteralStarPredicate) {
        return ((LiteralStarPredicate) other).getValue();
    }
    if (other instanceof ValueColumnPredicate) {
        ValueColumnPredicate valueColumnPredicate =
            (ValueColumnPredicate) other;
        return evaluate(valueColumnPredicate.getValue());
    }
    if (other instanceof ListColumnPredicate) {
        final List<Object> thatSet = new ArrayList<Object>();
        ((ListColumnPredicate) other).values(thatSet);
        for (Object o : thatSet) {
            if (evaluate(o)) {
                return true;
            }
        }
        return false;
    }
    throw Util.newInternal("unknown constraint type " + other);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:22,代码来源:ListColumnPredicate.java


示例14: describe

import mondrian.olap.Util; //导入依赖的package包/类
private void describe(StringBuilder buf, boolean values) {
    final String sep = Util.nl + "    ";
    buf.append(printSegmentHeaderInfo(sep));

    for (int i = 0; i < columns.length; i++) {
        buf.append(sep);
        buf.append(columns[i].getExpression().getGenericExpression());
        describeAxes(buf, i, values);
    }
    if (!excludedRegions.isEmpty()) {
        buf.append(sep);
        buf.append("excluded={");
        int k = 0;
        for (ExcludedRegion excludedRegion : excludedRegions) {
            if (k++ > 0) {
                buf.append(", ");
            }
            excludedRegion.describe(buf);
        }
        buf.append('}');
    }
    buf.append('}');
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:24,代码来源:Segment.java


示例15: createDataset

import mondrian.olap.Util; //导入依赖的package包/类
SegmentDataset createDataset(
    SegmentAxis[] axes,
    boolean sparse,
    SqlStatement.Type type,
    int size)
{
    if (sparse) {
        return new SparseSegmentDataset();
    } else {
        switch (type) {
        case OBJECT:
        case LONG:
        case STRING:
            return new DenseObjectSegmentDataset(axes, size);
        case INT:
            return new DenseIntSegmentDataset(axes, size);
        case DOUBLE:
            return new DenseDoubleSegmentDataset(axes, size);
        default:
            throw Util.unexpected(type);
        }
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:24,代码来源:Segment.java


示例16: addMeasure

import mondrian.olap.Util; //导入依赖的package包/类
/**
 * Adds a measure to a query.
 *
 * @param i Ordinal of measure
 * @param sqlQuery Query object
 */
protected void addMeasure(final int i, final SqlQuery sqlQuery) {
    RolapStar.Measure measure = getMeasure(i);
    if (!isPartOfSelect(measure)) {
        return;
    }
    Util.assertTrue(measure.getTable() == getStar().getFactTable());
    measure.getTable().addToFrom(sqlQuery, false, true);

    String exprInner =
        measure.getExpression() == null
            ? "*"
            : measure.generateExprString(sqlQuery);
    String exprOuter = measure.getAggregator().getExpression(exprInner);
    sqlQuery.addSelect(
        exprOuter,
        measure.getInternalType(),
        getMeasureAlias(i));
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:25,代码来源:AbstractQuerySpec.java


示例17: forType

import mondrian.olap.Util; //导入依赖的package包/类
static Column forType(
    int ordinal,
    SqlStatement.Type type,
    int capacity)
{
    switch (type) {
    case OBJECT:
    case STRING:
        return new ObjectColumn(ordinal, type, capacity);
    case INT:
        return new IntColumn(ordinal, type, capacity);
    case LONG:
        return new LongColumn(ordinal, type, capacity);
    case DOUBLE:
        return new DoubleColumn(ordinal, type, capacity);
    default:
        throw Util.unexpected(type);
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:20,代码来源:SegmentLoader.java


示例18: SiblingIterator

import mondrian.olap.Util; //导入依赖的package包/类
SiblingIterator(MemberReader reader, RolapMember member) {
    this.reader = reader;
    RolapMember parent = member.getParentMember();
    List<RolapMember> siblingList;
    if (parent == null) {
        siblingList = reader.getRootMembers();
        this.parentIterator = null;
    } else {
        siblingList = new ArrayList<RolapMember>();
        reader.getMemberChildren(parent, siblingList);
        this.parentIterator = new SiblingIterator(reader, parent);
    }
    this.siblings = siblingList;
    this.position = -1;
    for (int i = 0; i < this.siblings.size(); i++) {
        if (siblings.get(i).equals(member)) {
            this.position = i;
            break;
        }
    }
    if (this.position == -1) {
        throw Util.newInternal(
            "member " + member + " not found among its siblings");
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:26,代码来源:SmartMemberReader.java


示例19: testTwentySimpleGetters

import mondrian.olap.Util; //导入依赖的package包/类
public void testTwentySimpleGetters() throws Exception {
    final int cycles = 1000;
    final int actorsAmount = 20;

    List<SingleSchemaGetter> actors =
        new ArrayList<SingleSchemaGetter>(actorsAmount);
    for (int i = 0; i < actorsAmount; i++) {
        String catalogUrl = UUID.randomUUID().toString();

        DataSource ds = mock(DataSource.class);

        Util.PropertyList list = new Util.PropertyList();
        list.put(CatalogContent.name(), UUID.randomUUID().toString());

        // force the pool to create the fake schema
        RolapSchema schema = poolSpy.get(catalogUrl, ds, list);
        addedSchemas.add(schema);

        actors.add(new SingleSchemaGetter(
            poolSpy, cycles, catalogUrl, ds, list));
    }

    runTest(actors);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:25,代码来源:RolapSchemaPoolConcurrencyTest.java


示例20: process

import mondrian.olap.Util; //导入依赖的package包/类
/**
 * Processes a request.
 *
 * @param request  XML request, for example, "<SOAP-ENV:Envelope ...>".
 * @param response Destination for response
 * @throws XmlaException on error
 */
public void process(XmlaRequest request, XmlaResponse response)
    throws XmlaException
{
    Method method = request.getMethod();
    long start = System.currentTimeMillis();

    switch (method) {
    case DISCOVER:
        discover(request, response);
        break;
    case EXECUTE:
        execute(request, response);
        break;
    default:
        throw new XmlaException(
            CLIENT_FAULT_FC,
            HSB_BAD_METHOD_CODE,
            HSB_BAD_METHOD_FAULT_FS,
            new IllegalArgumentException(
                "Unsupported XML/A method: " + method));
    }
    if (LOGGER.isDebugEnabled()) {
        long end = System.currentTimeMillis();
        LOGGER.debug("XmlaHandler.process: time = " + (end - start));
        LOGGER.debug("XmlaHandler.process: " + Util.printMemory());
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:35,代码来源:XmlaHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Setup类代码示例发布时间:2022-05-22
下一篇:
Java AsyncSubject类代码示例发布时间: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