@Name(value="seamReload") @Scope(value=EVENT) @Install(precedence=10) public class NuxeoSeamHotReloader extends Object implements Serializable
Constructor and Description |
---|
NuxeoSeamHotReloader() |
Modifier and Type | Method and Description |
---|---|
String |
doFlush()
Calls the
ReloadService.flush() method, that should trigger the
reset of a bunch of caches shared by all users, and sends a Seam event
to propagate this to other Seam components. |
String |
doReload()
Triggers a full reload of Seam context and components.
|
boolean |
getCanTriggerFlush()
Returns true if dev mode is set and current user is an administrator.
|
Long |
getCurrentCacheTimestamp()
Returns the last flush timestamp held by the
ReloadService . |
boolean |
isDevModeSet()
Returns true if dev mode is set
|
boolean |
isHotReloadEnabled() |
boolean |
shouldResetCache(Long cacheTimestamp)
Returns true if reload service has sent a runtime flush event since
given timestamp.
|
boolean |
shouldResetCache(TimestampedService service,
Long cacheTimestamp)
Returns true if given service has changed since given timestamp.
|
void |
triggerResetOnSeamComponents()
Resets most caches of the Seam application.
|
@Factory(value="nxDevModeSet", scope=EVENT) public boolean isDevModeSet()
Framework.isDevModeSet()
@Factory(value="seamHotReloadIsEnabled", scope=APPLICATION) public boolean isHotReloadEnabled()
public boolean getCanTriggerFlush()
public String doFlush()
ReloadService.flush()
method, that should trigger the
reset of a bunch of caches shared by all users, and sends a Seam event
to propagate this to other Seam components.
Does nothing if not in dev mode.
The reload service flush method should already be triggerd by install/uninstall of modules. This method makes it possible to force it again, and to propagate it to the Seam layer for current user.
#resetSeamComponentsCaches()
,
shouldResetCache(Long)
,
shouldResetCache(TimestampedService, Long)
public boolean shouldResetCache(Long cacheTimestamp)
cacheTimestamp
- ReloadService.lastFlushed()
public Long getCurrentCacheTimestamp()
ReloadService
.ReloadService
,
TimestampedService
public boolean shouldResetCache(TimestampedService service, Long cacheTimestamp)
service
- cacheTimestamp
- TimestampedService
@Observer(value="flush", create=false) @BypassInterceptors public void triggerResetOnSeamComponents()
This is useful when a change is detected on the reload service.
For compatibility and easier upgrade, this method listens to the
EventNames.FLUSH_EVENT
, and sends other events to the Seam layer
for other components to reset their own cache without needing to change
their code.
In the future, this behaviour could be removed, so Seam component should
reset their cache listening to the EventNames.FLUSH_EVENT
directly.
public String doReload()
Needs the Seam debug jar to be present and Seam debug mode to be enabled.
Copyright © 2012 Nuxeo SA. All Rights Reserved.