public class ApplicationBuilder extends Object implements ActivationEventListenerRegistration
Constructor and Description |
---|
ApplicationBuilder(String applicationName) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterActivation()
Called after application activation.
|
protected void |
beforeActivation()
Called before application activation.
|
protected void |
configureWithJson(javax.json.JsonObject root)
Configures the application struucture from a JSON document.
|
void |
deregisterActivationEventListener(ActivationEventListener listener) |
static ApplicationBuilder |
fromJson(InputStream json)
Load an ApplicationBuilder from a JSON InputStream.
|
static ApplicationBuilder |
fromJson(javax.json.JsonObject root)
Load an ApplicationBuilder from a JSONObject.
|
static ApplicationBuilder |
fromJson(String json)
Load an ApplicationBuilder from a JSON String.
|
static void |
main(String[] args)
main method that read JSON from STDIN.
|
ApplicationBuilder |
metaInfo(Object... metaInfos) |
ApplicationBuilder |
mode(Application.Mode mode) |
Application |
newApplication()
Create and activate a new Application.
|
void |
registerActivationEventListener(ActivationEventListener listener) |
ApplicationBuilder |
version(String version) |
LayerDeclaration |
withLayer(String layerName)
Declare Layer.
|
ApplicationBuilder |
withPassivationShutdownHook()
Register a JVM shutdown hook that passivate the Application.
|
public ApplicationBuilder(String applicationName)
public ApplicationBuilder version(String version)
public ApplicationBuilder mode(Application.Mode mode)
public ApplicationBuilder metaInfo(Object... metaInfos)
public ApplicationBuilder withPassivationShutdownHook()
afterActivation()
.public Application newApplication() throws AssemblyException, ActivationException
AssemblyException
- if the assembly failedActivationException
- if the activation failedprotected void beforeActivation()
protected void afterActivation()
public void registerActivationEventListener(ActivationEventListener listener)
registerActivationEventListener
in interface ActivationEventListenerRegistration
listener
- will be notified when Activation events occurpublic void deregisterActivationEventListener(ActivationEventListener listener)
deregisterActivationEventListener
in interface ActivationEventListenerRegistration
listener
- will not be notified when Activation events occur anymorepublic LayerDeclaration withLayer(String layerName)
layerName
- Name of the Layerpublic static ApplicationBuilder fromJson(String json)
json
- JSON StringAssemblyException
- if unable to declare the assemblypublic static ApplicationBuilder fromJson(InputStream json) throws AssemblyException
json
- JSON inputAssemblyException
- if unable to declare the assemblypublic static ApplicationBuilder fromJson(javax.json.JsonObject root) throws AssemblyException
root
- JSON objectAssemblyException
- if unable to declare the assemblyprotected void configureWithJson(javax.json.JsonObject root) throws AssemblyException
root
- The JSON document root.AssemblyException
- if probelms in the Assemblers provided in the JSON document.public static void main(String[] args) throws ActivationException, AssemblyException
Passivation exceptions are written to STDERR if any.
args
- UnusedAssemblyException
- if the assembly failedActivationException
- if the activation failed