Class AbstractPushController
- java.lang.Object
-
- java.lang.Thread
-
- de.hybris.platform.core.threadregistry.RegistrableThread
-
- de.hybris.platform.cockpit.session.impl.AbstractPushController
-
- All Implemented Interfaces:
PushController
,java.lang.Runnable
- Direct Known Subclasses:
CommentPushController
,CronJobsPushController
,WorkflowPushController
public abstract class AbstractPushController extends RegistrableThread implements PushController
Class to be used as super class when implementing a standard CockpitPushController
.- See Also:
PushController
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_DELAY
static java.lang.String
PARAM_UPDATE_INTERVAL
protected java.util.Map<java.lang.String,java.lang.Object>
params
-
Constructor Summary
Constructors Constructor Description AbstractPushController()
AbstractPushController(PushComponent pushComp)
AbstractPushController(PushComponent pushComp, int updateInterval)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addEvent(CockpitEvent cockpitEvent)
protected abstract void
after()
protected abstract void
before()
PushComponent
getComponent()
Returns this push controller'sPushComponent
.protected org.zkoss.zk.ui.Desktop
getDesktop()
java.util.Map<java.lang.String,java.lang.Object>
getParameters()
protected UISession
getSession()
int
getUpdateInterval()
Returns the update interval in milliseconds for this push controller.protected org.springframework.web.context.WebApplicationContext
getWebApplicationContext()
protected void
internalRun()
protected boolean
isDone()
protected void
loadParameters()
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.java.lang.String
toString()
-
Methods inherited from class de.hybris.platform.core.threadregistry.RegistrableThread
registerThread, run, unregisterThread, withInitialInfo
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.cockpit.session.PushController
isUpdateNeeded, update
-
-
-
-
Field Detail
-
DEFAULT_DELAY
protected static final int DEFAULT_DELAY
- See Also:
- Constant Field Values
-
PARAM_UPDATE_INTERVAL
public static final java.lang.String PARAM_UPDATE_INTERVAL
- See Also:
- Constant Field Values
-
params
protected final java.util.Map<java.lang.String,java.lang.Object> params
-
-
Constructor Detail
-
AbstractPushController
public AbstractPushController()
-
AbstractPushController
public AbstractPushController(PushComponent pushComp)
-
AbstractPushController
public AbstractPushController(PushComponent pushComp, int updateInterval)
-
-
Method Detail
-
setUpdateInterval
public void setUpdateInterval(int milliseconds)
Description copied from interface:PushController
Sets the update interval in milliseconds for this push controller.- Specified by:
setUpdateInterval
in interfacePushController
- Parameters:
milliseconds
- the delay between updates (or update requests) in milliseconds
-
getUpdateInterval
public int getUpdateInterval()
Description copied from interface:PushController
Returns the update interval in milliseconds for this push controller.- Specified by:
getUpdateInterval
in interfacePushController
- Returns:
- the delay between updates (or update requests) in milliseconds
-
setComponent
public void setComponent(PushComponent component)
Description copied from interface:PushController
Sets thePushComponent
to be used by this push controller tocomponent
.- Specified by:
setComponent
in interfacePushController
- Parameters:
component
- the push component used by this push controller- See Also:
PushComponent
-
getComponent
public PushComponent getComponent()
Description copied from interface:PushController
Returns this push controller'sPushComponent
.- Specified by:
getComponent
in interfacePushController
- Returns:
- the push component used by this push controller
-
getDesktop
protected org.zkoss.zk.ui.Desktop getDesktop()
-
setDone
public void setDone()
Description copied from interface:PushController
Tells this push controller to stop processing server push events. Typically stops the thread gently within one polling cycle (seePushController.getUpdateInterval()
).- Specified by:
setDone
in interfacePushController
- See Also:
PushController.startController()
-
isDone
protected boolean isDone()
-
internalRun
protected void internalRun()
- Overrides:
internalRun
in classRegistrableThread
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Thread
-
addEvent
protected void addEvent(CockpitEvent cockpitEvent)
-
startController
public void startController()
Description copied from interface:PushController
Starts this push controller. Typically starts the push controller thread.- Specified by:
startController
in interfacePushController
- See Also:
PushController.setDone()
-
getSession
protected UISession getSession()
-
getWebApplicationContext
protected org.springframework.web.context.WebApplicationContext getWebApplicationContext() throws java.lang.IllegalStateException
- Throws:
java.lang.IllegalStateException
-
before
protected abstract void before()
-
after
protected abstract void after()
-
setParameters
public void setParameters(java.util.Map<java.lang.String,java.lang.Object> params)
- Specified by:
setParameters
in interfacePushController
-
getParameters
public java.util.Map<java.lang.String,java.lang.Object> getParameters()
- Specified by:
getParameters
in interfacePushController
-
loadParameters
protected void loadParameters()
-
-