Permalink
Browse files

Reformatted with spaces instead of tabs

  • Loading branch information...
1 parent ee88bbf commit eaa3ad7585b8c9dfc4b332a88941d6faf61ea44a @johanoskarsson johanoskarsson committed May 22, 2010
@@ -144,14 +144,14 @@ public int read(String table, String key, Set<String> fields, HashMap<String, St
{
Exception errorexception = null;
try
- {
- client.set_keyspace(table);
- } catch (Exception e)
- {
- e.printStackTrace();
- e.printStackTrace(System.out);
- return Error;
- }
+ {
+ client.set_keyspace(table);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ e.printStackTrace(System.out);
+ return Error;
+ }
for (int i = 0; i < OperationRetries; i++)
{
@@ -249,14 +249,14 @@ public int scan(String table, String startkey, int recordcount, Set<String> fiel
Exception errorexception = null;
try
- {
- client.set_keyspace(table);
- } catch (Exception e)
- {
- e.printStackTrace();
- e.printStackTrace(System.out);
- return Error;
- }
+ {
+ client.set_keyspace(table);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ e.printStackTrace(System.out);
+ return Error;
+ }
for (int i = 0; i < OperationRetries; i++)
{
@@ -368,14 +368,14 @@ public int insert(String table, String key, HashMap<String, String> values)
Exception errorexception = null;
try
- {
- client.set_keyspace(table);
- } catch (Exception e)
- {
- e.printStackTrace();
- e.printStackTrace(System.out);
- return Error;
- }
+ {
+ client.set_keyspace(table);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ e.printStackTrace(System.out);
+ return Error;
+ }
for (int i = 0; i < OperationRetries; i++)
{
@@ -389,8 +389,8 @@ public int insert(String table, String key, HashMap<String, String> values)
Map<String, List<Mutation>> cfMutationMap = new HashMap<String, List<Mutation>>();
cfMutationMap.put("data", v);
batch_mutation.put(key.getBytes("UTF-8"), cfMutationMap);
-
- for (String field : values.keySet())
+
+ for (String field : values.keySet())
{
String val = values.get(field);
Column col = new Column(field.getBytes("UTF-8"), val.getBytes("UTF-8"), timestamp);
@@ -442,15 +442,15 @@ public int delete(String table, String key)
Exception errorexception = null;
try
- {
- client.set_keyspace(table);
- } catch (Exception e)
- {
- e.printStackTrace();
- e.printStackTrace(System.out);
- return Error;
- }
-
+ {
+ client.set_keyspace(table);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ e.printStackTrace(System.out);
+ return Error;
+ }
+
for (int i = 0; i < OperationRetries; i++)
{
try
@@ -137,18 +137,19 @@ public void reportReturnCode(String operation, int code)
data.get(operation).reportReturnCode(code);
}
- /**
- * Export the current measurements to a suitable format.
- * @param exporter Exporter representing the type of format to write to.
- * @throws IOException Thrown if the export failed.
- */
- public void exportMeasurements(MeasurementsExporter exporter) throws IOException
- {
- for (OneMeasurement measurement : data.values())
+ /**
+ * Export the current measurements to a suitable format.
+ *
+ * @param exporter Exporter representing the type of format to write to.
+ * @throws IOException Thrown if the export failed.
+ */
+ public void exportMeasurements(MeasurementsExporter exporter) throws IOException
+ {
+ for (OneMeasurement measurement : data.values())
{
measurement.exportMeasurements(exporter);
}
- }
+ }
/**
* Return a one line summary of the measurements.
@@ -45,11 +45,11 @@ public OneMeasurement(String _name) {
public abstract String getSummary();
- /**
- * Export the current measurements to a suitable format.
- *
- * @param exporter Exporter representing the type of format to write to.
- * @throws IOException Thrown if the export failed.
- */
- public abstract void exportMeasurements(MeasurementsExporter exporter) throws IOException;
+ /**
+ * Export the current measurements to a suitable format.
+ *
+ * @param exporter Exporter representing the type of format to write to.
+ * @throws IOException Thrown if the export failed.
+ */
+ public abstract void exportMeasurements(MeasurementsExporter exporter) throws IOException;
}
@@ -31,44 +31,44 @@
public class JSONMeasurementsExporter implements MeasurementsExporter
{
- private JsonFactory factory = new JsonFactory();
- private JsonGenerator g;
+ private JsonFactory factory = new JsonFactory();
+ private JsonGenerator g;
- public JSONMeasurementsExporter(OutputStream os) throws IOException
- {
+ public JSONMeasurementsExporter(OutputStream os) throws IOException
+ {
- BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
- g = factory.createJsonGenerator(bw);
- g.setPrettyPrinter(new DefaultPrettyPrinter());
- }
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
+ g = factory.createJsonGenerator(bw);
+ g.setPrettyPrinter(new DefaultPrettyPrinter());
+ }
- @Override
- public void write(String metric, String measurement, int i) throws IOException
- {
- g.writeStartObject();
- g.writeStringField("metric", metric);
- g.writeStringField("measurement", measurement);
- g.writeNumberField("value", i);
- g.writeEndObject();
- }
+ @Override
+ public void write(String metric, String measurement, int i) throws IOException
+ {
+ g.writeStartObject();
+ g.writeStringField("metric", metric);
+ g.writeStringField("measurement", measurement);
+ g.writeNumberField("value", i);
+ g.writeEndObject();
+ }
- @Override
- public void write(String metric, String measurement, double d) throws IOException
- {
- g.writeStartObject();
- g.writeStringField("metric", metric);
- g.writeStringField("measurement", measurement);
- g.writeNumberField("value", d);
- g.writeEndObject();
- }
+ @Override
+ public void write(String metric, String measurement, double d) throws IOException
+ {
+ g.writeStartObject();
+ g.writeStringField("metric", metric);
+ g.writeStringField("measurement", measurement);
+ g.writeNumberField("value", d);
+ g.writeEndObject();
+ }
- @Override
- public void close() throws IOException
- {
- if (g != null)
- {
- g.close();
- }
- }
+ @Override
+ public void close() throws IOException
+ {
+ if (g != null)
+ {
+ g.close();
+ }
+ }
}
@@ -26,32 +26,24 @@
public interface MeasurementsExporter extends Closeable
{
- /**
- * Write a measurement to the exported format.
- *
- * @param metric
- * Metric name, for example "READ LATENCY".
- * @param measurement
- * Measurement name, for example "Average latency".
- * @param i
- * Measurement to write.
- * @throws IOException
- * if writing failed
- */
- public void write(String metric, String measurement, int i) throws IOException;
+ /**
+ * Write a measurement to the exported format.
+ *
+ * @param metric Metric name, for example "READ LATENCY".
+ * @param measurement Measurement name, for example "Average latency".
+ * @param i Measurement to write.
+ * @throws IOException if writing failed
+ */
+ public void write(String metric, String measurement, int i) throws IOException;
- /**
- * Write a measurement to the exported format.
- *
- * @param metric
- * Metric name, for example "READ LATENCY".
- * @param measurement
- * Measurement name, for example "Average latency".
- * @param d
- * Measurement to write.
- * @throws IOException
- * if writing failed
- */
- public void write(String metric, String measurement, double d) throws IOException;
+ /**
+ * Write a measurement to the exported format.
+ *
+ * @param metric Metric name, for example "READ LATENCY".
+ * @param measurement Measurement name, for example "Average latency".
+ * @param d Measurement to write.
+ * @throws IOException if writing failed
+ */
+ public void write(String metric, String measurement, double d) throws IOException;
}
@@ -27,31 +27,31 @@
public class TextMeasurementsExporter implements MeasurementsExporter
{
- private BufferedWriter bw;
-
- public TextMeasurementsExporter(OutputStream os)
- {
- this.bw = new BufferedWriter(new OutputStreamWriter(os));
- }
-
- @Override
- public void write(String metric, String measurement, int i) throws IOException
- {
- bw.write("[" + metric + "], " + measurement + ", " + i);
- bw.newLine();
- }
-
- @Override
- public void write(String metric, String measurement, double d) throws IOException
- {
- bw.write("[" + metric + "], " + measurement + ", " + d);
- bw.newLine();
- }
-
- @Override
- public void close() throws IOException
- {
- this.bw.close();
- }
+ private BufferedWriter bw;
+
+ public TextMeasurementsExporter(OutputStream os)
+ {
+ this.bw = new BufferedWriter(new OutputStreamWriter(os));
+ }
+
+ @Override
+ public void write(String metric, String measurement, int i) throws IOException
+ {
+ bw.write("[" + metric + "], " + measurement + ", " + i);
+ bw.newLine();
+ }
+
+ @Override
+ public void write(String metric, String measurement, double d) throws IOException
+ {
+ bw.write("[" + metric + "], " + measurement + ", " + d);
+ bw.newLine();
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ this.bw.close();
+ }
}

0 comments on commit eaa3ad7

Please sign in to comment.