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(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(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.
|
Application |
newApplication()
Create and activate a new Application.
|
void |
registerActivationEventListener(ActivationEventListener listener) |
LayerDeclaration |
withLayer(String layerName)
Declare Layer.
|
public ApplicationBuilder(String applicationName)
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) throws JSONException, AssemblyException
json
- JSON StringJSONException
- if unable to read JSONAssemblyException
- if unable to declare the assemblypublic static ApplicationBuilder fromJson(InputStream json) throws JSONException, AssemblyException
json
- JSON inputJSONException
- if unable to read JSONAssemblyException
- if unable to declare the assemblypublic static ApplicationBuilder fromJson(JSONObject root) throws JSONException, AssemblyException
root
- JSON objectJSONException
- if unable to read JSONAssemblyException
- if unable to declare the assemblyprotected void configureWithJson(JSONObject root) throws JSONException, AssemblyException
root
- The JSON document root.JSONException
- if the JSON document isn't valid.AssemblyException
- if probelms in the Assemblers provided in the JSON document.public static void main(String[] args) throws JSONException, ActivationException, AssemblyException
Passivation exceptions are written to STDERR if any.
args
- UnusedJSONException
- if unable to read JSONAssemblyException
- if the assembly failedActivationException
- if the activation failed