Package mondrian.recorder

Examples of mondrian.recorder.ListRecorder$Entry


        Parser xmlParser = XOMUtil.createDefaultParser();

       final DOMWrapper domWrapper = xmlParser.parse(reader);
       rules = new DefaultDef.AggRules(domWrapper);

       ListRecorder msgRecorder = new ListRecorder();
       rules.validate(msgRecorder);
        if (msgRecorder.hasErrors()) {
            LOGGER.error("HAS ERRORS");
            for (Iterator it = msgRecorder.getErrorEntries(); it.hasNext();) {
                ListRecorder.Entry e = (ListRecorder.Entry) it.next();
                LOGGER.error("context=" + e.getContext());
                LOGGER.error("message=" + e.getMessage());
            }
        }
View Full Code Here


     * and their BitKeys can be generated.
     *
     * @throws SQLException
     */
    private void loadRolapStarAggregates() throws SQLException {
        ListRecorder msgRecorder = new ListRecorder();
        try {
            DefaultRules rules = DefaultRules.getInstance();
            JdbcSchema db = getJdbcSchema();
            // if we don't synchronize this on the db object,
            // we may end up getting a Concurrency exception due to
            // calls to other instances of AggTableManager.finalCleanUp()
            synchronized (db) {
                // fix for MONDRIAN-496
                // flush any existing usages of the jdbc schema, so we
                // don't accidentally use another star's metadata
                db.flushUsages();

                // loads tables, not their columns
                db.load();

                loop:
                for (RolapStar star : getStars()) {
                    // This removes any AggStars from any previous invocation of
                    // this method (if any)
                    star.prepareToLoadAggregates();

                    List<ExplicitRules.Group> aggGroups = getAggGroups(star);
                    for (ExplicitRules.Group group : aggGroups) {
                        group.validate(msgRecorder);
                    }

                    String factTableName = getFactTableName(star);

                    JdbcSchema.Table dbFactTable = db.getTable(factTableName);
                    if (dbFactTable == null) {
                        msgRecorder.reportWarning(
                            "No Table found for fact name="
                                + factTableName);
                        continue loop;
                    }

                    // For each column in the dbFactTable, figure out it they
                    // are measure or foreign key columns

                    bindToStar(dbFactTable, star, msgRecorder);
                    String schema = dbFactTable.table.schema;

                    // Now look at all tables in the database and per table,
                    // first see if it is a match for an aggregate table for
                    // this fact table and second see if its columns match
                    // foreign key and level columns.

                    for (JdbcSchema.Table dbTable : db.getTables()) {
                        String name = dbTable.getName();

                        // Do the catalog schema aggregate excludes, exclude
                        // this table name.
                        if (ExplicitRules.excludeTable(name, aggGroups)) {
                            continue;
                        }

                        // First see if there is an ExplicitRules match. If so,
                        // then if all of the columns match up, then make an
                        // AggStar. On the other hand, if there is no
                        // ExplicitRules match, see if there is a Default
                        // match. If so and if all the columns match up, then
                        // also make an AggStar.
                        ExplicitRules.TableDef tableDef =
                            ExplicitRules.getIncludeByTableDef(name, aggGroups);

                        boolean makeAggStar = false;
                        int approxRowCount = Integer.MIN_VALUE;
                        // Is it handled by the ExplicitRules
                        if (tableDef != null) {
                            // load columns
                            dbTable.load();
                            makeAggStar = tableDef.columnsOK(
                                star,
                                dbFactTable,
                                dbTable,
                                msgRecorder);
                            approxRowCount = tableDef.getApproxRowCount();
                        }
                        if (! makeAggStar) {
                            // Is it handled by the DefaultRules
                            if (rules.matchesTableName(factTableName, name)) {
                                // load columns
                                dbTable.load();
                                makeAggStar = rules.columnsOK(
                                    star,
                                    dbFactTable,
                                    dbTable,
                                    msgRecorder);
                            }
                        }

                        if (makeAggStar) {
                            dbTable.setTableUsageType(
                                JdbcSchema.TableUsageType.AGG);
                            dbTable.table = new MondrianDef.Table(
                                schema,
                                name,
                                null, // null alias
                                null); // don't know about table hints
                            AggStar aggStar = AggStar.makeAggStar(
                                star,
                                dbTable,
                                msgRecorder,
                                approxRowCount);
                            if (aggStar.getSize() > 0) {
                                star.addAggStar(aggStar);
                            } else {
                                getLogger().warn(
                                    mres.AggTableZeroSize.str(
                                        aggStar.getFactTable().getName(),
                                        factTableName));
                            }
                        }
                        // Note: if the dbTable name matches but the columnsOK
                        // does not, then this is an error and the aggregate
                        // tables can not be loaded.
                        // We do not "reset" the column usages in the dbTable
                        // allowing it maybe to match another rule.
                    }
                }
            }
        } catch (RecorderException ex) {
            throw new MondrianException(ex);
        } finally {
            msgRecorder.logInfoMessage(getLogger());
            msgRecorder.logWarningMessage(getLogger());
            msgRecorder.logErrorMessage(getLogger());
            if (msgRecorder.hasErrors()) {
                throw mres.AggLoadingExceededErrorCount.ex(
                    msgRecorder.getErrorCount());
            }
        }
    }
View Full Code Here

  }

  @Override
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Entry e = entry(req);
    S3Object remove = map.remove(e);
    if (remove == null) {
      resp.sendError(404, "Not found " + e);
    } else {
      resp.sendError(HttpURLConnection.HTTP_NO_CONTENT, "Deleted");
View Full Code Here

    }

  }

  private Entry entry(HttpServletRequest req) {
    return new Entry(key(uri(req)));
  }
View Full Code Here

        log("doGet " + uri);
    if ("/".equals(uri.getPath())) {
      list(req, resp);
    } else {
      String key = uri.getPath().substring(1);
      Entry e = new Entry(key);
      S3Object obj = map.get(e);
        if (debug)
          log("map.get(" + key + ") = " + obj);
      if (obj == null) {
        resp.sendError(404, "Not here: " + e);
View Full Code Here

    if (maxKeysStr != null)
      maxKeys = Integer.parseInt(maxKeysStr);
    Writer w = new Writer();
    SortedMap<Entry, S3Object> submap = new TreeMap<Entry, S3Object>(map);
    if (prefix != null)
      submap = submap.tailMap(new Entry(prefix));
    int keyCount = 0;
    boolean truncated = false;
    String nextMarker = null;
    for (Entry e : submap.keySet()) {
      if (++keyCount > maxKeys) {
View Full Code Here

    log("doPut " + uri);
    if ("/".equals(uri.getPath())) {
      log("create bucket");
      bucket = true;
    } else {
      Entry e = new Entry(key(uri));
      e.setLastModified(new Date());
      e.setSize(req.getContentLength());
      e.setOwner(new Owner("id", "name"));
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      ServletInputStream is = req.getInputStream();
      byte b[] = new byte[128];
      while (true) {
        int len = is.read(b);
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                outputData.getEntry().add(outputEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                Entry durationEntry = new Entry();
                                durationEntry.setKey(DURATION);
                                durationEntry.setValue(testRecord.get(DURATION).toString());
                                outputData.getEntry().add(outputEntry);
                                outputData.getEntry().add(durationEntry);
                                if(testRecord.get(TEST_STATUS) != null){
                                    Entry statusEntry = new Entry();
                                    statusEntry.setKey(TEST_STATUS);
                                    statusEntry.setValue(testRecord.get(TEST_STATUS).toString());
                                    outputData.getEntry().add(statusEntry);
                                }
                               
                               
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
                        }
                        if (outputDataAdded) {
                            break;
                        }
                    }
                }else{
                    //Method did not return any data. So only write the duration as output
                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry durationEntry = new Entry();
                                durationEntry.setKey(DURATION);
                                durationEntry.setValue(testRecord.get(DURATION).toString());
                                outputData.getEntry().add(durationEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

TOP

Related Classes of mondrian.recorder.ListRecorder$Entry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.