You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:46:47 UTC
[29/50] brooklyn-library git commit: Tidy up interface definitions
Tidy up interface definitions
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/98257804
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/98257804
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/98257804
Branch: refs/heads/0.5.0
Commit: 982578042e025181b2af67a215917229c1ab3bc3
Parents: 9cbbe5e
Author: Andrew Kennedy <an...@cloudsoftcorp.com>
Authored: Thu Mar 21 12:09:30 2013 +0000
Committer: Andrew Kennedy <an...@cloudsoftcorp.com>
Committed: Fri Apr 19 10:36:07 2013 +0100
----------------------------------------------------------------------
.../brooklyn/entity/messaging/kafka/Kafka.java | 3 +-
.../entity/messaging/kafka/KafkaBroker.java | 25 +++++++-------
.../entity/messaging/kafka/KafkaCluster.java | 36 ++++++++++----------
.../entity/messaging/kafka/KafkaZookeeper.java | 14 ++++----
4 files changed, 41 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/98257804/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/Kafka.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/Kafka.java b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/Kafka.java
index a0e4eef..02cc0af 100644
--- a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/Kafka.java
+++ b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/Kafka.java
@@ -15,6 +15,7 @@
*/
package brooklyn.entity.messaging.kafka;
+import brooklyn.config.ConfigKey;
import brooklyn.entity.basic.Attributes;
import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
@@ -26,7 +27,7 @@ import brooklyn.util.flags.SetFromFlag;
*/
public interface Kafka {
- BasicConfigKey<String> SUGGESTED_VERSION = new BasicConfigKey<String>(SoftwareProcess.SUGGESTED_VERSION, "0.7.2-incubating");
+ ConfigKey<String> SUGGESTED_VERSION = new BasicConfigKey<String>(SoftwareProcess.SUGGESTED_VERSION, "0.7.2-incubating");
@SetFromFlag("downloadUrl")
BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey<String>(
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/98257804/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBroker.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBroker.java b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBroker.java
index e17f0de..2a82b13 100644
--- a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBroker.java
+++ b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBroker.java
@@ -15,6 +15,7 @@
*/
package brooklyn.entity.messaging.kafka;
+import brooklyn.config.ConfigKey;
import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.java.UsesJmx;
import brooklyn.entity.messaging.MessageBroker;
@@ -35,31 +36,31 @@ public interface KafkaBroker extends SoftwareProcess, MessageBroker, UsesJmx, Ka
public static final ConfigKey<Integer> START_TIMEOUT = SoftwareProcess.START_TIMEOUT;
@SetFromFlag("version")
- BasicConfigKey<String> SUGGESTED_VERSION = Kafka.SUGGESTED_VERSION;
+ ConfigKey<String> SUGGESTED_VERSION = Kafka.SUGGESTED_VERSION;
@SetFromFlag("kafkaPort")
PortAttributeSensorAndConfigKey KAFKA_PORT = new PortAttributeSensorAndConfigKey("kafka.port", "Kafka port", "9092+");
/** Location of the configuration file template to be copied to the server.*/
@SetFromFlag("serverConfig")
- BasicConfigKey<String> SERVER_CONFIG_TEMPLATE = new BasicConfigKey<String>(
- String.class, "kafka.config.server", "Server configuration template (in freemarker format)", "classpath://brooklyn/entity/messaging/kafka/server.properties");
+ ConfigKey<String> SERVER_CONFIG_TEMPLATE = new BasicConfigKey<String>(
+ String.class, "kafka.broker.configTemplate", "Server configuration template (in freemarker format)", "classpath://brooklyn/entity/messaging/kafka/server.properties");
@SetFromFlag("zookeeper")
- BasicConfigKey<KafkaZookeeper> ZOOKEEPER = new BasicConfigKey<KafkaZookeeper>(KafkaZookeeper.class, "kafka.broker.zookeeper", "Kafka zookeeper entity");
+ ConfigKey<KafkaZookeeper> ZOOKEEPER = new BasicConfigKey<KafkaZookeeper>(KafkaZookeeper.class, "kafka.broker.zookeeper", "Kafka zookeeper entity");
AttributeSensor<Integer> BROKER_ID = new BasicAttributeSensor<Integer>(Integer.class, "kafka.broker.id", "Kafka unique broker ID");
- BasicAttributeSensor<Long> FETCH_REQUEST_COUNT = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.fetch.total", "Fetch request count");
- BasicAttributeSensor<Long> TOTAL_FETCH_TIME = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.fetch.time.total", "Total fetch request processing time (millis)");
- BasicAttributeSensor<Double> MAX_FETCH_TIME = new BasicAttributeSensor<Double>(Double.class, "kafka.broker.fetch.time.max", "Max fetch request processing time (millis)");
+ AttributeSensor<Long> FETCH_REQUEST_COUNT = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.fetch.total", "Fetch request count");
+ AttributeSensor<Long> TOTAL_FETCH_TIME = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.fetch.time.total", "Total fetch request processing time (millis)");
+ AttributeSensor<Double> MAX_FETCH_TIME = new BasicAttributeSensor<Double>(Double.class, "kafka.broker.fetch.time.max", "Max fetch request processing time (millis)");
- BasicAttributeSensor<Long> PRODUCE_REQUEST_COUNT = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.produce.total", "Produce request count");
- BasicAttributeSensor<Long> TOTAL_PRODUCE_TIME = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.produce.time.total", "Total produce request processing time (millis)");
- BasicAttributeSensor<Double> MAX_PRODUCE_TIME = new BasicAttributeSensor<Double>(Double.class, "kafka.broker.produce.time.max", "Max produce request processing time (millis)");
+ AttributeSensor<Long> PRODUCE_REQUEST_COUNT = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.produce.total", "Produce request count");
+ AttributeSensor<Long> TOTAL_PRODUCE_TIME = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.produce.time.total", "Total produce request processing time (millis)");
+ AttributeSensor<Double> MAX_PRODUCE_TIME = new BasicAttributeSensor<Double>(Double.class, "kafka.broker.produce.time.max", "Max produce request processing time (millis)");
- BasicAttributeSensor<Long> BYTES_RECEIVED = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.bytes.received", "Total bytes received");
- BasicAttributeSensor<Long> BYTES_SENT = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.bytes.sent", "Total bytes sent");
+ AttributeSensor<Long> BYTES_RECEIVED = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.bytes.received", "Total bytes received");
+ AttributeSensor<Long> BYTES_SENT = new BasicAttributeSensor<Long>(Long.class, "kafka.broker.bytes.sent", "Total bytes sent");
Integer getKafkaPort();
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/98257804/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaCluster.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaCluster.java b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaCluster.java
index 65ed272..96e46ff 100644
--- a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaCluster.java
+++ b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaCluster.java
@@ -53,7 +53,7 @@ import brooklyn.util.flags.SetFromFlag;
@ImplementedBy(KafkaClusterImpl.class)
public interface KafkaCluster extends Entity, Startable, Resizable {
- public static class Spec<T extends KafkaCluster, S extends Spec<T,S>> extends BasicEntitySpec<T,S> {
+ class Spec<T extends KafkaCluster, S extends Spec<T,S>> extends BasicEntitySpec<T,S> {
private static class ConcreteSpec extends Spec<KafkaCluster, ConcreteSpec> {
ConcreteSpec() {
@@ -70,7 +70,7 @@ public interface KafkaCluster extends Entity, Startable, Resizable {
}
public S initialSize(int val) {
- configure(INITIAL_SIZE, 1);
+ configure(INITIAL_SIZE, val);
return self();
}
@@ -94,35 +94,35 @@ public interface KafkaCluster extends Entity, Startable, Resizable {
public static final ConfigKey<Integer> START_TIMEOUT = ConfigKeys.START_TIMEOUT;
@SetFromFlag("initialSize")
- public static ConfigKey<Integer> INITIAL_SIZE = new BasicConfigKey<Integer>(Cluster.INITIAL_SIZE, 1);
+ ConfigKey<Integer> INITIAL_SIZE = new BasicConfigKey<Integer>(Cluster.INITIAL_SIZE, 1);
- @SetFromFlag("controller")
- public static BasicAttributeSensorAndConfigKey<KafkaZookeeper> ZOOKEEPER = new BasicAttributeSensorAndConfigKey<KafkaZookeeper>(
- KafkaZookeeper.class, "kafkacluster.zookeeper", "Kafka zookeeper for the cluster; if null a default will created");
+ @SetFromFlag("zookeeper")
+ BasicAttributeSensorAndConfigKey<KafkaZookeeper> ZOOKEEPER = new BasicAttributeSensorAndConfigKey<KafkaZookeeper>(
+ KafkaZookeeper.class, "kafka.cluster.zookeeper", "Kafka zookeeper for the cluster; if null a default will created");
@SetFromFlag("zookeeperSpec")
- public static BasicAttributeSensorAndConfigKey<EntitySpec<KafkaZookeeper>> ZOOKEEPER_SPEC = new BasicAttributeSensorAndConfigKey(
- EntitySpec.class, "kafkacluster.zookeeperSpec", "Spec for creating the kafka zookeeper");
+ BasicAttributeSensorAndConfigKey<EntitySpec<KafkaZookeeper>> ZOOKEEPER_SPEC = new BasicAttributeSensorAndConfigKey(
+ EntitySpec.class, "kafka.cluster.zookeeperSpec", "Spec for creating the kafka zookeeper");
/** Factory to create a Kafka broker, given flags */
@SetFromFlag("brokerFactory")
- public static BasicAttributeSensorAndConfigKey<ConfigurableEntityFactory<KafkaBroker>> BROKER_FACTORY = new BasicAttributeSensorAndConfigKey(
- ConfigurableEntityFactory.class, "kafkacluster.brokerFactory", "Factory to create a Kafka broker");
+ BasicAttributeSensorAndConfigKey<ConfigurableEntityFactory<KafkaBroker>> BROKER_FACTORY = new BasicAttributeSensorAndConfigKey(
+ ConfigurableEntityFactory.class, "kafka.cluster.brokerFactory", "Factory to create a Kafka broker");
/** Spec for Kafka broker entiites to be created */
@SetFromFlag("brokerSpec")
- public static BasicAttributeSensorAndConfigKey<EntitySpec<KafkaBroker>> BROKER_SPEC = new BasicAttributeSensorAndConfigKey(
- EntitySpec.class, "kafkacluster.brokerSpec", "Spec for Kafka broker entiites to be created");
+ BasicAttributeSensorAndConfigKey<EntitySpec<KafkaBroker>> BROKER_SPEC = new BasicAttributeSensorAndConfigKey(
+ EntitySpec.class, "kafka.cluster.brokerSpec", "Spec for Kafka broker entiites to be created");
- public static AttributeSensor<DynamicCluster> CLUSTER = new BasicAttributeSensor<DynamicCluster>(
- DynamicCluster.class, "kafkacluster.cluster", "Underlying Kafka broker cluster");
+ AttributeSensor<DynamicCluster> CLUSTER = new BasicAttributeSensor<DynamicCluster>(
+ DynamicCluster.class, "kafka.cluster.brokerCluster", "Underlying Kafka broker cluster");
- public static final AttributeSensor<String> HOSTNAME = Attributes.HOSTNAME;
+ AttributeSensor<String> HOSTNAME = Attributes.HOSTNAME;
- public KafkaZookeeper getZookeeper();
+ KafkaZookeeper getZookeeper();
- public ConfigurableEntityFactory<KafkaBroker> getBrokerFactory();
+ ConfigurableEntityFactory<KafkaBroker> getBrokerFactory();
- public DynamicCluster getCluster();
+ DynamicCluster getCluster();
}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/98257804/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaZookeeper.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaZookeeper.java b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaZookeeper.java
index 522828f..a001a29 100644
--- a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaZookeeper.java
+++ b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaZookeeper.java
@@ -15,9 +15,11 @@
*/
package brooklyn.entity.messaging.kafka;
+import brooklyn.config.ConfigKey;
import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.java.UsesJmx;
import brooklyn.entity.proxying.ImplementedBy;
+import brooklyn.event.AttributeSensor;
import brooklyn.event.basic.BasicAttributeSensor;
import brooklyn.event.basic.BasicConfigKey;
import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
@@ -33,19 +35,19 @@ public interface KafkaZookeeper extends SoftwareProcess, UsesJmx, Kafka {
public static final ConfigKey<Integer> START_TIMEOUT = SoftwareProcess.START_TIMEOUT;
@SetFromFlag("version")
- BasicConfigKey<String> SUGGESTED_VERSION = Kafka.SUGGESTED_VERSION;
+ ConfigKey<String> SUGGESTED_VERSION = Kafka.SUGGESTED_VERSION;
@SetFromFlag("zookeeperPort")
PortAttributeSensorAndConfigKey ZOOKEEPER_PORT = new PortAttributeSensorAndConfigKey("zookeeper.port", "Zookeeper port", "2181+");
/** Location of the configuration file template to be copied to the server. */
@SetFromFlag("zookeeperConfig")
- BasicConfigKey<String> ZOOKEEPER_CONFIG_TEMPLATE = new BasicConfigKey<String>(
- String.class, "kafka.config.zookeeper", "Zookeeper configuration template (in freemarker format)", "classpath://brooklyn/entity/messaging/kafka/zookeeper.properties");
+ ConfigKey<String> ZOOKEEPER_CONFIG_TEMPLATE = new BasicConfigKey<String>(
+ String.class, "kafka.zookeeper.configTemplate", "Zookeeper configuration template (in freemarker format)", "classpath://brooklyn/entity/messaging/kafka/zookeeper.properties");
- BasicAttributeSensor<Long> OUTSTANDING_REQUESTS = new BasicAttributeSensor<Long>(Long.class, "kafka.zookeeper.outstandingRequests", "Outstanding request count");
- BasicAttributeSensor<Long> PACKETS_RECEIVED = new BasicAttributeSensor<Long>(Long.class, "kafka.zookeeper.packets.received", "Total packets received");
- BasicAttributeSensor<Long> PACKETS_SENT = new BasicAttributeSensor<Long>(Long.class, "kafka.zookeeper.packets.sent", "Total packets sent");
+ AttributeSensor<Long> OUTSTANDING_REQUESTS = new BasicAttributeSensor<Long>(Long.class, "kafka.zookeeper.outstandingRequests", "Outstanding request count");
+ AttributeSensor<Long> PACKETS_RECEIVED = new BasicAttributeSensor<Long>(Long.class, "kafka.zookeeper.packets.received", "Total packets received");
+ AttributeSensor<Long> PACKETS_SENT = new BasicAttributeSensor<Long>(Long.class, "kafka.zookeeper.packets.sent", "Total packets sent");
Integer getZookeeperPort();