brooklyn-software-messaging: add org.apache package prefix
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/c14fef53 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/c14fef53 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/c14fef53 Branch: refs/heads/master Commit: c14fef53daba011f21f93d85198ca03e1bbb474c Parents: 5dfe944 Author: Ciprian Ciubotariu <[email protected]> Authored: Thu Aug 13 16:34:21 2015 +0300 Committer: Ciprian Ciubotariu <[email protected]> Committed: Tue Aug 18 12:33:20 2015 +0300 ---------------------------------------------------------------------- .../brooklyn/demo/KafkaClusterExample.java | 2 +- .../demo/StandaloneQpidBrokerExample.java | 4 +- .../apache/brooklyn/demo/StormSampleApp.java | 2 +- software/messaging/pom.xml | 10 +- .../entity/messaging/MessageBroker.java | 34 --- .../java/brooklyn/entity/messaging/Queue.java | 51 ---- .../java/brooklyn/entity/messaging/Topic.java | 46 ---- .../messaging/activemq/ActiveMQBroker.java | 81 ------ .../messaging/activemq/ActiveMQBrokerImpl.java | 124 --------- .../messaging/activemq/ActiveMQDestination.java | 24 -- .../activemq/ActiveMQDestinationImpl.java | 66 ----- .../messaging/activemq/ActiveMQDriver.java | 28 -- .../messaging/activemq/ActiveMQQueue.java | 27 -- .../messaging/activemq/ActiveMQQueueImpl.java | 69 ----- .../messaging/activemq/ActiveMQSpecs.java | 33 --- .../messaging/activemq/ActiveMQSshDriver.java | 145 ---------- .../messaging/activemq/ActiveMQTopic.java | 27 -- .../messaging/activemq/ActiveMQTopicImpl.java | 50 ---- .../entity/messaging/amqp/AmqpExchange.java | 45 --- .../entity/messaging/amqp/AmqpServer.java | 53 ---- .../entity/messaging/jms/JMSBroker.java | 58 ---- .../entity/messaging/jms/JMSBrokerImpl.java | 168 ------------ .../entity/messaging/jms/JMSDestination.java | 29 -- .../messaging/jms/JMSDestinationImpl.java | 51 ---- .../kafka/AbstractfKafkaSshDriver.java | 133 --------- .../brooklyn/entity/messaging/kafka/Kafka.java | 45 --- .../entity/messaging/kafka/KafkaBroker.java | 85 ------ .../messaging/kafka/KafkaBrokerDriver.java | 27 -- .../entity/messaging/kafka/KafkaBrokerImpl.java | 170 ------------ .../messaging/kafka/KafkaBrokerSshDriver.java | 97 ------- .../entity/messaging/kafka/KafkaCluster.java | 92 ------- .../messaging/kafka/KafkaClusterImpl.java | 206 -------------- .../entity/messaging/kafka/KafkaZooKeeper.java | 58 ---- .../messaging/kafka/KafkaZooKeeperDriver.java | 28 -- .../messaging/kafka/KafkaZooKeeperImpl.java | 47 ---- .../kafka/KafkaZooKeeperSshDriver.java | 82 ------ .../entity/messaging/qpid/QpidBroker.java | 79 ------ .../entity/messaging/qpid/QpidBrokerImpl.java | 147 ---------- .../entity/messaging/qpid/QpidDestination.java | 32 --- .../messaging/qpid/QpidDestinationImpl.java | 101 ------- .../entity/messaging/qpid/QpidDriver.java | 28 -- .../entity/messaging/qpid/QpidQueue.java | 29 -- .../entity/messaging/qpid/QpidQueueImpl.java | 66 ----- .../entity/messaging/qpid/QpidSshDriver.java | 137 ---------- .../entity/messaging/qpid/QpidTopic.java | 27 -- .../entity/messaging/qpid/QpidTopicImpl.java | 56 ---- .../entity/messaging/rabbit/RabbitBroker.java | 91 ------- .../messaging/rabbit/RabbitBrokerImpl.java | 121 --------- .../messaging/rabbit/RabbitDestination.java | 92 ------- .../entity/messaging/rabbit/RabbitDriver.java | 32 --- .../entity/messaging/rabbit/RabbitQueue.java | 85 ------ .../messaging/rabbit/RabbitSshDriver.java | 208 -------------- .../brooklyn/entity/messaging/storm/Storm.java | 105 ------- .../entity/messaging/storm/StormDeployment.java | 42 --- .../messaging/storm/StormDeploymentImpl.java | 77 ------ .../entity/messaging/storm/StormDriver.java | 27 -- .../entity/messaging/storm/StormImpl.java | 118 -------- .../entity/messaging/storm/StormSshDriver.java | 272 ------------------- .../entity/zookeeper/AbstractZooKeeperImpl.java | 109 -------- .../entity/zookeeper/ZooKeeperDriver.java | 27 -- .../entity/zookeeper/ZooKeeperEnsemble.java | 53 ---- .../entity/zookeeper/ZooKeeperEnsembleImpl.java | 105 ------- .../entity/zookeeper/ZooKeeperNode.java | 67 ----- .../entity/zookeeper/ZooKeeperNodeImpl.java | 33 --- .../entity/zookeeper/ZooKeeperSshDriver.java | 163 ----------- .../entity/messaging/MessageBroker.java | 34 +++ .../apache/brooklyn/entity/messaging/Queue.java | 51 ++++ .../apache/brooklyn/entity/messaging/Topic.java | 46 ++++ .../messaging/activemq/ActiveMQBroker.java | 81 ++++++ .../messaging/activemq/ActiveMQBrokerImpl.java | 124 +++++++++ .../messaging/activemq/ActiveMQDestination.java | 24 ++ .../activemq/ActiveMQDestinationImpl.java | 66 +++++ .../messaging/activemq/ActiveMQDriver.java | 28 ++ .../messaging/activemq/ActiveMQQueue.java | 27 ++ .../messaging/activemq/ActiveMQQueueImpl.java | 69 +++++ .../messaging/activemq/ActiveMQSpecs.java | 33 +++ .../messaging/activemq/ActiveMQSshDriver.java | 145 ++++++++++ .../messaging/activemq/ActiveMQTopic.java | 27 ++ .../messaging/activemq/ActiveMQTopicImpl.java | 50 ++++ .../entity/messaging/amqp/AmqpExchange.java | 45 +++ .../entity/messaging/amqp/AmqpServer.java | 53 ++++ .../entity/messaging/jms/JMSBroker.java | 58 ++++ .../entity/messaging/jms/JMSBrokerImpl.java | 168 ++++++++++++ .../entity/messaging/jms/JMSDestination.java | 29 ++ .../messaging/jms/JMSDestinationImpl.java | 51 ++++ .../kafka/AbstractfKafkaSshDriver.java | 133 +++++++++ .../brooklyn/entity/messaging/kafka/Kafka.java | 45 +++ .../entity/messaging/kafka/KafkaBroker.java | 85 ++++++ .../messaging/kafka/KafkaBrokerDriver.java | 27 ++ .../entity/messaging/kafka/KafkaBrokerImpl.java | 170 ++++++++++++ .../messaging/kafka/KafkaBrokerSshDriver.java | 97 +++++++ .../entity/messaging/kafka/KafkaCluster.java | 92 +++++++ .../messaging/kafka/KafkaClusterImpl.java | 206 ++++++++++++++ .../entity/messaging/kafka/KafkaZooKeeper.java | 58 ++++ .../messaging/kafka/KafkaZooKeeperDriver.java | 28 ++ .../messaging/kafka/KafkaZooKeeperImpl.java | 47 ++++ .../kafka/KafkaZooKeeperSshDriver.java | 82 ++++++ .../entity/messaging/qpid/QpidBroker.java | 79 ++++++ .../entity/messaging/qpid/QpidBrokerImpl.java | 147 ++++++++++ .../entity/messaging/qpid/QpidDestination.java | 32 +++ .../messaging/qpid/QpidDestinationImpl.java | 101 +++++++ .../entity/messaging/qpid/QpidDriver.java | 28 ++ .../entity/messaging/qpid/QpidQueue.java | 29 ++ .../entity/messaging/qpid/QpidQueueImpl.java | 66 +++++ .../entity/messaging/qpid/QpidSshDriver.java | 137 ++++++++++ .../entity/messaging/qpid/QpidTopic.java | 27 ++ .../entity/messaging/qpid/QpidTopicImpl.java | 56 ++++ .../entity/messaging/rabbit/RabbitBroker.java | 91 +++++++ .../messaging/rabbit/RabbitBrokerImpl.java | 121 +++++++++ .../messaging/rabbit/RabbitDestination.java | 92 +++++++ .../entity/messaging/rabbit/RabbitDriver.java | 32 +++ .../entity/messaging/rabbit/RabbitQueue.java | 85 ++++++ .../messaging/rabbit/RabbitSshDriver.java | 208 ++++++++++++++ .../brooklyn/entity/messaging/storm/Storm.java | 105 +++++++ .../entity/messaging/storm/StormDeployment.java | 42 +++ .../messaging/storm/StormDeploymentImpl.java | 77 ++++++ .../entity/messaging/storm/StormDriver.java | 27 ++ .../entity/messaging/storm/StormImpl.java | 118 ++++++++ .../entity/messaging/storm/StormSshDriver.java | 272 +++++++++++++++++++ .../entity/zookeeper/AbstractZooKeeperImpl.java | 109 ++++++++ .../entity/zookeeper/ZooKeeperDriver.java | 27 ++ .../entity/zookeeper/ZooKeeperEnsemble.java | 53 ++++ .../entity/zookeeper/ZooKeeperEnsembleImpl.java | 105 +++++++ .../entity/zookeeper/ZooKeeperNode.java | 67 +++++ .../entity/zookeeper/ZooKeeperNodeImpl.java | 33 +++ .../entity/zookeeper/ZooKeeperSshDriver.java | 163 +++++++++++ .../entity/messaging/activemq/activemq.xml | 154 ----------- .../messaging/kafka/kafka-google-doorway.jpg | Bin 15692 -> 0 bytes .../entity/messaging/kafka/server.properties | 112 -------- .../entity/messaging/kafka/zookeeper.properties | 13 - .../entity/messaging/rabbit/rabbitmq.config | 5 - .../brooklyn/entity/messaging/storm/storm.yaml | 39 --- .../brooklyn/entity/messaging/zookeeper/zoo.cfg | 42 --- .../entity/messaging/activemq/activemq.xml | 154 +++++++++++ .../messaging/kafka/kafka-google-doorway.jpg | Bin 0 -> 15692 bytes .../entity/messaging/kafka/server.properties | 112 ++++++++ .../entity/messaging/kafka/zookeeper.properties | 13 + .../entity/messaging/rabbit/rabbitmq.config | 5 + .../brooklyn/entity/messaging/storm/storm.yaml | 39 +++ .../brooklyn/entity/messaging/zookeeper/zoo.cfg | 42 +++ .../messaging/activemq/ActiveMQEc2LiveTest.java | 117 -------- .../activemq/ActiveMQGoogleComputeLiveTest.java | 117 -------- .../activemq/ActiveMQIntegrationTest.java | 258 ------------------ .../messaging/kafka/KafkaIntegrationTest.java | 142 ---------- .../entity/messaging/kafka/KafkaLiveTest.java | 68 ----- .../entity/messaging/kafka/KafkaSupport.java | 109 -------- .../entity/messaging/qpid/QpidEc2LiveTest.java | 46 ---- .../messaging/qpid/QpidIntegrationTest.java | 254 ----------------- .../messaging/rabbit/RabbitEc2LiveTest.java | 98 ------- .../messaging/rabbit/RabbitIntegrationTest.java | 189 ------------- .../messaging/storm/LocalhostLiveTest.java | 32 --- .../messaging/storm/SoftLayerLiveTest.java | 33 --- .../storm/StormAbstractCloudLiveTest.java | 200 -------------- .../messaging/storm/StormEc2LiveTest.java | 58 ---- .../messaging/storm/StormGceLiveTest.java | 51 ---- .../storm/topologies/ExclamationBolt.java | 51 ---- .../zookeeper/ZooKeeperEc2LiveTest.java | 48 ---- .../zookeeper/ZooKeeperEnsembleLiveTest.java | 127 --------- .../messaging/activemq/ActiveMQEc2LiveTest.java | 117 ++++++++ .../activemq/ActiveMQGoogleComputeLiveTest.java | 117 ++++++++ .../activemq/ActiveMQIntegrationTest.java | 258 ++++++++++++++++++ .../messaging/kafka/KafkaIntegrationTest.java | 142 ++++++++++ .../entity/messaging/kafka/KafkaLiveTest.java | 68 +++++ .../entity/messaging/kafka/KafkaSupport.java | 109 ++++++++ .../entity/messaging/qpid/QpidEc2LiveTest.java | 46 ++++ .../messaging/qpid/QpidIntegrationTest.java | 254 +++++++++++++++++ .../messaging/rabbit/RabbitEc2LiveTest.java | 98 +++++++ .../messaging/rabbit/RabbitIntegrationTest.java | 189 +++++++++++++ .../messaging/storm/LocalhostLiveTest.java | 32 +++ .../messaging/storm/SoftLayerLiveTest.java | 33 +++ .../storm/StormAbstractCloudLiveTest.java | 200 ++++++++++++++ .../messaging/storm/StormEc2LiveTest.java | 58 ++++ .../messaging/storm/StormGceLiveTest.java | 51 ++++ .../storm/topologies/ExclamationBolt.java | 51 ++++ .../zookeeper/ZooKeeperEc2LiveTest.java | 48 ++++ .../zookeeper/ZooKeeperEnsembleLiveTest.java | 127 +++++++++ .../src/test/resources/opengamma-cluster.yaml | 2 +- .../src/test/resources/storm-blueprint.yaml | 2 +- 178 files changed, 7182 insertions(+), 7182 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/KafkaClusterExample.java ---------------------------------------------------------------------- diff --git a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/KafkaClusterExample.java b/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/KafkaClusterExample.java index ea316b5..63bc3fd 100644 --- a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/KafkaClusterExample.java +++ b/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/KafkaClusterExample.java @@ -22,7 +22,7 @@ import java.util.List; import brooklyn.entity.basic.ApplicationBuilder; import brooklyn.entity.basic.Entities; -import brooklyn.entity.messaging.kafka.KafkaCluster; +import org.apache.brooklyn.entity.messaging.kafka.KafkaCluster; import org.apache.brooklyn.api.entity.proxying.EntitySpec; import org.apache.brooklyn.launcher.BrooklynLauncher; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/StandaloneQpidBrokerExample.java ---------------------------------------------------------------------- diff --git a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/StandaloneQpidBrokerExample.java b/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/StandaloneQpidBrokerExample.java index aecd1be..c3969a5 100644 --- a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/StandaloneQpidBrokerExample.java +++ b/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/StandaloneQpidBrokerExample.java @@ -23,8 +23,8 @@ import java.util.List; import brooklyn.entity.basic.AbstractApplication; import brooklyn.entity.basic.Entities; import brooklyn.entity.basic.StartableApplication; -import brooklyn.entity.messaging.amqp.AmqpServer; -import brooklyn.entity.messaging.qpid.QpidBroker; +import org.apache.brooklyn.entity.messaging.amqp.AmqpServer; +import org.apache.brooklyn.entity.messaging.qpid.QpidBroker; import org.apache.brooklyn.api.entity.proxying.EntitySpec; import org.apache.brooklyn.launcher.BrooklynLauncher; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/StormSampleApp.java ---------------------------------------------------------------------- diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/StormSampleApp.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/StormSampleApp.java index 52f5cdc..26f4e37 100644 --- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/StormSampleApp.java +++ b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/StormSampleApp.java @@ -28,7 +28,7 @@ import org.apache.brooklyn.api.entity.proxying.EntitySpec; import brooklyn.entity.basic.AbstractApplication; import brooklyn.entity.basic.Entities; import brooklyn.entity.basic.StartableApplication; -import brooklyn.entity.messaging.storm.StormDeployment; +import org.apache.brooklyn.entity.messaging.storm.StormDeployment; import org.apache.brooklyn.launcher.BrooklynLauncher; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/pom.xml ---------------------------------------------------------------------- diff --git a/software/messaging/pom.xml b/software/messaging/pom.xml index 8d26aa9..bd0a84d 100644 --- a/software/messaging/pom.xml +++ b/software/messaging/pom.xml @@ -53,11 +53,11 @@ the given components. These are files "without any degree of creativity" from the perspective of the Brooklyn/Apache contribution. --> - <exclude>src/main/resources/brooklyn/entity/messaging/activemq/activemq.xml</exclude> - <exclude>src/main/resources/brooklyn/entity/messaging/kafka/server.properties</exclude> - <exclude>src/main/resources/brooklyn/entity/messaging/kafka/zookeeper.properties</exclude> - <exclude>src/main/resources/brooklyn/entity/messaging/storm/storm.yaml</exclude> - <exclude>src/main/resources/brooklyn/entity/messaging/rabbit/rabbitmq.config</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/messaging/activemq/activemq.xml</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/messaging/kafka/server.properties</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/messaging/kafka/zookeeper.properties</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/messaging/storm/storm.yaml</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/messaging/rabbit/rabbitmq.config</exclude> </excludes> </configuration> </plugin> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/MessageBroker.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/MessageBroker.java b/software/messaging/src/main/java/brooklyn/entity/messaging/MessageBroker.java deleted file mode 100644 index 60405e3..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/MessageBroker.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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; - -import org.apache.brooklyn.api.entity.Entity; -import org.apache.brooklyn.api.event.AttributeSensor; - -import brooklyn.event.basic.Sensors; - -/** - * Marker interface identifying message brokers. - */ -public interface MessageBroker extends Entity { - AttributeSensor<String> BROKER_URL = Sensors.newStringSensor("broker.url", "Broker Connection URL"); - - /** Setup the URL for external connections to the broker. */ - void setBrokerUrl(); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/Queue.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/Queue.java b/software/messaging/src/main/java/brooklyn/entity/messaging/Queue.java deleted file mode 100644 index 2bf2cb2..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/Queue.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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; - -import org.apache.brooklyn.api.event.AttributeSensor; - -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; -import brooklyn.event.basic.Sensors; - -/** - * An interface that describes a messaging queue. - */ -public interface Queue { - BasicAttributeSensorAndConfigKey<String> QUEUE_NAME = new BasicAttributeSensorAndConfigKey<String>(String.class, "queue.name", "Queue name"); - - AttributeSensor<Integer> QUEUE_DEPTH_BYTES = Sensors.newIntegerSensor("queue.depth.bytes", "Queue depth in bytes"); - AttributeSensor<Integer> QUEUE_DEPTH_MESSAGES = Sensors.newIntegerSensor("queue.depth.messages", "Queue depth in messages"); - - /** - * Create the queue. - * - * TODO make this an effector - */ - abstract void create(); - - /** - * Delete the queue. - * - * TODO make this an effector - */ - abstract void delete(); - - String getQueueName(); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/Topic.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/Topic.java b/software/messaging/src/main/java/brooklyn/entity/messaging/Topic.java deleted file mode 100644 index bf45ee5..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/Topic.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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; - -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; - -/** - * An interface that describes a messaging topic. - */ -public interface Topic { - BasicAttributeSensorAndConfigKey<String> TOPIC_NAME = new BasicAttributeSensorAndConfigKey<String>( - String.class, "topic.name", "Topic name"); - - /** - * Create the topic. - * - * TODO make this an effector - */ - public abstract void create(); - - /** - * Delete the topic. - * - * TODO make this an effector - */ - public abstract void delete(); - - String getTopicName(); - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java deleted file mode 100644 index b8bbdca..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.activemq; - -import org.apache.brooklyn.api.catalog.Catalog; -import org.apache.brooklyn.api.entity.proxying.ImplementedBy; -import org.apache.brooklyn.core.util.flags.SetFromFlag; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.basic.Attributes; -import brooklyn.entity.basic.ConfigKeys; -import brooklyn.entity.basic.SoftwareProcess; -import brooklyn.entity.java.UsesJmx; -import brooklyn.entity.messaging.MessageBroker; -import brooklyn.entity.messaging.jms.JMSBroker; -import brooklyn.event.basic.AttributeSensorAndConfigKey; -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey; -import brooklyn.event.basic.BasicConfigKey; -import brooklyn.event.basic.PortAttributeSensorAndConfigKey; -import brooklyn.util.time.Duration; -/** - * An {@link org.apache.brooklyn.api.entity.Entity} that represents a single ActiveMQ broker instance. - */ -@Catalog(name="ActiveMQ Broker", description="ActiveMQ is an open source message broker which fully implements the Java Message Service 1.1 (JMS)", iconUrl="classpath:///activemq-logo.png") -@ImplementedBy(ActiveMQBrokerImpl.class) -public interface ActiveMQBroker extends SoftwareProcess, MessageBroker, UsesJmx, JMSBroker<ActiveMQQueue, ActiveMQTopic> { - - @SetFromFlag("startTimeout") - ConfigKey<Duration> START_TIMEOUT = SoftwareProcess.START_TIMEOUT; - - @SetFromFlag("version") - public static final ConfigKey<String> SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "5.10.2"); - - @SetFromFlag("downloadUrl") - public static final AttributeSensorAndConfigKey<String,String> DOWNLOAD_URL = new StringAttributeSensorAndConfigKey( - Attributes.DOWNLOAD_URL, "${driver.mirrorUrl}/${version}/apache-activemq-${version}-bin.tar.gz"); - - /** download mirror, if desired */ - @SetFromFlag("mirrorUrl") - public static final BasicConfigKey<String> MIRROR_URL = new BasicConfigKey<String>(String.class, "activemq.install.mirror.url", "URL of mirror", - "http://www.mirrorservice.org/sites/ftp.apache.org/activemq"); - - @SetFromFlag("brokerName") - public static final AttributeSensorAndConfigKey<String,String> BROKER_NAME = - ConfigKeys.newStringSensorAndConfigKey("activemq.brokerName", "ActiveMQ Broker Name", "localhost"); - - @SetFromFlag("openWirePort") - public static final PortAttributeSensorAndConfigKey OPEN_WIRE_PORT = new PortAttributeSensorAndConfigKey("openwire.port", "OpenWire port", "61616+"); - - @SetFromFlag("jettyPort") - public static final PortAttributeSensorAndConfigKey AMQ_JETTY_PORT = new PortAttributeSensorAndConfigKey("activemq.jetty.port", "jetty port", "8161+"); - - @SetFromFlag("jmxUser") - public static final BasicAttributeSensorAndConfigKey<String> JMX_USER = new BasicAttributeSensorAndConfigKey<String>(UsesJmx.JMX_USER, "admin"); - - @SetFromFlag("jmxPassword") - public static final BasicAttributeSensorAndConfigKey<String> JMX_PASSWORD = new BasicAttributeSensorAndConfigKey<String>(UsesJmx.JMX_PASSWORD, "admin"); - - @SetFromFlag("templateConfigurationUrl") - public static final BasicAttributeSensorAndConfigKey<String> TEMPLATE_CONFIGURATION_URL = new BasicAttributeSensorAndConfigKey<String>( - String.class, "activemq.templateConfigurationUrl", "Template file (in freemarker format) for the conf/activemq.xml file", - "classpath://brooklyn/entity/messaging/activemq/activemq.xml"); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java deleted file mode 100644 index c849df1..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.activemq; - -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.apache.brooklyn.api.entity.proxying.EntitySpec; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.entity.basic.Entities; -import brooklyn.entity.java.UsesJmx; -import brooklyn.entity.messaging.jms.JMSBrokerImpl; -import brooklyn.event.feed.jmx.JmxAttributePollConfig; -import brooklyn.event.feed.jmx.JmxFeed; - -import com.google.common.base.Functions; -import com.google.common.base.Objects.ToStringHelper; -import com.google.common.base.Predicates; -/** - * An {@link org.apache.brooklyn.api.entity.Entity} that represents a single ActiveMQ broker instance. - */ -public class ActiveMQBrokerImpl extends JMSBrokerImpl<ActiveMQQueue, ActiveMQTopic> implements ActiveMQBroker { - private static final Logger log = LoggerFactory.getLogger(ActiveMQBrokerImpl.class); - - private volatile JmxFeed jmxFeed; - - public ActiveMQBrokerImpl() { - super(); - } - - @Override - public void init() { - super.init(); - Entities.getRequiredUrlConfig(this, TEMPLATE_CONFIGURATION_URL); - } - - public void setBrokerUrl() { - setAttribute(BROKER_URL, String.format("tcp://%s:%d", getAttribute(HOSTNAME), getAttribute(OPEN_WIRE_PORT))); - } - - public Integer getJmxPort() { - return !isJmxEnabled() ? Integer.valueOf(-1) : getAttribute(UsesJmx.JMX_PORT); - } - - public String getBrokerName() { - return getAttribute(BROKER_NAME); - } - - public Integer getOpenWirePort() { - return getAttribute(OPEN_WIRE_PORT); - } - - public boolean isJmxEnabled() { - return Boolean.TRUE.equals(getConfig(USE_JMX)); - } - - @Override - public ActiveMQQueue createQueue(Map properties) { - ActiveMQQueue result = addChild(EntitySpec.create(ActiveMQQueue.class).configure(properties)); - Entities.manage(result); - result.create(); - return result; - } - - @Override - public ActiveMQTopic createTopic(Map properties) { - ActiveMQTopic result = addChild(EntitySpec.create(ActiveMQTopic.class).configure(properties)); - Entities.manage(result); - result.create(); - return result; - } - - @Override - protected void connectSensors() { - setAttribute(BROKER_URL, String.format("tcp://%s:%d", getAttribute(HOSTNAME), getAttribute(OPEN_WIRE_PORT))); - - String brokerMbeanName = "org.apache.activemq:type=Broker,brokerName=" + getBrokerName(); - - jmxFeed = JmxFeed.builder() - .entity(this) - .period(500, TimeUnit.MILLISECONDS) - .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP) - .objectName(brokerMbeanName) - .attributeName("BrokerName") - .onSuccess(Functions.forPredicate(Predicates.notNull())) - .onFailureOrException(Functions.constant(false)) - .suppressDuplicates(true)) - .build(); - } - - @Override - public void disconnectSensors() { - super.disconnectSensors(); - if (jmxFeed != null) jmxFeed.stop(); - } - - @Override - protected ToStringHelper toStringHelper() { - return super.toStringHelper().add("openWirePort", getAttribute(OPEN_WIRE_PORT)); - } - - @Override - public Class getDriverInterface() { - return ActiveMQDriver.class; - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDestination.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDestination.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDestination.java deleted file mode 100644 index b33942c..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDestination.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.activemq; - -import brooklyn.entity.messaging.jms.JMSDestination; - -public interface ActiveMQDestination extends JMSDestination { -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDestinationImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDestinationImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDestinationImpl.java deleted file mode 100644 index 02b4d29..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDestinationImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.activemq; - -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; - -import org.apache.brooklyn.api.entity.Entity; -import org.apache.brooklyn.api.entity.basic.EntityLocal; - -import com.google.common.base.Preconditions; - -import brooklyn.entity.messaging.jms.JMSDestinationImpl; -import brooklyn.event.feed.jmx.JmxFeed; -import brooklyn.event.feed.jmx.JmxHelper; -import brooklyn.util.exceptions.Exceptions; - -public abstract class ActiveMQDestinationImpl extends JMSDestinationImpl implements ActiveMQDestination { - protected ObjectName brokerMBeanName; - protected transient JmxHelper jmxHelper; - protected volatile JmxFeed jmxFeed; - - public ActiveMQDestinationImpl() { - } - - @Override - public void onManagementStarting() { - super.onManagementStarting(); - - String brokerName = getBrokerName(); - Preconditions.checkArgument(brokerName != null && !brokerName.isEmpty(), "ActiveMQ brokerName attribute must be specified"); - - try { - brokerMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName); - jmxHelper = new JmxHelper((EntityLocal) getParent()); - } catch (MalformedObjectNameException e) { - throw Exceptions.propagate(e); - } - } - - @Override - protected void disconnectSensors() { - if (jmxFeed != null) jmxFeed.stop(); - } - - protected String getBrokerName() { - Preconditions.checkNotNull(getParent(), "JMS Destination must have a broker parent"); - return getParent().getAttribute(ActiveMQBroker.BROKER_NAME); - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDriver.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDriver.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDriver.java deleted file mode 100644 index 8e69017..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQDriver.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.activemq; - -import brooklyn.entity.java.JavaSoftwareProcessDriver; - -public interface ActiveMQDriver extends JavaSoftwareProcessDriver { - - String getBrokerName(); - - Integer getOpenWirePort(); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQQueue.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQQueue.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQQueue.java deleted file mode 100644 index 458b6f0..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQQueue.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.activemq; - -import org.apache.brooklyn.api.entity.proxying.ImplementedBy; - -import brooklyn.entity.messaging.Queue; - -@ImplementedBy(ActiveMQQueueImpl.class) -public interface ActiveMQQueue extends ActiveMQDestination, Queue { -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQQueueImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQQueueImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQQueueImpl.java deleted file mode 100644 index 856b2db..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQQueueImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.activemq; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.event.feed.jmx.JmxAttributePollConfig; -import brooklyn.event.feed.jmx.JmxFeed; - -public class ActiveMQQueueImpl extends ActiveMQDestinationImpl implements ActiveMQQueue { - public static final Logger log = LoggerFactory.getLogger(ActiveMQQueue.class); - - public ActiveMQQueueImpl() { - } - - @Override - public void onManagementStarting() { - super.onManagementStarting(); - setAttribute(QUEUE_NAME, getName()); - } - - public String getQueueName() { - return getName(); - } - - public void create() { - log.debug("{} adding queue {} to broker {}", new Object[] {this, getName(), jmxHelper.getAttribute(brokerMBeanName, "BrokerName")}); - - jmxHelper.operation(brokerMBeanName, "addQueue", getName()); - - connectSensors(); - } - - public void delete() { - jmxHelper.operation(brokerMBeanName, "removeQueue", getName()); - disconnectSensors(); - } - - @Override - protected void connectSensors() { - String queue = String.format("org.apache.activemq:type=Broker,brokerName=%s,destinationType=Queue,destinationName=%s", getBrokerName(), getName()); - - jmxFeed = JmxFeed.builder() - .entity(this) - .helper(jmxHelper) - .pollAttribute(new JmxAttributePollConfig<Integer>(QUEUE_DEPTH_MESSAGES) - .objectName(queue) - .attributeName("QueueSize")) - .build(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQSpecs.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQSpecs.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQSpecs.java deleted file mode 100644 index 4a481ec..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQSpecs.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.activemq; - -import org.apache.brooklyn.api.entity.proxying.EntitySpec; - -public class ActiveMQSpecs { - - public static EntitySpec<ActiveMQBroker> brokerSpec() { - return EntitySpec.create(ActiveMQBroker.class); - } - - public static EntitySpec<ActiveMQBroker> brokerSpecChef() { - return EntitySpec.create(ActiveMQBroker.class); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQSshDriver.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQSshDriver.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQSshDriver.java deleted file mode 100644 index 43096ed..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQSshDriver.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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.activemq; - -import static java.lang.String.format; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import brooklyn.entity.basic.Entities; -import brooklyn.entity.java.JavaSoftwareProcessSshDriver; -import org.apache.brooklyn.location.basic.SshMachineLocation; -import brooklyn.util.collections.MutableMap; -import brooklyn.util.net.Networking; -import brooklyn.util.os.Os; -import brooklyn.util.ssh.BashCommands; - -import com.google.common.collect.ImmutableMap; - -public class ActiveMQSshDriver extends JavaSoftwareProcessSshDriver implements ActiveMQDriver { - - public ActiveMQSshDriver(ActiveMQBrokerImpl entity, SshMachineLocation machine) { - super(entity, machine); - } - - @Override - protected String getLogFileLocation() { - return Os.mergePathsUnix(getRunDir(), "data/activemq.log"); - } - - @Override - public String getBrokerName() { - return entity.getAttribute(ActiveMQBroker.BROKER_NAME); - } - - @Override - public Integer getOpenWirePort() { - return entity.getAttribute(ActiveMQBroker.OPEN_WIRE_PORT); - } - - public String getMirrorUrl() { - return entity.getConfig(ActiveMQBroker.MIRROR_URL); - } - - protected String getTemplateConfigurationUrl() { - return entity.getAttribute(ActiveMQBroker.TEMPLATE_CONFIGURATION_URL); - } - - public String getPidFile() { - return "data/activemq.pid"; - } - - @Override - public void preInstall() { - resolver = Entities.newDownloader(this); - setExpandedInstallDir(Os.mergePaths(getInstallDir(), resolver.getUnpackedDirectoryName(format("apache-activemq-%s", getVersion())))); - } - - @Override - public void install() { - List<String> urls = resolver.getTargets(); - String saveAs = resolver.getFilename(); - - List<String> commands = new LinkedList<String>(); - commands.addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs)); - commands.add(BashCommands.INSTALL_TAR); - commands.add("tar xzfv "+saveAs); - - newScript(INSTALLING) - .body.append(commands) - .execute(); - } - - @Override - public void customize() { - Networking.checkPortsValid(ImmutableMap.of("jmxPort", getJmxPort(), "openWirePort", getOpenWirePort())); - newScript(CUSTOMIZING) - .body.append( - format("cp -R %s/{bin,conf,data,lib,webapps} .", getExpandedInstallDir()), - // Required in version 5.5.1 (at least), but not in version 5.7.0 - "sed -i.bk 's/\\[-z \"$JAVA_HOME\"]/\\[ -z \"$JAVA_HOME\" ]/g' bin/activemq", - // Stop it writing to dev null on start - "sed -i.bk \"s/\\(ACTIVEMQ_HOME..bin.run.jar.*\\)>.dev.null/\\1/\" bin/activemq", - // Required if launching multiple AMQ's, prevent jetty port conflicts - "sed -i.bk 's/8161/"+getEntity().getAttribute(ActiveMQBroker.AMQ_JETTY_PORT)+"/g' conf/jetty.xml" - // TODO disable persistence (this should be a flag -- but it seems to have no effect, despite ): - // "sed -i.bk 's/broker /broker persistent=\"false\" /g' conf/activemq.xml", - ) - .execute(); - - // Copy the configuration file across - String destinationConfigFile = Os.mergePathsUnix(getRunDir(), "conf/activemq.xml"); - copyTemplate(getTemplateConfigurationUrl(), destinationConfigFile); - } - - @Override - public void launch() { - // Using nohup, as recommended at http://activemq.apache.org/run-broker.html - newScript(ImmutableMap.of(USE_PID_FILE, false), LAUNCHING) - .body.append("nohup ./bin/activemq start > ./data/activemq-extra.log 2>&1 &") - .execute(); - } - - @Override - public boolean isRunning() { - return newScript(ImmutableMap.of(USE_PID_FILE, getPidFile()), CHECK_RUNNING).execute() == 0; - } - - @Override - public void stop() { - newScript(ImmutableMap.of(USE_PID_FILE, getPidFile()), STOPPING).execute(); - } - - @Override - public void kill() { - newScript(ImmutableMap.of(USE_PID_FILE, getPidFile()), KILLING).execute(); - } - - @Override - public Map<String, String> getShellEnvironment() { - return MutableMap.<String,String>builder() - .putAll(super.getShellEnvironment()) - .put("ACTIVEMQ_HOME", getRunDir()) - .put("ACTIVEMQ_PIDFILE", getPidFile()) - .renameKey("JAVA_OPTS", "ACTIVEMQ_OPTS") - .build(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQTopic.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQTopic.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQTopic.java deleted file mode 100644 index 304e3e9..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQTopic.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.activemq; - -import org.apache.brooklyn.api.entity.proxying.ImplementedBy; - -import brooklyn.entity.messaging.Topic; - -@ImplementedBy(ActiveMQTopicImpl.class) -public interface ActiveMQTopic extends ActiveMQDestination, Topic { -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQTopicImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQTopicImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQTopicImpl.java deleted file mode 100644 index c3cdd86..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQTopicImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.activemq; - - -public class ActiveMQTopicImpl extends ActiveMQDestinationImpl implements ActiveMQTopic { - public ActiveMQTopicImpl() { - } - - @Override - public void onManagementStarting() { - super.onManagementStarting(); - setAttribute(TOPIC_NAME, getName()); - } - - @Override - public void create() { - jmxHelper.operation(brokerMBeanName, "addTopic", getName()); - connectSensors(); - } - - public void delete() { - jmxHelper.operation(brokerMBeanName, "removeTopic", getName()); - disconnectSensors(); - } - - public void connectSensors() { - //TODO add sensors for topics - } - - public String getTopicName() { - return getName(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/amqp/AmqpExchange.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/amqp/AmqpExchange.java b/software/messaging/src/main/java/brooklyn/entity/messaging/amqp/AmqpExchange.java deleted file mode 100644 index 0ddd854..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/amqp/AmqpExchange.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.amqp; - -import org.apache.brooklyn.api.event.Sensor; -import org.apache.brooklyn.core.util.flags.SetFromFlag; - -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; - -/** - * An interface that describes an AMQP exchange. - */ -public interface AmqpExchange { - - /* AMQP standard exchange names. */ - - String DIRECT = "amq.direct"; - String TOPIC = "amq.topic"; - - /** The AMQP exchange name {@link Sensor}. */ - @SetFromFlag("exchange") - BasicAttributeSensorAndConfigKey<String> EXCHANGE_NAME = new BasicAttributeSensorAndConfigKey<String>( - String.class, "amqp.exchange.name", "AMQP exchange name"); - - /** - * Return the AMQP exchange name. - */ - public String getExchangeName(); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/amqp/AmqpServer.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/amqp/AmqpServer.java b/software/messaging/src/main/java/brooklyn/entity/messaging/amqp/AmqpServer.java deleted file mode 100644 index a044d45..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/amqp/AmqpServer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.amqp; - -import org.apache.brooklyn.api.entity.Entity; - -import brooklyn.entity.basic.Attributes; -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; -import brooklyn.event.basic.PortAttributeSensorAndConfigKey; - -/** - * Marker interface identifying AMQP servers. - */ -public interface AmqpServer extends Entity { - - /* AMQP protocol version strings. */ - - String AMQP_0_8 = "0-8"; - String AMQP_0_9 = "0-9"; - String AMQP_0_9_1 = "0-9-1"; - String AMQP_0_10 = "0-10"; - String AMQP_1_0 = "1-0"; - - PortAttributeSensorAndConfigKey AMQP_PORT = Attributes.AMQP_PORT; - - BasicAttributeSensorAndConfigKey<String> VIRTUAL_HOST_NAME = new BasicAttributeSensorAndConfigKey<String>( - String.class, "amqp.virtualHost", "AMQP virtual host name", "localhost"); - - BasicAttributeSensorAndConfigKey<String> AMQP_VERSION = new BasicAttributeSensorAndConfigKey<String>( - String.class, "amqp.version", "AMQP protocol version"); - - String getVirtualHost(); - - String getAmqpVersion(); - - Integer getAmqpPort(); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBroker.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBroker.java b/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBroker.java deleted file mode 100644 index d121c56..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBroker.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.jms; - -import java.util.Collection; -import java.util.Map; - -import brooklyn.entity.basic.SoftwareProcess; -import brooklyn.entity.messaging.MessageBroker; -import brooklyn.entity.messaging.Queue; -import brooklyn.entity.messaging.Topic; - -import com.google.common.annotations.VisibleForTesting; - -public interface JMSBroker<Q extends JMSDestination & Queue, T extends JMSDestination & Topic> extends SoftwareProcess, MessageBroker { - - @VisibleForTesting - public Collection<String> getQueueNames(); - - @VisibleForTesting - public Collection<String> getTopicNames(); - - @VisibleForTesting - public Map<String, Q> getQueues(); - - @VisibleForTesting - public Map<String, T> getTopics(); - - /** TODO make this an effector */ - public void addQueue(String name); - - public void addQueue(String name, Map properties); - - public Q createQueue(Map properties); - - /** TODO make this an effector */ - public void addTopic(String name); - - public void addTopic(String name, Map properties); - - public T createTopic(Map properties); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java deleted file mode 100644 index 43f13ba..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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.jms; - -import static brooklyn.util.JavaGroovyEquivalents.groovyTruth; - -import java.util.Collection; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.entity.basic.Lifecycle; -import brooklyn.entity.basic.SoftwareProcessImpl; -import brooklyn.entity.messaging.Queue; -import brooklyn.entity.messaging.Topic; -import brooklyn.util.collections.MutableMap; -import brooklyn.util.time.Duration; -import brooklyn.util.time.Time; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -public abstract class JMSBrokerImpl<Q extends JMSDestination & Queue, T extends JMSDestination & Topic> extends SoftwareProcessImpl implements JMSBroker<Q,T> { - private static final Logger log = LoggerFactory.getLogger(JMSBroker.class); - - Collection<String> queueNames; - Collection<String> topicNames; - Map<String, Q> queues = Maps.newLinkedHashMap(); - Map<String, T> topics = Maps.newLinkedHashMap(); - - public JMSBrokerImpl() { - } - - @Override - public JMSBrokerImpl configure(Map properties) { - if (queueNames==null) queueNames = Lists.newArrayList(); - if (groovyTruth(properties.get("queue"))) queueNames.add((String) properties.remove("queue")); - if (groovyTruth(properties.get("queues"))) queueNames.addAll((Collection<String>) properties.remove("queues")); - - if (topicNames==null) topicNames = Lists.newArrayList(); - if (groovyTruth(properties.get("topic"))) topicNames.add((String) properties.remove("topic")); - if (groovyTruth(properties.get("topics"))) topicNames.addAll((Collection<String>) properties.remove("topics")); - - return (JMSBrokerImpl) super.configure(properties); - } - - @Override - public Collection<String> getQueueNames() { - return queueNames; - } - - @Override - public Collection<String> getTopicNames() { - return topicNames; - } - - @Override - public Map<String, Q> getQueues() { - return queues; - } - - @Override - public Map<String, T> getTopics() { - return topics; - } - - @Override - protected void connectSensors() { - super.connectSensors(); - setBrokerUrl(); - } - - // should be called after sensor-polling is activated etc - @Override - protected void postStart() { - super.postStart(); - // stupid to do this here, but there appears to be a race where sometimes the - // broker throws a BrokerStopped exception, even though the sensor indicates it is up - Time.sleep(Duration.FIVE_SECONDS); - for (String name : queueNames) { - addQueue(name); - } - for (String name : topicNames) { - addTopic(name); - } - } - - @Override - public abstract void setBrokerUrl(); - - @Override - public void preStop() { - // If can't delete queues, continue trying to stop. - // (e.g. in CI have seen activemq "BrokerStoppedException" thrown in queue.destroy()). - try { - for (JMSDestination queue : queues.values()) { - queue.destroy(); - } - } catch (Exception e) { - log.warn("Error deleting queues from broker "+this+"; continuing with stop...", e); - } - - try { - for (JMSDestination topic : topics.values()) { - topic.destroy(); - } - } catch (Exception e) { - log.warn("Error deleting topics from broker "+this+"; continuing with stop...", e); - } - - super.preStop(); - } - - @Override - public void addQueue(String name) { - addQueue(name, MutableMap.of()); - } - - public void checkStartingOrRunning() { - Lifecycle state = getAttribute(SERVICE_STATE_ACTUAL); - if (getAttribute(SERVICE_STATE_ACTUAL) == Lifecycle.RUNNING) return; - if (getAttribute(SERVICE_STATE_ACTUAL) == Lifecycle.STARTING) return; - // TODO this check may be redundant or even inappropriate - throw new IllegalStateException("Cannot run against "+this+" in state "+state); - } - - @Override - public void addQueue(String name, Map properties) { - checkStartingOrRunning(); - properties.put("name", name); - queues.put(name, createQueue(properties)); - } - - @Override - public abstract Q createQueue(Map properties); - - @Override - public void addTopic(String name) { - addTopic(name, MutableMap.of()); - } - - @Override - public void addTopic(String name, Map properties) { - checkStartingOrRunning(); - properties.put("name", name); - topics.put(name, createTopic(properties)); - } - - @Override - public abstract T createTopic(Map properties); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSDestination.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSDestination.java b/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSDestination.java deleted file mode 100644 index 6257551..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSDestination.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.jms; - -import org.apache.brooklyn.api.entity.Entity; - -public interface JMSDestination extends Entity { - public String getName(); - - public void delete(); - - public void destroy(); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSDestinationImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSDestinationImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSDestinationImpl.java deleted file mode 100644 index 7f65cef..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSDestinationImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.jms; - -import brooklyn.entity.basic.AbstractEntity; - -import com.google.common.base.Preconditions; - -public abstract class JMSDestinationImpl extends AbstractEntity implements JMSDestination { - public JMSDestinationImpl() { - } - - @Override - public void onManagementStarting() { - super.onManagementStarting(); - Preconditions.checkNotNull(getName(), "Name must be specified"); - } - - @Override - public String getName() { - return getDisplayName(); - } - - protected abstract void connectSensors(); - - protected abstract void disconnectSensors(); - - public abstract void delete(); - - public void destroy() { - disconnectSensors(); - delete(); - super.destroy(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/AbstractfKafkaSshDriver.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/AbstractfKafkaSshDriver.java b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/AbstractfKafkaSshDriver.java deleted file mode 100644 index b797f7e..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/AbstractfKafkaSshDriver.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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.kafka; - -import static java.lang.String.format; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.apache.brooklyn.api.entity.basic.EntityLocal; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.basic.Entities; -import brooklyn.entity.java.JavaSoftwareProcessSshDriver; -import org.apache.brooklyn.location.basic.SshMachineLocation; -import brooklyn.util.collections.MutableMap; -import brooklyn.util.net.Networking; -import brooklyn.util.os.Os; -import brooklyn.util.ssh.BashCommands; - -public abstract class AbstractfKafkaSshDriver extends JavaSoftwareProcessSshDriver { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(KafkaZooKeeperSshDriver.class); - - public AbstractfKafkaSshDriver(EntityLocal entity, SshMachineLocation machine) { - super(entity, machine); - } - - protected abstract Map<String, Integer> getPortMap(); - - protected abstract ConfigKey<String> getConfigTemplateKey(); - - protected abstract String getConfigFileName(); - - protected abstract String getLaunchScriptName(); - - protected abstract String getTopicsScriptName(); - - protected abstract String getProcessIdentifier(); - - @Override - protected String getLogFileLocation() { return Os.mergePaths(getRunDir(), "console.out"); } - - @Override - public void preInstall() { - resolver = Entities.newDownloader(this); - setExpandedInstallDir(Os.mergePaths(getInstallDir(), resolver.getUnpackedDirectoryName(format("kafka_%s", getVersion())))); - } - - @Override - public void install() { - List<String> urls = resolver.getTargets(); - String saveAs = resolver.getFilename(); - - List<String> commands = new LinkedList<String>(); - commands.addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs)); - commands.add(BashCommands.INSTALL_TAR); - commands.add("tar xzfv "+saveAs); - commands.add("cd "+getExpandedInstallDir()); - - newScript(INSTALLING) - .body.append(commands) - .execute(); - } - - @Override - public void customize() { - Networking.checkPortsValid(getPortMap()); - - newScript(CUSTOMIZING) - .failOnNonZeroResultCode() - .body.append(format("cp -R %s/* %s", getExpandedInstallDir(), getRunDir())) - .execute(); - - String config = entity.getConfig(getConfigTemplateKey()); - copyTemplate(config, getConfigFileName()); - } - - @Override - public void launch() { - newScript(MutableMap.of(USE_PID_FILE, getPidFile()), LAUNCHING) - .failOnNonZeroResultCode() - .body.append(String.format("nohup ./bin/%s ./%s > console.out 2>&1 &", getLaunchScriptName(), getConfigFileName())) - .execute(); - } - - public String getPidFile() { return Os.mergePathsUnix(getRunDir(), "kafka.pid"); } - - @Override - public boolean isRunning() { - return newScript(MutableMap.of(USE_PID_FILE, getPidFile()), CHECK_RUNNING).execute() == 0; - } - - @Override - public void stop() { - newScript(MutableMap.of(USE_PID_FILE, false), STOPPING) - .body.append(String.format("ps ax | grep %s | awk '{print $1}' | xargs kill", getProcessIdentifier())) - .body.append(String.format("ps ax | grep %s | awk '{print $1}' | xargs kill -9", getProcessIdentifier())) - .execute(); - } - - /** - * Use RMI agent to provide JMX. - */ - @Override - public Map<String, String> getShellEnvironment() { - return MutableMap.<String, String>builder() - .putAll(super.getShellEnvironment()) - .renameKey("JAVA_OPTS", "KAFKA_JMX_OPTS") - .build(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/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 deleted file mode 100644 index 64123b3..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/Kafka.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.kafka; - -import org.apache.brooklyn.core.util.flags.SetFromFlag; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.basic.Attributes; -import brooklyn.entity.basic.ConfigKeys; -import brooklyn.entity.basic.SoftwareProcess; -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; - -/** - * Shared Kafka broker and zookeeper properties. - */ -public interface Kafka { - - ConfigKey<String> SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "2.9.2-0.8.2.1"); - - @SetFromFlag("downloadUrl") - BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey<String>( - Attributes.DOWNLOAD_URL, "http://apache.cbox.biz/kafka/0.8.2.1/kafka_${version}.tgz"); - - // TODO: Upgrade to version 0.8.0, which will require refactoring of the sensors to reflect the changes to the JMX beans -// @SetFromFlag("downloadUrl") -// BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey<String>( -// Attributes.DOWNLOAD_URL, "http://mirror.catn.com/pub/apache/kafka/${version}/kafka-${version}-src.tgz"); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/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 deleted file mode 100644 index 71b20c5..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBroker.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.kafka; - -import org.apache.brooklyn.api.entity.proxying.ImplementedBy; -import org.apache.brooklyn.api.event.AttributeSensor; -import org.apache.brooklyn.core.util.flags.SetFromFlag; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.basic.ConfigKeys; -import brooklyn.entity.basic.SoftwareProcess; -import brooklyn.entity.java.UsesJmx; -import brooklyn.entity.messaging.MessageBroker; -import brooklyn.entity.zookeeper.ZooKeeperNode; -import brooklyn.event.basic.BasicConfigKey; -import brooklyn.event.basic.PortAttributeSensorAndConfigKey; -import brooklyn.event.basic.Sensors; - -import org.apache.brooklyn.location.basic.PortRanges; - -import brooklyn.util.time.Duration; - -/** - * An {@link org.apache.brooklyn.api.entity.Entity} that represents a single Kafka broker instance. - */ -@ImplementedBy(KafkaBrokerImpl.class) -public interface KafkaBroker extends SoftwareProcess, MessageBroker, UsesJmx, Kafka { - - @SetFromFlag("startTimeout") - ConfigKey<Duration> START_TIMEOUT = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.START_TIMEOUT, Duration.FIVE_MINUTES); - - @SetFromFlag("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("kafkaServerConfig") - ConfigKey<String> KAFKA_BROKER_CONFIG_TEMPLATE = new BasicConfigKey<String>(String.class, - "kafka.broker.configTemplate", "Kafka broker configuration template (in freemarker format)", - "classpath://brooklyn/entity/messaging/kafka/server.properties"); - - @SetFromFlag("zookeeper") - ConfigKey<ZooKeeperNode> ZOOKEEPER = new BasicConfigKey<ZooKeeperNode>(ZooKeeperNode.class, "kafka.broker.zookeeper", "Kafka zookeeper entity"); - - PortAttributeSensorAndConfigKey INTERNAL_JMX_PORT = new PortAttributeSensorAndConfigKey( - "internal.jmx.direct.port", "JMX internal port (started by Kafka broker, if using UsesJmx.JMX_AGENT_MODE is not null)", PortRanges.fromString("9999+")); - - AttributeSensor<Integer> BROKER_ID = Sensors.newIntegerSensor("kafka.broker.id", "Kafka unique broker ID"); - - AttributeSensor<Long> FETCH_REQUEST_COUNT = Sensors.newLongSensor("kafka.broker.fetch.total", "Fetch request count"); - AttributeSensor<Long> TOTAL_FETCH_TIME = Sensors.newLongSensor("kafka.broker.fetch.time.total", "Total fetch request processing time (millis)"); - AttributeSensor<Double> MAX_FETCH_TIME = Sensors.newDoubleSensor("kafka.broker.fetch.time.max", "Max fetch request processing time (millis)"); - - AttributeSensor<Long> PRODUCE_REQUEST_COUNT = Sensors.newLongSensor("kafka.broker.produce.total", "Produce request count"); - AttributeSensor<Long> TOTAL_PRODUCE_TIME = Sensors.newLongSensor("kafka.broker.produce.time.total", "Total produce request processing time (millis)"); - AttributeSensor<Double> MAX_PRODUCE_TIME = Sensors.newDoubleSensor("kafka.broker.produce.time.max", "Max produce request processing time (millis)"); - - AttributeSensor<Long> BYTES_RECEIVED = Sensors.newLongSensor("kafka.broker.bytes.received", "Total bytes received"); - AttributeSensor<Long> BYTES_SENT = Sensors.newLongSensor("kafka.broker.bytes.sent", "Total bytes sent"); - - Integer getKafkaPort(); - - Integer getBrokerId(); - - ZooKeeperNode getZookeeper(); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c14fef53/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBrokerDriver.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBrokerDriver.java b/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBrokerDriver.java deleted file mode 100644 index c20deff..0000000 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/kafka/KafkaBrokerDriver.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.kafka; - -import brooklyn.entity.java.JavaSoftwareProcessDriver; - -public interface KafkaBrokerDriver extends JavaSoftwareProcessDriver { - - Integer getKafkaPort(); - -}
