|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.TaskHeap.UpdateManager.UpdateManagerNodeDecl
org.sandev.TaskHeap.UpdateManager.UpdateManagerNodeBase
org.sandev.TaskHeap.UpdateManager.UpdateManagerNode
Implementation of UpdateManagerNode.
| Field Summary | |
protected long |
startupTime
The timestamp when this node started. |
protected org.sandev.basics.util.AuthUserLookup |
userLookup
The instance we use for looking up users. |
| Fields inherited from class org.sandev.TaskHeap.UpdateManager.UpdateManagerNodeDecl |
notify, userLookupInstanceName |
| Fields inherited from interface org.sandev.basics.nodecommon.Controllable |
OPERATION_FAIL, OPERATION_RESUME, OPERATION_SHUTDOWN, OPERATION_STARTUP, OPERATION_STR_FAIL, OPERATION_STR_RESUME, OPERATION_STR_SHUTDOWN, OPERATION_STR_STARTUP, OPERATION_STR_SUSPEND, OPERATION_STR_UNDEFINED, OPERATION_STRINGS, OPERATION_SUSPEND, OPERATION_UNDEFINED, SHUTDOWN_ERROR_RESTART_GLOBAL, SHUTDOWN_ERROR_RESTART_LOCAL, SHUTDOWN_ERROR_TERMINATE, SHUTDOWN_NORMAL, STATE_FAILED, STATE_FAILING, STATE_RESUMING, STATE_RUNNING, STATE_STARTING, STATE_STOPPED, STATE_STOPPING, STATE_STR_FAILED, STATE_STR_FAILING, STATE_STR_RESUMING, STATE_STR_RUNNING, STATE_STR_STARTING, STATE_STR_STOPPED, STATE_STR_STOPPING, STATE_STR_SUSPENDED, STATE_STR_SUSPENDING, STATE_STR_UNDEFINED, STATE_STRINGS, STATE_SUSPENDED, STATE_SUSPENDING, STATE_UNDEFINED |
| Constructor Summary | |
UpdateManagerNode()
|
|
| Method Summary | |
protected org.sandev.basics.structs.AggregateUpdate |
addImpliedUpdates(org.sandev.basics.structs.AggregateUpdate au)
Add any additional updates that are implied by the given updates to the given AggregateUpdate message. |
org.sandev.basics.structs.AggregateUpdate |
callAggregateUpdate(org.sandev.basics.structs.AggregateUpdate au)
Override any synchronous outbound AggregateUpdate call to update our cached information along the way. |
protected void |
confirmChildReferences(PlanUpdate pu,
java.util.ArrayList al,
org.sandev.basics.structs.AggregateUpdate au)
Make sure that any referenced instances have this Plan as the parent, and make sure no previously referenced instances still reference this Plan. |
protected static org.sandev.basics.structs.SandPersistMessage |
findFromUpdates(long id,
java.util.ArrayList al)
If there is an existing update in the list for the given ID, then return that instance. |
protected org.sandev.basics.structs.SandUpdateMessage |
findUpdate(long id,
org.sandev.basics.structs.SandUpdateMessage[] updates,
java.util.ArrayList al)
Look for an existing update of the specified instance and return the latest, or null if not found. |
protected boolean |
fixReference(Plan plan,
long childID,
boolean hasChild)
Given a plan that either hasChild or not, add the reference or remove it as needed. |
java.lang.String |
getDeploymentPrefix()
Return the prefix for this deployment. |
org.sandev.basics.structs.SandPersistMessage |
getInstance(java.lang.String classname,
long id,
org.sandev.basics.util.AuthUser user)
Instance lookup utility. |
protected long |
getParentForInstance(org.sandev.basics.structs.SandInstanceMessage sim)
Return the parent uniqueID for the PlanComponent derived instance, or zero if there is no parent reference. |
protected long |
getParentForUpdate(org.sandev.basics.structs.SandUpdateMessage sum)
Return the parent uniqueID for the PlanComponent derived update, or zero if there is no parent reference. |
org.sandev.basics.util.AuthUser |
getUserForID(long id)
Convenience passthrough call to our configured AuthUserLookup. |
org.sandev.basics.util.AuthUser |
getUserFromLogin(java.lang.String username,
java.lang.String password)
Convenience passthrough call to our configured AuthUserLookup. |
org.sandev.basics.util.AuthUserLookup |
getUserLookup()
initializing accessor for userLookup. |
protected org.sandev.basics.structs.AggregateUpdate |
heapUpdate(org.sandev.basics.structs.AggregateUpdate au)
Handle the specified updates to the overall TaskHeap. |
protected boolean |
isRecalcExempt(org.sandev.basics.structs.SandUpdateMessage sum)
Return true if this update is exempt from recalc processing, false otherwise. |
protected boolean |
isTopLevelPlan(org.sandev.basics.structs.SandPersistMessage spm)
Return true if the given SandPersistMessage is one of the top level plans, false otherwise. |
protected org.sandev.basics.structs.AggregateUpdate |
onReceive(org.sandev.basics.structs.AggregateUpdate msg)
Process the updates, including any bookkeeping for updates to Plans or Tasks. |
protected org.sandev.basics.sandmessages.Stats |
onReceive(org.sandev.basics.sandmessages.StatsQuery msg)
Return our current stats |
protected void |
onStartup()
Init our stats. |
protected void |
recalcParents(long parentID,
long userID,
java.util.ArrayList al)
Recalc the specified Plan, and any containing Plans recursively upward, appending the resulting updates to the specified list. |
protected void |
recalcPlan(Plan plan,
long userID,
java.util.ArrayList al)
Recalc the given plan. |
protected org.sandev.basics.structs.SandUpdateMessage[] |
removeDuplicateRecalcs(org.sandev.basics.structs.SandUpdateMessage[] sums)
We only want one PlanUpdate added per action. |
protected void |
removeReferenceToChild(org.sandev.basics.structs.SandInstanceMessage child,
org.sandev.basics.util.AuthUser user,
java.util.ArrayList al)
Given some form of PlanComponent derived update message, append an update as necessary to remove it from its parent. |
void |
setUserLookup(org.sandev.basics.util.AuthUserLookup val)
mutator for userLookup |
protected boolean |
timeEstimateChanged(org.sandev.basics.structs.SandUpdateMessage sum)
Return true if the timeEstimate for the given update has changed. |
protected void |
updateParentRef(long childID,
long parentID,
long userID,
java.util.ArrayList al)
Given a child, append an update to change its parent reference. |
protected void |
verifyParentRef(long childID,
long parentID,
long userID,
java.util.ArrayList al,
org.sandev.basics.structs.AggregateUpdate au)
Given a child make sure there is an update pending that sets its parent reference appropriately. |
protected void |
verifyReferenceToChild(long parentID,
long childID,
boolean hasChild,
org.sandev.basics.structs.SandUpdateMessage[] updates,
org.sandev.basics.util.AuthUser user,
java.util.ArrayList al)
Verify that there is a PlanUpdate for the given parent that either adds the child reference, or removes it, based on whether it now hasChild or not. |
protected void |
verifyTaskPhaseValid(Task task,
org.sandev.basics.util.AuthUser user)
Verify that the TaskPhase associated with the given Task is valid according to its TaskType. |
protected void |
verifyUpdate(org.sandev.basics.structs.SandUpdateMessage sum)
Check that the given update is ok. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected long startupTime
protected org.sandev.basics.util.AuthUserLookup userLookup
| Constructor Detail |
public UpdateManagerNode()
| Method Detail |
public org.sandev.basics.util.AuthUserLookup getUserLookup()
public void setUserLookup(org.sandev.basics.util.AuthUserLookup val)
public org.sandev.basics.util.AuthUser getUserForID(long id)
throws org.sandev.basics.structs.SandException
getUserForID in interface org.sandev.basics.util.AuthUserLookuporg.sandev.basics.structs.SandException
public org.sandev.basics.util.AuthUser getUserFromLogin(java.lang.String username,
java.lang.String password)
throws org.sandev.basics.structs.SandException
getUserFromLogin in interface org.sandev.basics.util.AuthUserLookuporg.sandev.basics.structs.SandException
public org.sandev.basics.structs.SandPersistMessage getInstance(java.lang.String classname,
long id,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
getInstance in interface org.sandev.basics.util.IDLookuporg.sandev.basics.structs.SandException
protected void onStartup()
throws org.sandev.basics.structs.SandException
onStartup in class UpdateManagerNodeBaseorg.sandev.basics.structs.SandException
protected org.sandev.basics.sandmessages.Stats onReceive(org.sandev.basics.sandmessages.StatsQuery msg)
throws org.sandev.basics.structs.SandException
onReceive in class UpdateManagerNodeBaseorg.sandev.basics.structs.SandException
protected org.sandev.basics.structs.AggregateUpdate onReceive(org.sandev.basics.structs.AggregateUpdate msg)
throws org.sandev.basics.structs.SandException
Since most updates actually consist of a single update, we
optimize that case.
onReceive in class UpdateManagerNodeBaseorg.sandev.basics.structs.SandException
public org.sandev.basics.structs.AggregateUpdate callAggregateUpdate(org.sandev.basics.structs.AggregateUpdate au)
throws org.sandev.basics.structs.SandException
callAggregateUpdate in class UpdateManagerNodeBaseorg.sandev.basics.structs.SandException
protected void verifyUpdate(org.sandev.basics.structs.SandUpdateMessage sum)
throws UpdateManagerException
UpdateManagerExceptionprotected boolean isTopLevelPlan(org.sandev.basics.structs.SandPersistMessage spm)
protected org.sandev.basics.structs.AggregateUpdate addImpliedUpdates(org.sandev.basics.structs.AggregateUpdate au)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected void verifyReferenceToChild(long parentID,
long childID,
boolean hasChild,
org.sandev.basics.structs.SandUpdateMessage[] updates,
org.sandev.basics.util.AuthUser user,
java.util.ArrayList al)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected org.sandev.basics.structs.SandUpdateMessage findUpdate(long id,
org.sandev.basics.structs.SandUpdateMessage[] updates,
java.util.ArrayList al)
protected boolean fixReference(Plan plan,
long childID,
boolean hasChild)
protected org.sandev.basics.structs.AggregateUpdate heapUpdate(org.sandev.basics.structs.AggregateUpdate au)
throws org.sandev.basics.structs.SandException
Recalc is handled in the PlanCalculator via a PlanRecalc synchronous request. Multiple simultaneous requests are handled concurrently, subject only to transactional constraints on the underlying data updates.
Implementation notes:
org.sandev.basics.structs.SandExceptionprotected boolean isRecalcExempt(org.sandev.basics.structs.SandUpdateMessage sum)
protected org.sandev.basics.structs.SandUpdateMessage[] removeDuplicateRecalcs(org.sandev.basics.structs.SandUpdateMessage[] sums)
This works by removing any plan recalc updates that have a subsequent update later on in the array.
protected void confirmChildReferences(PlanUpdate pu,
java.util.ArrayList al,
org.sandev.basics.structs.AggregateUpdate au)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected void removeReferenceToChild(org.sandev.basics.structs.SandInstanceMessage child,
org.sandev.basics.util.AuthUser user,
java.util.ArrayList al)
throws org.sandev.basics.structs.SandException
We recalculate the parent as part of this processing, to avoid requiring two separate update actions for the same parent Plan.
org.sandev.basics.structs.SandException
protected long getParentForUpdate(org.sandev.basics.structs.SandUpdateMessage sum)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected long getParentForInstance(org.sandev.basics.structs.SandInstanceMessage sim)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected boolean timeEstimateChanged(org.sandev.basics.structs.SandUpdateMessage sum)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected void verifyParentRef(long childID,
long parentID,
long userID,
java.util.ArrayList al,
org.sandev.basics.structs.AggregateUpdate au)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected void updateParentRef(long childID,
long parentID,
long userID,
java.util.ArrayList al)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected void recalcParents(long parentID,
long userID,
java.util.ArrayList al)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected void recalcPlan(Plan plan,
long userID,
java.util.ArrayList al)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected void verifyTaskPhaseValid(Task task,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandExceptionpublic java.lang.String getDeploymentPrefix()
protected static org.sandev.basics.structs.SandPersistMessage findFromUpdates(long id,
java.util.ArrayList al)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||