Skip to content

Commit

Permalink
MONDRIAN: Make javadoc check stricter - now checks even private membe…
Browse files Browse the repository at this point in the history
…rs - and fix errors so javadoc is clean again.

    Fix row count shown by SqlTupleReader.readTuples (contributed by Robin Tharappel).

[git-p4: depot-paths = "//open/mondrian/": change = 9645]
  • Loading branch information
julianhyde committed Jul 23, 2007
1 parent 4424030 commit c974d42
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 117 deletions.
22 changes: 19 additions & 3 deletions build.xml
Expand Up @@ -882,7 +882,23 @@ doc/**/*.xml"
style="misc/Meta.xsl"/>
</target>

<target name="javadoc">
<target name="javadoc-strict" description="
Generates javadoc as part of the nightly regress,
to make sure that all javadoc references are valid.">
<antcall target="javadoc-internal">
<param name="additionalparam" value=""/>
<param name="access" value="private"/>
</antcall>
</target>

<target name="javadoc" description="Generates javadoc for public site">
<antcall target="javadoc-internal">
<param name="additionalparam" value="-linksource"/>
<param name="access" value="package"/>
</antcall>
</target>

<target name="javadoc-internal">
<mkdir dir="${javadoc.dir}" />
<delete quiet="true" file="${javadoc.dir}/index.html"/>
<javadoc sourcepath="${java.dir}:${javatest.dir}"
Expand All @@ -893,9 +909,9 @@ doc/**/*.xml"
footer="&lt;a href=&quot;http://sourceforge.net/projects/mondrian&quot;&gt;&lt;img src=&quot;http://sourceforge.net/sflogo.php?group_id=35302&#38;type=1&quot; width=&quot;88&quot; height=&quot;31&quot; border=&quot;0&quot; alt=&quot;SourceForge.net_Logo&quot;&gt;&lt;/a&gt;"
author="true"
source="1.5"
access="package"
access="${access}"
Windowtitle="Mondrian OLAP Server, version ${version}"
additionalparam="-linksource"
additionalparam="${additionalparam}"
>
<tag name="pre" description="Pre-condition:"
scope="constructors,methods"/>
Expand Down
19 changes: 8 additions & 11 deletions src/main/mondrian/rolap/HierarchyUsage.java
Expand Up @@ -102,20 +102,21 @@ enum Kind {
* (Usually the table of the lowest level of the hierarchy.)
*/
private MondrianDef.Relation joinTable;

/**
* The expression (usually a {@link MondrianDef.Column}) by which the
* hierarchy which is joined to the fact table.
* The expression (usually a {@link mondrian.olap.MondrianDef.Column}) by
* which the hierarchy which is joined to the fact table.
*/
private MondrianDef.Expression joinExp;

private final Kind kind;

/**
* Creates a HierarchyUsage.
*
*
* @param cube
* @param hierarchy
* @param cubeDim
* @param cube Cube
* @param hierarchy Hierarchy
* @param cubeDim XML definition of a dimension which belongs to a cube
*/
HierarchyUsage(RolapCube cube,
RolapHierarchy hierarchy,
Expand Down Expand Up @@ -347,7 +348,7 @@ void init(RolapCube cube,
this.joinTable = findJoinTable(hierarchy, joinLevel.getKeyExp().getTableAlias());
this.joinExp = joinLevel.getKeyExp();
} else if (hierarchy.getXmlHierarchy() != null &&
hierarchy.getXmlHierarchy().primaryKey != null) {
hierarchy.getXmlHierarchy().primaryKey != null) {
// 2. Specify a "primaryKey" attribute of in <Hierarchy>. You must
// also specify the "primaryKeyTable" attribute if the hierarchy
// is a join (hence has more than one table).
Expand All @@ -364,10 +365,6 @@ void init(RolapCube cube,
joinLevel.getKeyExp().getTableAlias());
this.joinExp = joinLevel.getKeyExp();
}
/*
RME
Util.assertTrue(Util.equals(foreignKey, hierarchy.foreignKey));
*/

// Unless this hierarchy is drawing from the fact table, we need
// a join expresion and a foreign key.
Expand Down
2 changes: 1 addition & 1 deletion src/main/mondrian/rolap/RolapConnection.java
Expand Up @@ -308,7 +308,7 @@ static DataSource createDataSource(Util.PropertyList connectInfo) {
/**
* Creates a {@link Properties} object containing all of the JDBC
* connection properties present in the
* {@link Util.PropertyList connectInfo}.
* {@link mondrian.olap.Util.PropertyList connectInfo}.
*
* @param connectInfo Connection properties
* @return The JDBC connection properties.
Expand Down
6 changes: 3 additions & 3 deletions src/main/mondrian/rolap/RolapCube.java
Expand Up @@ -1696,7 +1696,7 @@ protected RolapStar.Column makeColumns(
//

/**
* Formats a {@link MondrianDef.Relation} indenting joins for
* Formats a {@link mondrian.olap.MondrianDef.Relation}, indenting joins for
* readability.
*
* @param relation
Expand Down Expand Up @@ -1776,7 +1776,7 @@ private static RelNode lookup(MondrianDef.Table table, Map<String, RelNode> map)
}

/**
* Attempts to transform a {@link MondrianDef.Relation}
* Attempts to transform a {@link mondrian.olap.MondrianDef.Relation}
* into the "canonical" form.
*
* <p>What is the canonical form? It is only relevant
Expand Down Expand Up @@ -2045,7 +2045,7 @@ private static void topToBottom(MondrianDef.Relation relation) {
}

/**
* Copies a {@link MondrianDef.Relation}.
* Copies a {@link mondrian.olap.MondrianDef.Relation}.
*
* @param relation
*/
Expand Down
11 changes: 5 additions & 6 deletions src/main/mondrian/rolap/RolapUtil.java
Expand Up @@ -21,10 +21,7 @@
import java.io.*;
import java.lang.reflect.Array;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
import java.util.*;

import mondrian.calc.ExpCompiler;

Expand Down Expand Up @@ -81,9 +78,11 @@ public int compareTo(Object o) {

/**
* Names of classes of drivers we've loaded (or have tried to load).
* @synchronization Lock the {@link RolapConnection} class.
*
* <p>NOTE: Synchronization policy: Lock the {@link RolapConnection} class
* before modifying or using this member.
*/
private static final HashSet<String> loadedDrivers = new HashSet<String>();
private static final Set<String> loadedDrivers = new HashSet<String>();

static RolapMember[] toArray(List<RolapMember> v) {
return v.isEmpty()
Expand Down
50 changes: 25 additions & 25 deletions src/main/mondrian/rolap/SqlConstraintUtils.java
Expand Up @@ -286,9 +286,9 @@ public static void addMemberConstraint(
}
}

int maxConstraints =
int maxConstraints =
MondrianProperties.instance().MaxConstraints.get();

for (Collection<RolapMember> c = parents;
!c.isEmpty();
c = getUniqueParentMembers(c))
Expand All @@ -306,8 +306,8 @@ public static void addMemberConstraint(
}
RolapLevel level = m.getLevel();
RolapHierarchy hierarchy = level.getHierarchy();
String q =

String q =
level.getExpressionWithAlias(
sqlQuery, levelToColumnMap, level.getKeyExp());
RolapStar.Column column = levelToColumnMap.get(level);
Expand All @@ -321,11 +321,11 @@ public static void addMemberConstraint(
relationNamesToStarTableMap,
targetTable);
} else {
hierarchy.addToFrom(sqlQuery, level.getKeyExp());
hierarchy.addToFrom(sqlQuery, level.getKeyExp());
}

if (cc instanceof ListColumnPredicate &&
((ListColumnPredicate) cc).getPredicates().size() >
((ListColumnPredicate) cc).getPredicates().size() >
maxConstraints)
{
// Simply get them all, do not create where-clause.
Expand All @@ -338,7 +338,7 @@ public static void addMemberConstraint(
sqlQuery.addWhere(where);
}
}

if (level.isUnique()) {
break; // no further qualification needed
}
Expand Down Expand Up @@ -383,23 +383,23 @@ private static LinkedHashSet<RolapMember> getUniqueParentMembers(
*
* @param sqlQuery query containing the where clause
* @param levelToColumnMap where to find each level's key
* @param query the query that the sql expression will be added to
* @param relationNamesToStarTableMap map to disambiguate table aliases
* @param members list of constraining members
* @param restrictMemberTypes defines the behavior when calculated members are present
*/
private static void constrainMultiLevelMembers(
SqlQuery sqlQuery,
Map<RolapLevel, RolapStar.Column> levelToColumnMap,
Map<String, RolapStar.Table> relationNamesToStarTableMap,
Map<String, RolapStar.Table> relationNamesToStarTableMap,
List<RolapMember> members,
boolean restrictMemberTypes)
{
if (sqlQuery.getDialect().supportsMultiValueInExpr()) {
if (generateMultiValueInExpr(
sqlQuery,
sqlQuery,
levelToColumnMap,
relationNamesToStarTableMap,
members,
members,
restrictMemberTypes)) {
return;
}
Expand Down Expand Up @@ -430,7 +430,7 @@ private static void constrainMultiLevelMembers(
if (firstMember) {
RolapHierarchy hierarchy =
(RolapHierarchy) level.getHierarchy();

RolapStar.Column column = levelToColumnMap.get(level);

if (column != null &&
Expand All @@ -441,10 +441,10 @@ private static void constrainMultiLevelMembers(
relationNamesToStarTableMap,
targetTable);
} else {
hierarchy.addToFrom(sqlQuery, level.getKeyExp());
}
hierarchy.addToFrom(sqlQuery, level.getKeyExp());
}
}

if (!firstLevel) {
condition += " and ";
} else {
Expand Down Expand Up @@ -533,7 +533,7 @@ private static String getColumnValue(
*/
public static String constrainLevel(
RolapLevel level,
Map<RolapLevel, RolapStar.Column> levelToColumnMap,
Map<RolapLevel, RolapStar.Column> levelToColumnMap,
SqlQuery query,
String columnValue,
boolean caseSensitive)
Expand All @@ -550,9 +550,9 @@ public static String constrainLevel(
}
String column =
level.getExpressionWithAlias(query, levelToColumnMap, exp);

String constraint;

if (RolapUtil.mdxNullLiteral.equalsIgnoreCase(columnValue)) {
constraint = column + " is " + RolapUtil.sqlNullLiteral;
} else {
Expand Down Expand Up @@ -596,7 +596,7 @@ public static String constrainLevel(
private static boolean generateMultiValueInExpr(
SqlQuery sqlQuery,
Map<RolapLevel, RolapStar.Column> levelToColumnMap,
Map<String, RolapStar.Table> relationNamesToStarTableMap,
Map<String, RolapStar.Table> relationNamesToStarTableMap,
List<RolapMember> members,
boolean restrictMemberTypes)
{
Expand Down Expand Up @@ -636,18 +636,18 @@ private static boolean generateMultiValueInExpr(
relationNamesToStarTableMap,
targetTable);
} else {
hierarchy.addToFrom(sqlQuery, level.getKeyExp());
}
hierarchy.addToFrom(sqlQuery, level.getKeyExp());
}

if (!firstLevel) {
columnBuf.append(",");
}
MondrianDef.Expression exp = level.getNameExp();

if (exp == null) {
exp = level.getKeyExp();
}

String columnString =
level.getExpressionWithAlias(
sqlQuery,
Expand Down
19 changes: 11 additions & 8 deletions src/main/mondrian/rolap/SqlContextConstraint.java
Expand Up @@ -83,7 +83,7 @@ public static boolean isValidContext(
// we need to make sure all the levels join with each fact table;
// otherwise, it doesn't make sense to do the processing
// natively, as you'll end up with cartesian product joins!
for (Map<RolapLevel, RolapStar.Column> map :
for (Map<RolapLevel, RolapStar.Column> map :
baseCubeToLevelToColumnMap.values()) {
for (Level level : levels) {
if (map.get((RolapLevel) level) == null) {
Expand All @@ -101,14 +101,15 @@ public static boolean isValidContext(
* virtual cube by validating the measures referenced in the query.
*
* @param query query referencing the virtual cube
* @param baseCubeToLevelToColumnMaps level to column maps corresponding
* @param baseCubeToLevelToColumnMap level to column maps corresponding
* to the base cubes referenced from the virtual cube
*
* @return true if valid measures exist
*/
private static boolean findVirtualCubeJoinLevels(
Query query,
Map<RolapCube, Map<RolapLevel, RolapStar.Column>> baseCubeToLevelToColumnMap)
Map<RolapCube, Map<RolapLevel, RolapStar.Column>>
baseCubeToLevelToColumnMap)
{
// Gather the unique set of level-to-column maps corresponding
// to the underlying star/cube where the measure column
Expand Down Expand Up @@ -144,12 +145,13 @@ private static boolean findVirtualCubeJoinLevels(
* Adds information regarding a stored measure to maps
*
* @param measure the stored measure
* @param baseCubesLevelToColumnMaps level to column maps for the
* @param baseCubeToLevelToColumnMap level to column maps for the
* underlying cubes that make up the virtual cube referenced in a query
*/
private static void addMeasure(
RolapStoredMeasure measure,
Map<RolapCube, Map<RolapLevel, RolapStar.Column>> baseCubeToLevelToColumnMap)
Map<RolapCube, Map<RolapLevel, RolapStar.Column>>
baseCubeToLevelToColumnMap)
{
RolapStar.Measure starMeasure =
(RolapStar.Measure) measure.getStarMeasure();
Expand All @@ -164,12 +166,13 @@ private static void addMeasure(
* Extracts the stored measures referenced in an expression
*
* @param exp expression
* @param baseCubesLevelToColumnMaps level to column maps for the
* @param baseCubeToLevelToColumnMap level to column maps for the
* underlying cubes that make up the virtual cube referenced in a query
*/
private static void findMeasures(
Exp exp,
Map<RolapCube, Map<RolapLevel, RolapStar.Column>> baseCubeToLevelToColumnMap)
Map<RolapCube, Map<RolapLevel, RolapStar.Column>>
baseCubeToLevelToColumnMap)
{
if (exp instanceof MemberExpr) {
MemberExpr memberExpr = (MemberExpr) exp;
Expand Down Expand Up @@ -212,7 +215,7 @@ private static void findMeasures(
cacheKey.add(getClass());
cacheKey.add(strict);
cacheKey.addAll(Arrays.asList(evaluator.getMembers()));

// For virtual cubes, context constraint should be evaluated in the
// query's context, because the query might reference different base
// cubes.
Expand Down

0 comments on commit c974d42

Please sign in to comment.