All Downloads are FREE. Search and download functionalities are using the official Maven repository.

brooklyn.entity.messaging.storm.Storm Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
/*
 * 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 brooklyn.entity.messaging.storm;

import brooklyn.catalog.Catalog;
import brooklyn.config.ConfigKey;
import brooklyn.config.render.RendererHints;
import brooklyn.entity.Entity;
import brooklyn.entity.basic.ConfigKeys;
import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.java.UsesJmx;
import brooklyn.entity.proxying.ImplementedBy;
import brooklyn.entity.zookeeper.ZooKeeperEnsemble;
import brooklyn.event.AttributeSensor;
import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
import brooklyn.event.basic.Sensors;
import brooklyn.util.flags.SetFromFlag;

/**
 * An {@link brooklyn.entity.Entity} that represents a Storm node (UI, Nimbus or Supervisor).
 */
@Catalog(name="Storm Node", description="Apache Storm is a distributed realtime computation system. "
        + "Storm makes it easy to reliably process unbounded streams of data, doing for realtime processing "
        + "what Hadoop did for batch processing")
@ImplementedBy(StormImpl.class)
public interface Storm extends SoftwareProcess, UsesJmx {

    @SetFromFlag("version")
    ConfigKey SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "0.8.2");

    @SetFromFlag("nimbusHostname")
    ConfigKey NIMBUS_HOSTNAME = ConfigKeys.newStringConfigKey("storm.nimbus.hostname");
    
    @SetFromFlag("nimbusEntity")
    ConfigKey NIMBUS_ENTITY = ConfigKeys.newConfigKey(Entity.class, "storm.nimbus.entity");

    @SetFromFlag("downloadUrl")
    BasicAttributeSensorAndConfigKey DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey(
            SoftwareProcess.DOWNLOAD_URL, "https://dl.dropboxusercontent.com/s/fl4kr7w0oc8ihdw/storm-${version}.zip");

    ConfigKey START_MUTEX = ConfigKeys.newConfigKey(Object.class, "storm.start.mutex");

    @SetFromFlag("role")
    ConfigKey ROLE = ConfigKeys.newConfigKey(Role.class, "storm.role", "The Storm server role");

    @SetFromFlag("localDir")
    ConfigKey LOCAL_DIR = ConfigKeys.newStringConfigKey("storm.local.dir", "Setting for Storm local dir");
    
    @SetFromFlag("uiPort")
    PortAttributeSensorAndConfigKey UI_PORT = new PortAttributeSensorAndConfigKey("storm.ui.port", "Storm UI port", "8080+");

    @SetFromFlag("thriftPort")
    PortAttributeSensorAndConfigKey THRIFT_PORT = new PortAttributeSensorAndConfigKey("storm.thrift.port", "Storm Thrift port", "6627");

    @SetFromFlag("zookeeperEnsemble")
    ConfigKey ZOOKEEPER_ENSEMBLE = ConfigKeys.newConfigKey(ZooKeeperEnsemble.class,
            "storm.zookeeper.ensemble", "Zookeeper ensemble entity");

    @SetFromFlag("stormConfigTemplateUrl")
    ConfigKey STORM_CONFIG_TEMPLATE_URL = ConfigKeys.newStringConfigKey("storm.config.templateUrl",
            "Template file (in freemarker format) for the storm.yaml config file",
            "classpath://brooklyn/entity/messaging/storm/storm.yaml");

    @SetFromFlag("zeromqVersion")
    ConfigKey ZEROMQ_VERSION = ConfigKeys.newStringConfigKey("storm.zeromq.version", "zeromq version", "2.1.7");

    AttributeSensor SERVICE_UP_JMX = Sensors.newBooleanSensor("storm.service.jmx.up", "Whether JMX is up for this service");

    String getStormConfigTemplateUrl();

    String getHostname();

    Role getRole();
    
    enum Role { NIMBUS, SUPERVISOR, UI }

    AttributeSensor STORM_UI_URL = StormUiUrl.STORM_UI_URL;
    
    class StormUiUrl {
        public static final AttributeSensor STORM_UI_URL = Sensors.newStringSensor("storm.ui.url", "URL");

        static {
            RendererHints.register(STORM_UI_URL, RendererHints.namedActionWithUrl());
        }
    }

}