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
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 Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected static interfaceprotected static interfaceprotected static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AtomicReference<MessageChannel>protected final longfinal com.inductiveautomation.ignition.common.gson.Gsonprotected final PageModel.Handlersprotected final Stringidentifier of this view group.protected longfinal LoggerExstatic final ThreadLocal<PageModel>protected final PropertyTreeprotected longfinal InternalSessionprotected final com.inductiveautomation.perspective.gateway.model.PropertySyncManagerprotected final Function<String,CompletableFuture<Optional<ViewConfig>>> protected final Map<ViewInstanceId,ViewModel> -
Constructor Summary
ConstructorsConstructorDescriptionPageModel(InternalSession session, com.inductiveautomation.ignition.common.gson.Gson gson, LoggerEx log, String pageId) -
Method Summary
Modifier and TypeMethodDescriptioncom.inductiveautomation.ignition.common.gson.JsonObjectGenerates a brief report of the current views and their values for status pages.voidprotected PageModel.HandlerscreateHandlers(com.inductiveautomation.ignition.common.gson.Gson gson, LoggerEx log) createPropertyReference(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins) Create aPropertyReferencewith thisPerspectiveElementas the target.protected Function<String,CompletableFuture<Optional<ViewConfig>>> voidintintlonggetId()getName()getPage()com.google.common.eventbus.EventBusgetPropertyTreeOf(PropertyType propertyType) Fetch thePropertyTreeassociated with the givenPropertyTypegetView()intgetViews()booleanprotected booleanisViewAuthorized(ViewInstanceId viewInstanceId, ViewConfig viewConfig) voidmdcSetup()Set up the MDC keys for this contextvoidTear 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) voidvoidonKeepaliveReceived(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 voidprotected voidvoidreceive(MessageChannel channel, String protocol, Reader payload) com.inductiveautomation.ignition.common.gson.JsonObjectreport()Generates a full report of the current views and their values.voidvoidvoidsendGatewayLastActiveTime(long timestamp, long idleTime, long lastActiveServerTimestamp) voidSends a keepalive message down the websocket channel.voidsetPageTimeout(ScheduledFuture<?> pageTimeout) voidupdateModulesInfo(List<GatewayModule> modules) Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startupMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContext
auditMethods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContext
mdc, mdcSetupTree, mdcTeardownTree, mdcWrapMethods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElement
getAuditProfile, getQualifiedPath, isRunning
-
Field Details
-
PAGE
-
session
-
gson
public final com.inductiveautomation.ignition.common.gson.Gson gson -
log
-
id
identifier of this view group. will be unique per tab open for a project -
created
protected final long created -
views
-
syncManager
protected final com.inductiveautomation.perspective.gateway.model.PropertySyncManager syncManager -
channel
-
handlers
-
viewConfigLoader
-
props
-
lastKeepalive
protected volatile long lastKeepalive -
roundtrip
protected volatile long roundtrip
-
-
Constructor Details
-
PageModel
public PageModel(@Nonnull InternalSession session, @Nonnull com.inductiveautomation.ignition.common.gson.Gson gson, @Nonnull LoggerEx log, @Nonnull String pageId)
-
-
Method Details
-
getPage
- Specified by:
getPagein interfacePerspectiveElement- Returns:
- The Page that this element is part of. Will return null if this is the Session
-
getView
- Specified by:
getViewin interfacePerspectiveElement- Returns:
- The view within which this element exists, or null if this is a Page or Session
-
getName
- Specified by:
getNamein interfacePerspectiveElement- 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
- Specified by:
getSessionin interfacePerspectiveElement- Returns:
- The session that this element is a part of.
-
createPropertyReference
@Nonnull public PropertyReference createPropertyReference(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins) Description copied from interface:PerspectiveElementCreate aPropertyReferencewith thisPerspectiveElementas the target.- Specified by:
createPropertyReferencein interfacePerspectiveElement- Parameters:
referencePath- the path to the propertysubscriber- the subscriber - aConsumerofPropertyTreeChangeEventsacceptableOrigins- theSetofOrigins in which the subscriber is interested- Returns:
- the
PropertyReference
-
getPropertyTreeOf
Description copied from interface:PropertyTreeOwnerFetch thePropertyTreeassociated with the givenPropertyType- Specified by:
getPropertyTreeOfin interfacePropertyTreeOwner- Parameters:
propertyType- ThePropertyTypeof thePropertyTreewe 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
-
getPageEventBus
public com.google.common.eventbus.EventBus getPageEventBus()- Specified by:
getPageEventBusin interfacePage
-
getPageEventManager
- Specified by:
getPageEventManagerin interfacePage
-
createViewConfigLoader
-
createHandlers
protected PageModel.Handlers createHandlers(com.inductiveautomation.ignition.common.gson.Gson gson, LoggerEx log) -
getId
-
getCreated
public long getCreated()- Specified by:
getCreatedin interfacePage
-
getViews
-
getViewCount
public int getViewCount() -
getComponentCount
public int getComponentCount() -
getBindingCount
public int getBindingCount() -
getLogger
- Specified by:
getLoggerin interfaceLoggingContext
-
getMdcParent
- Specified by:
getMdcParentin interfaceLoggingContext
-
mdcSetup
public void mdcSetup()Description copied from interface:LoggingContextSet up the MDC keys for this context- Specified by:
mdcSetupin interfaceLoggingContext
-
mdcTeardown
public void mdcTeardown()Description copied from interface:LoggingContextTear down the MDC keys that are added in #mdcSetup- Specified by:
mdcTeardownin interfaceLoggingContext
-
notifyProjectUpdated
public void notifyProjectUpdated() -
send
public void send(String protocol, com.inductiveautomation.ignition.common.gson.JsonElement payload) throws IOException - Throws:
IOException
-
send
- Specified by:
sendin interfacePage- Throws:
IOException
-
receive
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfacePage
-
notifyConnected
-
notifyDisconnected
-
setPageTimeout
-
onSessionPropertyChange
Called from the session when the session properties change. Puts the changes into the accumulator inside the sync manager.- Parameters:
propertyType- ThePropertyTypeof the session'sPropertyTreewhich fired thePropertyTreeChangeEventchangeEvent- ThePropertyTreeChangeEventfired from the session'sPropertyTree
-
report
public 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
-
briefReport
public 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
-
sendKeepalive
public 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 -
sendGatewayLastActiveTime
public void sendGatewayLastActiveTime(long timestamp, long idleTime, long lastActiveServerTimestamp) -
onKeepaliveReceived
public void onKeepaliveReceived(long timestamp) When the route /data/perspective/keepalive is fetched, it will route back to here -
isViewAuthorized
protected boolean isViewAuthorized(@Nonnull ViewInstanceId viewInstanceId, @Nonnull ViewConfig viewConfig) -
updateModulesInfo
-
onStartup
protected void onStartup()- Specified by:
onStartupin classAbstractLifecycle
-
onShutdown
protected void onShutdown()- Specified by:
onShutdownin classAbstractLifecycle
-
disconnect
public void disconnect() -
close
-
newAuthChallenge
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 interfacePage- Parameters:
authChallengeRequest- theAuthChallengeRequest- Throws:
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
-
newAuthChallengeInternal
- Throws:
Exception
-
getAuditSnapshot
- Specified by:
getAuditSnapshotin interfaceAuditingContext- Returns:
- A new, or extended,
AuditContext.Builder, with qualified information about the current scope.
-