Java Code Examples for org.apache.brooklyn.api.sensor.AttributeSensor#getName()
The following examples show how to use
org.apache.brooklyn.api.sensor.AttributeSensor#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OnPublicNetworkEnricherTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Test public <T> void testIgnoresNonMatchingSensors() throws Exception { AttributeSensor<URI> sensor1 = Sensors.newSensor(URI.class, "my.different"); AttributeSensor<URL> sensor2 = Sensors.newSensor(URL.class, "my.different2"); AttributeSensor<String> sensor3 = Sensors.newStringSensor("my.different3"); AttributeSensor<Integer> sensor4 = Sensors.newIntegerSensor("my.different4"); AttributeSensor<HostAndPort> sensor5 = Sensors.newSensor(HostAndPort.class, "my.different5"); entity.sensors().set(Attributes.SUBNET_ADDRESS, "127.0.0.1"); entity.sensors().set(sensor1, URI.create("http://127.0.0.1:1234/my/path")); entity.sensors().set(sensor2, new URL("http://127.0.0.1:1234/my/path")); entity.sensors().set(sensor3, "http://127.0.0.1:1234/my/path"); entity.sensors().set(sensor4, 1234); entity.sensors().set(sensor5, HostAndPort.fromParts("127.0.0.1", 1234)); portForwardManager.associate("myPublicIp", HostAndPort.fromParts("mypublichost", 5678), machine, 1234); entity.addLocations(ImmutableList.of(machine)); entity.enrichers().add(EnricherSpec.create(OnPublicNetworkEnricher.class)); Map<AttributeSensor<?>, Object> allSensors = entity.sensors().getAll(); String errMsg = "sensors="+allSensors; for (AttributeSensor<?> sensor : allSensors.keySet()) { String name = sensor.getName(); assertFalse(name.startsWith("my.different") && sensor.getName().contains("public"), errMsg); } }
Example 2
Source File: RollingMeanEnricher.java From brooklyn-server with Apache License 2.0 | 5 votes |
/** * @deprecated since 0.12.0; use {@link EnricherSpec} */ @Deprecated public RollingMeanEnricher(Entity producer, AttributeSensor<T> source, AttributeSensor<Double> target, int windowSize) { super(producer, source, target); this.windowSize = windowSize; if (source!=null && target!=null) this.uniqueTag = JavaClassNames.simpleClassName(getClass())+":"+source.getName()+"->"+target.getName(); }
Example 3
Source File: LoadBalancingPolicy.java From brooklyn-server with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public LoadBalancingPolicy(Map props, AttributeSensor<? extends Number> metric, BalanceablePoolModel<NodeType, ItemType> model) { super(props); this.metric = metric; this.lowThresholdConfigKeyName = metric.getName()+".threshold.low"; this.highThresholdConfigKeyName = metric.getName()+".threshold.high"; this.model = model; this.strategy = new BalancingStrategy(getDisplayName(), model); // TODO: extract interface, inject impl // TODO Should re-use the execution manager's thread pool, somehow executor = Executors.newSingleThreadScheduledExecutor(newThreadFactory()); }
Example 4
Source File: DependentConfiguration.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Beta protected MultiBuilder(Iterable<? extends Entity> sources, AttributeSensor<T> sensor, Predicate<? super T> readiness) { builder = new Builder<T,V>(null, sensor); builder.readiness(readiness); for (Entity s : checkNotNull(sources, "sources")) { multiSource.add(new AttributeAndSensorCondition<T>(s, sensor, readiness)); } this.name = "waiting on "+sensor.getName(); this.descriptionBase = "waiting on "+sensor.getName()+" "+readiness +" from "+Iterables.size(sources)+" entit"+Strings.ies(sources); }