You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ge...@apache.org on 2017/05/11 12:11:38 UTC
[1/4] brooklyn-library git commit: Delete obsolete examples
Repository: brooklyn-library
Updated Branches:
refs/heads/master 3a853d622 -> 8c3ad2786
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java
deleted file mode 100644
index 5c58fee..0000000
--- a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java
+++ /dev/null
@@ -1,174 +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 org.apache.brooklyn.demo;
-
-import static org.apache.brooklyn.core.sensor.DependentConfiguration.attributeWhenReady;
-import static org.apache.brooklyn.core.sensor.DependentConfiguration.formatString;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.catalog.CatalogConfig;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.location.PortRanges;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.enricher.stock.Enrichers;
-import org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.JavaWebAppService;
-import org.apache.brooklyn.entity.webapp.WebAppService;
-import org.apache.brooklyn.entity.webapp.WebAppServiceConstants;
-import org.apache.brooklyn.entity.database.mysql.MySqlNode;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.entity.java.JavaEntityMethods;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy;
-import org.apache.brooklyn.policy.enricher.HttpLatencyDetector;
-import org.apache.brooklyn.util.CommandLineUtil;
-import org.apache.brooklyn.util.core.BrooklynMavenArtifacts;
-import org.apache.brooklyn.util.core.ResourceUtils;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-
-/**
- * Launches a 3-tier app with nginx, clustered jboss, and mysql.
- * <p>
- * Includes some advanced features such as KPI / derived sensors,
- * and annotations for use in a catalog.
- * <p>
- * This variant also increases minimum size to 2.
- * Note the policy min size must have the same value,
- * otherwise it fights with cluster set up trying to reduce the cluster size!
- **/
-@Catalog(name="Elastic Java Web + DB",
- description="Deploys a WAR to a load-balanced elastic Java AppServer cluster, " +
- "with an auto-scaling policy, " +
- "wired to a database initialized with the provided SQL; " +
- "defaults to a 'Hello World' chatroom app.",
- iconUrl="classpath://brooklyn/demo/glossy-3d-blue-web-icon.png")
-public class WebClusterDatabaseExampleApp extends AbstractApplication implements StartableApplication {
-
- public static final Logger LOG = LoggerFactory.getLogger(WebClusterDatabaseExampleApp.class);
-
- public static final String DEFAULT_LOCATION = "localhost";
-
- public static final String DEFAULT_WAR_PATH = ResourceUtils.create(WebClusterDatabaseExampleApp.class)
- // take this war, from the classpath, or via maven if not on the classpath
- .firstAvailableUrl(
- "classpath://hello-world-sql-webapp.war",
- BrooklynMavenArtifacts.localUrl("example", "brooklyn-example-hello-world-sql-webapp", "war"))
- .or("classpath://hello-world-sql-webapp.war");
-
- @CatalogConfig(label="WAR (URL)", priority=2)
- public static final ConfigKey<String> WAR_PATH = ConfigKeys.newConfigKey(
- "app.war", "URL to the application archive which should be deployed",
- DEFAULT_WAR_PATH);
-
- // TODO to expose in catalog we need to let the keystore url be specified (not hard)
- // and also confirm that this works for nginx (might be a bit fiddly);
- // booleans in the gui are working (With checkbox)
- @CatalogConfig(label="HTTPS")
- public static final ConfigKey<Boolean> USE_HTTPS = ConfigKeys.newConfigKey(
- "app.https", "Whether the application should use HTTPS only or just HTTP only (default)", false);
-
- public static final String DEFAULT_DB_SETUP_SQL_URL = "classpath://visitors-creation-script.sql";
-
- @CatalogConfig(label="DB Setup SQL (URL)", priority=1)
- public static final ConfigKey<String> DB_SETUP_SQL_URL = ConfigKeys.newConfigKey(
- "app.db_sql", "URL to the SQL script to set up the database",
- DEFAULT_DB_SETUP_SQL_URL);
-
- public static final String DB_TABLE = "visitors";
- public static final String DB_USERNAME = "brooklyn";
- public static final String DB_PASSWORD = "br00k11n";
-
- public static final AttributeSensor<Integer> APPSERVERS_COUNT = Sensors.newIntegerSensor(
- "appservers.count", "Number of app servers deployed");
- public static final AttributeSensor<Double> REQUESTS_PER_SECOND_IN_WINDOW =
- WebAppServiceConstants.REQUESTS_PER_SECOND_IN_WINDOW;
- public static final AttributeSensor<String> ROOT_URL = WebAppServiceConstants.ROOT_URL;
-
- @Override
- public void initApp() {
- MySqlNode mysql = addChild(
- EntitySpec.create(MySqlNode.class)
- .configure(MySqlNode.CREATION_SCRIPT_URL, Entities.getRequiredUrlConfig(this, DB_SETUP_SQL_URL)));
-
- ControlledDynamicWebAppCluster web = addChild(
- EntitySpec.create(ControlledDynamicWebAppCluster.class)
- .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+"))
- // to specify a diferrent appserver:
-// .configure(ControlledDynamicWebAppCluster.MEMBER_SPEC, EntitySpec.create(TomcatServer.class))
- .configure(JavaWebAppService.ROOT_WAR, Entities.getRequiredUrlConfig(this, WAR_PATH))
- .configure(JavaEntityMethods.javaSysProp("brooklyn.example.db.url"),
- formatString("jdbc:%s%s?user=%s\\&password=%s",
- attributeWhenReady(mysql, MySqlNode.DATASTORE_URL), DB_TABLE, DB_USERNAME, DB_PASSWORD))
- .configure(DynamicCluster.INITIAL_SIZE, 2)
- .configure(WebAppService.ENABLED_PROTOCOLS, ImmutableSet.of(getConfig(USE_HTTPS) ? "https" : "http")) );
-
- web.enrichers().add(HttpLatencyDetector.builder()
- .url(ROOT_URL)
- .rollup(10, TimeUnit.SECONDS)
- .build());
-
- web.getCluster().policies().add(AutoScalerPolicy.builder()
- .metric(DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE)
- .metricRange(10, 100)
- .sizeRange(2, 5)
- .build());
-
- enrichers().add(Enrichers.builder()
- .propagating(WebAppServiceConstants.ROOT_URL,
- DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW,
- HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW)
- .from(web)
- .build());
-
- enrichers().add(Enrichers.builder()
- .propagating(ImmutableMap.of(DynamicWebAppCluster.GROUP_SIZE, APPSERVERS_COUNT))
- .from(web)
- .build());
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, WebClusterDatabaseExampleApp.class)
- .displayName("Brooklyn WebApp Cluster with Database example"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterExample.java b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterExample.java
deleted file mode 100644
index e5a1ae2..0000000
--- a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterExample.java
+++ /dev/null
@@ -1,95 +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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.entity.proxy.nginx.NginxController;
-import org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.jboss.JBoss7Server;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.Lists;
-
-/**
- * Launches a clustered and load-balanced set of web servers.
- * Demonstrates syntax, so many of the options used here are the defaults.
- * (So the class could be much simpler, as in WebClusterExampleAlt.)
- * <p>
- * Requires:
- * -Xmx512m -Xms128m -XX:MaxPermSize=256m
- * and brooklyn-all jar, and this jar or classes dir, on classpath.
- **/
-public class WebClusterExample extends AbstractApplication {
- public static final Logger LOG = LoggerFactory.getLogger(WebClusterExample.class);
-
- static BrooklynProperties config = BrooklynProperties.Factory.newDefault();
-
- public static final String DEFAULT_LOCATION = "localhost";
-
- public static final String WAR_PATH = "classpath://hello-world-webapp.war";
-
- private NginxController nginxController;
- private ControlledDynamicWebAppCluster web;
-
- @Override
- public void initApp() {
- nginxController = addChild(EntitySpec.create(NginxController.class)
- //.configure("domain", "webclusterexample.brooklyn.local")
- .configure("port", "8000+"));
-
- web = addChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
- .displayName("WebApp cluster")
- .configure(ControlledDynamicWebAppCluster.CONTROLLER, nginxController)
- .configure(ControlledDynamicWebAppCluster.INITIAL_SIZE, 1)
- .configure(ControlledDynamicWebAppCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class)
- .configure("httpPort", "8080+")
- .configure("war", WAR_PATH)));
-
- web.getCluster().policies().add(AutoScalerPolicy.builder()
- .metric(DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE)
- .sizeRange(1, 5)
- .metricRange(10, 100)
- .build());
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
-
- // TODO Want to parse, to handle multiple locations
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(WebClusterExample.class).displayName("Brooklyn WebApp Cluster example"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/resources/catalog.bom b/examples/simple-web-cluster/src/main/resources/catalog.bom
deleted file mode 100644
index 4d5cd8c..0000000
--- a/examples/simple-web-cluster/src/main/resources/catalog.bom
+++ /dev/null
@@ -1,31 +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.
-
-brooklyn.catalog:
- version: "0.12.0-SNAPSHOT" # BROOKLYN_VERSION
- itemType: template
- items:
- - id: org.apache.brooklyn.demo.NodeJsTodoApplication
- item:
- services:
- - type: org.apache.brooklyn.demo.NodeJsTodoApplication
- name: NodeJS Todo
- - id: org.apache.brooklyn.demo.WebClusterDatabaseExampleApp
- item:
- services:
- - type: org.apache.brooklyn.demo.WebClusterDatabaseExampleApp
- name: Elastic Java Web + DB
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/resources/logback-custom.xml
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/resources/logback-custom.xml b/examples/simple-web-cluster/src/main/resources/logback-custom.xml
deleted file mode 100644
index 02a8a82..0000000
--- a/examples/simple-web-cluster/src/main/resources/logback-custom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<included>
-
- <!--
-
- this file demonstrates how to customise logging, base on the placeholder
- logging-custom.xml included in brooklyn-logging-includes.
-
- -->
-
- <!-- include this category -->
- <logger name="org.apache.brooklyn.demo" level="DEBUG"/>
-
- <!-- log to simple-web-cluster.log -->
- <property name="logging.basename" scope="context" value="brooklyn-simple-web-cluster" />
-
- <!--
-
- more customisation is possible by overriding the default-included
- configuration files, such as logback-main.xml (entirely replacing configuration),
- or e.g. brooklyn/logback-appender-file.xml (replacing the FILE logger config).
-
- -->
-
-</included>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/glossy-3d-blue-web-icon.png
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/glossy-3d-blue-web-icon.png b/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/glossy-3d-blue-web-icon.png
deleted file mode 100644
index 542a1de..0000000
Binary files a/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/glossy-3d-blue-web-icon.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/nodejs-riak-todo.yaml
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/nodejs-riak-todo.yaml b/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/nodejs-riak-todo.yaml
deleted file mode 100644
index 958d29d..0000000
--- a/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/nodejs-riak-todo.yaml
+++ /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.
-
-name: "Node.JS Todo Application"
-origin: "https://github.com/amirrajan/nodejs-todo/"
-location:
- jclouds:aws-ec2:us-west-1:
- imageId: us-west-1/ami-c33cdd87
-services:
-- type: org.apache.brooklyn.entity.nosql.riak.RiakCluster
- initialSize: 2
- id: mycluster
- brooklyn.config:
- provisioning.properties:
- osFamily: centos
- minCores: 4
- minRam: 2048
-- type: org.apache.brooklyn.entity.webapp.nodejs.NodeJsWebAppService
- id: nodejs-riak1
- name: "Node.JS"
- brooklyn.config:
- gitRepoUrl:
- "https://github.com/bostko/nodejs-todo.git"
- appFileName: server.js
- appName: nodejs-todo
- nodePackages:
- - basho-riak-client
- env:
- NODE_ENV: production
- RIAK_NODES: >
- $brooklyn:component("mycluster").attributeWhenReady("riak.cluster.nodeListPbPort")
- launch.latch: $brooklyn:component("mycluster").attributeWhenReady("service.isUp")
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/nodejs-todo.yaml
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/nodejs-todo.yaml b/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/nodejs-todo.yaml
deleted file mode 100644
index 6aab1db..0000000
--- a/examples/simple-web-cluster/src/main/resources/org/apache/brooklyn/demo/nodejs-todo.yaml
+++ /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.
-
-id: nodejs-todo-application
-name: "Node.JS Todo Application"
-origin: "https://github.com/amirrajan/nodejs-todo/"
-locations:
-- jclouds:softlayer:ams01
-services:
-- type: org.apache.brooklyn.entity.nosql.redis.RedisStore
- id: redis
- name: "Redis"
-- type: org.apache.brooklyn.entity.webapp.nodejs.NodeJsWebAppService
- id: nodejs
- name: "Node.JS"
- brooklyn.config:
- gitRepoUrl:
- "https://github.com/grkvlt/nodejs-todo/"
- appFileName: server.js
- appName: nodejs-todo
- nodePackages:
- - express
- - ejs
- - jasmine-node
- - underscore
- - method-override
- - cookie-parser
- - express-session
- - body-parser
- - cookie-session
- - redis
- - redis-url
- - connect
- env:
- REDISTOGO_URL: >
- $brooklyn:formatString("redis://%s:%d/",
- component("redis").attributeWhenReady("host.subnet.hostname"),
- component("redis").attributeWhenReady("redis.port"))
- launch.latch: $brooklyn:component("redis").attributeWhenReady("service.isUp")
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/resources/visitors-creation-script.sql
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/resources/visitors-creation-script.sql b/examples/simple-web-cluster/src/main/resources/visitors-creation-script.sql
deleted file mode 100644
index 2422f8f..0000000
--- a/examples/simple-web-cluster/src/main/resources/visitors-creation-script.sql
+++ /dev/null
@@ -1,41 +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.
---
-create database visitors;
-use visitors;
-
-# not necessary to create user if we grant (and not supported in some dialects)
-# create user 'brooklyn' identified by 'br00k11n';
-
-grant usage on *.* to 'brooklyn'@'%' identified by 'br00k11n';
-
-# ''@localhost is sometimes set up, overriding brooklyn@'%', so do a second explicit grant
-grant usage on *.* to 'brooklyn'@'localhost' identified by 'br00k11n';
-
-grant all privileges on visitors.* to 'brooklyn'@'%';
-
-flush privileges;
-
-CREATE TABLE MESSAGES (
- id BIGINT NOT NULL AUTO_INCREMENT,
- NAME VARCHAR(30) NOT NULL,
- MESSAGE VARCHAR(400) NOT NULL,
- PRIMARY KEY (ID)
- );
-
-INSERT INTO MESSAGES values (default, 'Isaac Asimov', 'I grew up in Brooklyn' );
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java b/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java
deleted file mode 100644
index 2dfbb81..0000000
--- a/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java
+++ /dev/null
@@ -1,204 +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 org.apache.brooklyn.demo;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityAsserts;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
-import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixture;
-import org.apache.brooklyn.enricher.stock.Propagator;
-import org.apache.brooklyn.entity.proxy.nginx.NginxController;
-import org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.tomcat.Tomcat8Server;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.test.HttpTestUtils;
-import org.apache.brooklyn.test.WebAppMonitor;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.time.Duration;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.entity.database.mysql.MySqlNode;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.entity.java.JavaEntityMethods;
-import org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy;
-import org.apache.brooklyn.policy.enricher.HttpLatencyDetector;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-
-public class RebindWebClusterDatabaseExampleAppIntegrationTest extends RebindTestFixture<StartableApplication> {
-
- private static final Logger LOG = LoggerFactory.getLogger(RebindWebClusterDatabaseExampleAppIntegrationTest.class);
-
- private Location origLoc;
- private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>();
- private ExecutorService executor;
-
- @BeforeMethod(alwaysRun=true)
- @Override
- public void setUp() throws Exception {
- super.setUp();
- origLoc = origManagementContext.getLocationRegistry().resolve("localhost");
- executor = Executors.newCachedThreadPool();
- webAppMonitors.clear();
- }
-
- @AfterMethod(alwaysRun=true)
- @Override
- public void tearDown() throws Exception {
- for (WebAppMonitor monitor : webAppMonitors) {
- monitor.terminate();
- }
- if (executor != null) executor.shutdownNow();
- super.tearDown();
- }
-
- @Override
- protected StartableApplication createApp() {
- StartableApplication result = origManagementContext.getEntityManager().createEntity(EntitySpec.create(StartableApplication.class)
- .impl(WebClusterDatabaseExampleApp.class)
- .configure(DynamicCluster.INITIAL_SIZE, 2));
- return result;
- }
-
- private WebAppMonitor newWebAppMonitor(String url, int expectedResponseCode) {
- WebAppMonitor monitor = new WebAppMonitor(url)
-// .delayMillis(0) FIXME Re-enable to fast polling
- .expectedResponseCode(expectedResponseCode)
- .logFailures(LOG);
- webAppMonitors.add(monitor);
- executor.execute(monitor);
- return monitor;
- }
-
- @Test(groups="Integration")
- public void testRestoresSimpleApp() throws Exception {
- origApp.start(ImmutableList.of(origLoc));
-
- assertAppFunctional(origApp);
-
- String clusterUrl = checkNotNull(origApp.getAttribute(WebClusterDatabaseExampleApp.ROOT_URL), "cluster url");
- WebAppMonitor monitor = newWebAppMonitor(clusterUrl, 200);
-
- newApp = rebind(RebindOptions.create().terminateOrigManagementContext(true));
- assertAppFunctional(newApp);
-
- // expect no failures during rebind
- monitor.assertNoFailures("hitting nginx url");
- monitor.terminate();
- }
-
- private void assertAppFunctional(StartableApplication app) throws Exception {
- // expect standard config to (still) be set
- assertNotNull(app.getConfig(WebClusterDatabaseExampleApp.WAR_PATH));
- assertEquals(app.getConfig(WebClusterDatabaseExampleApp.USE_HTTPS), Boolean.FALSE);
- assertNotNull(app.getConfig(WebClusterDatabaseExampleApp.DB_SETUP_SQL_URL));
-
- // expect entities to be there
- MySqlNode mysql = (MySqlNode) Iterables.find(app.getChildren(), Predicates.instanceOf(MySqlNode.class));
- ControlledDynamicWebAppCluster web = (ControlledDynamicWebAppCluster) Iterables.find(app.getChildren(), Predicates.instanceOf(ControlledDynamicWebAppCluster.class));
- final NginxController nginx = (NginxController) Iterables.find(web.getChildren(), Predicates.instanceOf(NginxController.class));
- DynamicWebAppCluster webCluster = (DynamicWebAppCluster) Iterables.find(web.getChildren(), Predicates.instanceOf(DynamicWebAppCluster.class));
- Collection<Entity> appservers = web.getMembers();
- assertEquals(appservers.size(), 2);
- String clusterUrl = checkNotNull(app.getAttribute(WebClusterDatabaseExampleApp.ROOT_URL), "cluster url");
- String dbUrl = checkNotNull(mysql.getAttribute(MySqlNode.DATASTORE_URL), "database url");
- final String expectedJdbcUrl = String.format("jdbc:%s%s?user=%s\\&password=%s", dbUrl, WebClusterDatabaseExampleApp.DB_TABLE,
- WebClusterDatabaseExampleApp.DB_USERNAME, WebClusterDatabaseExampleApp.DB_PASSWORD);
-
- // expect web-app to be reachable, and wired up to database
- HttpTestUtils.assertHttpStatusCodeEventuallyEquals(clusterUrl, 200);
- for (Entity appserver : appservers) {
- String appserverUrl = checkNotNull(appserver.getAttribute(Tomcat8Server.ROOT_URL), "appserver url of "+appserver);
-
- HttpTestUtils.assertHttpStatusCodeEventuallyEquals(appserverUrl, 200);
- assertEquals(expectedJdbcUrl, appserver.getConfig(JavaEntityMethods.javaSysProp("brooklyn.example.db.url")), "of "+appserver);
- }
-
- WebAppMonitor monitor = newWebAppMonitor(clusterUrl, 200);
-
- // expect auto-scaler policy to be there, and to be functional (e.g. can trigger resize)
- AutoScalerPolicy autoScalerPolicy = (AutoScalerPolicy) Iterables.find(webCluster.policies(), Predicates.instanceOf(AutoScalerPolicy.class));
-
- autoScalerPolicy.config().set(AutoScalerPolicy.MIN_POOL_SIZE, 3);
- EntityAsserts.assertGroupSizeEqualsEventually(web, 3);
- final Collection<Entity> webMembersAfterGrow = web.getMembers();
-
- for (final Entity appserver : webMembersAfterGrow) {
- Asserts.succeedsEventually(MutableMap.of("timeout", Duration.TWO_MINUTES), new Runnable() {
- @Override public void run() {
- String appserverUrl = checkNotNull(appserver.getAttribute(Tomcat8Server.ROOT_URL), "appserver url of "+appserver);
- HttpTestUtils.assertHttpStatusCodeEquals(appserverUrl, 200);
- assertEquals(expectedJdbcUrl, appserver.getConfig(JavaEntityMethods.javaSysProp("brooklyn.example.db.url")), "of "+appserver);
- Asserts.assertEqualsIgnoringOrder(nginx.getAttribute(NginxController.SERVER_POOL_TARGETS).keySet(), webMembersAfterGrow);
- }});
- }
-
- // expect enrichers to be there
- Iterables.find(web.enrichers(), Predicates.instanceOf(HttpLatencyDetector.class));
- Iterable<Enricher> propagatorEnrichers = Iterables.filter(web.enrichers(), Predicates.instanceOf(Propagator.class));
- assertEquals(Iterables.size(propagatorEnrichers), 3, "propagatorEnrichers="+propagatorEnrichers);
-
- // Check we see evidence of the enrichers having an effect.
- // Relying on WebAppMonitor to stimulate activity.
- EntityAsserts.assertAttributeEqualsEventually(app, WebClusterDatabaseExampleApp.APPSERVERS_COUNT, 3);
- EntityAsserts.assertAttributeChangesEventually(web, DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW);
- EntityAsserts.assertAttributeChangesEventually(app, DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW);
- EntityAsserts.assertAttributeChangesEventually(web, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT);
- EntityAsserts.assertAttributeChangesEventually(web, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW);
-
- // Restore the web-cluster to its original size of 2
- autoScalerPolicy.config().set(AutoScalerPolicy.MIN_POOL_SIZE, 2);
- EntityAsserts.assertGroupSizeEqualsEventually(web, 2);
-
- final Entity removedAppserver = Iterables.getOnlyElement(Sets.difference(ImmutableSet.copyOf(webMembersAfterGrow), ImmutableSet.copyOf(web.getMembers())));
- Asserts.succeedsEventually(new Runnable() {
- @Override public void run() {
- assertFalse(Entities.isManaged(removedAppserver));
- }});
-
- monitor.assertNoFailures("hitting nginx url");
- monitor.terminate();
- }
-}
[4/4] brooklyn-library git commit: Closes #107
Posted by ge...@apache.org.
Closes #107
Delete obsolete examples
Deletes:
* `examples/global-web-fabric`
* `examples/simple-messaging-pubsub`
* `examples/simple-nosql-cluster`
* `examples/simple-web-cluster`
(as discussed on the dev@brooklyn mailing list.)
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/8c3ad278
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/8c3ad278
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/8c3ad278
Branch: refs/heads/master
Commit: 8c3ad278695ff7b328b6e4bb97337730375b601f
Parents: 3a853d6 e1278bf
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Thu May 11 13:11:28 2017 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Thu May 11 13:11:28 2017 +0100
----------------------------------------------------------------------
examples/global-web-fabric/.gitignore | 2 -
examples/global-web-fabric/README.txt | 42 ----
examples/global-web-fabric/pom.xml | 108 ---------
.../resources/vmc-delete-all.sh | 34 ---
.../brooklyn/demo/GlobalWebFabricExample.java | 117 ---------
.../java/org/apache/brooklyn/demo/ReadMe.java | 28 ---
.../src/main/resources/catalog.bom | 26 --
examples/pom.xml | 4 -
examples/simple-messaging-pubsub/.gitignore | 1 -
examples/simple-messaging-pubsub/README.txt | 47 ----
examples/simple-messaging-pubsub/pom.xml | 134 -----------
.../brooklyn/demo/KafkaClusterExample.java | 58 -----
.../java/org/apache/brooklyn/demo/Publish.java | 71 ------
.../demo/StandaloneQpidBrokerExample.java | 73 ------
.../org/apache/brooklyn/demo/Subscribe.java | 76 ------
.../src/main/resources/custom-config.xml | 65 -----
.../src/main/resources/passwd | 21 --
examples/simple-nosql-cluster/.gitignore | 1 -
examples/simple-nosql-cluster/README.md | 41 ----
examples/simple-nosql-cluster/pom.xml | 106 --------
.../src/main/assembly/assembly.xml | 64 -----
.../src/main/assembly/files/conf/logback.xml | 29 ---
.../src/main/assembly/scripts/start.sh | 40 ----
.../brooklyn/demo/CumulusRDFApplication.java | 239 -------------------
.../demo/HighAvailabilityCassandraCluster.java | 89 -------
.../brooklyn/demo/ResilientMongoDbApp.java | 105 --------
.../brooklyn/demo/RiakClusterExample.java | 76 ------
.../brooklyn/demo/SimpleCassandraCluster.java | 58 -----
.../brooklyn/demo/SimpleCouchDBCluster.java | 36 ---
.../brooklyn/demo/SimpleMongoDBReplicaSet.java | 39 ---
.../brooklyn/demo/SimpleRedisCluster.java | 35 ---
.../apache/brooklyn/demo/StormSampleApp.java | 69 ------
.../brooklyn/demo/WideAreaCassandraCluster.java | 86 -------
.../src/main/resources/catalog.bom | 53 ----
.../src/main/resources/cumulus.yaml | 26 --
.../src/main/resources/mongodb.conf | 32 ---
.../brooklyn/demo/ha-cassandra-cluster.yaml | 45 ----
.../brooklyn/demo/simple-cassandra-cluster.yaml | 28 ---
.../demo/wide-area-cassandra-cluster.yaml | 41 ----
examples/simple-web-cluster/.gitignore | 2 -
examples/simple-web-cluster/README.txt | 59 -----
examples/simple-web-cluster/pom.xml | 164 -------------
.../resources/jmeter-test-plan.jmx | 143 -----------
.../src/main/assembly/assembly.xml | 74 ------
.../src/main/assembly/files/README.txt | 49 ----
.../src/main/assembly/scripts/start.sh | 43 ----
.../brooklyn/demo/NodeJsTodoApplication.java | 60 -----
.../brooklyn/demo/SingleWebServerExample.java | 66 -----
.../demo/WebClusterDatabaseExample.java | 122 ----------
.../demo/WebClusterDatabaseExampleApp.java | 174 --------------
.../apache/brooklyn/demo/WebClusterExample.java | 95 --------
.../src/main/resources/catalog.bom | 31 ---
.../src/main/resources/logback-custom.xml | 43 ----
.../brooklyn/demo/glossy-3d-blue-web-icon.png | Bin 46490 -> 0 bytes
.../apache/brooklyn/demo/nodejs-riak-todo.yaml | 46 ----
.../org/apache/brooklyn/demo/nodejs-todo.yaml | 53 ----
.../main/resources/visitors-creation-script.sql | 41 ----
...lusterDatabaseExampleAppIntegrationTest.java | 204 ----------------
58 files changed, 3714 deletions(-)
----------------------------------------------------------------------
[3/4] brooklyn-library git commit: Delete obsolete examples
Posted by ge...@apache.org.
Delete obsolete examples
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/e1278bf1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/e1278bf1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/e1278bf1
Branch: refs/heads/master
Commit: e1278bf1f4aa195ab966fe582f1aebab3b372510
Parents: 6caaad4
Author: Aled Sage <al...@gmail.com>
Authored: Wed May 10 14:48:33 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Wed May 10 14:48:33 2017 +0100
----------------------------------------------------------------------
examples/global-web-fabric/.gitignore | 2 -
examples/global-web-fabric/README.txt | 42 ----
examples/global-web-fabric/pom.xml | 108 ---------
.../resources/vmc-delete-all.sh | 34 ---
.../brooklyn/demo/GlobalWebFabricExample.java | 117 ---------
.../java/org/apache/brooklyn/demo/ReadMe.java | 28 ---
.../src/main/resources/catalog.bom | 26 --
examples/pom.xml | 4 -
examples/simple-messaging-pubsub/.gitignore | 1 -
examples/simple-messaging-pubsub/README.txt | 47 ----
examples/simple-messaging-pubsub/pom.xml | 134 -----------
.../brooklyn/demo/KafkaClusterExample.java | 58 -----
.../java/org/apache/brooklyn/demo/Publish.java | 71 ------
.../demo/StandaloneQpidBrokerExample.java | 73 ------
.../org/apache/brooklyn/demo/Subscribe.java | 76 ------
.../src/main/resources/custom-config.xml | 65 -----
.../src/main/resources/passwd | 21 --
examples/simple-nosql-cluster/.gitignore | 1 -
examples/simple-nosql-cluster/README.md | 41 ----
examples/simple-nosql-cluster/pom.xml | 106 --------
.../src/main/assembly/assembly.xml | 64 -----
.../src/main/assembly/files/conf/logback.xml | 29 ---
.../src/main/assembly/scripts/start.sh | 40 ----
.../brooklyn/demo/CumulusRDFApplication.java | 239 -------------------
.../demo/HighAvailabilityCassandraCluster.java | 89 -------
.../brooklyn/demo/ResilientMongoDbApp.java | 105 --------
.../brooklyn/demo/RiakClusterExample.java | 76 ------
.../brooklyn/demo/SimpleCassandraCluster.java | 58 -----
.../brooklyn/demo/SimpleCouchDBCluster.java | 36 ---
.../brooklyn/demo/SimpleMongoDBReplicaSet.java | 39 ---
.../brooklyn/demo/SimpleRedisCluster.java | 35 ---
.../apache/brooklyn/demo/StormSampleApp.java | 69 ------
.../brooklyn/demo/WideAreaCassandraCluster.java | 86 -------
.../src/main/resources/catalog.bom | 53 ----
.../src/main/resources/cumulus.yaml | 26 --
.../src/main/resources/mongodb.conf | 32 ---
.../brooklyn/demo/ha-cassandra-cluster.yaml | 45 ----
.../brooklyn/demo/simple-cassandra-cluster.yaml | 28 ---
.../demo/wide-area-cassandra-cluster.yaml | 41 ----
examples/simple-web-cluster/.gitignore | 2 -
examples/simple-web-cluster/README.txt | 59 -----
examples/simple-web-cluster/pom.xml | 164 -------------
.../resources/jmeter-test-plan.jmx | 143 -----------
.../src/main/assembly/assembly.xml | 74 ------
.../src/main/assembly/files/README.txt | 49 ----
.../src/main/assembly/scripts/start.sh | 43 ----
.../brooklyn/demo/NodeJsTodoApplication.java | 60 -----
.../brooklyn/demo/SingleWebServerExample.java | 66 -----
.../demo/WebClusterDatabaseExample.java | 122 ----------
.../demo/WebClusterDatabaseExampleApp.java | 174 --------------
.../apache/brooklyn/demo/WebClusterExample.java | 95 --------
.../src/main/resources/catalog.bom | 31 ---
.../src/main/resources/logback-custom.xml | 43 ----
.../brooklyn/demo/glossy-3d-blue-web-icon.png | Bin 46490 -> 0 bytes
.../apache/brooklyn/demo/nodejs-riak-todo.yaml | 46 ----
.../org/apache/brooklyn/demo/nodejs-todo.yaml | 53 ----
.../main/resources/visitors-creation-script.sql | 41 ----
...lusterDatabaseExampleAppIntegrationTest.java | 204 ----------------
58 files changed, 3714 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/global-web-fabric/.gitignore
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/.gitignore b/examples/global-web-fabric/.gitignore
deleted file mode 100644
index 14fb0b8..0000000
--- a/examples/global-web-fabric/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-brooklyn-example-global-web-fabric/
-brooklyn-example-global-web-fabric.tar.gz
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/global-web-fabric/README.txt
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/README.txt b/examples/global-web-fabric/README.txt
deleted file mode 100644
index 0d3ee8b..0000000
--- a/examples/global-web-fabric/README.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-Instructions for running examples
-=================================
-
-The commands below assume that the `brooklyn` script is on your $PATH, this project has been built,
-and you are in this directory. Adjust to taste for other configurations.
-
- export BROOKLYN_CLASSPATH=$(pwd)/target/classes
-
- # Launch the app in aws-ec2 regions eu-west-1 and us-east-1
- brooklyn launch --app org.apache.brooklyn.demo.GlobalWebFabricExample --location "aws-ec2:eu-west-1,aws-ec2:us-east-1"
-
----
-
-The aws-ec2 credentials are retrieved from ~/.brooklyn/brooklyn.properties
-
-This file should contain something like:
- brooklyn.jclouds.aws-ec2.identity=AKA50M30N3S1DFR0MAW55
- brooklyn.jclouds.aws-ec2.credential=aT0Ps3cr3tC0D3wh1chAW5w1llG1V3y0uTOus333
-
-Brooklyn defaults to using ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub.
-
----
-
-For more information please visit https://brooklyn.incubator.apache.org/.
-
-----
-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.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/global-web-fabric/pom.xml
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/pom.xml b/examples/global-web-fabric/pom.xml
deleted file mode 100644
index 328ddb9..0000000
--- a/examples/global-web-fabric/pom.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <packaging>jar</packaging>
- <artifactId>brooklyn-example-global-web-fabric</artifactId>
- <name>Brooklyn Global Web Fabric Example</name>
-
- <parent>
- <groupId>org.apache.brooklyn.example</groupId>
- <artifactId>brooklyn-examples-parent</artifactId>
- <version>0.12.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-launcher</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-webapp</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <!-- copy the WAR so it is available on the classpath for programmatic deployment -->
- <executions>
- <execution>
- <id>copy</id>
- <phase>process-classes</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <!-- this can fail in eclipse trying to copy _from_ target/classes.
- see http://jira.codehaus.org/browse/MDEP-259 -->
- <groupId>org.apache.brooklyn.example</groupId>
- <artifactId>brooklyn-example-hello-world-webapp</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/classes</outputDirectory>
- <destFileName>hello-world-webapp.war</destFileName>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>${project.basedir}</directory>
- <includes>
- <include>${project.artifactId}/</include>
- <include>brooklyn*.log</include>
- <include>brooklyn*.log.*</include>
- <include>stacktrace.log</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/global-web-fabric/resources/vmc-delete-all.sh
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/resources/vmc-delete-all.sh b/examples/global-web-fabric/resources/vmc-delete-all.sh
deleted file mode 100755
index f90ce02..0000000
--- a/examples/global-web-fabric/resources/vmc-delete-all.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-# deletes all vmc applications against the current target (if no args) or against all targets specified
-
-vmc_delete_all() {
- for x in `vmc apps | grep brooklyn | awk '{print $2}'` ; do vmc delete $x ; done
-}
-
-if [ -z "$1" ]; then
- vmc_delete_all
-else
- for x in $@ ; do
- vmc target $x
- vmc_delete_all
- done
-fi
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java b/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java
deleted file mode 100644
index 9f83ca2..0000000
--- a/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java
+++ /dev/null
@@ -1,117 +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 org.apache.brooklyn.demo;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.catalog.CatalogConfig;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.location.PortRanges;
-import org.apache.brooklyn.core.sensor.PortAttributeSensorAndConfigKey;
-import org.apache.brooklyn.entity.dns.geoscaling.GeoscalingDnsService;
-import org.apache.brooklyn.entity.group.DynamicRegionsFabric;
-import org.apache.brooklyn.entity.proxy.AbstractController;
-import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.JavaWebAppService;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.util.CommandLineUtil;
-import org.apache.brooklyn.util.core.BrooklynMavenArtifacts;
-import org.apache.brooklyn.util.core.ResourceUtils;
-
-@Catalog(name="Global Web Fabric",
- description="Deploys a WAR to multiple clusters, showing how Brooklyn fabrics work",
- iconUrl="classpath://brooklyn/demo/glossy-3d-blue-web-icon.png")
-public class GlobalWebFabricExample extends AbstractApplication {
-
- public static final Logger log = LoggerFactory.getLogger(GlobalWebFabricExample.class);
-
- static final List<String> DEFAULT_LOCATIONS = ImmutableList.of(
- "aws-ec2:eu-west-1",
- "aws-ec2:ap-southeast-1",
- "aws-ec2:us-west-1" );
-
- public static final String DEFAULT_WAR_PATH = ResourceUtils.create(GlobalWebFabricExample.class)
- // take this war, from the classpath, or via maven if not on the classpath
- .firstAvailableUrl(
- "classpath://hello-world-webapp.war",
- BrooklynMavenArtifacts.localUrl("example", "brooklyn-example-hello-world-webapp", "war"))
- .or("classpath://hello-world-webapp.war");
-
- @CatalogConfig(label="WAR (URL)", priority=2)
- public static final ConfigKey<String> WAR_PATH = ConfigKeys.newConfigKey(
- "app.war", "URL to the application archive which should be deployed",
- DEFAULT_WAR_PATH);
-
- // load-balancer instances must run on some port to work with GeoDNS, port 80 to work without special, so make that default
- // (but included here in case it runs on a different port on all machines, or use a range to work with multiple localhosts)
- @CatalogConfig(label="Proxy server HTTP port")
- public static final PortAttributeSensorAndConfigKey PROXY_HTTP_PORT =
- new PortAttributeSensorAndConfigKey(AbstractController.PROXY_HTTP_PORT, PortRanges.fromInteger(80));
-
- @Override
- public void initApp() {
- StringConfigMap config = getManagementContext().getConfig();
-
- GeoscalingDnsService geoDns = addChild(EntitySpec.create(GeoscalingDnsService.class)
- .displayName("GeoScaling DNS")
- .configure("username", checkNotNull(config.getFirst("brooklyn.geoscaling.username"), "username"))
- .configure("password", checkNotNull(config.getFirst("brooklyn.geoscaling.password"), "password"))
- .configure("primaryDomainName", checkNotNull(config.getFirst("brooklyn.geoscaling.primaryDomain"), "primaryDomain"))
- .configure("smartSubdomainName", "brooklyn"));
-
- DynamicRegionsFabric webFabric = addChild(EntitySpec.create(DynamicRegionsFabric.class)
- .displayName("Web Fabric")
- .configure(DynamicRegionsFabric.MEMBER_SPEC, EntitySpec.create(DynamicWebAppCluster.class))
- .configure(JavaWebAppService.ROOT_WAR, Entities.getRequiredUrlConfig(this, WAR_PATH)));
-
- // tell GeoDNS what to monitor
- geoDns.setTargetEntityProvider(webFabric);
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String locations = CommandLineUtil.getCommandLineOption(args, "--locations", Joiner.on(",").join(DEFAULT_LOCATIONS));
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, GlobalWebFabricExample.class).displayName("Brooklyn Global Web Fabric Example"))
- .webconsolePort(port)
- .locations(Arrays.asList(locations))
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/ReadMe.java
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/ReadMe.java b/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/ReadMe.java
deleted file mode 100644
index 6858630..0000000
--- a/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/ReadMe.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 org.apache.brooklyn.demo;
-
-public class ReadMe {
-
-/* This class exists only so that javadoc is generated and artifacts can be staged at sonatype for deployment to maven central.
- * See: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
- *
- * (The actual examples are in other classes in this package / project.) */
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/global-web-fabric/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/src/main/resources/catalog.bom b/examples/global-web-fabric/src/main/resources/catalog.bom
deleted file mode 100644
index d54d3d2..0000000
--- a/examples/global-web-fabric/src/main/resources/catalog.bom
+++ /dev/null
@@ -1,26 +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.
-
-brooklyn.catalog:
- version: "0.12.0-SNAPSHOT" # BROOKLYN_VERSION
- itemType: template
- items:
- - id: org.apache.brooklyn.demo.GlobalWebFabricExample
- item:
- services:
- - type: org.apache.brooklyn.demo.GlobalWebFabricExample
- name: Global Web Fabric
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index c4aa410..ac03e8e 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -38,9 +38,5 @@
<modules>
<module>webapps</module>
- <module>simple-web-cluster</module>
- <module>global-web-fabric</module>
- <module>simple-messaging-pubsub</module>
- <module>simple-nosql-cluster</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-messaging-pubsub/.gitignore
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/.gitignore b/examples/simple-messaging-pubsub/.gitignore
deleted file mode 100644
index 7a8040d..0000000
--- a/examples/simple-messaging-pubsub/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-resources/lib/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-messaging-pubsub/README.txt
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/README.txt b/examples/simple-messaging-pubsub/README.txt
deleted file mode 100644
index 299695f..0000000
--- a/examples/simple-messaging-pubsub/README.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-Instructions for running examples
-=================================
-
-The commands below assume that the `brooklyn` script is already on your $PATH, and you are in the "examples" directory:
-
- cd simple-messaging-pubsub
- export BROOKLYN_CLASSPATH=$(pwd)/target/classes
-
- # Launches a qpid broker on localhost
- brooklyn -v launch --app org.apache.brooklyn.demo.StandaloneQpidBrokerExample --location localhost
-
- # You can get the broker's URL from the brooklyn web-console at http://localhost:8081
- # by looking at the broker entity's sensors or from the verbose output from the application startup
- URL="amqp://guest:guest@/localhost?brokerlist='tcp://localhost:5672'"
-
- # Test subscribing, to receive a message from the broker
- java -cp "./resources/lib/*:./target/classes" org.apache.brooklyn.demo.Subscribe ${URL}
-
- # Test publishing a message to the broker
- java -cp "./resources/lib/*:./target/classes" org.apache.brooklyn.demo.Publish ${URL}
-
-To test a Kafka distributed messaging cluster example, use the following command:
-
- # Launches a Kafka cluster on AWS EC2 with two brokers
- brooklyn -v launch --app org.apache.brooklyn.demo.KafkaClusterExample --location aws-ec2:eu-west-1
-
----
-
-For more information please visit https://brooklyn.incubator.apache.org/.
-
-----
-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.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-messaging-pubsub/pom.xml
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/pom.xml b/examples/simple-messaging-pubsub/pom.xml
deleted file mode 100644
index 94237b9..0000000
--- a/examples/simple-messaging-pubsub/pom.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <packaging>jar</packaging>
- <artifactId>brooklyn-example-simple-messaging-pubsub</artifactId>
- <name>Brooklyn Simple Messaging Publish-Subscribe Example</name>
-
- <parent>
- <groupId>org.apache.brooklyn.example</groupId>
- <artifactId>brooklyn-examples-parent</artifactId>
- <version>0.12.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <repositories>
- <repository>
- <id>oracle</id>
- <url>http://download.oracle.com/maven</url>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-launcher</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-messaging</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>${geronimo-jms_1.1_spec.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-client</artifactId>
- <version>${qpid.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy</id>
- <phase>process-classes</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-bdbstore</artifactId>
- <version>${qpid.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>com.sleepycat</groupId>
- <artifactId>je</artifactId>
- <version>${sleepycat-je.version}</version>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.directory}/classes</outputDirectory>
- </configuration>
- </execution>
- <execution>
- <id>copy-dependencies</id>
- <phase>process-classes</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <includeArtifactIds>
- geronimo-jms_1.1_spec,guava,jsr305,log4j,qpid-client,qpid-common,slf4j-api,slf4j-log4j12
- </includeArtifactIds>
- <outputDirectory>${project.basedir}/resources/lib</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>${project.basedir}</directory>
- <includes>
- <include>${project.artifactId}/</include>
- <include>brooklyn*.log</include>
- <include>brooklyn*.log.*</include>
- <include>stacktrace.log</include>
- <include>resources/lib/</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/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
deleted file mode 100644
index 5c5afb2..0000000
--- a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/KafkaClusterExample.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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.apache.brooklyn.entity.messaging.kafka.KafkaCluster;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.Lists;
-
-/** Kafka Cluster Application */
-public class KafkaClusterExample extends ApplicationBuilder {
-
- public static final String DEFAULT_LOCATION = "localhost";
-
- /** Configure the application. */
- protected void doBuild() {
- addChild(EntitySpec.create(KafkaCluster.class)
- .configure("startTimeout", 300) // 5 minutes
- .configure("initialSize", 2));
- // TODO set application display name?
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(new KafkaClusterExample().appDisplayName("Kafka cluster application"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/Publish.java
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/Publish.java b/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/Publish.java
deleted file mode 100644
index 8a68061..0000000
--- a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/Publish.java
+++ /dev/null
@@ -1,71 +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 org.apache.brooklyn.demo;
-
-import javax.jms.Connection;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.qpid.client.AMQConnectionFactory;
-import org.apache.qpid.configuration.ClientProperties;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
-
-/** Publishes messages to a queue on a Qpid broker at a given URL. */
-public class Publish {
- public static final String QUEUE = "'amq.direct'/'testQueue'; { node: { type: queue } }";
-
- public static void main(String...argv) throws Exception {
- Preconditions.checkElementIndex(0, argv.length, "Must specify broker URL");
- String url = argv[0];
-
- // Set Qpid client properties
- System.setProperty(ClientProperties.AMQP_VERSION, "0-10");
- System.setProperty(ClientProperties.DEST_SYNTAX, "ADDR");
-
- // Connect to the broker
- AMQConnectionFactory factory = new AMQConnectionFactory(url);
- Connection connection = factory.createConnection();
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- try {
- // Create a producer for the queue
- Queue destination = session.createQueue(QUEUE);
- MessageProducer messageProducer = session.createProducer(destination);
-
- // Send 100 messages
- for (int n = 0; n < 100; n++) {
- String body = String.format("test message %03d", n+1);
- TextMessage message = session.createTextMessage(body);
- messageProducer.send(message);
- System.out.printf("Sent message %s\n", body);
- }
- } catch (Exception e) {
- System.err.printf("Error while sending - %s\n", e.getMessage());
- System.err.printf("Cause: %s\n", Throwables.getStackTraceAsString(e));
- } finally {
- session.close();
- connection.close();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/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
deleted file mode 100644
index 98f7acb..0000000
--- a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/StandaloneQpidBrokerExample.java
+++ /dev/null
@@ -1,73 +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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.apache.brooklyn.entity.messaging.amqp.AmqpServer;
-import org.apache.brooklyn.entity.messaging.qpid.QpidBroker;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-/** Qpid Broker Application */
-public class StandaloneQpidBrokerExample extends AbstractApplication {
-
- public static final String CUSTOM_CONFIG_PATH = "classpath://custom-config.xml";
- public static final String PASSWD_PATH = "classpath://passwd";
- public static final String QPID_BDBSTORE_JAR_PATH = "classpath://qpid-bdbstore-0.20.jar";
- public static final String BDBSTORE_JAR_PATH = "classpath://je-5.0.34.jar";
-
- public static final String DEFAULT_LOCATION = "localhost";
-
- @Override
- public void initApp() {
- // Configure the Qpid broker entity
- QpidBroker broker = addChild(EntitySpec.create(QpidBroker.class)
- .configure("amqpPort", 5672)
- .configure("amqpVersion", AmqpServer.AMQP_0_10)
- .configure("runtimeFiles", ImmutableMap.builder()
- .put(CUSTOM_CONFIG_PATH, QpidBroker.CONFIG_XML)
- .put(PASSWD_PATH, QpidBroker.PASSWD)
- .put(QPID_BDBSTORE_JAR_PATH, "lib/opt/qpid-bdbstore-0.20.jar")
- .put(BDBSTORE_JAR_PATH, "lib/opt/je-5.0.34.jar")
- .build())
- .configure("queue", "testQueue"));
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, StandaloneQpidBrokerExample.class).displayName("Qpid app"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/Subscribe.java
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/Subscribe.java b/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/Subscribe.java
deleted file mode 100644
index b7df104..0000000
--- a/examples/simple-messaging-pubsub/src/main/java/org/apache/brooklyn/demo/Subscribe.java
+++ /dev/null
@@ -1,76 +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 org.apache.brooklyn.demo;
-
-import javax.jms.Connection;
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.qpid.client.AMQConnectionFactory;
-import org.apache.qpid.configuration.ClientProperties;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
-
-/** Receives messages from a queue on a Qpid broker at a given URL. */
-public class Subscribe {
- public static final String QUEUE = "'amq.direct'/'testQueue'; { node: { type: queue } }";
- private static final long MESSAGE_TIMEOUT_MILLIS = 15000L;
- private static final int MESSAGE_COUNT = 100;
-
- public static void main(String...argv) throws Exception {
- Preconditions.checkElementIndex(0, argv.length, "Must specify broker URL");
- String url = argv[0];
-
- // Set Qpid client properties
- System.setProperty(ClientProperties.AMQP_VERSION, "0-10");
- System.setProperty(ClientProperties.DEST_SYNTAX, "ADDR");
-
- // Connect to the broker
- AMQConnectionFactory factory = new AMQConnectionFactory(url);
- Connection connection = factory.createConnection();
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- System.out.printf("Waiting up to %s milliseconds to receive %s messages\n", MESSAGE_TIMEOUT_MILLIS, MESSAGE_COUNT);
- try {
- // Create a producer for the queue
- Queue destination = session.createQueue(QUEUE);
- MessageConsumer messageConsumer = session.createConsumer(destination);
-
- // Try and receive 100 messages
- for (int n = 0; n < MESSAGE_COUNT; n++) {
- TextMessage msg = (TextMessage) messageConsumer.receive(MESSAGE_TIMEOUT_MILLIS);
- if (msg == null) {
- System.out.printf("No message received in %s milliseconds, exiting", MESSAGE_TIMEOUT_MILLIS);
- break;
- }
- System.out.printf("Got message %d: '%s'\n", n+1, msg.getText());
- }
- } catch (Exception e) {
- System.err.printf("Error while receiving - %s\n", e.getMessage());
- System.err.printf("Cause: %s\n", Throwables.getStackTraceAsString(e));
- } finally {
- session.close();
- connection.close();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-messaging-pubsub/src/main/resources/custom-config.xml
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/src/main/resources/custom-config.xml b/examples/simple-messaging-pubsub/src/main/resources/custom-config.xml
deleted file mode 100644
index f3a65f6..0000000
--- a/examples/simple-messaging-pubsub/src/main/resources/custom-config.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<broker>
- <plugin-directory>${QPID_HOME}/lib/plugins</plugin-directory>
- <cache-directory>${QPID_HOME}/cache</cache-directory>
- <connector>
- <ssl>
- <enabled>false</enabled>
- </ssl>
- </connector>
- <management>
- <enabled>true</enabled>
- <ssl>
- <enabled>false</enabled>
- </ssl>
- </management>
- <security>
- <pd-auth-manager>
- <principal-database>
- <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
- <attributes>
- <attribute>
- <name>passwordFile</name>
- <value>${QPID_HOME}/etc/passwd</value>
- </attribute>
- </attributes>
- </principal-database>
- </pd-auth-manager>
- <allow-all />
- <msg-auth>false</msg-auth>
- </security>
- <virtualhosts>
- <default>localhost</default>
- <virtualhost>
- <name>localhost</name>
- <localhost>
- <store>
- <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
- <environment-path>${QPID_HOME}/store/localhost</environment-path>
- </store>
- </localhost>
- </virtualhost>
- </virtualhosts>
- <queue>
- <auto_register>true</auto_register>
- </queue>
- <status-updates>ON</status-updates>
-</broker>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-messaging-pubsub/src/main/resources/passwd
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/src/main/resources/passwd b/examples/simple-messaging-pubsub/src/main/resources/passwd
deleted file mode 100644
index a0f70ee..0000000
--- a/examples/simple-messaging-pubsub/src/main/resources/passwd
+++ /dev/null
@@ -1,21 +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.
-#
-# Custom password file
-
-guest:guest
-admin:password
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/.gitignore
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/.gitignore b/examples/simple-nosql-cluster/.gitignore
deleted file mode 100644
index 7a8040d..0000000
--- a/examples/simple-nosql-cluster/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-resources/lib/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/README.md
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/README.md b/examples/simple-nosql-cluster/README.md
deleted file mode 100644
index 55659da..0000000
--- a/examples/simple-nosql-cluster/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-Instructions for running examples
-=================================
-
-The commands below assume that the `brooklyn` script is already on your $PATH, and you are in the `examples` directory:
-
- cd simple-nosql-cluster
- export BROOKLYN_CLASSPATH=$(pwd)/target/classes
-
- # Launches a Redis cluster on AWS EC2
- brooklyn -v launch --app org.apache.brooklyn.demo.SimpleRedisCluster --location aws-ec2:eu-west-1
-
- # Launches a Cassandra cluster on AWS EC2
- brooklyn -v launch --app org.apache.brooklyn.demo.SimpleCassandraCluster --location aws-ec2:eu-west-1
-
- # Launches a CouchDB cluster on AWS EC2
- brooklyn -v launch --app org.apache.brooklyn.demo.SimpleCouchDBCluster --location aws-ec2:eu-west-1
-
- # Launches a CumulusRDF application backed by a cassandra cluster on AWS EC2
- brooklyn -v launch --app org.apache.brooklyn.demo.CumulusRDFApplication --location aws-ec2:eu-west-1
-
---------
-
-For more information please visit https://brooklyn.incubator.apache.org/.
-
-----
-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.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/pom.xml
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/pom.xml b/examples/simple-nosql-cluster/pom.xml
deleted file mode 100644
index be2893a..0000000
--- a/examples/simple-nosql-cluster/pom.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <packaging>jar</packaging>
- <artifactId>brooklyn-example-simple-nosql-cluster</artifactId>
-
- <name>Brooklyn NoSQL Cluster Examples</name>
- <description>
- Various NoSQL cluster-based applications, managed by Brooklyn.
- </description>
-
- <parent>
- <groupId>org.apache.brooklyn.example</groupId>
- <artifactId>brooklyn-examples-parent</artifactId>
- <version>0.12.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-launcher</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-messaging</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-nosql</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-logback-xml</artifactId>
- <version>${project.version}</version>
- <optional>true</optional>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>${project.basedir}</directory>
- <includes>
- <include>${project.artifactId}/</include>
- <include>brooklyn*.log</include>
- <include>brooklyn*.log.*</include>
- <include>stacktrace.log</include>
- <include>resources/lib/</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/assembly/assembly.xml b/examples/simple-nosql-cluster/src/main/assembly/assembly.xml
deleted file mode 100644
index 5c82d26..0000000
--- a/examples/simple-nosql-cluster/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<assembly>
- <id>dist</id>
- <formats>
- <format>dir</format>
- <format>tar.gz</format>
- </formats>
-
- <!-- Adds dependencies to zip package under lib directory -->
- <dependencySets>
- <dependencySet>
- <useProjectArtifact>false</useProjectArtifact>
- <outputDirectory>lib</outputDirectory>
- <unpack>false</unpack>
- </dependencySet>
- </dependencySets>
-
- <fileSets>
- <fileSet>
- <directory>src/main/assembly/scripts</directory>
- <outputDirectory></outputDirectory>
- <fileMode>0755</fileMode>
- <includes>
- <include>*</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>src/main/assembly/files</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>**</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>target</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- <excludes>
- <exclude>*-tests.jar</exclude>
- </excludes>
- </fileSet>
- </fileSets>
-</assembly>
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/assembly/files/conf/logback.xml
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/assembly/files/conf/logback.xml b/examples/simple-nosql-cluster/src/main/assembly/files/conf/logback.xml
deleted file mode 100644
index ddaa20c..0000000
--- a/examples/simple-nosql-cluster/src/main/assembly/files/conf/logback.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration>
-
- <!-- logging configuration for this project; edit this file as required, or override the files
- this includes as described in the Logging section of the brooklyn users guide.
- this project already supplies a logback-custom.xml which gets included to log our
- classes at debug level and write to a log file named after this project -->
-
- <include resource="logback-main.xml"/>
-
-</configuration>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/assembly/scripts/start.sh
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/assembly/scripts/start.sh b/examples/simple-nosql-cluster/src/main/assembly/scripts/start.sh
deleted file mode 100755
index c7ff6d9..0000000
--- a/examples/simple-nosql-cluster/src/main/assembly/scripts/start.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-if [ ! -z "$JAVA_HOME" ] ; then
- JAVA=$JAVA_HOME/bin/java
-else
- JAVA=`which java`
-fi
-
-if [ ! -x "$JAVA" ] ; then
- echo Cannot find java. Set JAVA_HOME or add java to path.
- exit 1
-fi
-
-if [[ ! `ls brooklyn-*.jar 2> /dev/null` ]] ; then
- echo Command must be run from the directory where the JAR is installed.
- exit 4
-fi
-
-$JAVA -Xms256m -Xmx1024m -XX:MaxPermSize=1024m \
- -classpath "conf/:*:lib/*" \
- org.apache.brooklyn.cli.Main \
- "$@"
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java
deleted file mode 100644
index 0e3780f..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java
+++ /dev/null
@@ -1,239 +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 org.apache.brooklyn.demo;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.catalog.CatalogConfig;
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.location.PortRanges;
-import org.apache.brooklyn.core.sensor.DependentConfiguration;
-import org.apache.brooklyn.entity.java.UsesJava;
-import org.apache.brooklyn.entity.java.UsesJmx;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraDatacenter;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraFabric;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraNode;
-import org.apache.brooklyn.entity.webapp.JavaWebAppService;
-import org.apache.brooklyn.entity.webapp.tomcat.TomcatServer;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.ha.ServiceFailureDetector;
-import org.apache.brooklyn.policy.ha.ServiceReplacer;
-import org.apache.brooklyn.policy.ha.ServiceRestarter;
-import org.apache.brooklyn.util.CommandLineUtil;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.text.TemplateProcessor;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.net.HostAndPort;
-
-/** CumulusRDF application with Cassandra cluster. */
-@Catalog(name="Cumulus RDF Application", description="CumulusRDF Application on a Tomcat server using a multi-region Cassandra fabric")
-public class CumulusRDFApplication extends AbstractApplication {
-
- private static final Logger log = LoggerFactory.getLogger(CumulusRDFApplication.class);
-
- @CatalogConfig(label="Cumulus Configuration File (URL)", priority=1)
- public static final ConfigKey<String> CUMULUS_RDF_CONFIG_URL = ConfigKeys.newConfigKey(
- "cumulus.config.url", "URL for the YAML configuration file for CumulusRDF", "classpath://cumulus.yaml");
-
- @CatalogConfig(label="Cassandra Thrift Port", priority=1)
- public static final ConfigKey<Integer> CASSANDRA_THRIFT_PORT = ConfigKeys.newConfigKey(
- "cumulus.cassandra.port", "Port to contact the Cassandra cluster on", 9160);
-
- @CatalogConfig(label="Cassandra Cluster Size", priority=1)
- public static final ConfigKey<Integer> CASSANDRA_CLUSTER_SIZE = ConfigKeys.newConfigKey(
- "cumulus.cassandra.cluster.size", "Initial size of the Cassandra cluster", 2);
-
- @CatalogConfig(label="Multi-region Fabric", priority=1)
- public static final ConfigKey<Boolean> MULTI_REGION_FABRIC = ConfigKeys.newConfigKey(
- "cumulus.cassandra.fabric", "Deploy a multi-region Cassandra fabric", false);
-
- // TODO Fails when given two locations
- // public static final String DEFAULT_LOCATIONS = "[ jclouds:aws-ec2:us-east-1,jclouds:rackspace-cloudservers-uk ]";
- public static final String DEFAULT_LOCATIONS = "jclouds:aws-ec2:us-east-1";
-
- private Effector<Void> cumulusConfig = Effectors.effector(Void.class, "cumulusConfig")
- .description("Configure the CumulusRDF web application")
- .buildAbstract();
-
- private Entity cassandra;
- private TomcatServer webapp;
- private HostAndPort endpoint;
- private final Object endpointMutex = new Object();
-
- /**
- * Create the application entities:
- * <ul>
- * <li>A {@link CassandraFabric} of {@link CassandraDatacenter}s containing {@link CassandraNode}s
- * <li>A {@link TomcatServer}
- * </ul>
- */
- @Override
- public void initApp() {
- // Cassandra cluster
- EntitySpec<CassandraDatacenter> clusterSpec = EntitySpec.create(CassandraDatacenter.class)
- .configure(CassandraDatacenter.MEMBER_SPEC, EntitySpec.create(CassandraNode.class)
- //FIXME can probably use JMXMP_AND_RMI now, to deploy to GCE and elsewhere
- .configure(UsesJmx.JMX_AGENT_MODE, UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT)
- .configure(UsesJmx.JMX_PORT, PortRanges.fromString("11099+"))
- .configure(UsesJmx.RMI_REGISTRY_PORT, PortRanges.fromString("9001+"))
- .configure(CassandraNode.THRIFT_PORT, PortRanges.fromInteger(getConfig(CASSANDRA_THRIFT_PORT)))
- .enricher(EnricherSpec.create(ServiceFailureDetector.class))
- .policy(PolicySpec.create(ServiceRestarter.class)
- .configure(ServiceRestarter.FAILURE_SENSOR_TO_MONITOR, ServiceFailureDetector.ENTITY_FAILED)))
- .policy(PolicySpec.create(ServiceReplacer.class)
- .configure(ServiceReplacer.FAILURE_SENSOR_TO_MONITOR, ServiceRestarter.ENTITY_RESTART_FAILED));
-
- if (getConfig(MULTI_REGION_FABRIC)) {
- cassandra = addChild(EntitySpec.create(CassandraFabric.class)
- .configure(CassandraDatacenter.CLUSTER_NAME, "Brooklyn")
- .configure(CassandraDatacenter.INITIAL_SIZE, getConfig(CASSANDRA_CLUSTER_SIZE)) // per location
- .configure(CassandraDatacenter.ENDPOINT_SNITCH_NAME, "org.apache.brooklyn.entity.nosql.cassandra.customsnitch.MultiCloudSnitch")
- .configure(CassandraNode.CUSTOM_SNITCH_JAR_URL, "classpath://org/apache/brooklyn/entity/nosql/cassandra/cassandra-multicloud-snitch.jar")
- .configure(CassandraFabric.MEMBER_SPEC, clusterSpec));
- } else {
- cassandra = addChild(EntitySpec.create(clusterSpec)
- .configure(CassandraDatacenter.CLUSTER_NAME, "Brooklyn")
- .configure(CassandraDatacenter.INITIAL_SIZE, getConfig(CASSANDRA_CLUSTER_SIZE)));
- }
-
- // Tomcat web-app server
- webapp = addChild(EntitySpec.create(TomcatServer.class)
- .configure(UsesJmx.JMX_AGENT_MODE, UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT)
- .configure(UsesJmx.JMX_PORT, PortRanges.fromString("11099+"))
- .configure(UsesJmx.RMI_REGISTRY_PORT, PortRanges.fromString("9001+"))
- .configure(JavaWebAppService.ROOT_WAR, "https://cumulusrdf.googlecode.com/svn/wiki/downloads/cumulusrdf-1.0.1.war")
- .configure(UsesJava.JAVA_SYSPROPS, MutableMap.of("cumulusrdf.config-file", "/tmp/cumulus.yaml")));
-
- // Add an effector to tomcat to reconfigure with a new YAML config file
- ((EntityInternal) webapp).getMutableEntityType().addEffector(cumulusConfig, new EffectorBody<Void>() {
- @Override
- public Void call(ConfigBag parameters) {
- // Process the YAML template given in the application config
- String url = Entities.getRequiredUrlConfig(CumulusRDFApplication.this, CUMULUS_RDF_CONFIG_URL);
- Map<String, Object> config;
- synchronized (endpointMutex) {
- config = MutableMap.<String, Object>of("cassandraHostname", endpoint.getHostText(), "cassandraThriftPort", endpoint.getPort());
- }
- String contents = TemplateProcessor.processTemplateContents(ResourceUtils.create(CumulusRDFApplication.this).getResourceAsString(url), config);
- // Copy the file contents to the remote machine
- return DynamicTasks.queue(SshEffectorTasks.put("/tmp/cumulus.yaml").contents(contents)).get();
- }
- });
-
- // Listen for HOSTNAME changes from the Cassandra fabric to show at least one node is available
- subscriptions().subscribe(cassandra, CassandraDatacenter.HOSTNAME, new SensorEventListener<String>() {
- @Override
- public void onEvent(SensorEvent<String> event) {
- if (Strings.isNonBlank(event.getValue())) {
- synchronized (endpointMutex) {
- String hostname = Entities.submit(CumulusRDFApplication.this, DependentConfiguration.attributeWhenReady(cassandra, CassandraDatacenter.HOSTNAME)).getUnchecked();
- Integer thriftPort = Entities.submit(CumulusRDFApplication.this, DependentConfiguration.attributeWhenReady(cassandra, CassandraDatacenter.THRIFT_PORT)).getUnchecked();
- HostAndPort current = HostAndPort.fromParts(hostname, thriftPort);
-
- // Check if the cluster access point has changed
- if (!current.equals(endpoint)) {
- log.info("Setting cluster endpoint to {}", current.toString());
- endpoint = current;
-
- // Reconfigure the CumulusRDF application and restart tomcat if necessary
- webapp.invoke(cumulusConfig, MutableMap.<String, Object>of());
- if (webapp.getAttribute(Startable.SERVICE_UP)) {
- webapp.restart();
- }
- }
- }
- }
- }
- });
- }
-
- /**
- * Controls the startup locations for the webapp and the cassandra fabric.
- *
- * @see AbstractApplication#start(Collection)
- */
- @Override
- public void start(Collection<? extends Location> locations) {
- addLocations(locations);
-
- // The web application only needs to run in one location, use the first
- // TODO use a multi-region web cluster
- Collection<? extends Location> first = MutableList.copyOf(Iterables.limit(locations, 1));
-
- ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING);
- try {
- Entities.invokeEffector(this, cassandra, Startable.START, MutableMap.of("locations", locations)).getUnchecked();
- Entities.invokeEffector(this, webapp, Startable.START, MutableMap.of("locations", first)).getUnchecked();
- } catch (Exception e) {
- throw Exceptions.propagate(e);
- } finally {
- ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING);
- }
- log.info("Started CumulusRDF in " + locations);
- }
-
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String locations = CommandLineUtil.getCommandLineOption(args, "--locations", DEFAULT_LOCATIONS);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, CumulusRDFApplication.class).displayName("CumulusRDF application using Cassandra"))
- .webconsolePort(port)
- .locations(Strings.isBlank(locations) ? ImmutableList.<String>of() : JavaStringEscapes.unwrapJsonishListIfPossible(locations))
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/HighAvailabilityCassandraCluster.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/HighAvailabilityCassandraCluster.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/HighAvailabilityCassandraCluster.java
deleted file mode 100644
index fbcd44d..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/HighAvailabilityCassandraCluster.java
+++ /dev/null
@@ -1,89 +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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.catalog.CatalogConfig;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraDatacenter;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraNode;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.ha.ServiceFailureDetector;
-import org.apache.brooklyn.policy.ha.ServiceReplacer;
-import org.apache.brooklyn.policy.ha.ServiceRestarter;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.Lists;
-
-@Catalog(name="HA Cassandra Cluster Application", description="Deploy a Cassandra cluster with a High Availability architecture.")
-public class HighAvailabilityCassandraCluster extends AbstractApplication {
-
- public static final String DEFAULT_LOCATION_SPEC = "aws-ec2:us-east-1";
-
- @CatalogConfig(label="Number of Availability Zones", priority=1)
- public static final ConfigKey<Integer> NUM_AVAILABILITY_ZONES = ConfigKeys.newConfigKey(
- "cassandra.cluster.numAvailabilityZones", "Number of availability zones to spread the cluster across", 3);
-
- @CatalogConfig(label="Initial Cluster Size", priority=2)
- public static final ConfigKey<Integer> CASSANDRA_CLUSTER_SIZE = ConfigKeys.newConfigKey(
- "cassandra.cluster.initialSize", "Initial size of the Cassandra cluster", 6);
-
-
- @Override
- public void initApp() {
- addChild(EntitySpec.create(CassandraDatacenter.class)
- .configure(CassandraDatacenter.CLUSTER_NAME, "Brooklyn")
- .configure(CassandraDatacenter.INITIAL_SIZE, getConfig(CASSANDRA_CLUSTER_SIZE))
- .configure(CassandraDatacenter.ENABLE_AVAILABILITY_ZONES, true)
- .configure(CassandraDatacenter.NUM_AVAILABILITY_ZONES, getConfig(NUM_AVAILABILITY_ZONES))
- //See https://github.com/brooklyncentral/brooklyn/issues/973
- //.configure(CassandraCluster.AVAILABILITY_ZONE_NAMES, ImmutableList.of("us-east-1b", "us-east-1c", "us-east-1e"))
- .configure(CassandraDatacenter.ENDPOINT_SNITCH_NAME, "GossipingPropertyFileSnitch")
- .configure(CassandraDatacenter.MEMBER_SPEC, EntitySpec.create(CassandraNode.class)
- .enricher(EnricherSpec.create(ServiceFailureDetector.class))
- .policy(PolicySpec.create(ServiceRestarter.class)
- .configure(ServiceRestarter.FAILURE_SENSOR_TO_MONITOR, ServiceFailureDetector.ENTITY_FAILED)))
- .policy(PolicySpec.create(ServiceReplacer.class)
- .configure(ServiceReplacer.FAILURE_SENSOR_TO_MONITOR, ServiceRestarter.ENTITY_RESTART_FAILED)));
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION_SPEC);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, HighAvailabilityCassandraCluster.class)
- .displayName("Cassandra"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
[2/4] brooklyn-library git commit: Delete obsolete examples
Posted by ge...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/ResilientMongoDbApp.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/ResilientMongoDbApp.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/ResilientMongoDbApp.java
deleted file mode 100644
index 814231f..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/ResilientMongoDbApp.java
+++ /dev/null
@@ -1,105 +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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.enricher.stock.Enrichers;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.entity.nosql.mongodb.MongoDBReplicaSet;
-import org.apache.brooklyn.entity.nosql.mongodb.MongoDBServer;
-import org.apache.brooklyn.entity.software.base.SoftwareProcess;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.ha.ServiceFailureDetector;
-import org.apache.brooklyn.policy.ha.ServiceReplacer;
-import org.apache.brooklyn.policy.ha.ServiceRestarter;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.Lists;
-
-/**
- * Sample showing a MongoDB replica set with resilience policies attached at nodes and the cluster.
- **/
-@Catalog(name="Resilient MongoDB")
-public class ResilientMongoDbApp extends AbstractApplication implements StartableApplication {
-
- public static final Logger LOG = LoggerFactory.getLogger(ResilientMongoDbApp.class);
-
- public static final String DEFAULT_LOCATION = "named:gce-europe-west1";
-
- @Override
- public void initApp() {
- MongoDBReplicaSet rs = addChild(
- EntitySpec.create(MongoDBReplicaSet.class)
- .configure(MongoDBReplicaSet.INITIAL_SIZE, 3));
-
- initResilience(rs);
-
- enrichers().add(Enrichers.builder()
- .propagating(MongoDBReplicaSet.REPLICA_SET_ENDPOINTS, MongoDBServer.REPLICA_SET_PRIMARY_ENDPOINT)
- .from(rs)
- .build());
- }
-
- /** this attaches a policy at each MongoDB node listening for ENTITY_FAILED,
- * attempting to _restart_ the process, and
- * failing that attempting to _replace_ the entity (e.g. a new VM), and
- * failing that setting the cluster "on-fire" */
- protected void initResilience(MongoDBReplicaSet rs) {
- subscriptions().subscribe(rs, DynamicCluster.MEMBER_ADDED, new SensorEventListener<Entity>() {
- @Override
- public void onEvent(SensorEvent<Entity> addition) {
- initSoftwareProcess((SoftwareProcess)addition.getValue());
- }
- });
- rs.policies().add(new ServiceReplacer(ServiceRestarter.ENTITY_RESTART_FAILED));
- }
-
- /** invoked whenever a new MongoDB server is added (the server may not be started yet) */
- protected void initSoftwareProcess(SoftwareProcess p) {
- p.enrichers().add(new ServiceFailureDetector());
- p.policies().add(new ServiceRestarter(ServiceFailureDetector.ENTITY_FAILED));
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, ResilientMongoDbApp.class)
- .displayName("Resilient MongoDB"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/RiakClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/RiakClusterExample.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/RiakClusterExample.java
deleted file mode 100644
index 646d74e..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/RiakClusterExample.java
+++ /dev/null
@@ -1,76 +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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.catalog.CatalogConfig;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.entity.nosql.riak.RiakCluster;
-import org.apache.brooklyn.entity.nosql.riak.RiakNode;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.ha.ServiceFailureDetector;
-import org.apache.brooklyn.policy.ha.ServiceRestarter;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-
-@Catalog(name = "Riak Cluster Application", description = "Riak ring deployment blueprint")
-public class RiakClusterExample extends AbstractApplication {
-
- public static final String DEFAULT_LOCATION_SPEC = "aws-ec2:us-east-1";
-
- @CatalogConfig(label = "Riak Ring Size")
- public static final ConfigKey<Integer> RIAK_RING_SIZE = ConfigKeys.newConfigKey(
- "riak.ring.size", "Initial size of the Riak Ring", 4);
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION_SPEC);
- Preconditions.checkArgument(args.isEmpty(), "Unsupported args: " + args);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, RiakClusterExample.class))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-
- public void initApp() {
- addChild(EntitySpec.create(RiakCluster.class)
- .configure(RiakCluster.INITIAL_SIZE, getConfig(RIAK_RING_SIZE))
- .configure(RiakCluster.MEMBER_SPEC, EntitySpec.create(RiakNode.class)
- .enricher(EnricherSpec.create(ServiceFailureDetector.class))
- .policy(PolicySpec.create(ServiceRestarter.class)
- .configure(ServiceRestarter.FAILURE_SENSOR_TO_MONITOR, ServiceFailureDetector.ENTITY_FAILED))));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleCassandraCluster.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleCassandraCluster.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleCassandraCluster.java
deleted file mode 100644
index 65c189c..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleCassandraCluster.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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraDatacenter;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.Lists;
-
-public class SimpleCassandraCluster extends AbstractApplication {
-
- private static final String DEFAULT_LOCATION = "localhost";
-
- @Override
- public void initApp() {
- addChild(EntitySpec.create(CassandraDatacenter.class)
- .configure(CassandraDatacenter.INITIAL_SIZE, 1)
- .configure(CassandraDatacenter.CLUSTER_NAME, "Brooklyn"));
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, SimpleCassandraCluster.class)
- .displayName("Cassandra"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleCouchDBCluster.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleCouchDBCluster.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleCouchDBCluster.java
deleted file mode 100644
index 1454ee6..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleCouchDBCluster.java
+++ /dev/null
@@ -1,36 +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 org.apache.brooklyn.demo;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
-import org.apache.brooklyn.entity.nosql.couchdb.CouchDBCluster;
-
-/** CouchDB cluster. */
-public class SimpleCouchDBCluster extends ApplicationBuilder {
-
- /** Create entities. */
- protected void doBuild() {
- addChild(EntitySpec.create(CouchDBCluster.class)
- .configure("initialSize", "2")
- .configure("clusterName", "Brooklyn")
- .configure("httpPort", "8000+"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleMongoDBReplicaSet.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleMongoDBReplicaSet.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleMongoDBReplicaSet.java
deleted file mode 100644
index 949729a..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleMongoDBReplicaSet.java
+++ /dev/null
@@ -1,39 +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 org.apache.brooklyn.demo;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
-import org.apache.brooklyn.entity.nosql.mongodb.MongoDBReplicaSet;
-import org.apache.brooklyn.entity.nosql.mongodb.MongoDBServer;
-
-public class SimpleMongoDBReplicaSet extends ApplicationBuilder {
-
- protected void doBuild() {
- addChild(EntitySpec.create(MongoDBReplicaSet.class)
- .configure("name", "Simple MongoDB replica set")
- .configure("initialSize", 3)
- .configure("replicaSetName", "simple-replica-set")
- .configure("memberSpec", EntitySpec.create(MongoDBServer.class)
- .configure("mongodbConfTemplateUrl", "classpath:///mongodb.conf")
- .configure("enableRestInterface", true)
- .configure("port", "27017+")));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleRedisCluster.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleRedisCluster.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleRedisCluster.java
deleted file mode 100644
index c505940..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/SimpleRedisCluster.java
+++ /dev/null
@@ -1,35 +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 org.apache.brooklyn.demo;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
-import org.apache.brooklyn.entity.nosql.redis.RedisCluster;
-
-/** Redis cluster. */
-public class SimpleRedisCluster extends ApplicationBuilder {
-
- /** Create entities. */
- protected void doBuild() {
- addChild(EntitySpec.create(RedisCluster.class)
- .configure("initialSize", "2")
- .configure("clusterName", "Brooklyn"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/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
deleted file mode 100644
index 062e044..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/StormSampleApp.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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.entity.messaging.storm.StormDeployment;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.Lists;
-
-/**
- * Sample showing a storm analyticscluster
- **/
-@Catalog(name="Storm Sample App",
-description="Creates a Storm analytics cluster",
- iconUrl="classpath://brooklyn/demo/glossy-3d-blue-web-icon.png")
-public class StormSampleApp extends AbstractApplication implements StartableApplication {
-
- public static final Logger LOG = LoggerFactory.getLogger(StormSampleApp.class);
-
- public static final String DEFAULT_LOCATION = "named:gce-europe-west1";
-
- @Override
- public void initApp() {
- addChild(EntitySpec.create(StormDeployment.class)
- .configure(StormDeployment.SUPERVISORS_COUNT, 2)
- .configure(StormDeployment.ZOOKEEPERS_COUNT, 1));
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, StormSampleApp.class)
- .displayName("Storm App"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/WideAreaCassandraCluster.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/WideAreaCassandraCluster.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/WideAreaCassandraCluster.java
deleted file mode 100644
index 2f0ce34..0000000
--- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/WideAreaCassandraCluster.java
+++ /dev/null
@@ -1,86 +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 org.apache.brooklyn.demo;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.catalog.CatalogConfig;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraDatacenter;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraFabric;
-import org.apache.brooklyn.entity.nosql.cassandra.CassandraNode;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.ha.ServiceFailureDetector;
-import org.apache.brooklyn.policy.ha.ServiceReplacer;
-import org.apache.brooklyn.policy.ha.ServiceRestarter;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.Lists;
-
-@Catalog(name="Wide Area Cassandra Cluster Application", description="Deploy a Cassandra cluster across multiple geographies.")
-public class WideAreaCassandraCluster extends AbstractApplication {
-
- public static final String DEFAULT_LOCATION_SPEC = "aws-ec2:us-east-1,rackspace-cloudservers-uk";
-
- @CatalogConfig(label="Initial Cluster Size (per location)", priority=2)
- public static final ConfigKey<Integer> CASSANDRA_CLUSTER_SIZE = ConfigKeys.newConfigKey(
- "cassandra.cluster.initialSize", "Initial size of the Cassandra clusterss", 2);
-
-
-
- @Override
- public void initApp() {
- addChild(EntitySpec.create(CassandraFabric.class)
- .configure(CassandraDatacenter.CLUSTER_NAME, "Brooklyn")
- .configure(CassandraDatacenter.INITIAL_SIZE, getConfig(CASSANDRA_CLUSTER_SIZE)) // per location
- .configure(CassandraDatacenter.ENDPOINT_SNITCH_NAME, "org.apache.brooklyn.entity.nosql.cassandra.customsnitch.MultiCloudSnitch")
- .configure(CassandraNode.CUSTOM_SNITCH_JAR_URL, "classpath://org/apache/brooklyn/entity/nosql/cassandra/cassandra-multicloud-snitch.jar")
- .configure(CassandraFabric.MEMBER_SPEC, EntitySpec.create(CassandraDatacenter.class)
- .configure(CassandraDatacenter.MEMBER_SPEC, EntitySpec.create(CassandraNode.class)
- .enricher(EnricherSpec.create(ServiceFailureDetector.class))
- .policy(PolicySpec.create(ServiceRestarter.class)
- .configure(ServiceRestarter.FAILURE_SENSOR_TO_MONITOR, ServiceFailureDetector.ENTITY_FAILED)))
- .policy(PolicySpec.create(ServiceReplacer.class)
- .configure(ServiceReplacer.FAILURE_SENSOR_TO_MONITOR, ServiceRestarter.ENTITY_RESTART_FAILED))));
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String locations = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION_SPEC);
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, WideAreaCassandraCluster.class)
- .displayName("Cassandra"))
- .webconsolePort(port)
- .locations(Arrays.asList(locations))
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/resources/catalog.bom b/examples/simple-nosql-cluster/src/main/resources/catalog.bom
deleted file mode 100644
index 92444f5..0000000
--- a/examples/simple-nosql-cluster/src/main/resources/catalog.bom
+++ /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.
-
-brooklyn.catalog:
- version: "0.12.0-SNAPSHOT" # BROOKLYN_VERSION
- itemType: template
- items:
- - id: org.apache.brooklyn.demo.RiakClusterExample
- item:
- services:
- - type: org.apache.brooklyn.demo.RiakClusterExample
- - id: org.apache.brooklyn.demo.CumulusRDFApplication
- description: CumulusRDF Application on a Tomcat server using a multi-region Cassandra fabric
- item:
- services:
- - type: org.apache.brooklyn.demo.CumulusRDFApplication
- name: Cumulus RDF Application
- - id: org.apache.brooklyn.demo.ResilientMongoDbApp
- item:
- services:
- - type: org.apache.brooklyn.demo.ResilientMongoDbApp
- name: Resilient MongoDB
- - id: org.apache.brooklyn.demo.StormSampleApp
- item:
- services:
- - type: org.apache.brooklyn.demo.StormSampleApp
- name: Storm Sample App
- - id: org.apache.brooklyn.demo.WideAreaCassandraCluster
- description: Deploy a Cassandra cluster across multiple geographies.
- item:
- services:
- - type: org.apache.brooklyn.demo.WideAreaCassandraCluster
- name: Wide Area Cassandra Cluster Application
- - id: org.apache.brooklyn.demo.HighAvailabilityCassandraCluster
- description: Deploy a Cassandra cluster with a High Availability architecture.
- item:
- services:
- - type: org.apache.brooklyn.demo.HighAvailabilityCassandraCluster
- name: HA Cassandra Cluster Application
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/resources/cumulus.yaml
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/resources/cumulus.yaml b/examples/simple-nosql-cluster/src/main/resources/cumulus.yaml
deleted file mode 100644
index 8772d37..0000000
--- a/examples/simple-nosql-cluster/src/main/resources/cumulus.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-[#ftl]
-#
-# 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.
-#
-storage-layout: "flat"
-cassandra-hosts: "${cassandraHostname}:${cassandraThriftPort?c}"
-cassandra-keyspace: "KeyspaceCumulus"
-proxy-mode: "false"
-triples-subject: -1
-triples-object: 5000
-query-limit: 50000
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/resources/mongodb.conf
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/resources/mongodb.conf b/examples/simple-nosql-cluster/src/main/resources/mongodb.conf
deleted file mode 100644
index 5237a54..0000000
--- a/examples/simple-nosql-cluster/src/main/resources/mongodb.conf
+++ /dev/null
@@ -1,32 +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.
-#
-
-# MongoDB configuration file
-
-# Startup configuration.
-verbose = v
-
-# Use less disk space.
-smallfiles = true
-
-# Disable journalling. By default:
-# - journal is false on 32 and true on 64 bit systems.
-# - nojournal is true on 32 and false on 64 bit systems.
-journal = false
-nojournal = true
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/ha-cassandra-cluster.yaml
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/ha-cassandra-cluster.yaml b/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/ha-cassandra-cluster.yaml
deleted file mode 100644
index a260e74..0000000
--- a/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/ha-cassandra-cluster.yaml
+++ /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.
-#
-# A YAML version of the HighAvailabilityCassandraCluster application
-#
-name: HA Cassandra cluster
-location: aws-ec2:us-east-1
-
-services:
-- type: org.apache.brooklyn.entity.nosql.cassandra.CassandraDatacenter
- name: Brooklyn
- brooklyn.config:
- initialSize: 6
- enableAvailabilityZones: true
- # See https://github.com/brooklyncentral/brooklyn/issues/973
- availabilityZoneNames:
- - us-east-1b
- - us-east-1c
- - us-east-1e
- numAvailabilityZones: 3
- snitchName: GossipingPropertyFileSnitch
- memberSpec:
- $brooklyn:entitySpec:
- type: org.apache.brooklyn.entity.nosql.cassandra.CassandraNode
- brookyn.policies:
- - type: org.apache.brooklyn.policy.ha.ServiceRestarter
- brooklyn.enrichers:
- - type: org.apache.brooklyn.policy.ha.ServiceFailureDetector
- brooklyn.policies:
- - type: org.apache.brooklyn.policy.ha.ServiceReplacer
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/simple-cassandra-cluster.yaml
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/simple-cassandra-cluster.yaml b/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/simple-cassandra-cluster.yaml
deleted file mode 100644
index 346ea78..0000000
--- a/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/simple-cassandra-cluster.yaml
+++ /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.
-#
-# A YAML version of the SimpleCassandraCluster application
-#
-name: Simple Cassandra cluster
-location: localhost
-
-services:
-- type: org.apache.brooklyn.entity.nosql.cassandra.CassandraDatacenter
- name: Brooklyn
- brooklyn.config:
- initialSize: 1
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/wide-area-cassandra-cluster.yaml
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/wide-area-cassandra-cluster.yaml b/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/wide-area-cassandra-cluster.yaml
deleted file mode 100644
index 91b785c..0000000
--- a/examples/simple-nosql-cluster/src/main/resources/org/apache/brooklyn/demo/wide-area-cassandra-cluster.yaml
+++ /dev/null
@@ -1,41 +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.
-#
-# A YAML version of the WideAreaCassandraCluster application
-#
-name: Wide Area Cassandra cluster
-locations:
-- aws-ec2:us-east-1
-- rackspace-cloudservers-uk
-
-services:
-- type: org.apache.brooklyn.entity.nosql.cassandra.CassandraFabric
- name: Brooklyn
- brooklyn.config:
- initialSize: 2
- snitchName: org.apache.brooklyn.entity.nosql.cassandra.customsnitch.MultiCloudSnitch
- customSnitchJarUrl: classpath://org/apache/brooklyn/entity/nosql/cassandra/cassandra-multicloud-snitch.jar
- memberSpec:
- $brooklyn:entitySpec:
- type: org.apache.brooklyn.entity.nosql.cassandra.CassandraNode
- brookyn.policies:
- - type: org.apache.brooklyn.policy.ha.ServiceRestarter
- brooklyn.enrichers:
- - type: org.apache.brooklyn.policy.ha.ServiceFailureDetector
- brooklyn.policies:
- - type: org.apache.brooklyn.policy.ha.ServiceReplacer
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/.gitignore
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/.gitignore b/examples/simple-web-cluster/.gitignore
deleted file mode 100644
index 9a3d6d6..0000000
--- a/examples/simple-web-cluster/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-brooklyn-example-simple-web-cluster/
-brooklyn-example-simple-web-cluster.tar.gz
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/README.txt
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/README.txt b/examples/simple-web-cluster/README.txt
deleted file mode 100644
index 598a4ce..0000000
--- a/examples/simple-web-cluster/README.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-Instructions for Running Examples
-=================================
-
-The commands below assume that the `brooklyn` script is on your $PATH, this project has been built,
-and you are in this directory. Adjust to taste for other configurations.
-
- export BROOKLYN_CLASSPATH=$(pwd)/target/classes
-
- # Three-tier: auto-scaling app-server cluster fronted by nginx, MySql backend wired up, on localhost
- brooklyn launch --app org.apache.brooklyn.demo.WebClusterDatabaseExample --location localhost
-
-The above requires passwordless `ssh localhost` and requires `gcc` to build `nginx`.
-You could instead target your favourite cloud, where this has been tried and tested:
-
- # Same three-tier, but in Amazon California, prompting for credentials
- # (the location arg can be changed for any example, of course, and other clouds are available)
- export JCLOUDS_AWS_EC2_IDENTITY=AKA50M30N3S1DFR0MAW55
- export JCLOUDS_AWS_EC2_CREDENTIAL=aT0Ps3cr3tC0D3wh1chAW5w1llG1V3y0uTOus333
- brooklyn launch --app brooklyn.demo.WebClusterDatabaseExample --location aws-ec2:us-west-1
-
-
-Other examples:
-
- # A very simple app: a single web-server
- brooklyn launch --app org.apache.brooklyn.demo.SingleWebServerExample --location localhost
-
- # A simple app: just load-balancer and appservers
- brooklyn launch --app org.apache.brooklyn.demo.WebClusterExample --location localhost
-
- # Three-tier example
- brooklyn launch --app org.apache.brooklyn.demo.WebClusterDatabaseExample --location localhost
-
-
-Redistributable embedded example:
-
- # To build a redistributable tar.gz with a start.sh script
- # which invokes the `main` method in the example class to start
- # (the redistributable will be at: target/brooklyn-*-bin.tar.gz )
- mvn clean assembly:assembly
-
-For more information please visit https://brooklyn.incubator.apache.org/.
-
-----
-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.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/pom.xml
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/pom.xml b/examples/simple-web-cluster/pom.xml
deleted file mode 100644
index ef5cd67..0000000
--- a/examples/simple-web-cluster/pom.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <packaging>jar</packaging>
- <artifactId>brooklyn-example-simple-web-cluster</artifactId>
- <name>Brooklyn Simple Web Cluster Example</name>
-
- <!-- this is only needed for "mvn deploy"; the group and version can be extracted
- and parent block removed to run this standalone -->
- <parent>
- <groupId>org.apache.brooklyn.example</groupId>
- <artifactId>brooklyn-examples-parent</artifactId>
- <version>0.12.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-launcher</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-webapp</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-database</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-nosql</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-logback-xml</artifactId>
- <version>${project.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-test-support</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <!-- copy the WAR so it is available on the classpath for programmatic deployment -->
- <executions>
- <execution>
- <id>copy</id>
- <phase>process-classes</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <!-- these can fail in eclipse trying to copy _from_ target/classes.
- see http://jira.codehaus.org/browse/MDEP-259 -->
- <artifactItem>
- <groupId>org.apache.brooklyn.example</groupId>
- <artifactId>brooklyn-example-hello-world-webapp</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/classes</outputDirectory>
- <destFileName>hello-world-webapp.war</destFileName>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.brooklyn.example</groupId>
- <artifactId>brooklyn-example-hello-world-sql-webapp</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/classes</outputDirectory>
- <destFileName>hello-world-sql-webapp.war</destFileName>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>${project.basedir}</directory>
- <includes>
- <include>${project.artifactId}/</include>
- <include>brooklyn*.log</include>
- <include>brooklyn*.log.*</include>
- <include>stacktrace.log</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <plugin>
- <!-- optional, with this block, `mvn assembly:assembly` will build a redistributable tgz -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/resources/jmeter-test-plan.jmx
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/resources/jmeter-test-plan.jmx b/examples/simple-web-cluster/resources/jmeter-test-plan.jmx
deleted file mode 100644
index 0eb1741..0000000
--- a/examples/simple-web-cluster/resources/jmeter-test-plan.jmx
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<jmeterTestPlan version="1.2" properties="2.1">
- <hashTree>
- <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Brooklyn local webapp test - load for localhost:8000" enabled="true">
- <stringProp name="TestPlan.comments"></stringProp>
- <boolProp name="TestPlan.functional_mode">false</boolProp>
- <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
- <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
- <collectionProp name="Arguments.arguments"/>
- </elementProp>
- <stringProp name="TestPlan.user_define_classpath"></stringProp>
- </TestPlan>
- <hashTree>
- <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Test Group - hitting site with 8 threads" enabled="true">
- <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
- <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
- <boolProp name="LoopController.continue_forever">false</boolProp>
- <intProp name="LoopController.loops">-1</intProp>
- </elementProp>
- <stringProp name="ThreadGroup.num_threads">8</stringProp>
- <stringProp name="ThreadGroup.ramp_time">1</stringProp>
- <longProp name="ThreadGroup.start_time">1326116677000</longProp>
- <longProp name="ThreadGroup.end_time">1326116677000</longProp>
- <boolProp name="ThreadGroup.scheduler">false</boolProp>
- <stringProp name="ThreadGroup.duration"></stringProp>
- <stringProp name="ThreadGroup.delay"></stringProp>
- </ThreadGroup>
- <hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Timer - frequency 50 reqs/sec per thread (20 ms delay)" enabled="true">
- <stringProp name="ConstantTimer.delay">20</stringProp>
- </ConstantTimer>
- <hashTree/>
- <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="HTTP Request - localhost:8000" enabled="true">
- <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
- <collectionProp name="Arguments.arguments"/>
- </elementProp>
- <stringProp name="HTTPSampler.domain">localhost</stringProp>
- <stringProp name="HTTPSampler.port">8000</stringProp>
- <stringProp name="HTTPSampler.connect_timeout"></stringProp>
- <stringProp name="HTTPSampler.response_timeout"></stringProp>
- <stringProp name="HTTPSampler.protocol"></stringProp>
- <stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp name="HTTPSampler.path"></stringProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
- <boolProp name="HTTPSampler.monitor">false</boolProp>
- <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
- </HTTPSampler>
- <hashTree/>
- <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true">
- <collectionProp name="CookieManager.cookies"/>
- <boolProp name="CookieManager.clearEachIteration">false</boolProp>
- </CookieManager>
- <hashTree/>
- </hashTree>
- <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
- <boolProp name="ResultCollector.error_logging">false</boolProp>
- <objProp>
- <name>saveConfig</name>
- <value class="SampleSaveConfiguration">
- <time>true</time>
- <latency>true</latency>
- <timestamp>true</timestamp>
- <success>true</success>
- <label>true</label>
- <code>true</code>
- <message>true</message>
- <threadName>true</threadName>
- <dataType>true</dataType>
- <encoding>false</encoding>
- <assertions>true</assertions>
- <subresults>true</subresults>
- <responseData>false</responseData>
- <samplerData>false</samplerData>
- <xml>true</xml>
- <fieldNames>false</fieldNames>
- <responseHeaders>false</responseHeaders>
- <requestHeaders>false</requestHeaders>
- <responseDataOnError>false</responseDataOnError>
- <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
- <assertionsResultsToSave>0</assertionsResultsToSave>
- <bytes>true</bytes>
- </value>
- </objProp>
- <stringProp name="filename"></stringProp>
- </ResultCollector>
- <hashTree/>
- <ResultCollector guiclass="SplineVisualizer" testclass="ResultCollector" testname="Spline Visualizer" enabled="true">
- <boolProp name="ResultCollector.error_logging">false</boolProp>
- <objProp>
- <name>saveConfig</name>
- <value class="SampleSaveConfiguration">
- <time>true</time>
- <latency>true</latency>
- <timestamp>true</timestamp>
- <success>true</success>
- <label>true</label>
- <code>true</code>
- <message>true</message>
- <threadName>true</threadName>
- <dataType>true</dataType>
- <encoding>false</encoding>
- <assertions>true</assertions>
- <subresults>true</subresults>
- <responseData>false</responseData>
- <samplerData>false</samplerData>
- <xml>true</xml>
- <fieldNames>false</fieldNames>
- <responseHeaders>false</responseHeaders>
- <requestHeaders>false</requestHeaders>
- <responseDataOnError>false</responseDataOnError>
- <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
- <assertionsResultsToSave>0</assertionsResultsToSave>
- <bytes>true</bytes>
- </value>
- </objProp>
- <stringProp name="filename"></stringProp>
- </ResultCollector>
- <hashTree/>
- </hashTree>
- </hashTree>
-</jmeterTestPlan>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/assembly/assembly.xml b/examples/simple-web-cluster/src/main/assembly/assembly.xml
deleted file mode 100644
index cbe7a08..0000000
--- a/examples/simple-web-cluster/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<assembly>
- <id>bin</id>
- <!-- Generates an archive containing the needed files;
- can add e.g. zip to the following
- (but executable bit is not preserved) -->
- <formats>
- <format>tar.gz</format>
- </formats>
-
- <!-- Adds dependencies to zip package under lib directory -->
- <dependencySets>
- <dependencySet>
- <!--
- Project artifact is not copied under library directory since
- it is added to the root directory of the zip package.
- -->
- <useProjectArtifact>false</useProjectArtifact>
- <outputDirectory>lib</outputDirectory>
- <unpack>false</unpack>
- </dependencySet>
- </dependencySets>
-
- <fileSets>
- <!--
- Adds startup scripts to the root directory of zip package. The startup
- scripts are located to src/main/scripts directory as stated by Maven
- conventions.
- -->
- <fileSet>
- <directory>src/main/assembly/scripts</directory>
- <outputDirectory></outputDirectory>
- <fileMode>0755</fileMode>
- <includes>
- <include>*</include>
- </includes>
- </fileSet>
- <!-- add additional files (but not marked executable -->
- <fileSet>
- <directory>src/main/assembly/files</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>*</include>
- </includes>
- </fileSet>
- <!-- adds jar package to the root directory of zip package -->
- <fileSet>
- <directory>target</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
- </fileSets>
-</assembly>
-
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/assembly/files/README.txt
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/assembly/files/README.txt b/examples/simple-web-cluster/src/main/assembly/files/README.txt
deleted file mode 100644
index cf49ea5..0000000
--- a/examples/simple-web-cluster/src/main/assembly/files/README.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-Brooklyn Example
-================
-
-To use, configure your cloud credentials then run ./start.sh in this directory.
-You can then access the management context in your browser, typically on localhost:8081.
-
-
-### Cloud Credentials
-
-To run, you'll need to specify credentials for your preferred cloud. This can be done
-in `~/.brooklyn/brooklyn.properties`:
-
- brooklyn.jclouds.aws-ec2.identity=AKXXXXXXXXXXXXXXXXXX
- brooklyn.jclouds.aws-ec2.credential=secret01xxxxxxxxxxxxxxxxxxxxxxxxxxx
-
-Alternatively these can be set as shell environment parameters or JVM system properties.
-
-Many other clouds are supported also, as well as pre-existing machines ("bring your own nodes"),
-custom endpoints for private clouds, and specifying custom keys and passphrases.
-For more information see:
-
- https://github.com/brooklyncentral/brooklyn/blob/master/docs/use/guide/defining-applications/common-usage.md#off-the-shelf-locations
-
-
-### Run
-
-Usage:
-
- ./start.sh [--port 8081+] location
-
-Where location might be `localhost` (the defaul), or `aws-ec2:us-east-1`, `openstack:endpoint`, etc.
-
-----
-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.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/assembly/scripts/start.sh
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/assembly/scripts/start.sh b/examples/simple-web-cluster/src/main/assembly/scripts/start.sh
deleted file mode 100755
index ec4f110..0000000
--- a/examples/simple-web-cluster/src/main/assembly/scripts/start.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-if [ -z "$BROOKLYN_APP_CLASS" ] ; then
- BROOKLYN_APP_CLASS=org.apache.brooklyn.demo.WebClusterDatabaseExample
-fi
-
-if [ -z "$JAVA" ] ; then
- JAVA=`which java`
-fi
-if [ ! -z "$JAVA_HOME" ] ; then
- JAVA=$JAVA_HOME/bin/java
-else
- JAVA=`which java`
-fi
-if [ ! -x "$JAVA" ] ; then
- echo Cannot find java. Set JAVA_HOME or add java to path.
- exit 1
-fi
-
-if [[ ! `ls *.jar 2> /dev/null` || ! `ls lib/*.jar 2> /dev/null` ]] ; then
- echo Command must be run from the directory where it is installed.
- exit 1
-fi
-
-$JAVA -Xms256m -Xmx1024m -XX:MaxPermSize=1024m -classpath "*:lib/*" $BROOKLYN_APP_CLASS "$@"
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/NodeJsTodoApplication.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/NodeJsTodoApplication.java b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/NodeJsTodoApplication.java
deleted file mode 100644
index 086f390..0000000
--- a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/NodeJsTodoApplication.java
+++ /dev/null
@@ -1,60 +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 org.apache.brooklyn.demo;
-
-import static org.apache.brooklyn.core.sensor.DependentConfiguration.attributeWhenReady;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.sensor.DependentConfiguration;
-import org.apache.brooklyn.entity.nosql.redis.RedisStore;
-import org.apache.brooklyn.entity.software.base.SoftwareProcess;
-import org.apache.brooklyn.entity.webapp.nodejs.NodeJsWebAppService;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Node.JS Todo Application
- */
-@Catalog(name="NodeJS Todo",
- description="Node.js is a cross-platform runtime environment for server-side and networking applications. Node.js applications are written in JavaScript",
- iconUrl="classpath://nodejs-logo.png")
-public class NodeJsTodoApplication extends AbstractApplication implements StartableApplication {
-
- @Override
- public void initApp() {
- RedisStore redis = addChild(EntitySpec.create(RedisStore.class));
-
- addChild(EntitySpec.create(NodeJsWebAppService.class)
- .configure(NodeJsWebAppService.APP_GIT_REPOSITORY_URL, "https://github.com/grkvlt/nodejs-todo/")
- .configure(NodeJsWebAppService.APP_FILE, "server.js")
- .configure(NodeJsWebAppService.APP_NAME, "nodejs-todo")
- .configure(NodeJsWebAppService.NODE_PACKAGE_LIST, ImmutableList.of("express", "ejs", "jasmine-node", "underscore", "method-override", "cookie-parser", "express-session", "body-parser", "cookie-session", "redis", "redis-url", "connect"))
- .configure(SoftwareProcess.SHELL_ENVIRONMENT, ImmutableMap.<String, Object>of(
- "REDISTOGO_URL", DependentConfiguration.formatString("redis://%s:%d/",
- attributeWhenReady(redis, Attributes.HOSTNAME), attributeWhenReady(redis, RedisStore.REDIS_PORT))))
- .configure(SoftwareProcess.LAUNCH_LATCH, attributeWhenReady(redis, Startable.SERVICE_UP)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.java b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.java
deleted file mode 100644
index cec7a7e..0000000
--- a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.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 org.apache.brooklyn.demo;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.location.PortRanges;
-import org.apache.brooklyn.entity.webapp.JavaWebAppService;
-import org.apache.brooklyn.entity.webapp.jboss.JBoss7Server;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.Lists;
-
-/** This example starts one web app on 8080, waits for a keypress, then stops it. */
-public class SingleWebServerExample extends AbstractApplication {
-
- public static final Logger LOG = LoggerFactory.getLogger(SingleWebServerExample.class);
-
- private static final String WAR_PATH = "classpath://hello-world-webapp.war";
-
- @Override
- public void initApp() {
- addChild(EntitySpec.create(JBoss7Server.class)
- .configure(JavaWebAppService.ROOT_WAR, WAR_PATH)
- .configure(Attributes.HTTP_PORT, PortRanges.fromString("8080+")));
- }
-
- // Shows how to use ApplicationBuilder without sub-classing, but for CLI usage one should sub-class
- public static void main(String[] argv) throws Exception {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", "localhost");
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, SingleWebServerExample.class).displayName("Brooklyn WebApp example"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e1278bf1/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java
deleted file mode 100644
index 601537a..0000000
--- a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java
+++ /dev/null
@@ -1,122 +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 org.apache.brooklyn.demo;
-
-import static org.apache.brooklyn.core.sensor.DependentConfiguration.attributeWhenReady;
-import static org.apache.brooklyn.core.sensor.DependentConfiguration.formatString;
-import static org.apache.brooklyn.entity.java.JavaEntityMethods.javaSysProp;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.entity.database.mysql.MySqlNode;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.location.PortRanges;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.enricher.stock.Enrichers;
-import org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.JavaWebAppService;
-import org.apache.brooklyn.entity.webapp.WebAppService;
-import org.apache.brooklyn.entity.webapp.WebAppServiceConstants;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy;
-import org.apache.brooklyn.policy.enricher.HttpLatencyDetector;
-import org.apache.brooklyn.util.CommandLineUtil;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-/**
- * Launches a 3-tier app with nginx, clustered jboss, and mysql.
- **/
-public class WebClusterDatabaseExample extends AbstractApplication {
-
- public static final Logger LOG = LoggerFactory.getLogger(WebClusterDatabaseExample.class);
-
- public static final String WAR_PATH = "classpath://hello-world-sql-webapp.war";
-
- public static final String DB_SETUP_SQL_URL = "classpath://visitors-creation-script.sql";
-
- public static final String DB_TABLE = "visitors";
- public static final String DB_USERNAME = "brooklyn";
- public static final String DB_PASSWORD = "br00k11n";
-
- public static final AttributeSensor<Integer> APPSERVERS_COUNT = Sensors.newIntegerSensor(
- "appservers.count", "Number of app servers deployed");
-
- @Override
- public void initApp() {
- MySqlNode mysql = addChild(EntitySpec.create(MySqlNode.class)
- .configure("creationScriptUrl", DB_SETUP_SQL_URL));
-
- ControlledDynamicWebAppCluster web = addChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
- .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+"))
- .configure(JavaWebAppService.ROOT_WAR, WAR_PATH)
- .configure(javaSysProp("brooklyn.example.db.url"),
- formatString("jdbc:%s%s?user=%s\\&password=%s",
- attributeWhenReady(mysql, MySqlNode.DATASTORE_URL),
- DB_TABLE, DB_USERNAME, DB_PASSWORD)) );
-
- web.enrichers().add(HttpLatencyDetector.builder().
- url(ControlledDynamicWebAppCluster.ROOT_URL).
- rollup(10, TimeUnit.SECONDS).
- build());
-
- // simple scaling policy
- web.getCluster().policies().add(AutoScalerPolicy.builder().
- metric(DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE).
- metricRange(10, 100).
- sizeRange(1, 5).
- build());
-
- // expose some KPI's
- enrichers().add(Enrichers.builder()
- .propagating(WebAppServiceConstants.ROOT_URL,
- DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW,
- HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW)
- .from(web)
- .build());
-
- enrichers().add(Enrichers.builder()
- .propagating(ImmutableMap.of(DynamicWebAppCluster.GROUP_SIZE, APPSERVERS_COUNT))
- .from(web)
- .build());
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", "localhost");
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, WebClusterDatabaseExample.class).displayName("Brooklyn WebApp Cluster with Database example"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}