PencilBlue Class
The main driver file for PencilBlue. Provides the function necessary to start up the master and/or child processes. In addition, it is responsible for ensuring that all system services are available by requiring the "requirements.js" file.
Constructor
PencilBlue
()
Item Index
Methods
- init
- initCommandService static
- initDBConnections static
- initDBIndices static
- initLibraries static
- initLogWrappers static
- initPlugins static
- initRequestHandler static
- initServer static
- initServerRegistration static
- initSessions
- initSiteMigration static
- initSites static
- onHttpConnect static
- onHttpConnectForHandoff static
- registerMetrics static
- start
- startInstance static
Properties
- pb static
- requestsServed static
Methods
init
()
To be called when the configuration is loaded. The function is responsible for triggered the startup of the HTTP connection listener as well as start a connection pool to the core DB.
initCommandService
-
cb
Initializes the command service by calling its "init" function.
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, [RESULT])
initDBConnections
-
cb
Attempts to initialize a connection pool to the core database
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, Boolean)
initDBIndices
-
cb
Checks to see if the process should verify that the indices are valid and in place.
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, Boolean)
initLibraries
-
cb
Initializes the libraries service
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, [RESULT])
initLogWrappers
-
cb
Ensures that any log messages by the NPM module are forwarded as output to the system logs
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, Boolean)
initPlugins
-
cb
Initializes the installed plugins.
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, Boolean)
initRequestHandler
-
cb
Initializes the request handler. This causes all system routes to be registered.
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, Boolean)
initServer
-
cb
Initializes the HTTP server(s). When SSL is enabled two servers are created. One to handle incoming HTTP traffic and one to handle HTTPS traffic.
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, Boolean)
initServerRegistration
-
cb
Initializes server registration.
Parameters:
-
cb
FunctionA callback that provides two parameters: cb(Error, [RESULT])
initSessions
-
cb
Starts the session handler
Parameters:
-
cb
Function
initSiteMigration
-
cb
Move a single tenant solution to a multi-tenant solution.
Parameters:
-
cb
Function- callback function
initSites
-
cb
Initializes site(s).
Parameters:
-
cb
Function- callback function
onHttpConnect
-
req
-
res
The function that handles normal server traffic. The function ensures that the incoming request is delegated out appropriately. When SSL Termination is in use if the 'x-forwarded-proto' header does equal 'https' then the request is delegated to the handoff function so the request can be redirected appropriately.
Parameters:
-
req
RequestThe incoming request
-
res
ResponseThe outgoing response
onHttpConnectForHandoff
-
req
-
res
Handles traffic that comes in for HTTP when SSL is enabled. The request is redirected to the appropriately protected HTTPS url.
Parameters:
-
req
RequestThe incoming request
-
res
ResponseThe outgoing response
registerMetrics
-
cb
Initializes the metric registrations to measure request counts
Parameters:
-
cb
Function
start
()
Starts up the instance of PencilBlue
startInstance
()
PencilBlue
static
The default entry point to a stand-alone instance of PencilBlue
Returns:
Properties
pb
Object
private
static
requestsServed
Integer
private
static
The number of requests served by this instance