You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/11/24 19:21:24 UTC
[4/6] camel git commit: code formating
code formating
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3c013e9a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3c013e9a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3c013e9a
Branch: refs/heads/master
Commit: 3c013e9a647d42a60cab2662fa416b7aa8780bb2
Parents: 7f51008
Author: woj-i <wo...@gmail.com>
Authored: Fri Oct 23 09:53:38 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Nov 24 19:07:56 2015 +0100
----------------------------------------------------------------------
.../camel/component/hbase/HBaseEndpoint.java | 50 ++++++++++----------
.../camel/component/hbase/HBaseProducer.java | 20 +++++---
2 files changed, 38 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3c013e9a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseEndpoint.java b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseEndpoint.java
index 2abc6f1..a8f94d0 100644
--- a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseEndpoint.java
+++ b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseEndpoint.java
@@ -71,10 +71,10 @@ public class HBaseEndpoint extends DefaultEndpoint {
@UriParam(description = "UserGroupInformation for HBase communication. If not specified, then Camel talks with HBase without Kerberos")
private UserGroupInformation ugi;
- /**
- * in the purpose of performance optimization
- */
- private byte[] tableNameBytes;
+ /**
+ * in the purpose of performance optimization
+ */
+ private byte[] tableNameBytes;
public HBaseEndpoint(String uri, HBaseComponent component, HTablePool tablePool, String tableName) {
super(uri, component);
@@ -82,9 +82,9 @@ public class HBaseEndpoint extends DefaultEndpoint {
this.tablePool = tablePool;
if (this.tableName == null) {
throw new IllegalArgumentException("Table name can not be null");
- }else{
- tableNameBytes = tableName.getBytes();
- }
+ } else {
+ tableNameBytes = tableName.getBytes();
+ }
}
public Producer createProducer() throws Exception {
@@ -92,7 +92,7 @@ public class HBaseEndpoint extends DefaultEndpoint {
}
public Consumer createConsumer(Processor processor) throws Exception {
- HBaseConsumer consumer = new HBaseConsumer(this, processor);
+ HBaseConsumer consumer = new HBaseConsumer(this, processor);
configureConsumer(consumer);
consumer.setMaxMessagesPerPoll(maxMessagesPerPoll);
return consumer;
@@ -232,27 +232,27 @@ public class HBaseEndpoint extends DefaultEndpoint {
/**
* Defines privileges to communicate with HBase table by {@link #getTable()}
- * @param ugi
+ * @param ugi
*/
public void setUgi(UserGroupInformation ugi) {
this.ugi = ugi;
}
/**
- * Gets connection to the table (secured or not, depends on the object initialization)
- * please remember to close the table after use
- * @return table, remember to close!
- */
- public HTableInterface getTable(){
- if (ugi!=null){
- return ugi.doAs(new PrivilegedAction<HTableInterface>() {
- @Override
- public HTableInterface run() {
- return tablePool.getTable(tableNameBytes);
- }
- });
- }else{
- return tablePool.getTable(tableNameBytes);
- }
- }
+ * Gets connection to the table (secured or not, depends on the object initialization)
+ * please remember to close the table after use
+ * @return table, remember to close!
+ */
+ public HTableInterface getTable() {
+ if (ugi != null) {
+ return ugi.doAs(new PrivilegedAction<HTableInterface>() {
+ @Override
+ public HTableInterface run() {
+ return tablePool.getTable(tableNameBytes);
+ }
+ });
+ } else {
+ return tablePool.getTable(tableNameBytes);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c013e9a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseProducer.java b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseProducer.java
index 215e502..dcdc57b 100644
--- a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseProducer.java
+++ b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseProducer.java
@@ -57,7 +57,7 @@ public class HBaseProducer extends DefaultProducer implements ServicePoolAware {
}
public void process(Exchange exchange) throws Exception {
- HTableInterface table = endpoint.getTable();
+ HTableInterface table = endpoint.getTable();
try {
updateHeaders(exchange);
@@ -100,7 +100,7 @@ public class HBaseProducer extends DefaultProducer implements ServicePoolAware {
mappingStrategy.applyScanResults(exchange.getOut(), new HBaseData(scanOperationResult));
}
} finally {
- table.close();
+ table.close();
}
}
@@ -124,7 +124,8 @@ public class HBaseProducer extends DefaultProducer implements ServicePoolAware {
ObjectHelper.notNull(family, "HBase column family", cell);
ObjectHelper.notNull(column, "HBase column", cell);
- put.add(HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column), endpoint.getCamelContext().getTypeConverter().convertTo(byte[].class, value));
+ put.add(HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column),
+ endpoint.getCamelContext().getTypeConverter().convertTo(byte[].class, value));
}
return put;
}
@@ -168,7 +169,8 @@ public class HBaseProducer extends DefaultProducer implements ServicePoolAware {
List<KeyValue> kvs = result.getColumn(HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column));
if (kvs != null && !kvs.isEmpty()) {
//Return the most recent entry.
- resultCell.setValue(endpoint.getCamelContext().getTypeConverter().convertTo(cellModel.getValueType(), kvs.get(0).getValue()));
+ resultCell
+ .setValue(endpoint.getCamelContext().getTypeConverter().convertTo(cellModel.getValueType(), kvs.get(0).getValue()));
resultCell.setTimestamp(kvs.get(0).getTimestamp());
}
resultCells.add(resultCell);
@@ -190,7 +192,8 @@ public class HBaseProducer extends DefaultProducer implements ServicePoolAware {
* Performs an HBase {@link Get} on a specific row, using a collection of values (family/column/value pairs).
* The result is <p>the most recent entry</p> for each column.
*/
- private List<HBaseRow> scanCells(HTableInterface table, HBaseRow model, String start, Integer maxRowScan, List<Filter> filters) throws Exception {
+ private List<HBaseRow> scanCells(HTableInterface table, HBaseRow model, String start, Integer maxRowScan, List<Filter> filters)
+ throws Exception {
List<HBaseRow> rowSet = new LinkedList<HBaseRow>();
HBaseRow startRow = new HBaseRow(model.getCells());
@@ -249,7 +252,9 @@ public class HBaseProducer extends DefaultProducer implements ServicePoolAware {
resultCell.setQualifier(modelCell.getQualifier());
if (result.getColumnLatest(HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column)) != null) {
- resultCell.setTimestamp(result.getColumnLatest(HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column)).getTimestamp());
+ resultCell.setTimestamp(
+ result.getColumnLatest(HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column))
+ .getTimestamp());
}
resultRow.getCells().add(resultCell);
}
@@ -272,7 +277,8 @@ public class HBaseProducer extends DefaultProducer implements ServicePoolAware {
exchange.getIn().setHeader(CellMappingStrategyFactory.STRATEGY, endpoint.getMappingStrategyName());
}
- if (endpoint.getMappingStrategyName() != null && exchange.getIn().getHeader(CellMappingStrategyFactory.STRATEGY_CLASS_NAME) == null) {
+ if (endpoint.getMappingStrategyName() != null &&
+ exchange.getIn().getHeader(CellMappingStrategyFactory.STRATEGY_CLASS_NAME) == null) {
exchange.getIn().setHeader(CellMappingStrategyFactory.STRATEGY_CLASS_NAME, endpoint.getMappingStrategyClassName());
}