brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikezaccardo <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Allow sensors to be aggregated us...
Date Thu, 24 Sep 2015 17:08:07 GMT
Github user mikezaccardo commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/919#discussion_r40344471
  
    --- Diff: core/src/main/java/org/apache/brooklyn/enricher/stock/reducer/Reducer.java ---
    @@ -0,0 +1,181 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.brooklyn.enricher.stock.reducer;
    +
    +import java.util.Iterator;
    +import java.util.List;
    +import java.util.Map;
    +
    +import org.apache.brooklyn.api.entity.Entity;
    +import org.apache.brooklyn.api.entity.EntityLocal;
    +import org.apache.brooklyn.api.sensor.AttributeSensor;
    +import org.apache.brooklyn.api.sensor.Sensor;
    +import org.apache.brooklyn.api.sensor.SensorEvent;
    +import org.apache.brooklyn.api.sensor.SensorEventListener;
    +import org.apache.brooklyn.config.ConfigKey;
    +import org.apache.brooklyn.core.config.ConfigKeys;
    +import org.apache.brooklyn.core.enricher.AbstractEnricher;
    +import org.apache.brooklyn.util.core.flags.SetFromFlag;
    +import org.apache.brooklyn.util.core.task.Tasks;
    +import org.apache.brooklyn.util.core.task.ValueResolver;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import com.google.api.client.util.Lists;
    +import com.google.common.base.Function;
    +import com.google.common.base.Preconditions;
    +import com.google.common.collect.ImmutableList;
    +import com.google.common.reflect.TypeToken;
    +
    +@SuppressWarnings("serial")
    +public abstract class Reducer<S, T> extends AbstractEnricher implements SensorEventListener<Object>
{
    +
    +    private static final Logger LOG = LoggerFactory.getLogger(Reducer.class);
    +
    +    @SetFromFlag("producer")
    +    public static ConfigKey<Entity> PRODUCER = ConfigKeys.newConfigKey(Entity.class,
"enricher.producer");
    +    public static ConfigKey<Sensor<?>> TARGET_SENSOR = ConfigKeys.newConfigKey(new
TypeToken<Sensor<?>>() {}, "enricher.targetSensor");
    +    public static ConfigKey<List<? extends AttributeSensor<?>>> SOURCE_SENSORS
= ConfigKeys.newConfigKey(new TypeToken<List<? extends AttributeSensor<?>>>()
{}, "enricher.sourceSensors");
    +    public static ConfigKey<Function<List<?>,?>> REDUCER_FUNCTION =
ConfigKeys.newConfigKey(new TypeToken<Function<List<?>, ?>>() {}, "enricher.reducerFunction");
    +    @SetFromFlag("transformation")
    +    public static final ConfigKey<String> REDUCER_FUNCTION_UNTYPED = ConfigKeys.newStringConfigKey("enricher.reducerFunction.untyped",
    +        "A string matching a pre-defined named reducer function, such as join");
    --- End diff --
    
    Should be "joiner" as the example


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message