Class DelegatingSchemaReader
- java.lang.Object
-
- mondrian.olap.DelegatingSchemaReader
-
- All Implemented Interfaces:
SchemaReader
public abstract class DelegatingSchemaReader extends Object implements SchemaReader
DelegatingSchemaReaderimplementsSchemaReaderby delegating all methods to an underlyingSchemaReader.It is a convenient base class if you want to override just a few of
SchemaReader's methods.- Since:
- Feb 26, 2003
- Author:
- jhyde
-
-
Field Summary
Fields Modifier and Type Field Description protected SchemaReaderschemaReader
-
Constructor Summary
Constructors Modifier Constructor Description protectedDelegatingSchemaReader(SchemaReader schemaReader)Creates a DelegatingSchemaReader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareMembersHierarchically(Member m1, Member m2)Compares a pair ofMembers according to their order in a prefix traversal.MembergetCalculatedMember(List<Id.Segment> nameParts)Looks up a calculated member by name.List<Member>getCalculatedMembers()Returns the list of calculated members.List<Member>getCalculatedMembers(Hierarchy hierarchy)Returns a list of calculated members in a given hierarchy.List<Member>getCalculatedMembers(Level level)Returns a list of calculated members in a given level.intgetChildrenCountFromCache(Member member)Returns number of children parent of a member, if the information can be retrieved from cache, otherwise -1.CubegetCube()Returns the default cube in which to look for dimensions etc.List<Dimension>getCubeDimensions(Cube cube)Returns the accessible dimensions of a cube.Cube[]getCubes()Returns the list of accessible cubes.DataSourcegetDataSource()Returns the data source.List<Hierarchy>getDimensionHierarchies(Dimension dimension)Returns the accessible hierarchies of a dimension.OlapElementgetElementChild(OlapElement parent, Id.Segment name)Looks up the child ofparentname, returning null if no element is found.OlapElementgetElementChild(OlapElement parent, Id.Segment name, MatchType matchType)Looks up the child ofparentcalledname, or an approximation according tomatchType, returning null if no element is found.MembergetHierarchyDefaultMember(Hierarchy hierarchy)Returns the default member of a hierarchy.List<Level>getHierarchyLevels(Hierarchy hierarchy)Returns the accessible levels of a hierarchy.List<Member>getHierarchyRootMembers(Hierarchy hierarchy)Returns an array of the root members ofhierarchy.MembergetLeadMember(Member member, int n)Returns a membernfurther along in the same level frommember.intgetLevelCardinality(Level level, boolean approximate, boolean materialize)Returns the number of members in a level, returning an approximation if acceptable.List<Member>getLevelMembers(Level level, boolean includeCalculated)Returns the members of a level, optionally including calculated members.List<Member>getLevelMembers(Level level, Evaluator context)Returns the members of a level, optionally filtering out members which are empty.voidgetMemberAncestors(Member member, List<Member> ancestorList)Returns a list of ancestors ofmember, in depth order.MembergetMemberByUniqueName(List<Id.Segment> uniqueNameParts, boolean failIfNotFound)Finds a member based upon its unique name, requiring an exact match.MembergetMemberByUniqueName(List<Id.Segment> uniqueNameParts, boolean failIfNotFound, MatchType matchType)Finds a member based upon its unique name.List<Member>getMemberChildren(List<Member> members)Returns direct children of each element ofmembers.List<Member>getMemberChildren(List<Member> members, Evaluator context)Returns direct children of each element ofmemberswhich is not empty incontext.List<Member>getMemberChildren(Member member)Returns direct children ofmember.List<Member>getMemberChildren(Member member, Evaluator context)Returns direct children ofmember, optimized for NON EMPTY.Map<? extends Member,Access>getMemberChildrenWithDetails(Member member, Evaluator evaluator)Similar toSchemaReader.getMemberChildren(Member, Evaluator)but returns a map of the grand-children and their access details and costs more to invoke because of the access controls.intgetMemberDepth(Member member)Returns the depth of a member.MembergetMemberParent(Member member)Returns the parent ofmember.voidgetMemberRange(Level level, Member startMember, Member endMember, List<Member> list)Appends tolistall members betweenstartMemberandendMember(inclusive) which belong tolevel.NamedSetgetNamedSet(List<Id.Segment> nameParts)Looks up a set by name.List<NameResolver.Namespace>getNamespaces()Returns a list of namespaces to search when resolving elements by name.NativeEvaluatorgetNativeSetEvaluator(FunDef fun, Exp[] args, Evaluator evaluator, Calc calc)Returns an object which can evaluate an expression in native SQL, or null if this is not possible.ParametergetParameter(String name)Returns the definition of a parameter with a given name, or null if not found.voidgetParentChildContributingChildren(Member dataMember, Hierarchy hierarchy, List<Member> list)Returns a list of contributing children of a member of a parent-child hierarchy.RolegetRole()Returns the access-control profile that thisSchemaReaderis implementing.RolapSchemagetSchema()Returns the schema.booleanisDrillable(Member member)Returns whether a member has visible children.booleanisVisible(Member member)Returns whether a member is visible.OlapElementlookupCompound(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category)Looks up an MDX object by name.OlapElementlookupCompound(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category, MatchType matchType)Looks up an MDX object by name, specifying how to match if no object exactly matches the name.OlapElementlookupCompoundInternal(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category, MatchType matchType)MemberlookupMemberChildByName(Member member, Id.Segment memberName, MatchType matchType)Finds a child of a member with a given name.List<Member>lookupMemberChildrenByNames(Member parent, List<Id.NameSegment> childNames, MatchType matchType)Finds a list of child members with the given names.Membersubstitute(Member member)Substitutes a member with an equivalent member which enforces the access control policy of this SchemaReader.SchemaReaderwithLocus()Returns a schema reader that automatically assigns a locus to each operation.SchemaReaderwithoutAccessControl()Returns a similar schema reader that has no access control.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface mondrian.olap.SchemaReader
countMemberChildren
-
-
-
-
Field Detail
-
schemaReader
protected final SchemaReader schemaReader
-
-
Constructor Detail
-
DelegatingSchemaReader
protected DelegatingSchemaReader(SchemaReader schemaReader)
Creates a DelegatingSchemaReader.- Parameters:
schemaReader- Parent reader to delegate unhandled calls to
-
-
Method Detail
-
getSchema
public RolapSchema getSchema()
Description copied from interface:SchemaReaderReturns the schema.- Specified by:
getSchemain interfaceSchemaReader- Returns:
- Schema, never null
-
getRole
public Role getRole()
Description copied from interface:SchemaReaderReturns the access-control profile that thisSchemaReaderis implementing.- Specified by:
getRolein interfaceSchemaReader
-
getCube
public Cube getCube()
Description copied from interface:SchemaReaderReturns the default cube in which to look for dimensions etc.- Specified by:
getCubein interfaceSchemaReader- Returns:
- Default cube
-
getCubeDimensions
public List<Dimension> getCubeDimensions(Cube cube)
Description copied from interface:SchemaReaderReturns the accessible dimensions of a cube.- Specified by:
getCubeDimensionsin interfaceSchemaReader
-
getDimensionHierarchies
public List<Hierarchy> getDimensionHierarchies(Dimension dimension)
Description copied from interface:SchemaReaderReturns the accessible hierarchies of a dimension.- Specified by:
getDimensionHierarchiesin interfaceSchemaReader
-
getHierarchyRootMembers
public List<Member> getHierarchyRootMembers(Hierarchy hierarchy)
Description copied from interface:SchemaReaderReturns an array of the root members ofhierarchy.- Specified by:
getHierarchyRootMembersin interfaceSchemaReader- Parameters:
hierarchy- Hierarchy- See Also:
SchemaReader.getCalculatedMembers(Hierarchy)
-
getMemberParent
public Member getMemberParent(Member member)
Description copied from interface:SchemaReaderReturns the parent ofmember.- Specified by:
getMemberParentin interfaceSchemaReader- Parameters:
member- Member- Returns:
- null if member is a root member
-
substitute
public Member substitute(Member member)
Description copied from interface:SchemaReaderSubstitutes a member with an equivalent member which enforces the access control policy of this SchemaReader.- Specified by:
substitutein interfaceSchemaReader
-
getMemberChildren
public List<Member> getMemberChildren(Member member)
Description copied from interface:SchemaReaderReturns direct children ofmember.- Specified by:
getMemberChildrenin interfaceSchemaReader
-
getMemberChildren
public List<Member> getMemberChildren(List<Member> members)
Description copied from interface:SchemaReaderReturns direct children of each element ofmembers.- Specified by:
getMemberChildrenin interfaceSchemaReader- Parameters:
members- Array of members- Returns:
- array of child members
-
getParentChildContributingChildren
public void getParentChildContributingChildren(Member dataMember, Hierarchy hierarchy, List<Member> list)
Description copied from interface:SchemaReaderReturns a list of contributing children of a member of a parent-child hierarchy.- Specified by:
getParentChildContributingChildrenin interfaceSchemaReader- Parameters:
dataMember- Data member for a member of the parent-child hierarcyhierarchy- Hierarchylist- List of members to populate
-
getMemberDepth
public int getMemberDepth(Member member)
Description copied from interface:SchemaReaderReturns the depth of a member.This may not be the same as
member.for three reasons:getLevel().getDepth()- Access control. The most senior visible member has level 0. If the client is not allowed to see the "All" and "Nation" levels of the "Store" hierarchy, then members of the "State" level will have depth 0.
- Parent-child hierarchies. Suppose Fred reports to Wilma, and Wilma reports to no one. "All Employees" has depth 0, Wilma has depth 1, and Fred has depth 2. Fred and Wilma are both in the "Employees" level, which has depth 1.
- Ragged hierarchies. If Israel has only one, hidden, province then the depth of Tel Aviv, Israel is 2, whereas the depth of another city, San Francisco, CA, USA is 3.
- Specified by:
getMemberDepthin interfaceSchemaReader
-
getMemberByUniqueName
public final Member getMemberByUniqueName(List<Id.Segment> uniqueNameParts, boolean failIfNotFound)
Description copied from interface:SchemaReaderFinds a member based upon its unique name, requiring an exact match.This method is equivalent to calling
SchemaReader.getMemberByUniqueName(java.util.List, boolean, MatchType)withMatchType.EXACT.- Specified by:
getMemberByUniqueNamein interfaceSchemaReader- Parameters:
uniqueNameParts- Unique name of memberfailIfNotFound- Whether to throw an error, as opposed to returningnull, if there is no such member.- Returns:
- The member, or null if not found
-
getMemberByUniqueName
public Member getMemberByUniqueName(List<Id.Segment> uniqueNameParts, boolean failIfNotFound, MatchType matchType)
Description copied from interface:SchemaReaderFinds a member based upon its unique name.- Specified by:
getMemberByUniqueNamein interfaceSchemaReader- Parameters:
uniqueNameParts- Unique name of memberfailIfNotFound- Whether to throw an error, as opposed to returningnull, if there is no such member.matchType- indicates the match mode; if not specified, EXACT- Returns:
- The member, or null if not found
-
lookupCompound
public final OlapElement lookupCompound(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category)
Description copied from interface:SchemaReaderLooks up an MDX object by name.Resolves a name such as '[Products].[Product Department].[Produce]' by resolving the components ('Products', and so forth) one at a time.
- Specified by:
lookupCompoundin interfaceSchemaReader- Parameters:
parent- Parent element to search innames- Exploded compound name, such as {"Products", "Product Department", "Produce"}failIfNotFound- If the element is not found, determines whether to return null or throw an errorcategory- Type of returned element, aCategoryvalue;Category.Unknownif it doesn't matter.
-
lookupCompound
public final OlapElement lookupCompound(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category, MatchType matchType)
Description copied from interface:SchemaReaderLooks up an MDX object by name, specifying how to match if no object exactly matches the name.Resolves a name such as '[Products].[Product Department].[Produce]' by resolving the components ('Products', and so forth) one at a time.
- Specified by:
lookupCompoundin interfaceSchemaReader- Parameters:
parent- Parent element to search innames- Exploded compound name, such as {"Products", "Product Department", "Produce"}failIfNotFound- If the element is not found, determines whether to return null or throw an errorcategory- Type of returned element, aCategoryvalue;Category.Unknownif it doesn't matter.matchType- indicates the match mode; if not specified, EXACT
-
getNamespaces
public List<NameResolver.Namespace> getNamespaces()
Description copied from interface:SchemaReaderReturns a list of namespaces to search when resolving elements by name.For example, a schema reader from the perspective of a cube will return cube and schema namespaces.
- Specified by:
getNamespacesin interfaceSchemaReader- Returns:
- List of namespaces
-
lookupCompoundInternal
public OlapElement lookupCompoundInternal(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category, MatchType matchType)
-
getCalculatedMember
public Member getCalculatedMember(List<Id.Segment> nameParts)
Description copied from interface:SchemaReaderLooks up a calculated member by name. If the name is not found in the current scope, returns null.- Specified by:
getCalculatedMemberin interfaceSchemaReader
-
getNamedSet
public NamedSet getNamedSet(List<Id.Segment> nameParts)
Description copied from interface:SchemaReaderLooks up a set by name. If the name is not found in the current scope, returns null.- Specified by:
getNamedSetin interfaceSchemaReader
-
getMemberRange
public void getMemberRange(Level level, Member startMember, Member endMember, List<Member> list)
Description copied from interface:SchemaReaderAppends tolistall members betweenstartMemberandendMember(inclusive) which belong tolevel.- Specified by:
getMemberRangein interfaceSchemaReader
-
getLeadMember
public Member getLeadMember(Member member, int n)
Description copied from interface:SchemaReaderReturns a membernfurther along in the same level frommember.- Specified by:
getLeadMemberin interfaceSchemaReader
-
compareMembersHierarchically
public int compareMembersHierarchically(Member m1, Member m2)
Description copied from interface:SchemaReaderCompares a pair ofMembers according to their order in a prefix traversal. (that is, it is an ancestor or a earlier), is a sibling, or comes later in a prefix traversal.- Specified by:
compareMembersHierarchicallyin interfaceSchemaReader- Returns:
- A negative integer if
m1is an ancestor, an earlier sibling of an ancestor, or a descendent of an earlier sibling, ofm2; zero ifm1is a sibling ofm2; a positive integer ifm1comes later in the prefix traversal thenm2.
-
getElementChild
public OlapElement getElementChild(OlapElement parent, Id.Segment name)
Description copied from interface:SchemaReaderLooks up the child ofparentname, returning null if no element is found.Always equivalent to
getElementChild(parent, name, MatchType.EXACT).- Specified by:
getElementChildin interfaceSchemaReader- Parameters:
parent- Parent element to search inname- Compound in compound name, such as "[Product]" or "&[1]"- Returns:
- Element with given name, or null
-
getElementChild
public OlapElement getElementChild(OlapElement parent, Id.Segment name, MatchType matchType)
Description copied from interface:SchemaReaderLooks up the child ofparentcalledname, or an approximation according tomatchType, returning null if no element is found.- Specified by:
getElementChildin interfaceSchemaReader- Parameters:
parent- Parent element to search inname- Compound in compound name, such as "[Product]" or "&[1]"matchType- Match type- Returns:
- Element with given name, or null
-
getLevelMembers
public List<Member> getLevelMembers(Level level, boolean includeCalculated)
Description copied from interface:SchemaReaderReturns the members of a level, optionally including calculated members.- Specified by:
getLevelMembersin interfaceSchemaReader
-
getHierarchyLevels
public List<Level> getHierarchyLevels(Hierarchy hierarchy)
Description copied from interface:SchemaReaderReturns the accessible levels of a hierarchy.- Specified by:
getHierarchyLevelsin interfaceSchemaReader- Parameters:
hierarchy- Hierarchy
-
getHierarchyDefaultMember
public Member getHierarchyDefaultMember(Hierarchy hierarchy)
Description copied from interface:SchemaReaderReturns the default member of a hierarchy. If the default member is in an inaccessible level, returns the nearest ascendant/descendant member.- Specified by:
getHierarchyDefaultMemberin interfaceSchemaReader- Parameters:
hierarchy- Hierarchy- Returns:
- Default member of hierarchy
-
isDrillable
public boolean isDrillable(Member member)
Description copied from interface:SchemaReaderReturns whether a member has visible children.- Specified by:
isDrillablein interfaceSchemaReader
-
isVisible
public boolean isVisible(Member member)
Description copied from interface:SchemaReaderReturns whether a member is visible.- Specified by:
isVisiblein interfaceSchemaReader
-
getCubes
public Cube[] getCubes()
Description copied from interface:SchemaReaderReturns the list of accessible cubes.- Specified by:
getCubesin interfaceSchemaReader
-
getCalculatedMembers
public List<Member> getCalculatedMembers(Hierarchy hierarchy)
Description copied from interface:SchemaReaderReturns a list of calculated members in a given hierarchy.- Specified by:
getCalculatedMembersin interfaceSchemaReader
-
getCalculatedMembers
public List<Member> getCalculatedMembers(Level level)
Description copied from interface:SchemaReaderReturns a list of calculated members in a given level.- Specified by:
getCalculatedMembersin interfaceSchemaReader
-
getCalculatedMembers
public List<Member> getCalculatedMembers()
Description copied from interface:SchemaReaderReturns the list of calculated members.- Specified by:
getCalculatedMembersin interfaceSchemaReader
-
getChildrenCountFromCache
public int getChildrenCountFromCache(Member member)
Description copied from interface:SchemaReaderReturns number of children parent of a member, if the information can be retrieved from cache, otherwise -1.- Specified by:
getChildrenCountFromCachein interfaceSchemaReader
-
getLevelCardinality
public int getLevelCardinality(Level level, boolean approximate, boolean materialize)
Description copied from interface:SchemaReaderReturns the number of members in a level, returning an approximation if acceptable.- Specified by:
getLevelCardinalityin interfaceSchemaReader- Parameters:
level- Levelapproximate- Whether an approximation is acceptablematerialize- Whether to go to disk if no approximation for the count is available and the members are not in cache. If false, returnsInteger.MIN_VALUEif value is not in cache.
-
getLevelMembers
public List<Member> getLevelMembers(Level level, Evaluator context)
Description copied from interface:SchemaReaderReturns the members of a level, optionally filtering out members which are empty.- Specified by:
getLevelMembersin interfaceSchemaReader- Parameters:
level- Levelcontext- Context for filtering- Returns:
- Members of this level
-
getMemberChildren
public List<Member> getMemberChildren(Member member, Evaluator context)
Description copied from interface:SchemaReaderReturns direct children ofmember, optimized for NON EMPTY.If
context == nullthen there is no context and all members are returned - then its identical toSchemaReader.getMemberChildren(Member). Ifcontextis not null, the resulting members may be restricted to those members that have a non empty row in the fact table forcontext. Wether or not optimization is possible depends on the SchemaReader implementation.- Specified by:
getMemberChildrenin interfaceSchemaReader
-
getMemberChildren
public List<Member> getMemberChildren(List<Member> members, Evaluator context)
Description copied from interface:SchemaReaderReturns direct children of each element ofmemberswhich is not empty incontext.- Specified by:
getMemberChildrenin interfaceSchemaReader- Parameters:
members- Array of memberscontext- Evaluation context- Returns:
- array of child members
-
getMemberAncestors
public void getMemberAncestors(Member member, List<Member> ancestorList)
Description copied from interface:SchemaReaderReturns a list of ancestors ofmember, in depth order.For example, for [Store].[USA].[CA], returns {[Store].[USA], [Store].[All Stores]}.
- Specified by:
getMemberAncestorsin interfaceSchemaReader- Parameters:
member- MemberancestorList- List of ancestors
-
lookupMemberChildByName
public Member lookupMemberChildByName(Member member, Id.Segment memberName, MatchType matchType)
Description copied from interface:SchemaReaderFinds a child of a member with a given name.- Specified by:
lookupMemberChildByNamein interfaceSchemaReader
-
lookupMemberChildrenByNames
public List<Member> lookupMemberChildrenByNames(Member parent, List<Id.NameSegment> childNames, MatchType matchType)
Description copied from interface:SchemaReaderFinds a list of child members with the given names.- Specified by:
lookupMemberChildrenByNamesin interfaceSchemaReader
-
getNativeSetEvaluator
public NativeEvaluator getNativeSetEvaluator(FunDef fun, Exp[] args, Evaluator evaluator, Calc calc)
Description copied from interface:SchemaReaderReturns an object which can evaluate an expression in native SQL, or null if this is not possible.- Specified by:
getNativeSetEvaluatorin interfaceSchemaReader- Parameters:
fun- Functionargs- Arguments to the functionevaluator- Evaluator, provides contextcalc- the calc to be natively evaluated
-
getParameter
public Parameter getParameter(String name)
Description copied from interface:SchemaReaderReturns the definition of a parameter with a given name, or null if not found.- Specified by:
getParameterin interfaceSchemaReader
-
getDataSource
public DataSource getDataSource()
Description copied from interface:SchemaReaderReturns the data source.- Specified by:
getDataSourcein interfaceSchemaReader- Returns:
- data source
-
withoutAccessControl
public SchemaReader withoutAccessControl()
Description copied from interface:SchemaReaderReturns a similar schema reader that has no access control.- Specified by:
withoutAccessControlin interfaceSchemaReader- Returns:
- Schema reader that has a similar perspective (e.g. cube) but no access control
-
withLocus
public SchemaReader withLocus()
Description copied from interface:SchemaReaderReturns a schema reader that automatically assigns a locus to each operation.It is less efficient; use this only if the operation is occurring outside the context of a statement. If you get the internal error "no locus", that's a sign you should use this method.
- Specified by:
withLocusin interfaceSchemaReader- Returns:
- Schema reader that assigns a locus to each operation
-
getMemberChildrenWithDetails
public Map<? extends Member,Access> getMemberChildrenWithDetails(Member member, Evaluator evaluator)
Description copied from interface:SchemaReaderSimilar toSchemaReader.getMemberChildren(Member, Evaluator)but returns a map of the grand-children and their access details and costs more to invoke because of the access controls. Called byRolapHierarchywhen determining the lowest access level of a Role within a hierarchy.- Specified by:
getMemberChildrenWithDetailsin interfaceSchemaReader
-
-