This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns immutant.init | |
(:use immutant-demo.core) | |
(:require [immutant.web :as web] | |
[immutant.jobs :as jobs] | |
[rhq.rest.client :as rhq] | |
[clojure.tools.logging :as logging])) | |
(web/start ring-handler) | |
(web/start "/biscuits" another-ring-handler) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns rhq.rest.client | |
(:require [clojure.data.json :as json]) | |
(:require [clj-http.client :as http])) | |
(def server-url "http://localhost:7080/rest/") | |
(def schedule-types | |
{:trait "TRAIT" | |
:numeric "MEASUREMENT"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SnappyNativeLoader | |
{ | |
private static HashMap<String, Boolean> loadedLibFiles = new HashMap<String, Boolean>(); | |
private static HashMap<String, Boolean> loadedLib = new HashMap<String, Boolean>(); | |
public static synchronized void load(String lib) { | |
if (loadedLibFiles.containsKey(lib) && loadedLibFiles.get(lib) == true) | |
return; | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"> | |
<!-- Explicitly indicate that we do not want sub deployments isolated; subdeployments need to see each other's classes --> | |
<ear-subdeployments-isolated>false</ear-subdeployments-isolated> | |
<!-- This corresponds to the top level deployment - which in this case in the EAR module --> | |
<deployment> | |
<dependencies> | |
<module name="org.jboss.common-core" export="true" /> <!-- needed to fix https://issues.jboss.org/browse/AS7-5336 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
importClass(org.rhq.cassandra.schema.SchemaManager); | |
if (project.properties['db'] == 'dev') { | |
self.log('PERFORMING STORAGE NODE SETUP TO LATEST SCHEMA'); | |
username = project.properties['rhq.dev.cassandra.username'] ? project.properties['rhq.dev.cassandra.username'] : 'cassandra'; | |
password = project.properties['rhq.dev.cassandra.password'] ? project.properties['rhq.dev.cassandra.password'] : 'cassandra'; | |
seeds = project.properties['rhq.dev.cassandra.seeds'] ? project.properties['rhq.dev.cassandra.seeds'] : '127.0.0.1|9160|9142'; | |
schemaManager = SchemaManager(username, password, seeds); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from org.rhq.cassandra.schema import SchemaManager | |
if project.properties['db'] == 'dev': | |
self.log('PERFORMING STORAGE NODE SETUP TO LATEST SCHEMA') | |
username = project.properties.get('rhq.dev.cassandra.username', 'cassandra') | |
password = project.properties.get('rhq.dev.cassandra.password', 'cassandra') | |
seeds = project.properties.get('rhq.dev.cassandra.seeds', '127.0.0.1|9160|9142') | |
schemaManager = SchemaManager(username, password, seeds) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
import org.rhq.cassandra.schema.SchemaManager | |
if $project.properties['db'] == 'dev' | |
$self.log 'PERFORMING STORAGE NODE SETUP TO LATEST SCHEMA' | |
username = $project.properties.fetch('rhq.dev.cassandra.username', 'cassandra') | |
password = $project.properties.fetch('rhq.dev.cassandra.password', 'cassandra') | |
seeds = $project.properties.fetch('rhq.dev.cassandra.seeds', '127.0.0.1|9160|9142') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE KEYSPACE rhq WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; | |
USE rhq; | |
CREATE TABLE raw_metrics ( | |
schedule_id int, | |
time timestamp, | |
value double, | |
PRIMARY KEY (schedule_id, time) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Stateless | |
public class MySessionBean { | |
@Resource(name="CassandraDS", mappedName="java:jboss/datasources/CassandraDS") | |
private DataSource dataSource; | |
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) | |
public void useCassandraDS() { | |
try { | |
Connection connection = dataSource.getConnection(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<subsystem xmlns="urn:jboss:domain:datasources:1.0"> | |
<datasources> | |
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" | |
use-java-context="true"> | |
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url> | |
<driver>h2</driver> | |
<security> | |
<user-name>sa</user-name> | |
<password>sa</password> | |
</security> |