Package mondrian.olap

Examples of mondrian.olap.CacheControl


    putValue(Action.ACCELERATOR_KEY, ActionMessages.getOptionalKeyStroke("ClearMondrianCacheAction.Accelerator"));
  }

  public void actionPerformed(final ActionEvent e)
  {
    final CacheControl cacheControl = AggregationManager.instance().getCacheControl(null, null);
    cacheControl.flushSchemaCache();
  }
View Full Code Here


    {
      final Connection connection =
          mondrianConnectionProvider.createConnection(computeProperties(parameters), dataSourceProvider.getDataSource());
      try
      {
        final CacheControl cacheControl = connection.getCacheControl(null);
        if (onlyCurrentSchema)
        {
          cacheControl.flushSchema(connection.getSchema());
        }
        else
        {
          cacheControl.flushSchemaCache();
        }
      }
      finally
      {
        connection.close();
View Full Code Here

   
    // retrieves Mondrian connection
    ScriptableMondrianDrillThrough smdt = (ScriptableMondrianDrillThrough) olapModel.getExtension("drillThrough");
    Connection mondrianConnection = smdt.getConnection();
    // retrieves CacheControl object
    CacheControl cacheControl = mondrianConnection.getCacheControl(null);
    // retrieves the MDX query
    MdxQuery mdxQuery = (MdxQuery) olapModel.getExtension("mdxQuery");
    Query mondrianQuery = mondrianConnection.parseQuery(mdxQuery.getMdxQuery());
    // finds the cube in the MDX query
      Cube cube = mondrianQuery.getCube();
      // flush cache on all measures for that cube
      CacheControl.CellRegion measuresRegion = cacheControl.createMeasuresRegion(cube);
      cacheControl.flush(measuresRegion);
     
//    Cube[] cubes = mondrianConnection.getSchema().getCubes();
//    for (int i = 0; i < cubes.length; i++) {
//      Cube aCube = cubes[i];
//      CacheControl.CellRegion measuresRegion = cacheControl.createMeasuresRegion(aCube);
View Full Code Here

        SegmentCacheWorker testWorker =
            new SegmentCacheWorker(mockCache, null);

        // Flush the cache before we start. Wait a second for the cache
        // flush to propagate.
        final CacheControl cc =
            getTestContext().getConnection().getCacheControl(null);
        Cube salesCube = getCube("Sales");
        cc.flush(cc.createMeasuresRegion(salesCube));
        Thread.sleep(1000);

        MondrianServer.forConnection(getTestContext().getConnection())
            .getAggregationManager().cacheMgr.segmentCacheWorkers
            .add(testWorker);

        final List<SegmentHeader> createdHeaders =
            new ArrayList<SegmentHeader>();
        final List<SegmentHeader> deletedHeaders =
            new ArrayList<SegmentHeader>();
        final SegmentCache.SegmentCacheListener listener =
            new SegmentCache.SegmentCacheListener() {
                public void handle(SegmentCacheEvent e) {
                    switch (e.getEventType()) {
                    case ENTRY_CREATED:
                        createdHeaders.add(e.getSource());
                        break;
                    case ENTRY_DELETED:
                        deletedHeaders.add(e.getSource());
                        break;
                    default:
                        throw new UnsupportedOperationException();
                    }
                }
            };

        try {
            // Register our custom listener.
            ((CompositeSegmentCache)MondrianServer
                .forConnection(getTestContext().getConnection())
                .getAggregationManager().cacheMgr.compositeCache)
                .addListener(listener);
            // Now execute a query and check the events
            executeQuery(
                "select {[Measures].[Unit Sales]} on columns from [Sales]");
            // Wait for propagation.
            Thread.sleep(2000);
            assertEquals(2, createdHeaders.size());
            assertEquals(0, deletedHeaders.size());
            assertEquals("Sales", createdHeaders.get(0).cubeName);
            assertEquals("FoodMart", createdHeaders.get(0).schemaName);
            assertEquals("Unit Sales", createdHeaders.get(0).measureName);
            createdHeaders.clear();
            deletedHeaders.clear();

            // Now flush the segment and check the events.
            cc.flush(cc.createMeasuresRegion(salesCube));

            // Wait for propagation.
            Thread.sleep(2000);
            assertEquals(0, createdHeaders.size());
            assertEquals(2, deletedHeaders.size());
View Full Code Here

TOP

Related Classes of mondrian.olap.CacheControl

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.