Interface PushController
-
- All Known Implementing Classes:
AbstractPushController
,CommentPushController
,CronJobsPushController
,WorkflowPushController
public interface PushController
A push controller is one of the fundamental building blocks of Cockpit's server push mechanism. It is typically executed in its own Thread and allows actions to be performed and components to be updated asynchronously using reverse Ajax. The push controller itself contains the logic for testing if an update is required (seeisUpdateNeeded()
) and if so notifying the appropriate Cockpit components by the use ofCockpitEvent
s (seeupdate()
). When used with aPushComponent
, it provides the means necessary to update ZK view components asynchronously. Normally there is no need to implement a push controller from scratch and extending the abstract classAbstractPushController
is usually the right way to go.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PushComponent
getComponent()
Returns this push controller'sPushComponent
.java.util.Map<java.lang.String,java.lang.Object>
getParameters()
int
getUpdateInterval()
Returns the update interval in milliseconds for this push controller.boolean
isUpdateNeeded()
Returns whether an update is required or not.void
setComponent(PushComponent component)
Sets thePushComponent
to be used by this push controller tocomponent
.void
setDone()
Tells this push controller to stop processing server push events.void
setParameters(java.util.Map<java.lang.String,java.lang.Object> params)
void
setUpdateInterval(int milliseconds)
Sets the update interval in milliseconds for this push controller.void
startController()
Starts this push controller.void
update()
Called whenever an update is needed i.e.
-
-
-
Method Detail
-
update
void update()
Called whenever an update is needed i.e. whenisUpdateNeeded()
has returnedtrue
. Typically createsCockpitEvent
s and adds them to a special event queue by calling thePushComponent.addEvent(CockpitEvent)
method on thePushComponent
returned bygetComponent()
.
-
isUpdateNeeded
boolean isUpdateNeeded()
Returns whether an update is required or not.- Returns:
true
if an update is needed,false
otherwise- See Also:
update()
-
setDone
void setDone()
Tells this push controller to stop processing server push events. Typically stops the thread gently within one polling cycle (seegetUpdateInterval()
).- See Also:
startController()
-
setComponent
void setComponent(PushComponent component)
Sets thePushComponent
to be used by this push controller tocomponent
.- Parameters:
component
- the push component used by this push controller- See Also:
PushComponent
-
getComponent
PushComponent getComponent()
Returns this push controller'sPushComponent
.- Returns:
- the push component used by this push controller
-
setUpdateInterval
void setUpdateInterval(int milliseconds)
Sets the update interval in milliseconds for this push controller.- Parameters:
milliseconds
- the delay between updates (or update requests) in milliseconds
-
getUpdateInterval
int getUpdateInterval()
Returns the update interval in milliseconds for this push controller.- Returns:
- the delay between updates (or update requests) in milliseconds
-
startController
void startController()
Starts this push controller. Typically starts the push controller thread.- See Also:
setDone()
-
setParameters
void setParameters(java.util.Map<java.lang.String,java.lang.Object> params)
-
getParameters
java.util.Map<java.lang.String,java.lang.Object> getParameters()
-
-