Package com.microstrategy.webapi
Interface ACMConsolidator<TDestination extends ACMDestination<TDestination>,TTargetDestination extends ACMDestination.ACMTargetDestination<TDestination>>
-
- All Known Implementing Classes:
ACMRefreshClusterMembershipConsolidator
public interface ACMConsolidator<TDestination extends ACMDestination<TDestination>,TTargetDestination extends ACMDestination.ACMTargetDestination<TDestination>>
ACMConsolidator is an interface that the user of the ACMDistributer utility must implement
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ACMConsolidator.SESSION_MODE
static class
ACMConsolidator.STRING_DATA_FORMAT
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addToConsolidation(java.lang.String iStringData)
addToConsolidation is how the results of all all the XML API calls are notified to the ACMConslidator.default void
extractPage()
extractPage is used after the results are complete and merged.java.lang.String
getConsolidatedStringData()
getConsolidatedStringData will return the string data format (xml or Json) that has been consolidated in the startConsolidation and addToConsolidation steps
This method does last-minute finalization of the final result.ACMConsolidator.STRING_DATA_FORMAT
getResultStringDataFormat()
ACMConsolidator.SESSION_MODE
getSessionMode()
default <TClusterNode extends IDSSXMLClusterNode>
voidnotifyClusterNodeChoices(java.util.Map<TClusterNode,java.util.Collection<java.lang.String>> iClusterNodes, TDestination iDestination)
notifyClusterNodeChoices is the way the ACMDistributor infrastructure notifies the ACMConsolidator of its decisions about IServers.default <TClusterNode extends IDSSXMLClusterNode>
java.util.Map<TClusterNode,java.util.Collection<java.lang.String>>overrideClusterNodes(java.util.List<TClusterNode> iAllNodesInCluster, java.util.List<TClusterNode> iActiveNodesInCluster, java.util.Collection<java.lang.String> iProjectIds)
overrideClusterNodes allows the ACMConsolidator to override the choices that the ACMDistributor infrastructure would make.
The ACMDistributor can calculate the IServers for you, picking IServers that obey the rules of User Fencing, User Affinity, Load Balancing, Distribution of Project, etc.java.lang.String
remoteCall(TTargetDestination iTargetDestination, java.util.Collection<java.lang.String> iProjectIds)
remoteCall is where the ACMConsolidator implements the XML API call to a specific IServer.default void
setTime(long iMilliseconds)
setTime is used to set the total running time of the distributed operation.default boolean
useCachedValue(TTargetDestination iTargetDestination)
useCachedValue allows the ACMConsolidator to skip some IServers.
-
-
-
Method Detail
-
overrideClusterNodes
default <TClusterNode extends IDSSXMLClusterNode> java.util.Map<TClusterNode,java.util.Collection<java.lang.String>> overrideClusterNodes(java.util.List<TClusterNode> iAllNodesInCluster, java.util.List<TClusterNode> iActiveNodesInCluster, java.util.Collection<java.lang.String> iProjectIds)
overrideClusterNodes allows the ACMConsolidator to override the choices that the ACMDistributor infrastructure would make.
The ACMDistributor can calculate the IServers for you, picking IServers that obey the rules of User Fencing, User Affinity, Load Balancing, Distribution of Project, etc. This method is provided for special occasions when you want to pick your own set of IServers.
To use the default list, return an empty list (or use the default implementation)- Parameters:
iAllNodesInCluster
- a list of all the nodes in the cluster (alive or dead)iActiveNodesInCluster
- a list of all the alive nodes in the clusteriProjectIds
- a list of project ids- Returns:
- Map of IDSSXMLClusterNode to List of Project Ids. Guaranteed to not be null, but may be empty
-
notifyClusterNodeChoices
default <TClusterNode extends IDSSXMLClusterNode> void notifyClusterNodeChoices(java.util.Map<TClusterNode,java.util.Collection<java.lang.String>> iClusterNodes, TDestination iDestination) throws MSTRWebAPIException
notifyClusterNodeChoices is the way the ACMDistributor infrastructure notifies the ACMConsolidator of its decisions about IServers.- Parameters:
iClusterNodes
- all the IServers that will be called and which projects will be usediDestination
- the cluster level destination (descriptive of the cluster)- Throws:
MSTRWebAPIException
-
useCachedValue
default boolean useCachedValue(TTargetDestination iTargetDestination)
useCachedValue allows the ACMConsolidator to skip some IServers. This is useful when the data hasn't changed and you still have a cache.- Parameters:
iTargetDestination
- information about the target IServer. For XML API calls that require a session, the session id is in this structure.- Returns:
- true to tell the ACMDistributor infrastructure to skip this IServer, false to tell it to create a thread and call the XML API on is IServer
-
remoteCall
java.lang.String remoteCall(TTargetDestination iTargetDestination, java.util.Collection<java.lang.String> iProjectIds) throws MSTRWebAPIException
remoteCall is where the ACMConsolidator implements the XML API call to a specific IServer. The ACMConsolidator may need to construct the XML and sends/receive it to/from an IServer. The result MUST be in a "string data format" such as xml or Json
The ACMDistributor infrastructure creates threads for each IServer and calls remoteCall for each IServer (on different threads). Thus, this call is fully free threaded. So be wary, you may need a lock.- Parameters:
iTargetDestination
- information about the target IServer. For XML API calls that require a session, the session id is in this structure.iProjectIds
- the set of project ids to access on this IServer. It may be empty but never null- Returns:
- the XML or JSON returned from the XML API call
- Throws:
MSTRWebAPIException
-
addToConsolidation
void addToConsolidation(java.lang.String iStringData) throws MSTRWebAPIException
addToConsolidation is how the results of all all the XML API calls are notified to the ACMConslidator. The ACMConsolidator should collect all the data in preparation for consolidation. Although this call may happen in parallel with remoteCall, this call is serially called to itself. Thus, you probably won't need a lock- Parameters:
iStringData
-- Throws:
MSTRWebAPIException
-
setTime
default void setTime(long iMilliseconds)
setTime is used to set the total running time of the distributed operation. Each operation is run simultaneously. Thus, timing each operation alone and then adding the results could produce a time that is actually longer than the real-time that has elapsed as an end user would feel. So, the algorithm is to start a timer before distribution, stop the timer once all results are complete and merged. Use this method to set that time interval.- Parameters:
iMilliseconds
-
-
extractPage
default void extractPage()
extractPage is used after the results are complete and merged. The resulting set may be very large. This method pulls out, from that resulting set, just the page that was asked for.
-
getConsolidatedStringData
java.lang.String getConsolidatedStringData() throws MSTRWebAPIException
getConsolidatedStringData will return the string data format (xml or Json) that has been consolidated in the startConsolidation and addToConsolidation steps
This method does last-minute finalization of the final result. This method is guaranteed to be called only once and after the call to extractPage.- Returns:
- Throws:
MSTRWebAPIException
-
getSessionMode
ACMConsolidator.SESSION_MODE getSessionMode()
-
getResultStringDataFormat
ACMConsolidator.STRING_DATA_FORMAT getResultStringDataFormat()
-
-