This is a primary gateway interface for the framework. This class provides methods and routines necessary to bootstrap the framework and the end user application constructed within the framework. It is both an abstract base class as well as a ready to use bootstrap. Please refer to the documentation of the methods for more info. It also is the main entrypoint to pretty much the entire application.
This static property should contain the loaded NPM package module which is used by the kernel to draw different kinds of the information and data. This could be overridden by the modified kernels that are custom to arbitrary applications. This definition (package.json) should corellate to framework.
This static property should contain the loaded NPM package module which is used by the kernel to draw different kinds of the information and data. This could be overridden by the modified kernels that are custom to arbitrary applications. This definition (package.json) should corellate to application.
Create a new instance of the kernel, run all the prerequisites
that are necessary, do the configuration on the kernel, then
boot it up, using the hostname and port parameters from config.
Please use this static method instead of manually launching up.
Refer to the static method makeKernelSetup
for information.
The kernel preemption routine is called once the kernel has passed the initial launching and configuration phase, but is yet to start up the router, connect services and instantiate an actual application. This method gets passes continuation that does that. The method can either invoke it or omit it.
The complementary part of the kernel launching protocol. It is
invoked by the bootstrapping routine to do the actual kernel
launch. If you are going to override the bootstrap procedures
then override this static method, rather than the bootstrap
.
Be careful about the relations between methods when overriding.
The public constructor of the kernel instrances. Generally you should neither use it directly, not override. It serves the purpose of setting up the configurations will never be changed, such as the kernel self identification tokens.
This is a little kernel registry broker that when asked to, goes to the router registry and attempts to find there the instance of the specified kind (class). If it succeeds then it returns an instance to the invoker. If not, however, it throws an assertion error about being unable to accquire.
This routines sets up the infrastructure necessary for kernel to properly intercept and process errors and exceptions. This includes synchronous exceptions as well as the asynchronous errors. Depending on the instance configuration this method could either crash the kernel on error or proceed operations.
Shutdown the kernel instance. This includes shutting down both HTTP and HTTPS server that may be running, stopping the router and unregistering all the services as a precauting. After that the scope is being dispersed and some events are being emited.
The important internal routine that sets up and configures a kernel beacon that gets fired once at each configured interval. The beacon, once fired, gets propagated to all services that implement the appropriate asynchronous hook. This mechanism is intended as a heartbeat that can be leveraged by each service.
Allocate a module scanner insrance for this kernel and setup
the scanner per the scoping configuration to monitor certain
directories. Please reference the ModuleScanner
comppnent
implementation for more information on its operations and a
configuration routines and facilities. The scanner itself is
is a zombie services, therefore is instantuated accordingly.
This routine takes care of resolving all the necessary details for successfully creating and running an HTTPS (SSL) server. The details are typically at least the key and the certficiate. This implementation draws data from the config file and then used it to obtain the necessary content and whater else needs.
Setup and launch either HTTP or HTTPS servers to listen at the configured addresses and ports. This method reads up the scoping configuration in order to obtain the data necessary for instantiating, configuring and launching up the servers. See the method implementation for info on the exact semantic.
Setup and launch either HTTP or HTTPS servers to listen at the configured addresses and ports. This method reads up the scoping configuration in order to obtain the data necessary for instantiating, configuring and launching up the servers. See the method implementation for info on the exact semantic.
Setup and attach Socket.IO handlers to each of the servers.
That is HTTP and HTTPS servers that are running and listening
for new connections. The kernel itself does not use the sockets
it just sets it up. Please refer to the Socket.IO docs for info.
Also, see the configureSocketServers
method implementation.
This configuration utility sets up the environment for the Socket.IO server in the current kernel. Basically, this does the socket server configuration using the Socket.IO configure API to set the necessary options to opimize the performance. Please refer to the implementation for more info on options.
Setup the Connect middleware framework along with the default pipeline of middlewares necessary for the Granite framework to operate correctly. You are encouraged to override this method to provide a Connect setup procedure to your own liking, etc. Each middleware instance is stored in the kernel as variable.
This method sets up the necessary internal toolkits, such as the determined scope and the router, which is then are wired in with the located and instantiated services. Please refer to the implementation on how and what is being done exactly. Also, it looks up and initialized the requested env scope.
Setup a set of appropriate Connect middlewares that will take
care of serving static directory content for all configured
assets directory, using the options drawed from configuration.
You should override the method to tweak the creation process.
Please see the serveStaticDirectory
method implementation.
Either get or set an identica token. This token is application identification string of a free form, but usually formed by a app name plus a verion after the at sign. If no arguments are supplied, the method will get identica, otherwise - attempt to set one. If there is no identica - it asks the configuration.
The utilitary method that is being called by either the kernel or scope implementation to establish the desirable facade for logging. The options from the config may be used to configure various options of the logger, such as output format, etc.
Create and wire in an appropriate Connext middleware that will serve the specified directory as the directory with a static content. That is, it will expose it to the world (not list it). The serving aspects can be configured via a passed in options.
Copyright (c) 2013, Alexander Cherniuk ts33kr@gmail.com All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.