You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by rm...@apache.org on 2013/11/07 17:38:19 UTC

svn commit: r1539707 - in /incubator/sirona/trunk: ./ agent/store/ agent/store/cassandra/ agent/store/cassandra/src/ agent/store/cassandra/src/main/ agent/store/cassandra/src/main/java/ agent/store/cassandra/src/main/java/org/ agent/store/cassandra/src...

Author: rmannibucau
Date: Thu Nov  7 16:38:18 2013
New Revision: 1539707

URL: http://svn.apache.org/r1539707
Log:
basic cassandra module structure. All is to implement

Added:
    incubator/sirona/trunk/agent/store/cassandra/
    incubator/sirona/trunk/agent/store/cassandra/pom.xml
    incubator/sirona/trunk/agent/store/cassandra/src/
    incubator/sirona/trunk/agent/store/cassandra/src/main/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraBuilder.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraCollectorDataStoreFactory.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/DynamicDelegatedSerializer.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/CassandraSirona.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraCollectorCounterDataStore.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraLeafCounter.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CounterDao.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/gauge/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/gauge/CassandraCollectorGaugeDataStore.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/status/
    incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/status/CassandraCollectorNodeStatusDataStore.java
    incubator/sirona/trunk/agent/store/cassandra/src/main/resources/
    incubator/sirona/trunk/agent/store/cassandra/src/test/
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/AgentCounterTest.java
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraRunner.java
    incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraTestInject.java
    incubator/sirona/trunk/agent/store/cassandra/src/test/resources/
    incubator/sirona/trunk/agent/store/cassandra/src/test/resources/log4j.xml
    incubator/sirona/trunk/agent/store/cassandra/src/test/resources/sirona.properties
Modified:
    incubator/sirona/trunk/agent/store/pom.xml
    incubator/sirona/trunk/core/src/main/java/org/apache/sirona/configuration/Configuration.java
    incubator/sirona/trunk/core/src/main/java/org/apache/sirona/counters/Counter.java
    incubator/sirona/trunk/core/src/main/java/org/apache/sirona/math/M2AwareStatisticalSummary.java
    incubator/sirona/trunk/pom.xml
    incubator/sirona/trunk/server/collector/src/main/java/org/apache/sirona/collector/server/store/counter/CollectorCounter.java

Added: incubator/sirona/trunk/agent/store/cassandra/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/pom.xml?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/pom.xml (added)
+++ incubator/sirona/trunk/agent/store/cassandra/pom.xml Thu Nov  7 16:38:18 2013
@@ -0,0 +1,56 @@
+<?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">
+  <parent>
+    <artifactId>sirona-store</artifactId>
+    <groupId>org.apache.sirona</groupId>
+    <version>0.1-incubating-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>sirona-cassandra</artifactId>
+  <name>Apache Sirona Incubator :: Agent :: Store :: Cassandra</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.sirona</groupId>
+      <artifactId>sirona-collector</artifactId>
+      <classifier>classes</classifier>
+    </dependency>
+
+    <dependency>
+      <groupId>org.hectorclient</groupId>
+      <artifactId>hector-core</artifactId>
+      <version>1.1-4</version>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.cassandraunit</groupId>
+      <artifactId>cassandra-unit</artifactId>
+      <version>1.2.0.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraBuilder.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraBuilder.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraBuilder.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraBuilder.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,58 @@
+/*
+ * 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.sirona.cassandra;
+
+import org.apache.sirona.configuration.Configuration;
+
+@Configuration.AutoSet
+public class CassandraBuilder {
+    private String hosts = "localhost:9171";
+    private String cluster = "sirona-cluster";
+    private String keyspace = "sirona";
+    private String counterColumnFamily = "counters";
+    private String gaugeColumnFamily = "gauges";
+    private String statusColumnFamily = "statuses";
+    private int replicationFactor = 1;
+
+    public String getHosts() {
+        return hosts;
+    }
+
+    public String getCluster() {
+        return cluster;
+    }
+
+    public String getKeyspace() {
+        return keyspace;
+    }
+
+    public String getCounterColumnFamily() {
+        return counterColumnFamily;
+    }
+
+    public String getGaugeColumnFamily() {
+        return gaugeColumnFamily;
+    }
+
+    public String getStatusColumnFamily() {
+        return statusColumnFamily;
+    }
+
+    public int getReplicationFactor() {
+        return replicationFactor;
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraCollectorDataStoreFactory.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraCollectorDataStoreFactory.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraCollectorDataStoreFactory.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/CassandraCollectorDataStoreFactory.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,28 @@
+/*
+ * 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.sirona.cassandra;
+
+import org.apache.sirona.cassandra.collector.counter.CassandraCollectorCounterDataStore;
+import org.apache.sirona.cassandra.collector.gauge.CassandraCollectorGaugeDataStore;
+import org.apache.sirona.cassandra.collector.status.CassandraCollectorNodeStatusDataStore;
+import org.apache.sirona.store.DelegateDataStoreFactory;
+
+public class CassandraCollectorDataStoreFactory extends DelegateDataStoreFactory {
+    public CassandraCollectorDataStoreFactory() {
+        super(new CassandraCollectorCounterDataStore(), new CassandraCollectorGaugeDataStore(), new CassandraCollectorNodeStatusDataStore());
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/DynamicDelegatedSerializer.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/DynamicDelegatedSerializer.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/DynamicDelegatedSerializer.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/DynamicDelegatedSerializer.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,40 @@
+/*
+ * 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.sirona.cassandra;
+
+import me.prettyprint.cassandra.serializers.AbstractSerializer;
+import me.prettyprint.hector.api.Serializer;
+
+import java.nio.ByteBuffer;
+
+public class DynamicDelegatedSerializer<T> extends AbstractSerializer<T> {
+    private Serializer<? extends T> delegate = null;
+
+    @Override
+    public ByteBuffer toByteBuffer(final T obj) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public T fromByteBuffer(final ByteBuffer byteBuffer) {
+        return delegate.fromByteBuffer(byteBuffer);
+    }
+
+    public void setDelegate(final Serializer<? extends T> delegate) {
+        this.delegate = delegate;
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/CassandraSirona.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/CassandraSirona.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/CassandraSirona.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/CassandraSirona.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,90 @@
+/*
+ * 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.sirona.cassandra.collector;
+
+import me.prettyprint.cassandra.service.CassandraHostConfigurator;
+import me.prettyprint.cassandra.service.ThriftKsDef;
+import me.prettyprint.hector.api.Cluster;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition;
+import me.prettyprint.hector.api.ddl.ComparatorType;
+import me.prettyprint.hector.api.factory.HFactory;
+import org.apache.sirona.cassandra.CassandraBuilder;
+import org.apache.sirona.configuration.Configuration;
+
+import java.util.logging.Logger;
+
+import static java.util.Arrays.asList;
+
+public class CassandraSirona {
+    private static final Logger LOGGER = Logger.getLogger(CassandraSirona.class.getName());
+
+    private static final String SEPARATOR = "->";
+
+    private final CassandraBuilder builder = Configuration.findOrCreateInstance(CassandraBuilder.class);
+    private final Cluster cluster;
+    private final Keyspace keyspace;
+
+    public CassandraSirona() {
+        final CassandraHostConfigurator configurator = new CassandraHostConfigurator(builder.getHosts());
+        configurator.setMaxActive(75);
+        cluster = HFactory.getOrCreateCluster(builder.getCluster(), configurator);
+
+        final String keyspaceName = builder.getKeyspace();
+
+        keyspace = HFactory.createKeyspace(keyspaceName, cluster);
+
+        final ColumnFamilyDefinition counters = HFactory.createColumnFamilyDefinition(keyspaceName, builder.getCounterColumnFamily(), ComparatorType.UTF8TYPE);
+        final ColumnFamilyDefinition gauges = HFactory.createColumnFamilyDefinition(keyspaceName, builder.getGaugeColumnFamily(), ComparatorType.UTF8TYPE);
+        final ColumnFamilyDefinition statuses = HFactory.createColumnFamilyDefinition(keyspaceName, builder.getStatusColumnFamily(), ComparatorType.UTF8TYPE);
+
+        { // ensure keyspace exists, here if the keyspace doesn't exist we suppose nothing exist
+            if (cluster.describeKeyspace(keyspaceName) == null) {
+                LOGGER.info("Creating Cassandra '" + keyspaceName + "' keyspace.");
+                cluster.addKeyspace(
+                    HFactory.createKeyspaceDefinition(keyspaceName, ThriftKsDef.DEF_STRATEGY_CLASS, builder.getReplicationFactor(),
+                        asList(counters, gauges, statuses)));
+            }
+        }
+    }
+
+    public String generateKey(final String... bases) {
+        final StringBuilder builder = new StringBuilder();
+        if (bases == null || bases.length == 0) {
+            return builder.toString();
+        }
+
+        for (final String s : bases) {
+            builder.append(s).append(SEPARATOR);
+        }
+        builder.setLength(builder.length() - SEPARATOR.length());
+        return builder.toString();
+    }
+
+    @Configuration.Destroying
+    public void shutdown() {
+        HFactory.shutdownCluster(cluster);
+    }
+
+    public String getCounterColumnFamily() {
+        return builder.getCounterColumnFamily();
+    }
+
+    public Keyspace getKeyspace() {
+        return keyspace;
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraCollectorCounterDataStore.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraCollectorCounterDataStore.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraCollectorCounterDataStore.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraCollectorCounterDataStore.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,55 @@
+/*
+ * 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.sirona.cassandra.collector.counter;
+
+import org.apache.sirona.collector.server.store.counter.InMemoryCollectorCounterStore;
+import org.apache.sirona.collector.server.store.counter.LeafCollectorCounter;
+import org.apache.sirona.counters.Counter;
+
+import java.util.Collection;
+
+public class CassandraCollectorCounterDataStore extends InMemoryCollectorCounterStore {
+    private final CounterDao dao;
+
+    public CassandraCollectorCounterDataStore() {
+        dao = new CounterDao();
+    }
+
+    @Override
+    public LeafCollectorCounter getOrCreateCounter(final Counter.Key key, final String marker) {
+        final CassandraLeafCounter byKey = dao.findByKey(key, marker);
+        if (byKey != null) {
+            return byKey;
+        }
+        return dao.save(new CassandraLeafCounter(key), marker);
+    }
+
+    @Override
+    public Collection<String> markers() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<? extends Counter> getCounters(final String marker) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void clearCounters() {
+        throw new UnsupportedOperationException();
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraLeafCounter.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraLeafCounter.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraLeafCounter.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CassandraLeafCounter.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,35 @@
+/*
+ * 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.sirona.cassandra.collector.counter;
+
+import org.apache.sirona.collector.server.store.counter.LeafCollectorCounter;
+import org.apache.sirona.math.M2AwareStatisticalSummary;
+
+public class CassandraLeafCounter extends LeafCollectorCounter {
+    public CassandraLeafCounter(final Key key) {
+        super(key);
+    }
+
+    public void sync(final M2AwareStatisticalSummary newStats, final int newConcurrency) {
+        super.update(newStats, newConcurrency);
+    }
+
+    @Override
+    public void update(final M2AwareStatisticalSummary newStats, final int newConcurrency) {
+        throw new UnsupportedOperationException();
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CounterDao.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CounterDao.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CounterDao.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/counter/CounterDao.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,116 @@
+/*
+ * 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.sirona.cassandra.collector.counter;
+
+import me.prettyprint.cassandra.serializers.DoubleSerializer;
+import me.prettyprint.cassandra.serializers.IntegerSerializer;
+import me.prettyprint.cassandra.serializers.LongSerializer;
+import me.prettyprint.cassandra.serializers.SerializerTypeInferer;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.Serializer;
+import me.prettyprint.hector.api.beans.ColumnSlice;
+import me.prettyprint.hector.api.beans.HColumn;
+import me.prettyprint.hector.api.factory.HFactory;
+import me.prettyprint.hector.api.query.QueryResult;
+import me.prettyprint.hector.api.query.SliceQuery;
+import org.apache.sirona.cassandra.DynamicDelegatedSerializer;
+import org.apache.sirona.cassandra.collector.CassandraSirona;
+import org.apache.sirona.configuration.Configuration;
+import org.apache.sirona.counters.Counter;
+import org.apache.sirona.math.M2AwareStatisticalSummary;
+
+public class CounterDao {
+    private static final String[] FIND_COLUMNS = new String[] { "maxConcurrency", "variance", "n", "max", "min", "sum", "m2", "mean" };
+
+    private final Keyspace keyspace;
+    private final String family;
+    private final CassandraSirona cassandra;
+
+    public CounterDao() {
+        this.cassandra = Configuration.findOrCreateInstance(CassandraSirona.class);
+        this.keyspace = cassandra.getKeyspace();
+        this.family = cassandra.getCounterColumnFamily();
+    }
+
+    public CassandraLeafCounter findByKey(final Counter.Key ckey, final String marker) {
+        final String key = cassandra.generateKey(ckey.getRole().getName(), ckey.getName(), marker);
+
+        final DynamicDelegatedSerializer<Number> serializer = new DynamicDelegatedSerializer<Number>();
+        final SliceQuery<String, String, Number> q = HFactory.createSliceQuery(keyspace,
+            StringSerializer.get(), StringSerializer.get(), serializer);
+
+        final QueryResult<ColumnSlice<String, Number>> result = q.setKey(key)
+            .setColumnNames(FIND_COLUMNS)
+            .setColumnFamily(family)
+            .execute();
+
+        final ColumnSlice<String, Number> map = result.get();
+        if (map.getColumns().isEmpty()) {
+            return null;
+        }
+
+        final CassandraLeafCounter counter = new CassandraLeafCounter(ckey);
+        counter.sync(new M2AwareStatisticalSummary(
+            getOrZero(serializer, map.getColumnByName("mean"), DoubleSerializer.get()).doubleValue(),
+            getOrZero(serializer, map.getColumnByName("variance"), DoubleSerializer.get()).doubleValue(),
+            getOrZero(serializer, map.getColumnByName("n"), LongSerializer.get()).longValue(),
+            getOrZero(serializer, map.getColumnByName("max"), DoubleSerializer.get()).doubleValue(),
+            getOrZero(serializer, map.getColumnByName("min"), DoubleSerializer.get()).doubleValue(),
+            getOrZero(serializer, map.getColumnByName("sum"), DoubleSerializer.get()).doubleValue(),
+            getOrZero(serializer, map.getColumnByName("m2"), DoubleSerializer.get()).doubleValue()),
+            getOrZero(serializer, map.getColumnByName("maxConcurrency"), IntegerSerializer.get()).intValue());
+        return counter;
+    }
+
+    public CassandraLeafCounter save(final CassandraLeafCounter counter, final String marker) {
+        final Counter.Key key = counter.getKey();
+        final String id = id(key, marker);
+
+        HFactory.createMutator(keyspace, StringSerializer.get())
+            .addInsertion(id, family, column("role", key.getRole().getName()))
+            .addInsertion(id, family, column("key", key.getName()))
+            .addInsertion(id, family, column("maxConcurrency", counter.getMaxConcurrency()))
+            .addInsertion(id, family, column("variance", counter.getVariance()))
+            .addInsertion(id, family, column("n", counter.getHits()))
+            .addInsertion(id, family, column("max", counter.getMax()))
+            .addInsertion(id, family, column("min", counter.getMin()))
+            .addInsertion(id, family, column("sum", counter.getSum()))
+            .addInsertion(id, family, column("m2", counter.getSecondMoment()))
+            .addInsertion(id, family, column("mean", counter.getMean()))
+            .addInsertion(id, family, column("marker", marker))
+            .execute();
+
+        return counter;
+    }
+
+    private String id(final Counter.Key key, final String marker) {
+        return cassandra.generateKey(key.getRole().getName(), key.getName(), marker);
+    }
+
+    private static Number getOrZero(final DynamicDelegatedSerializer<Number> delegatedSerializer, final HColumn<String, Number> col, final Serializer<? extends Number> serializer) {
+        delegatedSerializer.setDelegate(serializer);
+        if (col == null || col.getValue() == null) {
+            return 0;
+        }
+        return col.getValue();
+    }
+
+    private static <B> HColumn<String, B> column(final String name, final B value) {
+        return HFactory.createColumn(name, value, StringSerializer.get(), (Serializer<B>) SerializerTypeInferer.getSerializer(value));
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/gauge/CassandraCollectorGaugeDataStore.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/gauge/CassandraCollectorGaugeDataStore.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/gauge/CassandraCollectorGaugeDataStore.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/gauge/CassandraCollectorGaugeDataStore.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,66 @@
+/*
+ * 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.sirona.cassandra.collector.gauge;
+
+import org.apache.sirona.Role;
+import org.apache.sirona.store.gauge.CollectorGaugeDataStore;
+import org.apache.sirona.store.gauge.GaugeValuesRequest;
+
+import java.util.Collection;
+import java.util.Map;
+
+public class CassandraCollectorGaugeDataStore implements CollectorGaugeDataStore {
+    @Override
+    public Map<Long, Double> getGaugeValues(final GaugeValuesRequest gaugeValuesRequest) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<Role> gauges() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Role findGaugeRole(final String name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void gaugeStopped(final Role gauge) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Map<Long, Double> getGaugeValues(final GaugeValuesRequest gaugeValuesRequest, final String marker) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void createOrNoopGauge(final Role role, final String marker) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void addToGauge(final Role role, final long time, final double value, final String marker) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<String> markers() {
+        throw new UnsupportedOperationException();
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/status/CassandraCollectorNodeStatusDataStore.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/status/CassandraCollectorNodeStatusDataStore.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/status/CassandraCollectorNodeStatusDataStore.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/main/java/org/apache/sirona/cassandra/collector/status/CassandraCollectorNodeStatusDataStore.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,39 @@
+/*
+ * 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.sirona.cassandra.collector.status;
+
+import org.apache.sirona.status.NodeStatus;
+import org.apache.sirona.store.status.CollectorNodeStatusDataStore;
+
+import java.util.Map;
+
+public class CassandraCollectorNodeStatusDataStore implements CollectorNodeStatusDataStore {
+    @Override
+    public Map<String, NodeStatus> statuses() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void reset() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void store(final String node, final NodeStatus status) {
+        throw new UnsupportedOperationException();
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/AgentCounterTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/AgentCounterTest.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/AgentCounterTest.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/AgentCounterTest.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,67 @@
+/*
+ * 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.sirona.cassandra;
+
+import me.prettyprint.hector.api.Cluster;
+import me.prettyprint.hector.api.Keyspace;
+import org.apache.sirona.Role;
+import org.apache.sirona.cassandra.collector.counter.CassandraCollectorCounterDataStore;
+import org.apache.sirona.cassandra.collector.counter.CounterDao;
+import org.apache.sirona.cassandra.framework.CassandraRunner;
+import org.apache.sirona.cassandra.framework.CassandraTestInject;
+import org.apache.sirona.collector.server.store.counter.LeafCollectorCounter;
+import org.apache.sirona.counters.Counter;
+import org.apache.sirona.counters.Unit;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+@RunWith(CassandraRunner.class)
+public class AgentCounterTest {
+    @CassandraTestInject
+    private Cluster cluster;
+
+    @CassandraTestInject
+    private Keyspace keyspace;
+
+    @Test
+    public void keyspaceInit() {
+        assertEquals(3, cluster.describeKeyspaces().size()); // system keyspaces
+
+        new CassandraCollectorCounterDataStore();
+
+        assertEquals(3 + 1, cluster.describeKeyspaces().size());
+        assertNotNull(cluster.describeKeyspace(keyspace.getKeyspaceName()));
+    }
+
+    @Test
+    public void getOrCreateCounter() {
+        final Counter.Key key = new Counter.Key(new Role("K100Drap", Unit.UNARY), "K100Drap#1");
+        final String marker = "node1";
+
+        assertNull(new CounterDao().findByKey(key, marker));
+        new CassandraCollectorCounterDataStore().getOrCreateCounter(key, marker);
+        assertNotNull(new CounterDao().findByKey(key, marker));
+
+        final LeafCollectorCounter counter = new CassandraCollectorCounterDataStore().getOrCreateCounter(key, marker);
+        assertEquals("K100Drap#1", counter.getKey().getName());
+        assertEquals("K100Drap", counter.getKey().getRole().getName());
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraRunner.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraRunner.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraRunner.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraRunner.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,89 @@
+/*
+ * 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.sirona.cassandra.framework;
+
+import me.prettyprint.hector.api.Cluster;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.factory.HFactory;
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.sirona.configuration.Configuration;
+import org.apache.sirona.repositories.Repository;
+import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
+import org.junit.rules.MethodRule;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+public class CassandraRunner extends BlockJUnit4ClassRunner {
+    private static final String CLUSTER = "TestCluster";
+
+    public CassandraRunner(final Class<?> klass) throws InitializationError {
+        super(klass);
+    }
+
+    @Override
+    protected List<MethodRule> rules(Object test) {
+        final List<MethodRule> rules = super.rules(test);
+        rules.add(new MethodRule(){
+            public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
+                return new CassandraLifecycle(target, base);
+            }
+        });
+        return rules;
+    }
+
+    public class CassandraLifecycle extends Statement {
+        private final Statement next;
+        private final Object instance;
+
+        public CassandraLifecycle(final Object target, final Statement next) {
+            this.next = next;
+            this.instance = target;
+        }
+
+        @Override
+        public void evaluate() throws Throwable {
+            EmbeddedCassandraServerHelper.startEmbeddedCassandra();
+            EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
+            try {
+                final Cluster cluster = HFactory.getOrCreateCluster("TestCluster", DatabaseDescriptor.getRpcAddress().getHostName() + ":" + DatabaseDescriptor.getRpcPort());
+
+                for (final Field f : instance.getClass().getDeclaredFields()) {
+                    final CassandraTestInject annotation = f.getAnnotation(CassandraTestInject.class);
+                    if (annotation != null) {
+                        if (Cluster.class.equals(f.getType())) {
+                            f.setAccessible(true);
+                            f.set(instance, cluster);
+                        } else if (Keyspace.class.equals(f.getType())) {
+                            f.setAccessible(true);
+                            f.set(instance, HFactory.createKeyspace(CLUSTER, cluster));
+                        }
+                    }
+                }
+                next.evaluate();
+            } finally {
+                EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
+                Repository.INSTANCE.reset();
+                Configuration.shutdown();
+            }
+        }
+    }
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraTestInject.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraTestInject.java?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraTestInject.java (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/test/java/org/apache/sirona/cassandra/framework/CassandraTestInject.java Thu Nov  7 16:38:18 2013
@@ -0,0 +1,28 @@
+/*
+ * 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.sirona.cassandra.framework;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CassandraTestInject {
+    String value() default "";
+}

Added: incubator/sirona/trunk/agent/store/cassandra/src/test/resources/log4j.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/test/resources/log4j.xml?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/test/resources/log4j.xml (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/test/resources/log4j.xml Thu Nov  7 16:38:18 2013
@@ -0,0 +1,27 @@
+<?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.
+-->
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+  <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.SimpleLayout" />
+  </appender>
+  <root>
+    <priority value ="info" />
+    <appender-ref ref="stdout" />
+  </root>
+</log4j:configuration>
\ No newline at end of file

Added: incubator/sirona/trunk/agent/store/cassandra/src/test/resources/sirona.properties
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cassandra/src/test/resources/sirona.properties?rev=1539707&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/store/cassandra/src/test/resources/sirona.properties (added)
+++ incubator/sirona/trunk/agent/store/cassandra/src/test/resources/sirona.properties Thu Nov  7 16:38:18 2013
@@ -0,0 +1,17 @@
+# 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.
+org.apache.sirona.cassandra.CassandraBuilder.keyspace = TestCluster

Modified: incubator/sirona/trunk/agent/store/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/pom.xml?rev=1539707&r1=1539706&r2=1539707&view=diff
==============================================================================
--- incubator/sirona/trunk/agent/store/pom.xml (original)
+++ incubator/sirona/trunk/agent/store/pom.xml Thu Nov  7 16:38:18 2013
@@ -33,5 +33,6 @@
   <modules>
     <module>graphite</module>
     <module>cube</module>
+    <module>cassandra</module>
   </modules>
 </project>

Modified: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/configuration/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/core/src/main/java/org/apache/sirona/configuration/Configuration.java?rev=1539707&r1=1539706&r2=1539707&view=diff
==============================================================================
--- incubator/sirona/trunk/core/src/main/java/org/apache/sirona/configuration/Configuration.java (original)
+++ incubator/sirona/trunk/core/src/main/java/org/apache/sirona/configuration/Configuration.java Thu Nov  7 16:38:18 2013
@@ -244,6 +244,9 @@ public final class Configuration {
         if (String.class.equals(type)) {
             return value;
         }
+        if (String[].class.equals(type)) {
+            return value.split(",");
+        }
         if (int.class.equals(type)) {
             return Integer.parseInt(value);
         }

Modified: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/counters/Counter.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/core/src/main/java/org/apache/sirona/counters/Counter.java?rev=1539707&r1=1539706&r2=1539707&view=diff
==============================================================================
--- incubator/sirona/trunk/core/src/main/java/org/apache/sirona/counters/Counter.java (original)
+++ incubator/sirona/trunk/core/src/main/java/org/apache/sirona/counters/Counter.java Thu Nov  7 16:38:18 2013
@@ -18,6 +18,7 @@ package org.apache.sirona.counters;
 
 import org.apache.sirona.Role;
 
+import java.io.Serializable;
 import java.util.concurrent.atomic.AtomicInteger;
 
 /**
@@ -59,7 +60,7 @@ public interface Counter {
 
     double getSecondMoment(); // here for aggregation etc but not (yet?) a human metric so not in MetricData
 
-    public static class Key {
+    public static class Key implements Serializable {
         private final String name;
         private final Role role;
 

Modified: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/math/M2AwareStatisticalSummary.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/core/src/main/java/org/apache/sirona/math/M2AwareStatisticalSummary.java?rev=1539707&r1=1539706&r2=1539707&view=diff
==============================================================================
--- incubator/sirona/trunk/core/src/main/java/org/apache/sirona/math/M2AwareStatisticalSummary.java (original)
+++ incubator/sirona/trunk/core/src/main/java/org/apache/sirona/math/M2AwareStatisticalSummary.java Thu Nov  7 16:38:18 2013
@@ -16,9 +16,10 @@
  */
 package org.apache.sirona.math;
 
+import java.io.Serializable;
 import java.util.Map;
 
-public class M2AwareStatisticalSummary {
+public class M2AwareStatisticalSummary implements Serializable {
     private final double mean;
     private final double variance;
     private final long n;
@@ -92,8 +93,4 @@ public class M2AwareStatisticalSummary {
     public double getSum() {
         return sum;
     }
-
-    public double getM2() {
-        return m2;
-    }
 }

Modified: incubator/sirona/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/pom.xml?rev=1539707&r1=1539706&r2=1539707&view=diff
==============================================================================
--- incubator/sirona/trunk/pom.xml (original)
+++ incubator/sirona/trunk/pom.xml Thu Nov  7 16:38:18 2013
@@ -297,6 +297,12 @@
       </dependency>
       <dependency>
         <groupId>org.apache.sirona</groupId>
+        <artifactId>sirona-collector</artifactId>
+        <version>${project.version}</version>
+        <classifier>classes</classifier>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.sirona</groupId>
         <artifactId>sirona-aop</artifactId>
         <version>${project.version}</version>
       </dependency>

Modified: incubator/sirona/trunk/server/collector/src/main/java/org/apache/sirona/collector/server/store/counter/CollectorCounter.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/collector/src/main/java/org/apache/sirona/collector/server/store/counter/CollectorCounter.java?rev=1539707&r1=1539706&r2=1539707&view=diff
==============================================================================
--- incubator/sirona/trunk/server/collector/src/main/java/org/apache/sirona/collector/server/store/counter/CollectorCounter.java (original)
+++ incubator/sirona/trunk/server/collector/src/main/java/org/apache/sirona/collector/server/store/counter/CollectorCounter.java Thu Nov  7 16:38:18 2013
@@ -20,12 +20,13 @@ import org.apache.sirona.math.M2AwareSta
 import org.apache.sirona.counters.Counter;
 import org.apache.sirona.counters.Unit;
 
+import java.io.Serializable;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-public abstract class CollectorCounter implements Counter {
+public abstract class CollectorCounter implements Counter, Serializable {
     protected final Key key;
     protected final ReadWriteLock lock = new ReentrantReadWriteLock();
     protected volatile int maxConcurrency = 0;