Class PushEngineFactory
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)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 Summary
Modifier and TypeMethodDescriptionstatic PushEngineBuilds the engine with the server's collaborators.
Method Details
build
Builds the engine with the server's collaborators.- Parameters:
server- The server.- Returns:
- The engine, not started.