Package org.jgrapes.webconlet.sysinfo
Class SysInfoConlet
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The conlet’s model.static class
The periodically generated update event.Nested classes/interfaces inherited from class org.jgrapes.webconsole.base.AbstractConlet
AbstractConlet.ConletTrackingInfo
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default
-
Field Summary
Fields inherited from class org.jgrapes.webconsole.base.AbstractConlet
TYPE_INSTANCE_SEPARATOR
-
Constructor Summary
ConstructorDescriptionSysInfoConlet
(Channel componentChannel) Creates a new component with its channel set to the given channel. -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional
<SysInfoConlet.SysInfoModel> createStateRepresentation
(Event<?> event, ConsoleConnection session, String conletId) Creates an instance of the type that represents the conlet’s state, initialized with default values.protected Set
<Conlet.RenderMode> doRenderConlet
(RenderConletRequestBase<?> event, ConsoleConnection connection, String conletId, SysInfoConlet.SysInfoModel conletState) Called byAbstractConlet.onAddConletRequest(AddConletRequest, ConsoleConnection)
andAbstractConlet.onRenderConletRequest(RenderConletRequest, ConsoleConnection)
to complete rendering the web console component.protected void
doUpdateConletState
(NotifyConletModel event, ConsoleConnection connection, SysInfoConlet.SysInfoModel conletState) Called byAbstractConlet.onNotifyConletModel(org.jgrapes.webconsole.base.events.NotifyConletModel, org.jgrapes.webconsole.base.ConsoleConnection)
to complete handling the notification.void
onConsoleReady
(ConsoleReady event, ConsoleConnection connection) OnConsoleReady
, fire theAddConletType
.void
onUpdate
(SysInfoConlet.Update event, ConsoleConnection connection) Handle the periodic update event by sendingNotifyConletView
events.Methods inherited from class org.jgrapes.webconsole.base.freemarker.FreeMarkerConlet
doGetResource, fmConletModel, fmModel, fmModel, fmSessionModel, fmTypeModel, freemarkerConfig, processTemplate, processTemplate
Methods inherited from class org.jgrapes.webconsole.base.AbstractConlet
afterOnClosed, conletIds, conletIdsByConsoleConnection, conletViews, createNewState, doConletDeleted, doRemoveConletType, doSetLocale, generateInstanceId, l10nBundles, localizations, onAddConletRequest, onClosed, onConletDeleted, onConletResourceRequest, onDetached, onNotifyConletModel, onRenderConletRequest, onSetLocale, putInSession, readContent, readContent, recreateState, removeState, resourceBundle, setPeriodicRefresh, stateFromSession, statesFromSession, supportedLocales, trackConlet, trackedConnections, type, typeFromId
Methods inherited from class org.jgrapes.core.Component
channel, component, defaultCriterion, isEligibleFor, setName
Methods inherited from class org.jgrapes.core.internal.ComponentVertex
activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGenerator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SysInfoConlet
Creates a new component with its channel set to the given channel.- Parameters:
componentChannel
- the channel that the component’s handlers listen on by default and thatManager.fire(Event, Channel...)
sends the event to
-
-
Method Details
-
onConsoleReady
@Handler public void onConsoleReady(ConsoleReady event, ConsoleConnection connection) throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException OnConsoleReady
, fire theAddConletType
.- Parameters:
event
- the eventconnection
- the console connection- Throws:
TemplateNotFoundException
- the template not found exceptionMalformedTemplateNameException
- the malformed template name exceptionParseException
- the parse exceptionIOException
- Signals that an I/O exception has occurred.
-
createStateRepresentation
protected Optional<SysInfoConlet.SysInfoModel> createStateRepresentation(Event<?> event, ConsoleConnection session, String conletId) throws Exception Description copied from class:AbstractConlet
Creates an instance of the type that represents the conlet’s state, initialized with default values.The default implementation returns
Optional.isEmpty()
, thus indicating that no state information is needed or available.This method should always be overridden if conlet instances have associated state.
- Overrides:
createStateRepresentation
in classAbstractConlet<SysInfoConlet.SysInfoModel>
- Parameters:
event
- the event, which may contain required information (seeAddConletRequest.properties()
)session
- the console connection, sometimes required to send events to components that provide a backing storeconletId
- the conlet id calculated astype() + TYPE_INSTANCE_SEPARATOR + generateInstanceId(...)
- Returns:
- the state representation or
Optional.empty()
if none is required - Throws:
Exception
- if an exception occurs
-
doRenderConlet
protected Set<Conlet.RenderMode> doRenderConlet(RenderConletRequestBase<?> event, ConsoleConnection connection, String conletId, SysInfoConlet.SysInfoModel conletState) throws Exception Description copied from class:AbstractConlet
Called byAbstractConlet.onAddConletRequest(AddConletRequest, ConsoleConnection)
andAbstractConlet.onRenderConletRequest(RenderConletRequest, ConsoleConnection)
to complete rendering the web console component.The
- Specified by:
doRenderConlet
in classAbstractConlet<SysInfoConlet.SysInfoModel>
- Parameters:
event
- the eventconnection
- the channelconletId
- the component idconletState
- the conlet’s state; may benull
if the conlet doesn’t have associated state information- Returns:
- the rendered modes
- Throws:
Exception
- the exception
-
onUpdate
Handle the periodic update event by sendingNotifyConletView
events.- Parameters:
event
- the eventconnection
- the console connection
-
doUpdateConletState
protected void doUpdateConletState(NotifyConletModel event, ConsoleConnection connection, SysInfoConlet.SysInfoModel conletState) throws Exception Description copied from class:AbstractConlet
Called byAbstractConlet.onNotifyConletModel(org.jgrapes.webconsole.base.events.NotifyConletModel, org.jgrapes.webconsole.base.ConsoleConnection)
to complete handling the notification.The default implementation does nothing.
- Overrides:
doUpdateConletState
in classAbstractConlet<SysInfoConlet.SysInfoModel>
- Parameters:
event
- the eventconnection
- the channelconletState
- the conlet’s state; may benull
if the conlet doesn’t have associated state information- Throws:
Exception
-