public static class Foo { @SetFromFlag int w; @SetFromFlag(immutable=true) private int x; @SetFromFlag("y") public int yNotY; }
public static class WithImmutableNonNullableObject { @SetFromFlag Object a; @SetFromFlag(immutable=true, nullable=false) public Object b; }
public static class MyChildEntity extends AbstractEntity { public static final ConfigKey<String> MY_CHILD_CONFIG = ConfigKeys.newStringConfigKey("mychildentity.myconfig"); @SetFromFlag("mychildconfigflagname") public static final ConfigKey<String> MY_CHILD_CONFIG_WITH_FLAGNAME = ConfigKeys.newStringConfigKey("mychildentity.myconfigwithflagname"); }
public static class MyPolicy extends AbstractPolicy { public static final BasicConfigKey<String> CONF1 = new BasicConfigKey<String>(String.class, "testpolicy.conf1", "my descr, conf1", "defaultval1"); public static final BasicConfigKey<Integer> CONF2 = new BasicConfigKey<Integer>(Integer.class, "testpolicy.conf2", "my descr, conf2", 2); @SetFromFlag public String myfield; }
public static class MyEnricher extends AbstractEnricher { public static final BasicConfigKey<String> CONF1 = new BasicConfigKey<String>(String.class, "testenricher.conf1", "my descr, conf1", "defaultval1"); public static final BasicConfigKey<Integer> CONF2 = new BasicConfigKey<Integer>(Integer.class, "testenricher.conf2", "my descr, conf2", 2); @SetFromFlag public String myfield; } }
@ImplementedBy(value = LoopOverGroupMembersTestCaseImpl.class) public interface LoopOverGroupMembersTestCase extends TargetableTestComponent { /** * The test spec that will be run against each member of the group */ @SetFromFlag("testSpec") @SuppressWarnings("serial") ConfigKey<EntitySpec<? extends TargetableTestComponent>> TEST_SPEC = ConfigKeys.newConfigKey( new TypeToken<EntitySpec<? extends TargetableTestComponent>>(){}, "test.spec", "Test spec. The test case will create one of these per child"); }
public static class MyLocation extends AbstractLocation { public static final ConfigKey<String> MY_CONFIG = ConfigKeys.newStringConfigKey("mylocation.myconfig"); @SetFromFlag("myconfigflagname") public static final ConfigKey<String> MY_CONFIG_WITH_FLAGNAME = ConfigKeys.newStringConfigKey("mylocation.myconfigwithflagname"); public static final ConfigKey<String> MY_CONFIG_WITH_DEFAULT = ConfigKeys.newStringConfigKey("mylocation.myconfigwithdefault", "", "mydefault"); }
public static class MyChildLocation extends AbstractLocation { public static final ConfigKey<String> MY_CHILD_CONFIG = ConfigKeys.newStringConfigKey("mychildlocation.myconfig"); @SetFromFlag("mychildconfigflagname") public static final ConfigKey<String> MY_CHILD_CONFIG_WITH_FLAGNAME = ConfigKeys.newStringConfigKey("mychildlocation.myconfigwithflagname"); }
@ImplementedBy(BasicGroupImpl.class) public interface BasicGroup extends AbstractGroup { @SetFromFlag("childrenAsMembers") /** @deprecated since 0.7.0 use {@link Group#addMemberChild} */ @Deprecated ConfigKey<Boolean> CHILDREN_AS_MEMBERS = new BasicConfigKey<Boolean>( Boolean.class, "brooklyn.BasicGroup.childrenAsMembers", "Whether children are automatically added as group members", false); }
public static class LocationWithOverriddenId extends ConcreteLocation { @SetFromFlag String overriddenId; public LocationWithOverriddenId() { } public String getId() { return overriddenId; } }
private class ComputingList<TT> implements Function<Collection<TT>, List<TT>> { @Override public List<TT> apply(Collection<TT> input) { if (input==null) return null; return MutableList.copyOf(input).asUnmodifiable(); } }
/** * Intended to represent a group of homogeneous entities in a single location. */ public interface Cluster extends Group, Startable, Resizable { @CatalogConfig(label = "Initial size") @SetFromFlag("initialSize") BasicConfigKey<Integer> INITIAL_SIZE = new BasicConfigKey<Integer>( Integer.class, "cluster.initial.size", "Initial cluster size", 1); }
public static class MyOldStyleLocation extends AbstractLocation { @SetFromFlag String myfield; public MyOldStyleLocation(Map<?,?> flags) { super(flags); } }
public static class MyOldStyleEntity extends AbstractEntity { @SetFromFlag("confName") public static final ConfigKey<String> CONF_NAME = TestEntity.CONF_NAME; @SuppressWarnings("deprecation") public MyOldStyleEntity(Map<?,?> flags, Entity parent) { super(flags, parent); } }
private static class ConcreteLocation extends AbstractLocation { @SetFromFlag(defaultVal="mydefault") String myfield; public ConcreteLocation() { super(); } public ConcreteLocation(Map properties) { super(properties); } }
@ImplementedBy(MyEntity2Impl.class) public interface MyEntity2 extends Entity { @SetFromFlag("myconfig") public static final ConfigKey<String> MY_CONFIG = new BasicConfigKey<String>( String.class, "test.myconfig", "My test config"); @SetFromFlag("subscribe") public static final ConfigKey<Boolean> SUBSCRIBE = new BasicConfigKey<Boolean>( Boolean.class, "test.subscribe", "Whether to do some subscriptions on re-bind", false); public List<String> getEvents(); }
@ImplementedBy(MyLatchingEntityImpl.class) public interface MyLatchingEntity extends Entity { @SuppressWarnings({ "unchecked", "rawtypes" }) @SetFromFlag("subscribe") public static final ConfigKey<AttributeSensor<?>> SUBSCRIBE = new BasicConfigKey( AttributeSensor.class, "test.mylatchingentity.subscribe", "Sensor to subscribe to (or null means don't)", null); @SetFromFlag("publish") public static final ConfigKey<String> PUBLISH = new BasicConfigKey<String>( String.class, "test.mylatchingentity.publish", "Value to publish (or null means don't)", null); public static final AttributeSensor<String> MY_SENSOR = new BasicAttributeSensor<String>( String.class, "test.mylatchingentity.mysensor", "My test sensor"); }
/** * A collection of machines running Calico. */ @Catalog(name = "Calico Infrastructure", description = "Calico SDN", iconUrl = "classpath://calico-logo.png") @ImplementedBy(CalicoNetworkImpl.class) public interface CalicoNetwork extends DockerSdnProvider { @SetFromFlag("calicoVersion") ConfigKey<String> CALICO_VERSION = ConfigKeys.newStringConfigKey("calico.version", "The Calico SDN version number", "0.19.0"); AttributeSensorAndConfigKey<EntitySpec<?>, EntitySpec<?>> CALICO_NODE_SPEC = ConfigKeys.newSensorAndConfigKeyWithDefault(SDN_AGENT_SPEC, EntitySpec.create(CalicoNode.class)); ConfigKey<Boolean> USE_IPIP = ConfigKeys.newBooleanConfigKey("calico.ipip", "Use the IPIP protocol for inter-VM traffic", Boolean.TRUE); ConfigKey<Boolean> USE_NAT = ConfigKeys.newBooleanConfigKey("calico.nat", "Use NAT for outgoing traffic", Boolean.TRUE); }
@ImplementedBy(MyEntityWithMultipleInterfacesImpl.class) public interface MyEntityWithMultipleInterfaces extends Group, Resizable, EntityLocal { @SetFromFlag("myconfig") public static final ConfigKey<String> MY_CONFIG = new BasicConfigKey<String>( String.class, "test.myentity.myconfig", "My test config"); public static final AttributeSensor<String> MY_SENSOR = new BasicAttributeSensor<String>( String.class, "test.myentity.mysensor", "My test sensor"); }
@ImplementedBy(MyEntityImpl.class) public interface MyEntity extends Entity, Startable, EntityLocal { @SetFromFlag("myconfig") public static final ConfigKey<String> MY_CONFIG = new BasicConfigKey<String>( String.class, "test.myentity.myconfig", "My test config"); public static final AttributeSensor<String> MY_SENSOR = new BasicAttributeSensor<String>( String.class, "test.myentity.mysensor", "My test sensor"); }