Package org.jgrapes.webconlet.sysinfo
Class SysInfoConlet
- All Implemented Interfaces:
Iterable<ComponentType>,Channel,ComponentType,Eligible,Manager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe conlet’s model.static classThe periodically generated update event.Nested classes/interfaces inherited from class org.jgrapes.webconsole.base.AbstractConlet
AbstractConlet.ConletTrackingInfoNested 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
ConstructorsConstructorDescriptionSysInfoConlet(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 voiddoUpdateConletState(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.voidonConsoleReady(ConsoleReady event, ConsoleConnection connection) OnConsoleReady, fire theAddConletType.voidonUpdate(SysInfoConlet.Update event, ConsoleConnection connection) Handle the periodic update event by sendingNotifyConletViewevents.Methods inherited from class org.jgrapes.webconsole.base.freemarker.FreeMarkerConlet
doGetResource, fmConletModel, fmModel, fmModel, fmSessionModel, fmTypeModel, freemarkerConfig, processTemplate, processTemplateMethods 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, typeFromIdMethods inherited from class org.jgrapes.core.Component
channel, component, defaultCriterion, isEligibleFor, setNameMethods 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, unregisterAsGeneratorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:AbstractConletCreates 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:
createStateRepresentationin 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:AbstractConletCalled byAbstractConlet.onAddConletRequest(AddConletRequest, ConsoleConnection)andAbstractConlet.onRenderConletRequest(RenderConletRequest, ConsoleConnection)to complete rendering the web console component.The
- Specified by:
doRenderConletin classAbstractConlet<SysInfoConlet.SysInfoModel>- Parameters:
event- the eventconnection- the channelconletId- the component idconletState- the conlet’s state; may benullif the conlet doesn’t have associated state information- Returns:
- the rendered modes
- Throws:
Exception- the exception
-
onUpdate
Handle the periodic update event by sendingNotifyConletViewevents.- Parameters:
event- the eventconnection- the console connection
-
doUpdateConletState
protected void doUpdateConletState(NotifyConletModel event, ConsoleConnection connection, SysInfoConlet.SysInfoModel conletState) throws Exception Description copied from class:AbstractConletCalled byAbstractConlet.onNotifyConletModel(org.jgrapes.webconsole.base.events.NotifyConletModel, org.jgrapes.webconsole.base.ConsoleConnection)to complete handling the notification.The default implementation does nothing.
- Overrides:
doUpdateConletStatein classAbstractConlet<SysInfoConlet.SysInfoModel>- Parameters:
event- the eventconnection- the channelconletState- the conlet’s state; may benullif the conlet doesn’t have associated state information- Throws:
Exception
-