|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.rolap.CacheMemberReader
class CacheMemberReader
CacheMemberReader
implements MemberReader
by reading
from a pre-populated array of Member
s.
Note: CacheMemberReader can not handle ragged hierarchies. (HR
Tests fail if SmartMemberReader
is replaced with
CacheMemberReader).
Constructor Summary | |
---|---|
CacheMemberReader(MemberSource source)
|
Method Summary | |
---|---|
int |
compare(RolapMember m1,
RolapMember m2,
boolean siblingsAreEqual)
Compares two members according to their order in a prefix ordered traversal. |
RolapMember |
desubstitute(RolapMember member)
Returns the member which was substituted. |
List<RolapMember> |
getChildrenFromCache(RolapMember member,
MemberChildrenConstraint constraint)
Returns the children of member if they are currently in the
cache, otherwise returns null. |
RolapMember |
getDefaultMember()
|
RolapHierarchy |
getHierarchy()
Returns the hierarchy that this source is reading for. |
RolapMember |
getLeadMember(RolapMember member,
int n)
Returns the member n after member in the same
level (or before, if n is negative). |
int |
getLevelMemberCount(RolapLevel level)
Returns the number of members in this level. |
List<RolapMember> |
getLevelMembersFromCache(RolapLevel level,
TupleConstraint constraint)
Returns the members of level if they are currently in the
cache, otherwise returns null. |
RolapMember |
getMember(Object key)
Retrieves the RolapMember with a given key. |
RolapMember |
getMember(Object key,
boolean mustCheckCacheStatus)
Retrieves the RolapMember with a given key. |
TupleReader.MemberBuilder |
getMemberBuilder()
|
void |
getMemberChildren(List<RolapMember> parentMembers,
List<RolapMember> children)
Returns all members which are a child of one of the members in parentMembers , sorted by ordinal. |
void |
getMemberChildren(List<RolapMember> parentMembers,
List<RolapMember> children,
MemberChildrenConstraint constraint)
Populates a list of the children of a given set of Members, optionally applying a constraint. |
void |
getMemberChildren(RolapMember parentMember,
List<RolapMember> children)
Writes all children parentMember to children . |
void |
getMemberChildren(RolapMember member,
List<RolapMember> children,
MemberChildrenConstraint constraint)
Populates a list of the children of a Member, optionally applying a constraint. |
int |
getMemberCount()
Returns an estimate of number of members in this hierarchy. |
RolapMember |
getMemberParent(RolapMember member)
|
void |
getMemberRange(RolapLevel level,
RolapMember startMember,
RolapMember endMember,
List<RolapMember> list)
Writes all members between startMember and
endMember into list . |
List<RolapMember> |
getMembers()
Returns all members of this hierarchy, sorted by ordinal. |
List<RolapMember> |
getMembersInLevel(RolapLevel level,
int startOrdinal,
int endOrdinal)
Returns all of the members in level whose ordinal lies
between startOrdinal and endOrdinal . |
List<RolapMember> |
getMembersInLevel(RolapLevel level,
int startOrdinal,
int endOrdinal,
TupleConstraint constraint)
Returns the members in the given Level, optionally between a range of ordinals and applying a constraint. |
List<RolapMember> |
getRootMembers()
Returns all members of this hierarchy which do not have a parent, sorted by ordinal. |
boolean |
isMutable()
Returns whether the cache supports removing selected items. |
RolapMember |
lookupMember(List<Id.Segment> uniqueNameParts,
boolean failIfNotFound)
Finds a member based upon its unique name. |
Object |
makeKey(RolapMember parent,
Object key)
Creates a key with which to MemberCache.getMember(Object) or
MemberCache.putMember(Object, RolapMember) the
RolapMember with a given parent and key. |
void |
putChildren(RolapMember member,
MemberChildrenConstraint constraint,
List<RolapMember> children)
Registers that the children of member are
children (a list of RolapMember s). |
Object |
putMember(Object key,
RolapMember value)
Replaces the RolapMember with a given key and returns the
previous member if any. |
RolapMember |
removeMember(Object key)
Removes the RolapMember with a given key from the cache. |
RolapMember |
removeMemberAndDescendants(Object key)
Removes the designated RolapMember and all its descendants. |
boolean |
setCache(MemberCache cache)
Sets the cache which this MemberSource will write to. |
RolapMember |
substitute(RolapMember member)
Substitutes a given member. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
CacheMemberReader(MemberSource source)
Method Detail |
---|
public RolapHierarchy getHierarchy()
MemberSource
getHierarchy
in interface MemberSource
public boolean setCache(MemberCache cache)
MemberSource
MemberSource
will write to.
Cache-writeback is optional (for example, SqlMemberSource
supports it, and ArrayMemberSource
does not), and the return
value from this method indicates whether this object supports it.
If this method returns true
, the MemberSource.getMembers()
,
MemberSource.getRootMembers()
and MemberSource.getMemberChildren(mondrian.rolap.RolapMember, java.util.List
methods must
write to the cache, in addition to returning members as a return value.
setCache
in interface MemberSource
cache
- The MemberCache
which the caller would like
this MemberSource
to write to.
MemberSource
supports cache-writeback.public RolapMember substitute(RolapMember member)
MemberReader
This method is called whenever a member is returned from the wrapped member reader and is to be returned to the caller. You could say that it translates 'to caller space'.
substitute
in interface MemberReader
member
- Member
public RolapMember desubstitute(RolapMember member)
MemberReader
This method is called whenever the caller passes a member into a method and needs to be passed to a method on the wrapped member reader. You could say that it translates 'from caller space'.
desubstitute
in interface MemberReader
member
- Member
public List<RolapMember> getMembers()
MemberSource
If this object supports cache-writeaback
, also
writes these members to the cache.
getMembers
in interface MemberSource
public Object makeKey(RolapMember parent, Object key)
MemberCache
MemberCache.getMember(Object)
or
MemberCache.putMember(Object, RolapMember)
the
RolapMember
with a given parent and key.
makeKey
in interface MemberCache
parent
- Parent memberkey
- Key of member within parent
public RolapMember getMember(Object key)
MemberCache
RolapMember
with a given key.
getMember
in interface MemberCache
key
- cache key, created by MemberCache.makeKey(mondrian.rolap.RolapMember, java.lang.Object)
public RolapMember getMember(Object key, boolean mustCheckCacheStatus)
MemberCache
RolapMember
with a given key.
getMember
in interface MemberCache
key
- cache key, created by MemberCache.makeKey(mondrian.rolap.RolapMember, java.lang.Object)
mustCheckCacheStatus
- If true
, do not check cache status
public Object putMember(Object key, RolapMember value)
MemberCache
RolapMember
with a given key and returns the
previous member if any.
putMember
in interface MemberCache
key
- cache key, created by MemberCache.makeKey(mondrian.rolap.RolapMember, java.lang.Object)
value
- new member
public void putChildren(RolapMember member, MemberChildrenConstraint constraint, List<RolapMember> children)
MemberCache
member
are
children
(a list of RolapMember
s).
putChildren
in interface MemberCache
member
- the parent memberconstraint
- the condition that was used when the members were
fetched. May be null for all members (no constraint)children
- list of childrenpublic boolean isMutable()
MemberCache
MemberCache.removeMember(Object)
and
MemberCache.removeMemberAndDescendants(Object)
methods.
REVIEW: remove isMutable and move removeMember and removeMemberAndDescendants to new interface MutableMemberCache
isMutable
in interface MemberCache
public RolapMember removeMember(Object key)
MemberCache
RolapMember
with a given key from the cache.
Returns the previous member with that key, or null.
Optional operation: see MemberCache.isMutable()
.
removeMember
in interface MemberCache
key
- cache key, created by MemberCache.makeKey(mondrian.rolap.RolapMember, java.lang.Object)
public RolapMember removeMemberAndDescendants(Object key)
MemberCache
RolapMember
and all its descendants.
Returns the previous member with that key, or null.
Optional operation: see MemberCache.isMutable()
.
removeMemberAndDescendants
in interface MemberCache
key
- cache key, created by MemberCache.makeKey(mondrian.rolap.RolapMember, java.lang.Object)
public List<RolapMember> getChildrenFromCache(RolapMember member, MemberChildrenConstraint constraint)
MemberCache
member
if they are currently in the
cache, otherwise returns null.
The children may be garbage collected as soon as the returned list may be garbage collected.
getChildrenFromCache
in interface MemberCache
member
- the parent memberconstraint
- the condition that was used when the members were
fetched. May be null for all members (no constraint)
public List<RolapMember> getLevelMembersFromCache(RolapLevel level, TupleConstraint constraint)
MemberCache
level
if they are currently in the
cache, otherwise returns null.
The members may be garbage collected as soon as the returned list may be garbage collected.
getLevelMembersFromCache
in interface MemberCache
level
- the level whose members should be fetchedconstraint
- the condition that was used when the members were
fetched. May be null for all members (no constraint)
public RolapMember lookupMember(List<Id.Segment> uniqueNameParts, boolean failIfNotFound)
MemberSource
lookupMember
in interface MemberSource
public List<RolapMember> getRootMembers()
MemberSource
If this object supports cache-writeback
, also
writes these members to the cache.
getRootMembers
in interface MemberSource
List
of RolapMember
spublic List<RolapMember> getMembersInLevel(RolapLevel level, int startOrdinal, int endOrdinal)
MemberReader
level
whose ordinal lies
between startOrdinal
and endOrdinal
.
If this object
supports cache-writeback
, also
writes these members to the cache.
getMembersInLevel
in interface MemberReader
List
of RolapMember
public List<RolapMember> getMembersInLevel(RolapLevel level, int startOrdinal, int endOrdinal, TupleConstraint constraint)
MemberReader
getMembersInLevel
in interface MemberReader
level
- LevelstartOrdinal
- Ordinal of first member to retrieveendOrdinal
- Ordinal of last member to upper boundconstraint
- Constraint
public int getLevelMemberCount(RolapLevel level)
MemberReader
getLevelMemberCount
in interface MemberReader
level
- Level
public void getMemberChildren(RolapMember parentMember, List<RolapMember> children)
MemberSource
parentMember
to children
.
If this object supports cache-writeback
, also
writes these members to the cache.
getMemberChildren
in interface MemberSource
public void getMemberChildren(RolapMember member, List<RolapMember> children, MemberChildrenConstraint constraint)
MemberReader
getMemberChildren
in interface MemberReader
member
- Members whose children to findchildren
- List to populate with membersconstraint
- Constraintpublic void getMemberChildren(List<RolapMember> parentMembers, List<RolapMember> children)
MemberSource
parentMembers
, sorted by ordinal.
If this object supports cache-writeaback
, also
writes these members to the cache.
getMemberChildren
in interface MemberSource
public void getMemberChildren(List<RolapMember> parentMembers, List<RolapMember> children, MemberChildrenConstraint constraint)
MemberReader
getMemberChildren
in interface MemberReader
parentMembers
- List of members whose children to findchildren
- List to populate with membersconstraint
- Constraintpublic RolapMember getLeadMember(RolapMember member, int n)
MemberReader
n
after member
in the same
level (or before, if n
is negative).
Returns Hierarchy.getNullMember()
if we run off the beginning or
end of the level.
getLeadMember
in interface MemberReader
public void getMemberRange(RolapLevel level, RolapMember startMember, RolapMember endMember, List<RolapMember> list)
MemberReader
startMember
and
endMember
into list
.
getMemberRange
in interface MemberReader
public int getMemberCount()
MemberSource
getMemberCount
in interface MemberSource
public int compare(RolapMember m1, RolapMember m2, boolean siblingsAreEqual)
MemberReader
siblingsAreEqual
, then two members with the
same parent will compare equal.
compare
in interface MemberReader
siblingsAreEqual
and
m1 and m2 have the same parentpublic TupleReader.MemberBuilder getMemberBuilder()
getMemberBuilder
in interface MemberReader
public RolapMember getDefaultMember()
getDefaultMember
in interface MemberReader
public RolapMember getMemberParent(RolapMember member)
getMemberParent
in interface MemberReader
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |