本文整理汇总了Java中mondrian.rolap.agg.AggregationManager类的典型用法代码示例。如果您正苦于以下问题:Java AggregationManager类的具体用法?Java AggregationManager怎么用?Java AggregationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AggregationManager类属于mondrian.rolap.agg包,在下文中一共展示了AggregationManager类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDrillThroughSQL
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
/**
* Create an sql query that, when executed, will return the drill through
* data for this cell. If the parameter extendedContext is true, then the
* query will include all the levels (i.e. columns) of non-constraining
* members (i.e. members which are at the "All" level).
* If the parameter extendedContext is false, the query will exclude
* the levels (coulmns) of non-constraining members.
*/
public String getDrillThroughSQL(boolean extendedContext) {
RolapAggregationManager aggMan = AggregationManager.instance();
final Member[] currentMembers = getMembersForDrillThrough();
CellRequest cellRequest =
RolapAggregationManager.makeDrillThroughRequest(
currentMembers, extendedContext, result.getCube());
return (cellRequest == null)
? null
: aggMan.getDrillThroughSql(cellRequest, false);
}
示例2: getDrillThroughCount
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
public int getDrillThroughCount() {
RolapAggregationManager aggMan = AggregationManager.instance();
final Member[] currentMembers = getMembersForDrillThrough();
CellRequest cellRequest =
RolapAggregationManager.makeDrillThroughRequest(
currentMembers, false, result.getCube());
if (cellRequest == null) {
return -1;
}
RolapConnection connection =
(RolapConnection) result.getQuery().getConnection();
final String sql = aggMan.getDrillThroughSql(cellRequest, true);
final SqlStatement stmt =
RolapUtil.executeQuery(
connection.getDataSource(),
sql,
"RolapCell.getDrillThroughCount",
"Error while counting drill-through");
try {
ResultSet rs = stmt.getResultSet();
rs.next();
++stmt.rowCount;
return rs.getInt(1);
} catch (SQLException e) {
throw stmt.handle(e);
} finally {
stmt.close();
}
}
示例3: checkSchemaFile
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
/**
* Check if schema file is valid by initiating a mondrian connection.
*/
private void checkSchemaFile(File file) {
try {
// this connection parses the catalog file which if invalid will
// throw exception
PropertyList list = new PropertyList();
list.put("Provider", "mondrian");
list.put("Jdbc", jdbcConnectionUrl);
list.put("Catalog", file.toURL().toString());
list.put("JdbcDrivers", jdbcDriverClassName);
if (jdbcUsername != null && jdbcUsername.length() > 0) {
list.put("JdbcUser", jdbcUsername);
}
if (jdbcPassword != null && jdbcPassword.length() > 0) {
list.put("JdbcPassword", jdbcPassword);
}
// clear cache before connecting
AggregationManager.instance().getCacheControl(null)
.flushSchemaCache();
DriverManager.getConnection(list, null);
} catch (Exception ex) {
LOGGER.error(
"Exception : Schema file "
+ file.getAbsolutePath()
+ " is invalid."
+ ex.getMessage(), ex);
} catch (Error err) {
LOGGER.error(
"Error : Schema file "
+ file.getAbsolutePath()
+ " is invalid."
+ err.getMessage(), err);
}
}
示例4: refreshModel
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
public void refreshModel() {
// first save the view
// if (true) throw new UnsupportedOperationException();
// TODO: can we do this without requiring a "remote save"?
AggregationManager.instance().getCacheControl(null, null).flushSchemaCache();
browser.execute(visualization.generateRefreshModelJavascript(xmiFileLocation, modelId));
// "gCtrlr.repositoryBrowserController.remoteSave('"+modelId+"','tmp', '', 'xanalyzer', true)"
}
示例5: chooseAggStar
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
private static AggStar chooseAggStar(
MemberChildrenConstraint constraint,
RolapMember member)
{
if (!MondrianProperties.instance().UseAggregates.get()
|| !(constraint instanceof SqlContextConstraint))
{
return null;
}
SqlContextConstraint contextConstraint =
(SqlContextConstraint) constraint;
Evaluator evaluator = contextConstraint.getEvaluator();
RolapCube cube = (RolapCube) evaluator.getCube();
RolapStar star = cube.getStar();
final int starColumnCount = star.getColumnCount();
BitKey measureBitKey = BitKey.Factory.makeBitKey(starColumnCount);
BitKey levelBitKey = BitKey.Factory.makeBitKey(starColumnCount);
// Convert global ordinal to cube based ordinal (the 0th dimension
// is always [Measures])
// Expand calculated so we don't miss their bitkeys
final Member[] members =
SqlConstraintUtils.expandSupportedCalculatedMembers(
evaluator.getNonAllMembers(), evaluator);
// if measure is calculated, we can't continue
if (!(members[0] instanceof RolapBaseCubeMeasure)) {
return null;
}
RolapBaseCubeMeasure measure = (RolapBaseCubeMeasure)members[0];
// we need to do more than this! we need the rolap star ordinal, not
// the rolap cube
int bitPosition =
((RolapStar.Measure)measure.getStarMeasure()).getBitPosition();
// childLevel will always end up being a RolapCubeLevel, but the API
// calls into this method can be both shared RolapMembers and
// RolapCubeMembers so this cast is necessary for now. Also note that
// this method will never be called in the context of a virtual cube
// so baseCube isn't necessary for retrieving the correct column
// get the level using the current depth
RolapCubeLevel childLevel =
(RolapCubeLevel) member.getLevel().getChildLevel();
RolapStar.Column column = childLevel.getStarKeyColumn();
// set a bit for each level which is constrained in the context
final CellRequest request =
RolapAggregationManager.makeRequest(members);
if (request == null) {
// One or more calculated members. Cannot use agg table.
return null;
}
// TODO: RME why is this using the array of constrained columns
// from the CellRequest rather than just the constrained columns
// BitKey (method getConstrainedColumnsBitKey)?
RolapStar.Column[] columns = request.getConstrainedColumns();
for (RolapStar.Column column1 : columns) {
levelBitKey.set(column1.getBitPosition());
}
// set the masks
levelBitKey.set(column.getBitPosition());
measureBitKey.set(bitPosition);
// Set the bits for limited rollup members
RolapUtil.constraintBitkeyForLimitedMembers(
evaluator, members, cube, levelBitKey);
// find the aggstar using the masks
return AggregationManager.findAgg(
star, levelBitKey, measureBitKey, new boolean[] {false});
}
示例6: getAggregationManager
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
public AggregationManager getAggregationManager() {
if (shutdown) {
throw new MondrianException("Server already shutdown.");
}
return aggMgr;
}
示例7: testDeleteCommand
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
public void testDeleteCommand() {
final TestContext tc = getTestContext();
final Connection conn = tc.getConnection();
final CacheControl cc = conn.getCacheControl(null);
final RolapCubeMember sfCubeMember =
(RolapCubeMember) findMember(
tc, "Sales", "Retail", "CA", "San Francisco");
final RolapMember caMember = sfCubeMember.member.getParentMember();
final RolapHierarchy hierarchy = caMember.getHierarchy();
final RolapBaseCubeMeasure unitSalesCubeMember =
(RolapBaseCubeMeasure) findMember(
tc, "Sales", "Measures", "Unit Sales");
final RolapCubeMember yearCubeMember =
(RolapCubeMember) findMember(
tc, "Sales", "Time", "Year", "1997");
final Member[] cacheRegionMembers =
new Member[] {
unitSalesCubeMember,
sfCubeMember,
yearCubeMember
};
tc.assertAxisReturns(
"[Retail].[CA].Children",
"[Retail].[CA].[Alameda]\n"
+ "[Retail].[CA].[Beverly Hills]\n"
+ "[Retail].[CA].[Los Angeles]\n"
+ "[Retail].[CA].[San Diego]\n"
+ "[Retail].[CA].[San Francisco]");
final MemberReader memberReader = hierarchy.getMemberReader();
final MemberCache memberCache =
((SmartMemberReader) memberReader).getMemberCache();
List<RolapMember> caChildren =
memberCache.getChildrenFromCache(caMember, null);
assertEquals(5, caChildren.size());
// Load cell data and check it is in cache
executeQuery(
"select {[Measures].[Unit Sales]} on columns, {[Retail].[CA].[Alameda]} on rows from [Sales]");
final AggregationManager aggMgr =
((RolapConnection) conn).getServer().getAggregationManager();
assertEquals(
Double.valueOf("2117"),
aggMgr.getCellFromAllCaches(
AggregationManager.makeRequest(cacheRegionMembers)));
// Now tell the cache that [CA].[San Francisco] has been removed.
final CacheControl.MemberEditCommand command =
cc.createDeleteCommand(sfCubeMember);
cc.execute(command);
// Children of CA should be 4
assertEquals(
4,
memberCache.getChildrenFromCache(caMember, null).size());
// test that cells have been removed
assertNull(
aggMgr.getCellFromAllCaches(
AggregationManager.makeRequest(cacheRegionMembers)));
// The list of children should be updated.
tc.assertAxisReturns(
"[Retail].[CA].Children",
"[Retail].[CA].[Alameda]\n"
+ "[Retail].[CA].[Beverly Hills]\n"
+ "[Retail].[CA].[Los Angeles]\n"
+ "[Retail].[CA].[San Diego]");
}
示例8: chooseAggStar
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
private static AggStar chooseAggStar(
MemberChildrenConstraint constraint,
RolapMember member)
{
if (!MondrianProperties.instance().UseAggregates.get()
|| !(constraint instanceof SqlContextConstraint))
{
return null;
}
SqlContextConstraint contextConstraint =
(SqlContextConstraint) constraint;
Evaluator evaluator = contextConstraint.getEvaluator();
RolapCube cube = (RolapCube) evaluator.getCube();
RolapStar star = cube.getStar();
final int starColumnCount = star.getColumnCount();
BitKey measureBitKey = BitKey.Factory.makeBitKey(starColumnCount);
BitKey levelBitKey = BitKey.Factory.makeBitKey(starColumnCount);
// Convert global ordinal to cube based ordinal (the 0th dimension
// is always [Measures])
final Member[] members = evaluator.getMembers();
// if measure is calculated, we can't continue
if (!(members[0] instanceof RolapBaseCubeMeasure)) {
return null;
}
RolapBaseCubeMeasure measure = (RolapBaseCubeMeasure)members[0];
// we need to do more than this! we need the rolap star ordinal, not
// the rolap cube
int bitPosition =
((RolapStar.Measure)measure.getStarMeasure()).getBitPosition();
int ordinal = measure.getOrdinal();
// childLevel will always end up being a RolapCubeLevel, but the API
// calls into this method can be both shared RolapMembers and
// RolapCubeMembers so this cast is necessary for now. Also note that
// this method will never be called in the context of a virtual cube
// so baseCube isn't necessary for retrieving the correct column
// get the level using the current depth
RolapCubeLevel childLevel =
(RolapCubeLevel) member.getLevel().getChildLevel();
RolapStar.Column column = childLevel.getStarKeyColumn();
// set a bit for each level which is constrained in the context
final CellRequest request =
RolapAggregationManager.makeRequest(members);
if (request == null) {
// One or more calculated members. Cannot use agg table.
return null;
}
// TODO: RME why is this using the array of constrained columns
// from the CellRequest rather than just the constrained columns
// BitKey (method getConstrainedColumnsBitKey)?
RolapStar.Column[] columns = request.getConstrainedColumns();
for (RolapStar.Column column1 : columns) {
levelBitKey.set(column1.getBitPosition());
}
// set the masks
levelBitKey.set(column.getBitPosition());
measureBitKey.set(bitPosition);
// find the aggstar using the masks
AggStar aggStar = AggregationManager.instance().findAgg(
star, levelBitKey, measureBitKey, new boolean[]{ false });
return aggStar;
}
示例9: chooseAggStar
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
/**
* Obtains the AggStar instance which corresponds to an aggregate table
* which can be used to support the member constraint.
*
* @param evaluator the current evaluator to obtain the cube and members to
* be queried
* @return AggStar for aggregate table
*/
AggStar chooseAggStar(Evaluator evaluator) {
if (!MondrianProperties.instance().UseAggregates.get()) {
return null;
}
if (evaluator == null) {
return null;
}
// Current cannot support aggregate tables for virtual cubes
RolapCube cube = (RolapCube) evaluator.getCube();
if (cube.isVirtual()) {
return null;
}
RolapStar star = cube.getStar();
final int starColumnCount = star.getColumnCount();
BitKey measureBitKey = BitKey.Factory.makeBitKey(starColumnCount);
BitKey levelBitKey = BitKey.Factory.makeBitKey(starColumnCount);
// Convert global ordinal to cube based ordinal (the 0th dimension
// is always [Measures]). In the case of filter constraint this will
// be the measure on which the filter will be done.
final Member[] members = evaluator.getMembers();
// if measure is calculated, we can't continue
if (!(members[0] instanceof RolapBaseCubeMeasure)) {
return null;
}
RolapBaseCubeMeasure measure = (RolapBaseCubeMeasure)members[0];
int bitPosition =
((RolapStar.Measure) measure.getStarMeasure()).getBitPosition();
// set a bit for each level which is constrained in the context
final CellRequest request =
RolapAggregationManager.makeRequest(members);
if (request == null) {
// One or more calculated members. Cannot use agg table.
return null;
}
// TODO: RME why is this using the array of constrained columns
// from the CellRequest rather than just the constrained columns
// BitKey (method getConstrainedColumnsBitKey)?
RolapStar.Column[] columns = request.getConstrainedColumns();
for (RolapStar.Column column1 : columns) {
levelBitKey.set(column1.getBitPosition());
}
// set the masks
for (TargetBase target : targets) {
RolapLevel level = target.level;
if (!level.isAll()) {
RolapStar.Column column =
((RolapCubeLevel)level).getStarKeyColumn();
levelBitKey.set(column.getBitPosition());
}
}
measureBitKey.set(bitPosition);
// find the aggstar using the masks
AggStar aggStar = AggregationManager.instance().findAgg(
star, levelBitKey, measureBitKey, new boolean[]{ false });
return aggStar;
}
示例10: refreshData
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
public void refreshData() {
// first clear the server cache
AggregationManager.instance().getCacheControl(null, null).flushSchemaCache();
browser.execute(visualization.generateRefreshDataJavascript(xmiFileLocation, modelId));
}
示例11: getAggregationManager
import mondrian.rolap.agg.AggregationManager; //导入依赖的package包/类
public abstract AggregationManager getAggregationManager();