|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.entity.basic.ApplicationBuilder
@Beta public abstract class ApplicationBuilder
Experimental mechanism for defining/building applications. In future releases, this API will change. Its concepts will most likely be merged with a TOSCA implementation and with EntitySpec. For building an application. Users can sub-class and override doBuild(), putting the logic for creating and wiring together entities in there. The builder is mutable; a given instance should be used to build only a single application. Once manage() has been called, the application will be built and no additional configuration should be performed through this builder. Example (simplified) code for sub-classing is:
app = new ApplicationBuilder() { //@Override public void doBuild() { MySqlNode db = addChild(EntitySpec.create(MySqlNode.class))); JBoss7Server as = addChild(EntitySpec.create(JBoss7Server.class) .configure(HTTP_PORT, "8080+") .configure(javaSysProp("brooklyn.example.db.url"), attributeWhenReady(db, MySqlNode.MYSQL_URL)); }.manage(); }
Field Summary | |
---|---|
protected java.util.concurrent.atomic.AtomicBoolean |
inManage
|
protected boolean |
managed
|
Constructor Summary | |
ApplicationBuilder()
|
|
ApplicationBuilder(EntitySpec appSpec)
|
Method Summary | |
---|---|
protected java.lang.Object
|
addChild(java.lang.Object entity)
Adds the given entity as a child of the application being built. |
protected java.lang.Object
|
addChild(EntitySpec spec)
Adds the given entity as a child of the application being built. |
protected java.lang.Object
|
addChild(java.util.Map config, java.lang.Class type)
|
ApplicationBuilder
|
appDisplayName(java.lang.String val)
|
protected void
|
checkDuringManage()
|
protected void
|
checkNotManaged()
|
protected void
|
checkPreManage()
|
ApplicationBuilder
|
configure(java.util.Map config)
Configures the application instance. |
protected java.lang.Object
|
createChild(EntitySpec spec)
@deprecated since 0.5.0-rc.1 (added in 0.5.0-M2); use addChild(EntitySpec), for consistency with AbstractEntity#addChild(EntitySpec)#addChild(EntitySpec). |
protected java.lang.Object
|
createChild(java.util.Map config, java.lang.Class type)
@deprecated since 0.5.0-rc.1 (added in 0.5.0-M2); use addChild(Map, Class) |
protected java.lang.Object
|
createEntity(EntitySpec spec)
|
protected void
|
doBuild()
For overriding, to create and wire together entities. |
protected StartableApplication
|
getApp()
|
protected ManagementContext
|
getManagementContext()
|
java.lang.Class
|
getType()
Returns the type of the application being built. |
StartableApplication
|
manage()
Creates a new ManagementContext, and then builds and manages the application. |
StartableApplication
|
manage(ManagementContext managementContext)
Builds and manages the application, calling the user's doBuild() method. |
static EntitySpec
|
newAppSpec(java.lang.Class type)
@deprecated since 0.5.0-rc.1 (added in 0.5.0-M2) |
static java.lang.Object
|
newManagedApp(java.lang.Class type)
|
static java.lang.Object
|
newManagedApp(EntitySpec spec)
|
static java.lang.Object
|
newManagedApp(java.lang.Class type, ManagementContext managementContext)
|
static java.lang.Object
|
newManagedApp(EntitySpec spec, ManagementContext managementContext)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected final java.util.concurrent.atomic.AtomicBoolean inManage
protected boolean managed
Constructor Detail |
---|
public ApplicationBuilder()
public ApplicationBuilder(EntitySpec appSpec)
Method Detail |
---|
protected final java.lang.Object addChild(java.lang.Object entity)
protected final java.lang.Object addChild(EntitySpec spec)
protected final java.lang.Object addChild(java.util.Map config, java.lang.Class type)
public final ApplicationBuilder appDisplayName(java.lang.String val)
protected void checkDuringManage()
protected void checkNotManaged()
protected void checkPreManage()
public final ApplicationBuilder configure(java.util.Map config)
protected final java.lang.Object createChild(EntitySpec spec)
protected final java.lang.Object createChild(java.util.Map config, java.lang.Class type)
protected final java.lang.Object createEntity(EntitySpec spec)
protected void doBuild()
protected final StartableApplication getApp()
protected final ManagementContext getManagementContext()
public final java.lang.Class getType()
public final StartableApplication manage()
public final StartableApplication manage(ManagementContext managementContext)
public static EntitySpec newAppSpec(java.lang.Class type)
@SuppressWarnings("unchecked") @Beta public static java.lang.Object newManagedApp(java.lang.Class type)
@SuppressWarnings("unchecked") @Beta public static java.lang.Object newManagedApp(EntitySpec spec)
@SuppressWarnings("unchecked") @Beta public static java.lang.Object newManagedApp(java.lang.Class type, ManagementContext managementContext)
@SuppressWarnings("unchecked") @Beta public static java.lang.Object newManagedApp(EntitySpec spec, ManagementContext managementContext)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.