brooklyn.entity.webapp.ControlledDynamicWebAppCluster Maven / Gradle / Ivy
package brooklyn.entity.webapp;
import brooklyn.config.ConfigKey;
import brooklyn.entity.Entity;
import brooklyn.entity.basic.Attributes;
import brooklyn.entity.basic.ConfigKeys;
import brooklyn.entity.basic.ConfigurableEntityFactory;
import brooklyn.entity.group.Cluster;
import brooklyn.entity.group.DynamicCluster;
import brooklyn.entity.proxy.LoadBalancer;
import brooklyn.entity.proxying.EntitySpec;
import brooklyn.entity.proxying.ImplementedBy;
import brooklyn.entity.trait.Resizable;
import brooklyn.entity.trait.Startable;
import brooklyn.event.AttributeSensor;
import brooklyn.event.basic.BasicAttributeSensor;
import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
import brooklyn.util.flags.SetFromFlag;
/**
* This entity contains the sub-groups and entities that go in to a single location (e.g. datacenter)
* to provide web-app cluster functionality, viz load-balancer (controller) and webapp software processes.
*
* You can customise the web server by customising
* the factory (by reference in calling code)
* or supplying your own factory (as a config flag).
*
* The contents of this group entity are:
*
* - a {@link brooklyn.entity.group.DynamicCluster} of {@link WebAppService}s (defaults to JBoss7Server)
*
- a cluster controller (defaulting to Nginx if none supplied)
*
- a {@link brooklyn.policy.Policy} to resize the DynamicCluster
*
*/
@ImplementedBy(ControlledDynamicWebAppClusterImpl.class)
public interface ControlledDynamicWebAppCluster extends Entity, Startable, Resizable, ElasticJavaWebAppService {
@SetFromFlag("initialSize")
public static ConfigKey INITIAL_SIZE = ConfigKeys.newConfigKeyWithDefault(Cluster.INITIAL_SIZE, 1);
@SetFromFlag("controller")
public static BasicAttributeSensorAndConfigKey CONTROLLER = new BasicAttributeSensorAndConfigKey(
LoadBalancer.class, "controlleddynamicwebappcluster.controller", "Controller for the cluster; if null a default will created (using controllerSpec)");
@SetFromFlag("controllerSpec")
public static BasicAttributeSensorAndConfigKey> CONTROLLER_SPEC = new BasicAttributeSensorAndConfigKey(
EntitySpec.class, "controlleddynamicwebappcluster.controllerSpec", "Spec for creating the controller (if one not supplied explicitly); if null an NGINX instance will be created");
/** factory (or closure) to create the web server, given flags */
@SetFromFlag("factory")
public static BasicAttributeSensorAndConfigKey> FACTORY = new BasicAttributeSensorAndConfigKey(
ConfigurableEntityFactory.class, DynamicCluster.FACTORY.getName(), "factory (or closure) to create the web server");
/** Spec for web server entiites to be created */
@SetFromFlag("memberSpec")
public static BasicAttributeSensorAndConfigKey> MEMBER_SPEC = new BasicAttributeSensorAndConfigKey(
EntitySpec.class, DynamicCluster.MEMBER_SPEC.getName(), "Spec for web server entiites to be created");
@SetFromFlag("webClusterSpec")
public static BasicAttributeSensorAndConfigKey> WEB_CLUSTER_SPEC = new BasicAttributeSensorAndConfigKey(
EntitySpec.class, "controlleddynamicwebappcluster.webClusterSpec", "Spec for creating the cluster; if null a DynamicWebAppCluster will be created");
public static AttributeSensor CLUSTER = new BasicAttributeSensor(
DynamicWebAppCluster.class, "controlleddynamicwebappcluster.cluster", "Underlying web-app cluster");
public static final AttributeSensor HOSTNAME = Attributes.HOSTNAME;
public LoadBalancer getController();
public ConfigurableEntityFactory getFactory();
public DynamicWebAppCluster getCluster();
}