GORA-490 added package-info files and javadocs for gora-accumulo
Project: http://git-wip-us.apache.org/repos/asf/gora/repo Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/0cb1aeed Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/0cb1aeed Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/0cb1aeed Branch: refs/heads/master Commit: 0cb1aeed78f3efee8902a5bfeaaff22462753422 Parents: a0249c0 Author: cihad guzel <[email protected]> Authored: Wed Aug 24 02:39:11 2016 +0300 Committer: cihad guzel <[email protected]> Committed: Thu Aug 25 01:37:57 2016 +0300 ---------------------------------------------------------------------- .../gora/accumulo/encoders/package-info.java | 20 ++++++++++++++++ .../gora/accumulo/query/AccumuloQuery.java | 13 +++++++++-- .../gora/accumulo/query/AccumuloResult.java | 15 +++++++++--- .../gora/accumulo/query/package-info.java | 21 +++++++++++++++++ .../gora/accumulo/store/AccumuloMapping.java | 12 ++++++++++ .../gora/accumulo/store/AccumuloStore.java | 24 +++++++++++++------- .../gora/accumulo/store/package-info.java | 20 ++++++++++++++++ .../util/FixedByteArrayOutputStream.java | 3 +++ .../apache/gora/accumulo/util/package-info.java | 20 ++++++++++++++++ 9 files changed, 135 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/package-info.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/package-info.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/package-info.java new file mode 100644 index 0000000..f66e7bb --- /dev/null +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/package-info.java @@ -0,0 +1,20 @@ +/** + * 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. + */ +/** + * This package contains Accumulo store related util classes for encoder. + */ +package org.apache.gora.accumulo.encoders; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloQuery.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloQuery.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloQuery.java index 78e3635..f260a4d 100644 --- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloQuery.java +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloQuery.java @@ -21,14 +21,23 @@ import org.apache.gora.query.impl.QueryBase; import org.apache.gora.store.DataStore; /** - * + * Accumulo specific implementation of the {@link org.apache.gora.query.Query} interface. */ public class AccumuloQuery<K,T extends PersistentBase> extends QueryBase<K,T> { - + + /** + * Constructor for the query + */ public AccumuloQuery() { super(null); } + /** + * Constructor for the query + * + * @param dataStore Data store used + * + */ public AccumuloQuery(DataStore<K,T> dataStore) { super(dataStore); } http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloResult.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloResult.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloResult.java index f184228..08ebeca 100644 --- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloResult.java +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/AccumuloResult.java @@ -32,12 +32,15 @@ import org.apache.gora.query.impl.ResultBase; import org.apache.gora.store.DataStore; /** - * + * Accumulo specific implementation of the {@link org.apache.gora.query.Result} interface. */ public class AccumuloResult<K,T extends PersistentBase> extends ResultBase<K,T> { private RowIterator iterator; + /** + * Gets the data store used + */ public AccumuloStore<K,T> getDataStore() { return (AccumuloStore<K,T>) super.getDataStore(); } @@ -53,7 +56,10 @@ public class AccumuloResult<K,T extends PersistentBase> extends ResultBase<K,T> // TODO set batch size based on limit, and construct iterator later iterator = new RowIterator(scanner.iterator()); } - + + /** + * Gets the items reading progress + */ @Override public float getProgress() throws IOException { // TODO Auto-generated method stub @@ -64,7 +70,10 @@ public class AccumuloResult<K,T extends PersistentBase> extends ResultBase<K,T> public void close() throws IOException { } - + + /** + * Gets the next item + */ @Override protected boolean nextInner() throws IOException { http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/package-info.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/package-info.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/package-info.java new file mode 100644 index 0000000..ce4db56 --- /dev/null +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/query/package-info.java @@ -0,0 +1,21 @@ +/** + * 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. + */ +/** + * This package contains all the Accumulo store query representation class as well as Result set representing class + * when query is executed over the Accumulo dataStore. + */ +package org.apache.gora.accumulo.query; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloMapping.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloMapping.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloMapping.java index e0744b6..a62f1ee 100644 --- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloMapping.java +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloMapping.java @@ -22,9 +22,21 @@ import java.util.Map; import org.apache.accumulo.core.util.Pair; import org.apache.hadoop.io.Text; +/** + * Mapping definitions for Accumulo. + */ public class AccumuloMapping { + + /** + * A map of field names to Field objects containing schema's fields + */ Map<String,Pair<Text,Text>> fieldMap = new HashMap<>(); + + /** + * Look up the column associated to the Avro field. + */ Map<Pair<Text,Text>,String> columnMap = new HashMap<>(); + Map<String,String> tableConfig = new HashMap<>(); String tableName; String encoder; http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java index 18145ae..a68cdaa 100644 --- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java @@ -106,7 +106,10 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** - * Directs CRUD operations into Accumulo. + * Implementation of a Accumulo data store to be used by gora. + * + * @param <K> class to be used for the key + * @param <T> class to be persisted within the store */ public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T> { @@ -342,6 +345,15 @@ public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T return batchWriter; } + /** + * Initialize the data store by reading the credentials, setting the client's properties up and + * reading the mapping file. Initialize is called when then the call to + * {@link org.apache.gora.store.DataStoreFactory#createDataStore} is made. + * + * @param keyClass + * @param persistentClass + * @param properties + */ @Override public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) { try{ @@ -845,6 +857,9 @@ public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T return scanner; } + /** + * Execute the query and return the result. + */ @Override public Result<K,T> execute(Query<K,T> query) { try { @@ -974,13 +989,6 @@ public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T throw new IllegalArgumentException(UNKOWN + clazz.getName()); } - - - /** - * @param keyClass - * @param bytes - * @return - */ @SuppressWarnings("unchecked") static <K> K followingKey(Encoder encoder, Class<K> clazz, byte[] per) { http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/package-info.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/package-info.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/package-info.java new file mode 100644 index 0000000..9ffd8b6 --- /dev/null +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/package-info.java @@ -0,0 +1,20 @@ +/** + * 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. + */ +/** + * This package contains all the Accumulo store related classes. + */ +package org.apache.gora.accumulo.store; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/FixedByteArrayOutputStream.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/FixedByteArrayOutputStream.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/FixedByteArrayOutputStream.java index d2003bb..6127f48 100644 --- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/FixedByteArrayOutputStream.java +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/FixedByteArrayOutputStream.java @@ -19,6 +19,9 @@ package org.apache.gora.accumulo.util; import java.io.IOException; import java.io.OutputStream; +/** + * It is a implementation of {@link java.io.OutputStream} must always provide at least a method that writes one byte of output. + */ public class FixedByteArrayOutputStream extends OutputStream { private int i; http://git-wip-us.apache.org/repos/asf/gora/blob/0cb1aeed/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/package-info.java ---------------------------------------------------------------------- diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/package-info.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/package-info.java new file mode 100644 index 0000000..09d27bc --- /dev/null +++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/util/package-info.java @@ -0,0 +1,20 @@ +/** + * 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. + */ +/** + * This package contains Accumulo store related util classes. + */ +package org.apache.gora.accumulo.util; \ No newline at end of file
