Class PushEngineFactory

java.lang.Object
com.iizix.server.push.engine.PushEngineFactory

public final class PushEngineFactory extends Object
Builds the Push Notification (PN) engine over a running server: the settings container, the subscription store and the user directory over the server's connection pool, the spool over the server's property factory, the live-session enumerator and the in-session seam over the sessions' PN channels (P4-10), the region locator and the three transports.

This is a factory only: the module that owns the engine's lifecycle (initialization, start, servlet registration and disposal) is com.iizix.server.PushNotificationModule.

build(IServer) must run against a started server, because it reads ServerShell.getServerSettings() and ServerShell.getCurrentDirectory(). It does not require the applications to be loaded:

invalid reference
AppPushConfigs#forServer(IServer)
resolves an application lazily, on lookup.

Settings come from the server settings' $pushNotifications child when the configuration file carries one, else from a default PushNotificationsProps.

The server's own push container - the VAPID pair that serves the subscriptions made with application ID * - is a ServerPushKeys over the $push child of that settings container when the operator configured one, and over ServerPushKeys.FILE_NAME in the spool directory otherwise, where it is generated on first use - both under the [server] section of the credentials file (PUSH-CREDENTIALS.md section 3.6), which is built here first from the JVM's configuration (PushCredentials.fromConfiguration()) so that the keys can read it. See ServerPushKeys for the precedence.

Every Push Notification key file of the server - an application's VPrivKeyFile and fcmServiceAccountFile, the credentials file's [server] references - is read by one PushKeyFiles built here (PUSH-KEYFILES-DESIGN.md), shared by the credentials, the PushKeyResolver of the application configurations and the engine, whose watcher re-reads a changed file. A VAPID key file is loaded through the same PushEngineFactory.ServerKeyStorage as the server's own generated pair.

Author:
Christopher Mindus
  • Method Details

    • build

      public static PushEngine build(IServer server)
      Builds the engine with the server's collaborators.
      Parameters:
      server - The server.
      Returns:
      The engine, not started.