Class PageModel
- java.lang.Object
- 
- com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
- 
- com.inductiveautomation.perspective.gateway.model.PageModel
 
 
- 
- All Implemented Interfaces:
- AuditingContext,- LoggingContext,- Page,- PerspectiveElement,- PropertyTreeOwner
 - Direct Known Subclasses:
- DesignerPageModel
 
 public class PageModel extends AbstractLifecycle implements Page A page contains a number of views all running within the same web page, or tab. A given session may contain multiple pages running concurrently when the user has opened multiple tabs for the same project.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classPageModel.Handlers
 - 
Field SummaryFields Modifier and Type Field Description protected java.util.concurrent.atomic.AtomicReference<MessageChannel>channelprotected longcreatedcom.inductiveautomation.ignition.common.gson.Gsongsonprotected PageModel.Handlershandlersprotected java.lang.Stringididentifier of this view group.protected longlastKeepaliveLoggerExlogstatic java.lang.ThreadLocal<PageModel>PAGEprotected PropertyTreepropsprotected longroundtripInternalSessionsessionprotected com.inductiveautomation.perspective.gateway.model.PropertySyncManagersyncManagerprotected java.util.function.Function<java.lang.String,java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>>viewConfigLoaderprotected java.util.Map<ViewInstanceId,ViewModel>views
 - 
Constructor SummaryConstructors Constructor Description PageModel(InternalSession session, com.inductiveautomation.ignition.common.gson.Gson gson, LoggerEx log, java.lang.String pageId)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description com.inductiveautomation.ignition.common.gson.JsonObjectbriefReport()Generates a brief report of the current views and their values for status pages.voidclose(java.lang.String message)protected PageModel.HandlerscreateHandlers(com.inductiveautomation.ignition.common.gson.Gson gson, LoggerEx log)PropertyReferencecreatePropertyReference(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins)Create aPropertyReferencewith thisPerspectiveElementas the target.protected java.util.function.Function<java.lang.String,java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>>createViewConfigLoader()voiddisconnect()AuditContext.BuildergetAuditSnapshot()intgetBindingCount()intgetComponentCount()longgetCreated()java.lang.StringgetId()LoggerExgetLogger()LoggingContextgetMdcParent()java.lang.StringgetName()PagegetPage()com.google.common.eventbus.EventBusgetPageEventBus()EventManagergetPageEventManager()PropertyTreegetPropertyTreeOf(PropertyType propertyType)Fetch thePropertyTreeassociated with the givenPropertyTypeInternalSessiongetSession()ViewgetView()intgetViewCount()java.util.List<ViewModel>getViews()booleanisConnected()protected booleanisViewAuthorized(ViewInstanceId viewInstanceId, ViewConfig viewConfig)voidmdcSetup()Set up the MDC keys for this contextvoidmdcTeardown()Tear down the MDC keys that are added in #mdcSetupvoidnewAuthChallenge(AuthChallengeRequest authChallengeRequest)Trigger a new authentication challenge.voidnewAuthChallengeInternal(AuthChallengeRequest authChallengeRequest)voidnotifyConnected(MessageChannel channel)voidnotifyDisconnected(MessageChannel channel)voidnotifyProjectUpdated()voidonKeepaliveReceived(long timestamp)When the route /data/perspective/keepalive is fetched, it will route back to herevoidonSessionPropertyChange(PropertyType propertyType, PropertyTreeChangeEvent changeEvent)Called from the session when the session properties change.protected voidonShutdown()protected voidonStartup()voidreceive(MessageChannel channel, java.lang.String protocol, java.io.Reader payload)com.inductiveautomation.ignition.common.gson.JsonObjectreport()Generates a full report of the current views and their values.voidsend(java.lang.String protocol, com.inductiveautomation.ignition.common.gson.JsonElement payload)voidsend(java.lang.String protocol, java.lang.String payload)voidsendGatewayLastActiveTime(long timestamp, long idleTime)voidsendKeepalive()Sends a keepalive message down the websocket channel.voidsetPageTimeout(java.util.concurrent.ScheduledFuture<?> pageTimeout)voidupdateModulesInfo(java.util.List<GatewayModule> modules)- 
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycleisRunning, shutdown, startup
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContextaudit
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContextmdc, mdcSetupTree, mdcTeardownTree, mdcWrap
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElementgetAuditProfile, getQualifiedPath, isRunning
 
- 
 
- 
- 
- 
Field Detail- 
PAGEpublic static final java.lang.ThreadLocal<PageModel> PAGE 
 - 
sessionpublic final InternalSession session 
 - 
gsonpublic final com.inductiveautomation.ignition.common.gson.Gson gson 
 - 
logpublic final LoggerEx log 
 - 
idprotected final java.lang.String id identifier of this view group. will be unique per tab open for a project
 - 
createdprotected final long created 
 - 
viewsprotected final java.util.Map<ViewInstanceId,ViewModel> views 
 - 
syncManagerprotected final com.inductiveautomation.perspective.gateway.model.PropertySyncManager syncManager 
 - 
channelprotected final java.util.concurrent.atomic.AtomicReference<MessageChannel> channel 
 - 
handlersprotected final PageModel.Handlers handlers 
 - 
viewConfigLoaderprotected final java.util.function.Function<java.lang.String,java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>> viewConfigLoader 
 - 
propsprotected final PropertyTree props 
 - 
lastKeepaliveprotected volatile long lastKeepalive 
 - 
roundtripprotected volatile long roundtrip 
 
- 
 - 
Constructor Detail- 
PageModelpublic PageModel(@Nonnull InternalSession session, @Nonnull com.inductiveautomation.ignition.common.gson.Gson gson, @Nonnull LoggerEx log, @Nonnull java.lang.String pageId)
 
- 
 - 
Method Detail- 
getPage@Nullable public Page getPage() - Specified by:
- getPagein interface- PerspectiveElement
- Returns:
- The Page that this element is part of. Will return null if this is the Session
 
 - 
getView@Nullable public View getView() - Specified by:
- getViewin interface- PerspectiveElement
- Returns:
- The view within which this element exists, or null if this is a Page or Session
 
 - 
getName@Nonnull public java.lang.String getName() - Specified by:
- getNamein interface- PerspectiveElement
- Returns:
- The name of the element. If this is a component, it will be the name of the component. If this is a View, the name will be "view". If this is a Page, the name will be "page". If this is the session, the name will be "session".
 
 - 
getSession@Nonnull public InternalSession getSession() - Specified by:
- getSessionin interface- PerspectiveElement
- Returns:
- The session that this element is a part of.
 
 - 
createPropertyReference@Nonnull public PropertyReference createPropertyReference(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins) Description copied from interface:PerspectiveElementCreate aPropertyReferencewith thisPerspectiveElementas the target.- Specified by:
- createPropertyReferencein interface- PerspectiveElement
- Parameters:
- referencePath- the path to the property
- subscriber- the subscriber - a- Consumerof- PropertyTreeChangeEvents
- acceptableOrigins- the- Setof- Origins in which the subscriber is interested
- Returns:
- the PropertyReference
 
 - 
getPropertyTreeOf@Nullable public PropertyTree getPropertyTreeOf(@Nullable PropertyType propertyType) Description copied from interface:PropertyTreeOwnerFetch thePropertyTreeassociated with the givenPropertyType- Specified by:
- getPropertyTreeOfin interface- PropertyTreeOwner
- Parameters:
- propertyType- The- PropertyTypeof the- PropertyTreewe want to fetch
- Returns:
- The PropertyTree or null if this PropertyTreeOwner does not manage a PropertyTree for the given PropertyType or if a null PropertyType is given
 
 - 
getPageEventBuspublic com.google.common.eventbus.EventBus getPageEventBus() - Specified by:
- getPageEventBusin interface- Page
 
 - 
getPageEventManagerpublic EventManager getPageEventManager() - Specified by:
- getPageEventManagerin interface- Page
 
 - 
createViewConfigLoaderprotected java.util.function.Function<java.lang.String,java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>> createViewConfigLoader() 
 - 
createHandlersprotected PageModel.Handlers createHandlers(com.inductiveautomation.ignition.common.gson.Gson gson, LoggerEx log) 
 - 
getCreatedpublic long getCreated() - Specified by:
- getCreatedin interface- Page
 
 - 
getViewCountpublic int getViewCount() 
 - 
getComponentCountpublic int getComponentCount() 
 - 
getBindingCountpublic int getBindingCount() 
 - 
getLoggerpublic LoggerEx getLogger() - Specified by:
- getLoggerin interface- LoggingContext
 
 - 
getMdcParent@Nullable public LoggingContext getMdcParent() - Specified by:
- getMdcParentin interface- LoggingContext
 
 - 
mdcSetuppublic void mdcSetup() Description copied from interface:LoggingContextSet up the MDC keys for this context- Specified by:
- mdcSetupin interface- LoggingContext
 
 - 
mdcTeardownpublic void mdcTeardown() Description copied from interface:LoggingContextTear down the MDC keys that are added in #mdcSetup- Specified by:
- mdcTeardownin interface- LoggingContext
 
 - 
notifyProjectUpdatedpublic void notifyProjectUpdated() 
 - 
sendpublic void send(java.lang.String protocol, com.inductiveautomation.ignition.common.gson.JsonElement payload) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
sendpublic void send(java.lang.String protocol, java.lang.String payload) throws java.io.IOException
 - 
receivepublic void receive(MessageChannel channel, java.lang.String protocol, java.io.Reader payload) 
 - 
isConnectedpublic boolean isConnected() - Specified by:
- isConnectedin interface- Page
 
 - 
notifyConnectedpublic void notifyConnected(MessageChannel channel) 
 - 
notifyDisconnectedpublic void notifyDisconnected(MessageChannel channel) 
 - 
setPageTimeoutpublic void setPageTimeout(java.util.concurrent.ScheduledFuture<?> pageTimeout) 
 - 
onSessionPropertyChangepublic void onSessionPropertyChange(PropertyType propertyType, PropertyTreeChangeEvent changeEvent) Called from the session when the session properties change. Puts the changes into the accumulator inside the sync manager.- Parameters:
- propertyType- The- PropertyTypeof the session's- PropertyTreewhich fired the- PropertyTreeChangeEvent
- changeEvent- The- PropertyTreeChangeEventfired from the session's- PropertyTree
 
 - 
reportpublic com.inductiveautomation.ignition.common.gson.JsonObject report() Generates a full report of the current views and their values.- Returns:
- a json object containing the full property tree for the current executing project/session
 
 - 
briefReportpublic com.inductiveautomation.ignition.common.gson.JsonObject briefReport() Generates a brief report of the current views and their values for status pages.- Returns:
- a json array containing brief info on the current executing project/session
 
 - 
sendKeepalivepublic void sendKeepalive() Sends a keepalive message down the websocket channel. This will provoke the page's frontend code to HTTP GET the route at /data/perspective/keepalive
 - 
sendGatewayLastActiveTimepublic void sendGatewayLastActiveTime(long timestamp, long idleTime)
 - 
onKeepaliveReceivedpublic void onKeepaliveReceived(long timestamp) When the route /data/perspective/keepalive is fetched, it will route back to here
 - 
isViewAuthorizedprotected boolean isViewAuthorized(@Nonnull ViewInstanceId viewInstanceId, @Nonnull ViewConfig viewConfig)
 - 
updateModulesInfopublic void updateModulesInfo(java.util.List<GatewayModule> modules) 
 - 
onStartupprotected void onStartup() - Specified by:
- onStartupin class- AbstractLifecycle
 
 - 
onShutdownprotected void onShutdown() - Specified by:
- onShutdownin class- AbstractLifecycle
 
 - 
disconnectpublic void disconnect() 
 - 
newAuthChallengepublic void newAuthChallenge(AuthChallengeRequest authChallengeRequest) throws java.lang.Exception Description copied from interface:PageTrigger a new authentication challenge. Sends a message to the client to open the authentication challenge workflow using whatever framing option was specified in the auth challenge request.- Specified by:
- newAuthChallengein interface- Page
- Parameters:
- authChallengeRequest- the- AuthChallengeRequest
- Throws:
- java.lang.Exception- if the client identifier associated with the auth challenge request is blank, or if the message channel between the Gateway and the Client is not currently open
 
 - 
newAuthChallengeInternalpublic void newAuthChallengeInternal(AuthChallengeRequest authChallengeRequest) throws java.lang.Exception - Throws:
- java.lang.Exception
 
 - 
getAuditSnapshot@Nonnull public AuditContext.Builder getAuditSnapshot() - Specified by:
- getAuditSnapshotin interface- AuditingContext
- Returns:
- A new, or extended, AuditContext.Builder, with qualified information about the current scope.
 
 
- 
 
-