You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by jd...@apache.org on 2016/07/25 17:15:38 UTC
[33/36] incubator-kudu git commit: [java-client] repackage to
org.apache.kudu (Part 1)
[java-client] repackage to org.apache.kudu (Part 1)
Move all org.kududb directories to org.apache.kudu
Change-Id: I0b2956974a5869c597b9620d9ee403afa7fed8aa
Reviewed-on: http://gerrit.cloudera.org:8080/3736
Tested-by: Kudu Jenkins
Reviewed-by: Jean-Daniel Cryans <jd...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/5c305689
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/5c305689
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/5c305689
Branch: refs/heads/master
Commit: 5c305689b301140c8e656af16175e9b3c841cd5c
Parents: 88a1cf0
Author: Dan Burkert <da...@cloudera.com>
Authored: Sat Jul 23 11:10:16 2016 -0700
Committer: Jean-Daniel Cryans <jd...@apache.org>
Committed: Mon Jul 25 17:13:53 2016 +0000
----------------------------------------------------------------------
.../kudu/annotations/InterfaceAudience.java | 74 +
.../kudu/annotations/InterfaceStability.java | 66 +
.../ExcludePrivateAnnotationsJDiffDoclet.java | 61 +
...ExcludePrivateAnnotationsStandardDoclet.java | 60 +
.../IncludePublicAnnotationsStandardDoclet.java | 65 +
.../annotations/tools/RootDocProcessor.java | 248 ++
.../annotations/tools/StabilityOptions.java | 71 +
.../kudu/annotations/tools/package-info.java | 22 +
.../kududb/annotations/InterfaceAudience.java | 74 -
.../kududb/annotations/InterfaceStability.java | 66 -
.../ExcludePrivateAnnotationsJDiffDoclet.java | 61 -
...ExcludePrivateAnnotationsStandardDoclet.java | 60 -
.../IncludePublicAnnotationsStandardDoclet.java | 65 -
.../annotations/tools/RootDocProcessor.java | 248 --
.../annotations/tools/StabilityOptions.java | 71 -
.../kududb/annotations/tools/package-info.java | 22 -
.../apache/kudu/mapreduce/tools/CsvParser.java | 162 ++
.../apache/kudu/mapreduce/tools/ImportCsv.java | 116 +
.../kudu/mapreduce/tools/ImportCsvMapper.java | 143 +
.../tools/IntegrationTestBigLinkedList.java | 1662 ++++++++++++
.../apache/kudu/mapreduce/tools/RowCounter.java | 127 +
.../org/kududb/mapreduce/tools/CsvParser.java | 162 --
.../org/kududb/mapreduce/tools/ImportCsv.java | 116 -
.../kududb/mapreduce/tools/ImportCsvMapper.java | 143 -
.../tools/IntegrationTestBigLinkedList.java | 1662 ------------
.../org/kududb/mapreduce/tools/RowCounter.java | 127 -
.../kudu/mapreduce/tools/ITImportCsv.java | 123 +
.../tools/ITIntegrationTestBigLinkedList.java | 69 +
.../kudu/mapreduce/tools/ITRowCounter.java | 68 +
.../org/kududb/mapreduce/tools/ITImportCsv.java | 123 -
.../tools/ITIntegrationTestBigLinkedList.java | 69 -
.../kududb/mapreduce/tools/ITRowCounter.java | 68 -
.../main/java/org/apache/kudu/ColumnSchema.java | 301 +++
.../src/main/java/org/apache/kudu/Schema.java | 291 +++
.../src/main/java/org/apache/kudu/Type.java | 136 +
.../kudu/client/AbstractKuduScannerBuilder.java | 338 +++
.../apache/kudu/client/AlterTableOptions.java | 107 +
.../apache/kudu/client/AlterTableRequest.java | 70 +
.../apache/kudu/client/AlterTableResponse.java | 32 +
.../org/apache/kudu/client/AsyncKuduClient.java | 2437 ++++++++++++++++++
.../apache/kudu/client/AsyncKuduScanner.java | 894 +++++++
.../apache/kudu/client/AsyncKuduSession.java | 856 ++++++
.../main/java/org/apache/kudu/client/Batch.java | 199 ++
.../org/apache/kudu/client/BatchResponse.java | 105 +
.../main/java/org/apache/kudu/client/Bytes.java | 1094 ++++++++
.../org/apache/kudu/client/CallResponse.java | 162 ++
.../kudu/client/ColumnRangePredicate.java | 387 +++
.../apache/kudu/client/CreateTableOptions.java | 172 ++
.../apache/kudu/client/CreateTableRequest.java | 83 +
.../apache/kudu/client/CreateTableResponse.java | 31 +
.../org/apache/kudu/client/DeadlineTracker.java | 157 ++
.../java/org/apache/kudu/client/Delete.java | 41 +
.../apache/kudu/client/DeleteTableRequest.java | 68 +
.../apache/kudu/client/DeleteTableResponse.java | 32 +
.../org/apache/kudu/client/ErrorCollector.java | 83 +
.../kudu/client/ExternalConsistencyMode.java | 42 +
.../client/GetMasterRegistrationReceived.java | 231 ++
.../client/GetMasterRegistrationRequest.java | 74 +
.../client/GetMasterRegistrationResponse.java | 88 +
.../kudu/client/GetTableLocationsRequest.java | 84 +
.../kudu/client/GetTableSchemaRequest.java | 75 +
.../kudu/client/GetTableSchemaResponse.java | 79 +
.../kudu/client/HasFailedRpcException.java | 44 +
.../java/org/apache/kudu/client/IPCUtil.java | 83 +
.../java/org/apache/kudu/client/Insert.java | 37 +
.../kudu/client/IsAlterTableDoneRequest.java | 69 +
.../kudu/client/IsAlterTableDoneResponse.java | 44 +
.../kudu/client/IsCreateTableDoneRequest.java | 66 +
.../java/org/apache/kudu/client/KeyEncoder.java | 193 ++
.../java/org/apache/kudu/client/KuduClient.java | 415 +++
.../org/apache/kudu/client/KuduException.java | 99 +
.../org/apache/kudu/client/KuduPredicate.java | 683 +++++
.../java/org/apache/kudu/client/KuduRpc.java | 363 +++
.../org/apache/kudu/client/KuduRpcResponse.java | 56 +
.../org/apache/kudu/client/KuduScanToken.java | 315 +++
.../org/apache/kudu/client/KuduScanner.java | 149 ++
.../org/apache/kudu/client/KuduSession.java | 190 ++
.../java/org/apache/kudu/client/KuduTable.java | 203 ++
.../apache/kudu/client/ListTablesRequest.java | 73 +
.../apache/kudu/client/ListTablesResponse.java | 42 +
.../kudu/client/ListTabletServersRequest.java | 67 +
.../kudu/client/ListTabletServersResponse.java | 58 +
.../apache/kudu/client/ListTabletsRequest.java | 70 +
.../apache/kudu/client/ListTabletsResponse.java | 40 +
.../org/apache/kudu/client/LocatedTablet.java | 132 +
.../client/NoLeaderMasterFoundException.java | 37 +
.../kudu/client/NonCoveredRangeCache.java | 104 +
.../kudu/client/NonCoveredRangeException.java | 51 +
.../kudu/client/NonRecoverableException.java | 53 +
.../java/org/apache/kudu/client/Operation.java | 345 +++
.../apache/kudu/client/OperationResponse.java | 111 +
.../java/org/apache/kudu/client/PartialRow.java | 626 +++++
.../java/org/apache/kudu/client/Partition.java | 182 ++
.../org/apache/kudu/client/PartitionSchema.java | 142 +
.../kudu/client/PleaseThrottleException.java | 105 +
.../org/apache/kudu/client/ProtobufHelper.java | 253 ++
.../kudu/client/RecoverableException.java | 56 +
.../org/apache/kudu/client/RequestTracker.java | 76 +
.../java/org/apache/kudu/client/RowError.java | 116 +
.../kudu/client/RowErrorsAndOverflowStatus.java | 51 +
.../java/org/apache/kudu/client/RowResult.java | 570 ++++
.../apache/kudu/client/RowResultIterator.java | 132 +
.../org/apache/kudu/client/SecureRpcHelper.java | 285 ++
.../kudu/client/SessionConfiguration.java | 158 ++
.../java/org/apache/kudu/client/Statistics.java | 258 ++
.../java/org/apache/kudu/client/Status.java | 373 +++
.../org/apache/kudu/client/TabletClient.java | 879 +++++++
.../java/org/apache/kudu/client/Update.java | 37 +
.../java/org/apache/kudu/client/Upsert.java | 37 +
.../java/org/apache/kudu/util/AsyncUtil.java | 73 +
.../org/apache/kudu/util/HybridTimeUtil.java | 70 +
.../main/java/org/apache/kudu/util/NetUtil.java | 78 +
.../main/java/org/apache/kudu/util/Pair.java | 57 +
.../main/java/org/apache/kudu/util/Slice.java | 702 +++++
.../main/java/org/apache/kudu/util/Slices.java | 259 ++
.../src/main/java/org/kududb/ColumnSchema.java | 301 ---
.../src/main/java/org/kududb/Schema.java | 291 ---
.../src/main/java/org/kududb/Type.java | 136 -
.../client/AbstractKuduScannerBuilder.java | 338 ---
.../org/kududb/client/AlterTableOptions.java | 107 -
.../org/kududb/client/AlterTableRequest.java | 70 -
.../org/kududb/client/AlterTableResponse.java | 32 -
.../java/org/kududb/client/AsyncKuduClient.java | 2437 ------------------
.../org/kududb/client/AsyncKuduScanner.java | 894 -------
.../org/kududb/client/AsyncKuduSession.java | 856 ------
.../src/main/java/org/kududb/client/Batch.java | 199 --
.../java/org/kududb/client/BatchResponse.java | 105 -
.../src/main/java/org/kududb/client/Bytes.java | 1094 --------
.../java/org/kududb/client/CallResponse.java | 162 --
.../org/kududb/client/ColumnRangePredicate.java | 387 ---
.../org/kududb/client/CreateTableOptions.java | 172 --
.../org/kududb/client/CreateTableRequest.java | 83 -
.../org/kududb/client/CreateTableResponse.java | 31 -
.../java/org/kududb/client/DeadlineTracker.java | 157 --
.../src/main/java/org/kududb/client/Delete.java | 41 -
.../org/kududb/client/DeleteTableRequest.java | 68 -
.../org/kududb/client/DeleteTableResponse.java | 32 -
.../java/org/kududb/client/ErrorCollector.java | 83 -
.../kududb/client/ExternalConsistencyMode.java | 42 -
.../client/GetMasterRegistrationReceived.java | 231 --
.../client/GetMasterRegistrationRequest.java | 74 -
.../client/GetMasterRegistrationResponse.java | 88 -
.../kududb/client/GetTableLocationsRequest.java | 84 -
.../kududb/client/GetTableSchemaRequest.java | 75 -
.../kududb/client/GetTableSchemaResponse.java | 79 -
.../kududb/client/HasFailedRpcException.java | 44 -
.../main/java/org/kududb/client/IPCUtil.java | 83 -
.../src/main/java/org/kududb/client/Insert.java | 37 -
.../kududb/client/IsAlterTableDoneRequest.java | 69 -
.../kududb/client/IsAlterTableDoneResponse.java | 44 -
.../kududb/client/IsCreateTableDoneRequest.java | 66 -
.../main/java/org/kududb/client/KeyEncoder.java | 193 --
.../main/java/org/kududb/client/KuduClient.java | 415 ---
.../java/org/kududb/client/KuduException.java | 99 -
.../java/org/kududb/client/KuduPredicate.java | 683 -----
.../main/java/org/kududb/client/KuduRpc.java | 363 ---
.../java/org/kududb/client/KuduRpcResponse.java | 56 -
.../java/org/kududb/client/KuduScanToken.java | 315 ---
.../java/org/kududb/client/KuduScanner.java | 149 --
.../java/org/kududb/client/KuduSession.java | 190 --
.../main/java/org/kududb/client/KuduTable.java | 203 --
.../org/kududb/client/ListTablesRequest.java | 73 -
.../org/kududb/client/ListTablesResponse.java | 42 -
.../kududb/client/ListTabletServersRequest.java | 67 -
.../client/ListTabletServersResponse.java | 58 -
.../org/kududb/client/ListTabletsRequest.java | 70 -
.../org/kududb/client/ListTabletsResponse.java | 40 -
.../java/org/kududb/client/LocatedTablet.java | 132 -
.../client/NoLeaderMasterFoundException.java | 37 -
.../org/kududb/client/NonCoveredRangeCache.java | 104 -
.../kududb/client/NonCoveredRangeException.java | 51 -
.../kududb/client/NonRecoverableException.java | 53 -
.../main/java/org/kududb/client/Operation.java | 345 ---
.../org/kududb/client/OperationResponse.java | 111 -
.../main/java/org/kududb/client/PartialRow.java | 626 -----
.../main/java/org/kududb/client/Partition.java | 182 --
.../java/org/kududb/client/PartitionSchema.java | 142 -
.../kududb/client/PleaseThrottleException.java | 105 -
.../java/org/kududb/client/ProtobufHelper.java | 253 --
.../org/kududb/client/RecoverableException.java | 56 -
.../java/org/kududb/client/RequestTracker.java | 76 -
.../main/java/org/kududb/client/RowError.java | 116 -
.../client/RowErrorsAndOverflowStatus.java | 51 -
.../main/java/org/kududb/client/RowResult.java | 570 ----
.../org/kududb/client/RowResultIterator.java | 132 -
.../java/org/kududb/client/SecureRpcHelper.java | 285 --
.../org/kududb/client/SessionConfiguration.java | 158 --
.../main/java/org/kududb/client/Statistics.java | 258 --
.../src/main/java/org/kududb/client/Status.java | 373 ---
.../java/org/kududb/client/TabletClient.java | 879 -------
.../src/main/java/org/kududb/client/Update.java | 37 -
.../src/main/java/org/kududb/client/Upsert.java | 37 -
.../main/java/org/kududb/util/AsyncUtil.java | 73 -
.../java/org/kududb/util/HybridTimeUtil.java | 70 -
.../src/main/java/org/kududb/util/NetUtil.java | 78 -
.../src/main/java/org/kududb/util/Pair.java | 57 -
.../src/main/java/org/kududb/util/Slice.java | 702 -----
.../src/main/java/org/kududb/util/Slices.java | 259 --
.../org/apache/kudu/client/BaseKuduTest.java | 438 ++++
.../java/org/apache/kudu/client/ITClient.java | 396 +++
.../kudu/client/ITScannerMultiTablet.java | 129 +
.../org/apache/kudu/client/MiniKuduCluster.java | 474 ++++
.../apache/kudu/client/TestAsyncKuduClient.java | 157 ++
.../kudu/client/TestAsyncKuduSession.java | 514 ++++
.../java/org/apache/kudu/client/TestBitSet.java | 99 +
.../java/org/apache/kudu/client/TestBytes.java | 105 +
.../kudu/client/TestColumnRangePredicate.java | 72 +
.../apache/kudu/client/TestDeadlineTracker.java | 74 +
.../apache/kudu/client/TestErrorCollector.java | 90 +
.../kudu/client/TestFlexiblePartitioning.java | 422 +++
.../org/apache/kudu/client/TestHybridTime.java | 163 ++
.../org/apache/kudu/client/TestKeyEncoding.java | 272 ++
.../org/apache/kudu/client/TestKuduClient.java | 535 ++++
.../apache/kudu/client/TestKuduPredicate.java | 628 +++++
.../org/apache/kudu/client/TestKuduSession.java | 337 +++
.../org/apache/kudu/client/TestKuduTable.java | 301 +++
.../apache/kudu/client/TestLeaderFailover.java | 69 +
.../apache/kudu/client/TestMasterFailover.java | 72 +
.../apache/kudu/client/TestMiniKuduCluster.java | 116 +
.../org/apache/kudu/client/TestOperation.java | 166 ++
.../apache/kudu/client/TestRequestTracker.java | 74 +
.../org/apache/kudu/client/TestRowErrors.java | 98 +
.../org/apache/kudu/client/TestRowResult.java | 129 +
.../apache/kudu/client/TestScanPredicate.java | 609 +++++
.../kudu/client/TestScannerMultiTablet.java | 236 ++
.../org/apache/kudu/client/TestStatistics.java | 74 +
.../java/org/apache/kudu/client/TestStatus.java | 55 +
.../org/apache/kudu/client/TestTestUtils.java | 114 +
.../org/apache/kudu/client/TestTimeouts.java | 68 +
.../java/org/apache/kudu/client/TestUtils.java | 289 +++
.../org/apache/kudu/util/TestAsyncUtil.java | 75 +
.../org/apache/kudu/util/TestMurmurHash.java | 46 +
.../java/org/apache/kudu/util/TestNetUtil.java | 73 +
.../java/org/kududb/client/BaseKuduTest.java | 438 ----
.../test/java/org/kududb/client/ITClient.java | 396 ---
.../org/kududb/client/ITScannerMultiTablet.java | 129 -
.../java/org/kududb/client/MiniKuduCluster.java | 474 ----
.../org/kududb/client/TestAsyncKuduClient.java | 157 --
.../org/kududb/client/TestAsyncKuduSession.java | 514 ----
.../test/java/org/kududb/client/TestBitSet.java | 99 -
.../test/java/org/kududb/client/TestBytes.java | 105 -
.../kududb/client/TestColumnRangePredicate.java | 72 -
.../org/kududb/client/TestDeadlineTracker.java | 74 -
.../org/kududb/client/TestErrorCollector.java | 90 -
.../kududb/client/TestFlexiblePartitioning.java | 422 ---
.../java/org/kududb/client/TestHybridTime.java | 163 --
.../java/org/kududb/client/TestKeyEncoding.java | 272 --
.../java/org/kududb/client/TestKuduClient.java | 535 ----
.../org/kududb/client/TestKuduPredicate.java | 628 -----
.../java/org/kududb/client/TestKuduSession.java | 337 ---
.../java/org/kududb/client/TestKuduTable.java | 301 ---
.../org/kududb/client/TestLeaderFailover.java | 69 -
.../org/kududb/client/TestMasterFailover.java | 72 -
.../org/kududb/client/TestMiniKuduCluster.java | 116 -
.../java/org/kududb/client/TestOperation.java | 166 --
.../org/kududb/client/TestRequestTracker.java | 74 -
.../java/org/kududb/client/TestRowErrors.java | 98 -
.../java/org/kududb/client/TestRowResult.java | 129 -
.../org/kududb/client/TestScanPredicate.java | 609 -----
.../kududb/client/TestScannerMultiTablet.java | 236 --
.../java/org/kududb/client/TestStatistics.java | 74 -
.../test/java/org/kududb/client/TestStatus.java | 55 -
.../java/org/kududb/client/TestTestUtils.java | 114 -
.../java/org/kududb/client/TestTimeouts.java | 68 -
.../test/java/org/kududb/client/TestUtils.java | 289 ---
.../java/org/kududb/util/TestAsyncUtil.java | 75 -
.../java/org/kududb/util/TestMurmurHash.java | 46 -
.../test/java/org/kududb/util/TestNetUtil.java | 73 -
.../kudu/flume/sink/KuduEventProducer.java | 59 +
.../org/apache/kudu/flume/sink/KuduSink.java | 290 +++
.../sink/KuduSinkConfigurationConstants.java | 67 +
.../flume/sink/SimpleKuduEventProducer.java | 84 +
.../kududb/flume/sink/KuduEventProducer.java | 59 -
.../java/org/kududb/flume/sink/KuduSink.java | 290 ---
.../sink/KuduSinkConfigurationConstants.java | 67 -
.../flume/sink/SimpleKuduEventProducer.java | 84 -
.../apache/kudu/flume/sink/KuduSinkTest.java | 246 ++
.../org/kududb/flume/sink/KuduSinkTest.java | 246 --
.../kudu/mapreduce/CommandLineParser.java | 144 ++
.../org/apache/kudu/mapreduce/JarFinder.java | 179 ++
.../kudu/mapreduce/KuduTableInputFormat.java | 444 ++++
.../kudu/mapreduce/KuduTableMapReduceUtil.java | 541 ++++
.../mapreduce/KuduTableOutputCommitter.java | 57 +
.../kudu/mapreduce/KuduTableOutputFormat.java | 215 ++
.../org/apache/kudu/mapreduce/TableReducer.java | 28 +
.../org/kududb/mapreduce/CommandLineParser.java | 144 --
.../java/org/kududb/mapreduce/JarFinder.java | 179 --
.../kududb/mapreduce/KuduTableInputFormat.java | 444 ----
.../mapreduce/KuduTableMapReduceUtil.java | 541 ----
.../mapreduce/KuduTableOutputCommitter.java | 57 -
.../kududb/mapreduce/KuduTableOutputFormat.java | 215 --
.../java/org/kududb/mapreduce/TableReducer.java | 28 -
.../kudu/mapreduce/HadoopTestingUtility.java | 101 +
.../apache/kudu/mapreduce/ITInputFormatJob.java | 129 +
.../kudu/mapreduce/ITKuduTableInputFormat.java | 132 +
.../kudu/mapreduce/ITKuduTableOutputFormat.java | 66 +
.../kudu/mapreduce/ITOutputFormatJob.java | 131 +
.../apache/kudu/mapreduce/TestJarFinder.java | 128 +
.../kududb/mapreduce/HadoopTestingUtility.java | 101 -
.../org/kududb/mapreduce/ITInputFormatJob.java | 129 -
.../mapreduce/ITKuduTableInputFormat.java | 132 -
.../mapreduce/ITKuduTableOutputFormat.java | 66 -
.../org/kududb/mapreduce/ITOutputFormatJob.java | 131 -
.../org/kududb/mapreduce/TestJarFinder.java | 128 -
.../apache/kudu/spark/kudu/DefaultSource.scala | 276 ++
.../apache/kudu/spark/kudu/KuduContext.scala | 227 ++
.../org/apache/kudu/spark/kudu/KuduRDD.scala | 133 +
.../org/apache/kudu/spark/kudu/package.scala | 38 +
.../org/kududb/spark/kudu/DefaultSource.scala | 276 --
.../org/kududb/spark/kudu/KuduContext.scala | 227 --
.../scala/org/kududb/spark/kudu/KuduRDD.scala | 133 -
.../scala/org/kududb/spark/kudu/package.scala | 38 -
.../kudu/spark/kudu/DefaultSourceTest.scala | 266 ++
.../kudu/spark/kudu/KuduContextTest.scala | 35 +
.../apache/kudu/spark/kudu/TestContext.scala | 124 +
.../kududb/spark/kudu/DefaultSourceTest.scala | 266 --
.../org/kududb/spark/kudu/KuduContextTest.scala | 35 -
.../org/kududb/spark/kudu/TestContext.scala | 124 -
318 files changed, 33362 insertions(+), 33362 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/apache/kudu/annotations/InterfaceAudience.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/apache/kudu/annotations/InterfaceAudience.java b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/InterfaceAudience.java
new file mode 100644
index 0000000..b834947
--- /dev/null
+++ b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/InterfaceAudience.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * 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.kududb.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Annotation to inform users of a package, class or method's intended audience.
+ * Currently the audience can be {@link Public}, {@link LimitedPrivate} or
+ * {@link Private}. <br>
+ * All public classes must have InterfaceAudience annotation. <br>
+ * <ul>
+ * <li>Public classes that are not marked with this annotation must be
+ * considered by default as {@link Private}.</li>
+ *
+ * <li>External applications must only use classes that are marked
+ * {@link Public}. Avoid using non public classes as these classes
+ * could be removed or change in incompatible ways.</li>
+ *
+ * <li>Hadoop projects must only use classes that are marked
+ * {@link LimitedPrivate} or {@link Public}</li>
+ *
+ * <li> Methods may have a different annotation that it is more restrictive
+ * compared to the audience classification of the class. Example: A class
+ * might be {@link Public}, but a method may be {@link LimitedPrivate}
+ * </li></ul>
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public class InterfaceAudience {
+ /**
+ * Intended for use by any project or application.
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Public {};
+
+ /**
+ * Intended only for the project(s) specified in the annotation.
+ * For example, "Common", "HDFS", "MapReduce", "ZooKeeper", "HBase".
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface LimitedPrivate {
+ String[] value();
+ };
+
+ /**
+ * Intended for use only within Kudu itself.
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Private {};
+
+ private InterfaceAudience() {} // Audience can't exist on its own
+}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/apache/kudu/annotations/InterfaceStability.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/apache/kudu/annotations/InterfaceStability.java b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/InterfaceStability.java
new file mode 100644
index 0000000..84950e6
--- /dev/null
+++ b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/InterfaceStability.java
@@ -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.kududb.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.kududb.annotations.InterfaceAudience.LimitedPrivate;
+import org.kududb.annotations.InterfaceAudience.Private;
+import org.kududb.annotations.InterfaceAudience.Public;
+
+/**
+ * Annotation to inform users of how much to rely on a particular package,
+ * class or method not changing over time. Currently the stability can be
+ * {@link Stable}, {@link Evolving} or {@link Unstable}. <br>
+ *
+ * <ul><li>All classes that are annotated with {@link Public} or
+ * {@link LimitedPrivate} must have InterfaceStability annotation. </li>
+ * <li>Classes that are {@link Private} are to be considered unstable unless
+ * a different InterfaceStability annotation states otherwise.</li>
+ * <li>Incompatible changes must not be made to classes marked as stable.</li>
+ * </ul>
+ */
+@Public
+@InterfaceStability.Evolving
+public class InterfaceStability {
+ /**
+ * Can evolve while retaining compatibility for minor release boundaries.;
+ * can break compatibility only at major release (ie. at m.0).
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Stable {};
+
+ /**
+ * Evolving, but can break compatibility at minor release (i.e. m.x)
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Evolving {};
+
+ /**
+ * No guarantee is provided as to reliability or stability across any
+ * level of release granularity.
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Unstable {};
+}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/ExcludePrivateAnnotationsJDiffDoclet.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/ExcludePrivateAnnotationsJDiffDoclet.java b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/ExcludePrivateAnnotationsJDiffDoclet.java
new file mode 100644
index 0000000..5c0c7b8
--- /dev/null
+++ b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/ExcludePrivateAnnotationsJDiffDoclet.java
@@ -0,0 +1,61 @@
+/*
+ *
+ * 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.kududb.annotations.tools;
+
+import com.sun.javadoc.DocErrorReporter;
+import com.sun.javadoc.LanguageVersion;
+import com.sun.javadoc.RootDoc;
+
+import jdiff.JDiff;
+import org.kududb.annotations.InterfaceAudience;
+
+/**
+ * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a>
+ * for excluding elements that are annotated with
+ * {@link InterfaceAudience.Private} or
+ * {@link InterfaceAudience.LimitedPrivate}.
+ * It delegates to the JDiff Doclet, and takes the same options.
+ */
+public class ExcludePrivateAnnotationsJDiffDoclet {
+
+ public static LanguageVersion languageVersion() {
+ return LanguageVersion.JAVA_1_5;
+ }
+
+ public static boolean start(RootDoc root) {
+ System.out.println(
+ ExcludePrivateAnnotationsJDiffDoclet.class.getSimpleName());
+ return JDiff.start(RootDocProcessor.process(root));
+ }
+
+ public static int optionLength(String option) {
+ Integer length = StabilityOptions.optionLength(option);
+ if (length != null) {
+ return length;
+ }
+ return JDiff.optionLength(option);
+ }
+
+ public static boolean validOptions(String[][] options,
+ DocErrorReporter reporter) {
+ StabilityOptions.validOptions(options, reporter);
+ String[][] filteredOptions = StabilityOptions.filterOptions(options);
+ return JDiff.validOptions(filteredOptions, reporter);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/ExcludePrivateAnnotationsStandardDoclet.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/ExcludePrivateAnnotationsStandardDoclet.java b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/ExcludePrivateAnnotationsStandardDoclet.java
new file mode 100644
index 0000000..af8b088
--- /dev/null
+++ b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/ExcludePrivateAnnotationsStandardDoclet.java
@@ -0,0 +1,60 @@
+/*
+ *
+ * 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.kududb.annotations.tools;
+
+import com.sun.javadoc.DocErrorReporter;
+import com.sun.javadoc.LanguageVersion;
+import com.sun.javadoc.RootDoc;
+import com.sun.tools.doclets.standard.Standard;
+import org.kududb.annotations.InterfaceAudience;
+
+/**
+ * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a>
+ * for excluding elements that are annotated with
+ * {@link InterfaceAudience.Private} or
+ * {@link InterfaceAudience.LimitedPrivate}.
+ * It delegates to the Standard Doclet, and takes the same options.
+ */
+public class ExcludePrivateAnnotationsStandardDoclet {
+
+ public static LanguageVersion languageVersion() {
+ return LanguageVersion.JAVA_1_5;
+ }
+
+ public static boolean start(RootDoc root) {
+ System.out.println(
+ ExcludePrivateAnnotationsStandardDoclet.class.getSimpleName());
+ return Standard.start(RootDocProcessor.process(root));
+ }
+
+ public static int optionLength(String option) {
+ Integer length = StabilityOptions.optionLength(option);
+ if (length != null) {
+ return length;
+ }
+ return Standard.optionLength(option);
+ }
+
+ public static boolean validOptions(String[][] options,
+ DocErrorReporter reporter) {
+ StabilityOptions.validOptions(options, reporter);
+ String[][] filteredOptions = StabilityOptions.filterOptions(options);
+ return Standard.validOptions(filteredOptions, reporter);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/IncludePublicAnnotationsStandardDoclet.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/IncludePublicAnnotationsStandardDoclet.java b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/IncludePublicAnnotationsStandardDoclet.java
new file mode 100644
index 0000000..b5a67b2
--- /dev/null
+++ b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/IncludePublicAnnotationsStandardDoclet.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.kududb.annotations.tools;
+
+import com.sun.javadoc.DocErrorReporter;
+import com.sun.javadoc.LanguageVersion;
+import com.sun.javadoc.RootDoc;
+import com.sun.tools.doclets.standard.Standard;
+import org.kududb.annotations.InterfaceAudience;
+
+/**
+ * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a>
+ * that only includes class-level elements that are annotated with
+ * {@link InterfaceAudience.Public}.
+ * Class-level elements with no annotation are excluded.
+ * In addition, all elements that are annotated with
+ * {@link InterfaceAudience.Private} or
+ * {@link InterfaceAudience.LimitedPrivate}
+ * are also excluded.
+ * It delegates to the Standard Doclet, and takes the same options.
+ */
+public class IncludePublicAnnotationsStandardDoclet {
+
+ public static LanguageVersion languageVersion() {
+ return LanguageVersion.JAVA_1_5;
+ }
+
+ public static boolean start(RootDoc root) {
+ System.out.println(
+ IncludePublicAnnotationsStandardDoclet.class.getSimpleName());
+ RootDocProcessor.treatUnannotatedClassesAsPrivate = true;
+ return Standard.start(RootDocProcessor.process(root));
+ }
+
+ public static int optionLength(String option) {
+ Integer length = StabilityOptions.optionLength(option);
+ if (length != null) {
+ return length;
+ }
+ return Standard.optionLength(option);
+ }
+
+ public static boolean validOptions(String[][] options,
+ DocErrorReporter reporter) {
+ StabilityOptions.validOptions(options, reporter);
+ String[][] filteredOptions = StabilityOptions.filterOptions(options);
+ return Standard.validOptions(filteredOptions, reporter);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/RootDocProcessor.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/RootDocProcessor.java b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/RootDocProcessor.java
new file mode 100644
index 0000000..c4f19fb
--- /dev/null
+++ b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/RootDocProcessor.java
@@ -0,0 +1,248 @@
+/*
+ *
+ * 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.kududb.annotations.tools;
+
+import com.sun.javadoc.AnnotationDesc;
+import com.sun.javadoc.AnnotationTypeDoc;
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.ConstructorDoc;
+import com.sun.javadoc.Doc;
+import com.sun.javadoc.FieldDoc;
+import com.sun.javadoc.MethodDoc;
+import com.sun.javadoc.PackageDoc;
+import com.sun.javadoc.ProgramElementDoc;
+import com.sun.javadoc.RootDoc;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.kududb.annotations.InterfaceAudience;
+import org.kududb.annotations.InterfaceStability;
+
+/**
+ * Process the {@link RootDoc} by substituting with (nested) proxy objects that
+ * exclude elements with Private or LimitedPrivate annotations.
+ * <p>
+ * Based on code from http://www.sixlegs.com/blog/java/exclude-javadoc-tag.html.
+ */
+class RootDocProcessor {
+
+ static String stability = StabilityOptions.UNSTABLE_OPTION;
+ static boolean treatUnannotatedClassesAsPrivate = false;
+
+ public static RootDoc process(RootDoc root) {
+ return (RootDoc) process(root, RootDoc.class);
+ }
+
+ private static Object process(Object obj, Class<?> type) {
+ if (obj == null) {
+ return null;
+ }
+ Class<?> cls = obj.getClass();
+ if (cls.getName().startsWith("com.sun.")) {
+ return getProxy(obj);
+ } else if (obj instanceof Object[]) {
+ Class<?> componentType = type.isArray() ? type.getComponentType()
+ : cls.getComponentType();
+ Object[] array = (Object[]) obj;
+ Object[] newArray = (Object[]) Array.newInstance(componentType,
+ array.length);
+ for (int i = 0; i < array.length; ++i) {
+ newArray[i] = process(array[i], componentType);
+ }
+ return newArray;
+ }
+ return obj;
+ }
+
+ private static Map<Object, Object> proxies =
+ new WeakHashMap<Object, Object>();
+
+ private static Object getProxy(Object obj) {
+ Object proxy = proxies.get(obj);
+ if (proxy == null) {
+ proxy = Proxy.newProxyInstance(obj.getClass().getClassLoader(),
+ obj.getClass().getInterfaces(), new ExcludeHandler(obj));
+ proxies.put(obj, proxy);
+ }
+ return proxy;
+ }
+
+ private static class ExcludeHandler implements InvocationHandler {
+ private Object target;
+
+ public ExcludeHandler(Object target) {
+ this.target = target;
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ String methodName = method.getName();
+ if (target instanceof Doc) {
+ if (methodName.equals("isIncluded")) {
+ Doc doc = (Doc) target;
+ return !exclude(doc) && doc.isIncluded();
+ }
+ if (target instanceof RootDoc) {
+ if (methodName.equals("classes")) {
+ return filter(((RootDoc) target).classes(), ClassDoc.class);
+ } else if (methodName.equals("specifiedClasses")) {
+ return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
+ } else if (methodName.equals("specifiedPackages")) {
+ return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
+ }
+ } else if (target instanceof ClassDoc) {
+ if (isFiltered(args)) {
+ if (methodName.equals("methods")) {
+ return filter(((ClassDoc) target).methods(true), MethodDoc.class);
+ } else if (methodName.equals("fields")) {
+ return filter(((ClassDoc) target).fields(true), FieldDoc.class);
+ } else if (methodName.equals("innerClasses")) {
+ return filter(((ClassDoc) target).innerClasses(true),
+ ClassDoc.class);
+ } else if (methodName.equals("constructors")) {
+ return filter(((ClassDoc) target).constructors(true),
+ ConstructorDoc.class);
+ }
+ }
+ } else if (target instanceof PackageDoc) {
+ if (methodName.equals("allClasses")) {
+ if (isFiltered(args)) {
+ return filter(((PackageDoc) target).allClasses(true),
+ ClassDoc.class);
+ } else {
+ return filter(((PackageDoc) target).allClasses(), ClassDoc.class);
+ }
+ } else if (methodName.equals("annotationTypes")) {
+ return filter(((PackageDoc) target).annotationTypes(),
+ AnnotationTypeDoc.class);
+ } else if (methodName.equals("enums")) {
+ return filter(((PackageDoc) target).enums(),
+ ClassDoc.class);
+ } else if (methodName.equals("errors")) {
+ return filter(((PackageDoc) target).errors(),
+ ClassDoc.class);
+ } else if (methodName.equals("exceptions")) {
+ return filter(((PackageDoc) target).exceptions(),
+ ClassDoc.class);
+ } else if (methodName.equals("interfaces")) {
+ return filter(((PackageDoc) target).interfaces(),
+ ClassDoc.class);
+ } else if (methodName.equals("ordinaryClasses")) {
+ return filter(((PackageDoc) target).ordinaryClasses(),
+ ClassDoc.class);
+ }
+ }
+ }
+
+ if (args != null) {
+ if (methodName.equals("compareTo") || methodName.equals("equals")
+ || methodName.equals("overrides")
+ || methodName.equals("subclassOf")) {
+ args[0] = unwrap(args[0]);
+ }
+ }
+ try {
+ return process(method.invoke(target, args), method.getReturnType());
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+
+ private static boolean exclude(Doc doc) {
+ AnnotationDesc[] annotations = null;
+ if (doc instanceof ProgramElementDoc) {
+ annotations = ((ProgramElementDoc) doc).annotations();
+ } else if (doc instanceof PackageDoc) {
+ annotations = ((PackageDoc) doc).annotations();
+ }
+ if (annotations != null) {
+ for (AnnotationDesc annotation : annotations) {
+ String qualifiedTypeName = annotation.annotationType().qualifiedTypeName();
+ if (qualifiedTypeName.equals(
+ InterfaceAudience.Private.class.getCanonicalName())
+ || qualifiedTypeName.equals(
+ InterfaceAudience.LimitedPrivate.class.getCanonicalName())) {
+ return true;
+ }
+ if (stability.equals(StabilityOptions.EVOLVING_OPTION)) {
+ if (qualifiedTypeName.equals(
+ InterfaceStability.Unstable.class.getCanonicalName())) {
+ return true;
+ }
+ }
+ if (stability.equals(StabilityOptions.STABLE_OPTION)) {
+ if (qualifiedTypeName.equals(
+ InterfaceStability.Unstable.class.getCanonicalName())
+ || qualifiedTypeName.equals(
+ InterfaceStability.Evolving.class.getCanonicalName())) {
+ return true;
+ }
+ }
+ }
+ for (AnnotationDesc annotation : annotations) {
+ String qualifiedTypeName =
+ annotation.annotationType().qualifiedTypeName();
+ if (qualifiedTypeName.equals(
+ InterfaceAudience.Public.class.getCanonicalName())) {
+ return false;
+ }
+ }
+ }
+ if (treatUnannotatedClassesAsPrivate) {
+ return doc.isClass() || doc.isInterface() || doc.isAnnotationType();
+ }
+ return false;
+ }
+
+ private static Object[] filter(Doc[] array, Class<?> componentType) {
+ if (array == null || array.length == 0) {
+ return array;
+ }
+ List<Object> list = new ArrayList<Object>(array.length);
+ for (Doc entry : array) {
+ if (!exclude(entry)) {
+ list.add(process(entry, componentType));
+ }
+ }
+ return list.toArray((Object[]) Array.newInstance(componentType, list
+ .size()));
+ }
+
+ private Object unwrap(Object proxy) {
+ if (proxy instanceof Proxy)
+ return ((ExcludeHandler) Proxy.getInvocationHandler(proxy)).target;
+ return proxy;
+ }
+
+ private boolean isFiltered(Object[] args) {
+ return args != null && Boolean.TRUE.equals(args[0]);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/StabilityOptions.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/StabilityOptions.java b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/StabilityOptions.java
new file mode 100644
index 0000000..d5cf5e1
--- /dev/null
+++ b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/StabilityOptions.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.kududb.annotations.tools;
+
+import com.sun.javadoc.DocErrorReporter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+class StabilityOptions {
+ public static final String STABLE_OPTION = "-stable";
+ public static final String EVOLVING_OPTION = "-evolving";
+ public static final String UNSTABLE_OPTION = "-unstable";
+
+ public static Integer optionLength(String option) {
+ String opt = option.toLowerCase(Locale.ENGLISH);
+ if (opt.equals(UNSTABLE_OPTION)) return 1;
+ if (opt.equals(EVOLVING_OPTION)) return 1;
+ if (opt.equals(STABLE_OPTION)) return 1;
+ return null;
+ }
+
+ public static void validOptions(String[][] options,
+ DocErrorReporter reporter) {
+ for (int i = 0; i < options.length; i++) {
+ String opt = options[i][0].toLowerCase(Locale.ENGLISH);
+ if (opt.equals(UNSTABLE_OPTION)) {
+ RootDocProcessor.stability = UNSTABLE_OPTION;
+ } else if (opt.equals(EVOLVING_OPTION)) {
+ RootDocProcessor.stability = EVOLVING_OPTION;
+ } else if (opt.equals(STABLE_OPTION)) {
+ RootDocProcessor.stability = STABLE_OPTION;
+ }
+ }
+ }
+
+ public static String[][] filterOptions(String[][] options) {
+ List<String[]> optionsList = new ArrayList<String[]>();
+ for (int i = 0; i < options.length; i++) {
+ if (!options[i][0].equalsIgnoreCase(UNSTABLE_OPTION)
+ && !options[i][0].equalsIgnoreCase(EVOLVING_OPTION)
+ && !options[i][0].equalsIgnoreCase(STABLE_OPTION)) {
+ optionsList.add(options[i]);
+ }
+ }
+ String[][] filteredOptions = new String[optionsList.size()][];
+ int i = 0;
+ for (String[] option : optionsList) {
+ filteredOptions[i++] = option;
+ }
+ return filteredOptions;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/package-info.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/package-info.java b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/package-info.java
new file mode 100644
index 0000000..ec0103b
--- /dev/null
+++ b/java/interface-annotations/src/main/java/org/apache/kudu/annotations/tools/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *
+ * 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.
+ */
+@InterfaceAudience.Private
+package org.kududb.annotations.tools;
+
+import org.kududb.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/kududb/annotations/InterfaceAudience.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/kududb/annotations/InterfaceAudience.java b/java/interface-annotations/src/main/java/org/kududb/annotations/InterfaceAudience.java
deleted file mode 100644
index b834947..0000000
--- a/java/interface-annotations/src/main/java/org/kududb/annotations/InterfaceAudience.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * 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.kududb.annotations;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Annotation to inform users of a package, class or method's intended audience.
- * Currently the audience can be {@link Public}, {@link LimitedPrivate} or
- * {@link Private}. <br>
- * All public classes must have InterfaceAudience annotation. <br>
- * <ul>
- * <li>Public classes that are not marked with this annotation must be
- * considered by default as {@link Private}.</li>
- *
- * <li>External applications must only use classes that are marked
- * {@link Public}. Avoid using non public classes as these classes
- * could be removed or change in incompatible ways.</li>
- *
- * <li>Hadoop projects must only use classes that are marked
- * {@link LimitedPrivate} or {@link Public}</li>
- *
- * <li> Methods may have a different annotation that it is more restrictive
- * compared to the audience classification of the class. Example: A class
- * might be {@link Public}, but a method may be {@link LimitedPrivate}
- * </li></ul>
- */
-@InterfaceAudience.Public
-@InterfaceStability.Evolving
-public class InterfaceAudience {
- /**
- * Intended for use by any project or application.
- */
- @Documented
- @Retention(RetentionPolicy.RUNTIME)
- public @interface Public {};
-
- /**
- * Intended only for the project(s) specified in the annotation.
- * For example, "Common", "HDFS", "MapReduce", "ZooKeeper", "HBase".
- */
- @Documented
- @Retention(RetentionPolicy.RUNTIME)
- public @interface LimitedPrivate {
- String[] value();
- };
-
- /**
- * Intended for use only within Kudu itself.
- */
- @Documented
- @Retention(RetentionPolicy.RUNTIME)
- public @interface Private {};
-
- private InterfaceAudience() {} // Audience can't exist on its own
-}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/kududb/annotations/InterfaceStability.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/kududb/annotations/InterfaceStability.java b/java/interface-annotations/src/main/java/org/kududb/annotations/InterfaceStability.java
deleted file mode 100644
index 84950e6..0000000
--- a/java/interface-annotations/src/main/java/org/kududb/annotations/InterfaceStability.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * 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.kududb.annotations;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import org.kududb.annotations.InterfaceAudience.LimitedPrivate;
-import org.kududb.annotations.InterfaceAudience.Private;
-import org.kududb.annotations.InterfaceAudience.Public;
-
-/**
- * Annotation to inform users of how much to rely on a particular package,
- * class or method not changing over time. Currently the stability can be
- * {@link Stable}, {@link Evolving} or {@link Unstable}. <br>
- *
- * <ul><li>All classes that are annotated with {@link Public} or
- * {@link LimitedPrivate} must have InterfaceStability annotation. </li>
- * <li>Classes that are {@link Private} are to be considered unstable unless
- * a different InterfaceStability annotation states otherwise.</li>
- * <li>Incompatible changes must not be made to classes marked as stable.</li>
- * </ul>
- */
-@Public
-@InterfaceStability.Evolving
-public class InterfaceStability {
- /**
- * Can evolve while retaining compatibility for minor release boundaries.;
- * can break compatibility only at major release (ie. at m.0).
- */
- @Documented
- @Retention(RetentionPolicy.RUNTIME)
- public @interface Stable {};
-
- /**
- * Evolving, but can break compatibility at minor release (i.e. m.x)
- */
- @Documented
- @Retention(RetentionPolicy.RUNTIME)
- public @interface Evolving {};
-
- /**
- * No guarantee is provided as to reliability or stability across any
- * level of release granularity.
- */
- @Documented
- @Retention(RetentionPolicy.RUNTIME)
- public @interface Unstable {};
-}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/kududb/annotations/tools/ExcludePrivateAnnotationsJDiffDoclet.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/ExcludePrivateAnnotationsJDiffDoclet.java b/java/interface-annotations/src/main/java/org/kududb/annotations/tools/ExcludePrivateAnnotationsJDiffDoclet.java
deleted file mode 100644
index 5c0c7b8..0000000
--- a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/ExcludePrivateAnnotationsJDiffDoclet.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * 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.kududb.annotations.tools;
-
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.LanguageVersion;
-import com.sun.javadoc.RootDoc;
-
-import jdiff.JDiff;
-import org.kududb.annotations.InterfaceAudience;
-
-/**
- * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a>
- * for excluding elements that are annotated with
- * {@link InterfaceAudience.Private} or
- * {@link InterfaceAudience.LimitedPrivate}.
- * It delegates to the JDiff Doclet, and takes the same options.
- */
-public class ExcludePrivateAnnotationsJDiffDoclet {
-
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_5;
- }
-
- public static boolean start(RootDoc root) {
- System.out.println(
- ExcludePrivateAnnotationsJDiffDoclet.class.getSimpleName());
- return JDiff.start(RootDocProcessor.process(root));
- }
-
- public static int optionLength(String option) {
- Integer length = StabilityOptions.optionLength(option);
- if (length != null) {
- return length;
- }
- return JDiff.optionLength(option);
- }
-
- public static boolean validOptions(String[][] options,
- DocErrorReporter reporter) {
- StabilityOptions.validOptions(options, reporter);
- String[][] filteredOptions = StabilityOptions.filterOptions(options);
- return JDiff.validOptions(filteredOptions, reporter);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/kududb/annotations/tools/ExcludePrivateAnnotationsStandardDoclet.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/ExcludePrivateAnnotationsStandardDoclet.java b/java/interface-annotations/src/main/java/org/kududb/annotations/tools/ExcludePrivateAnnotationsStandardDoclet.java
deleted file mode 100644
index af8b088..0000000
--- a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/ExcludePrivateAnnotationsStandardDoclet.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * 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.kududb.annotations.tools;
-
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.LanguageVersion;
-import com.sun.javadoc.RootDoc;
-import com.sun.tools.doclets.standard.Standard;
-import org.kududb.annotations.InterfaceAudience;
-
-/**
- * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a>
- * for excluding elements that are annotated with
- * {@link InterfaceAudience.Private} or
- * {@link InterfaceAudience.LimitedPrivate}.
- * It delegates to the Standard Doclet, and takes the same options.
- */
-public class ExcludePrivateAnnotationsStandardDoclet {
-
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_5;
- }
-
- public static boolean start(RootDoc root) {
- System.out.println(
- ExcludePrivateAnnotationsStandardDoclet.class.getSimpleName());
- return Standard.start(RootDocProcessor.process(root));
- }
-
- public static int optionLength(String option) {
- Integer length = StabilityOptions.optionLength(option);
- if (length != null) {
- return length;
- }
- return Standard.optionLength(option);
- }
-
- public static boolean validOptions(String[][] options,
- DocErrorReporter reporter) {
- StabilityOptions.validOptions(options, reporter);
- String[][] filteredOptions = StabilityOptions.filterOptions(options);
- return Standard.validOptions(filteredOptions, reporter);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/kududb/annotations/tools/IncludePublicAnnotationsStandardDoclet.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/IncludePublicAnnotationsStandardDoclet.java b/java/interface-annotations/src/main/java/org/kududb/annotations/tools/IncludePublicAnnotationsStandardDoclet.java
deleted file mode 100644
index b5a67b2..0000000
--- a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/IncludePublicAnnotationsStandardDoclet.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * 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.kududb.annotations.tools;
-
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.LanguageVersion;
-import com.sun.javadoc.RootDoc;
-import com.sun.tools.doclets.standard.Standard;
-import org.kududb.annotations.InterfaceAudience;
-
-/**
- * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a>
- * that only includes class-level elements that are annotated with
- * {@link InterfaceAudience.Public}.
- * Class-level elements with no annotation are excluded.
- * In addition, all elements that are annotated with
- * {@link InterfaceAudience.Private} or
- * {@link InterfaceAudience.LimitedPrivate}
- * are also excluded.
- * It delegates to the Standard Doclet, and takes the same options.
- */
-public class IncludePublicAnnotationsStandardDoclet {
-
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_5;
- }
-
- public static boolean start(RootDoc root) {
- System.out.println(
- IncludePublicAnnotationsStandardDoclet.class.getSimpleName());
- RootDocProcessor.treatUnannotatedClassesAsPrivate = true;
- return Standard.start(RootDocProcessor.process(root));
- }
-
- public static int optionLength(String option) {
- Integer length = StabilityOptions.optionLength(option);
- if (length != null) {
- return length;
- }
- return Standard.optionLength(option);
- }
-
- public static boolean validOptions(String[][] options,
- DocErrorReporter reporter) {
- StabilityOptions.validOptions(options, reporter);
- String[][] filteredOptions = StabilityOptions.filterOptions(options);
- return Standard.validOptions(filteredOptions, reporter);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/kududb/annotations/tools/RootDocProcessor.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/RootDocProcessor.java b/java/interface-annotations/src/main/java/org/kududb/annotations/tools/RootDocProcessor.java
deleted file mode 100644
index c4f19fb..0000000
--- a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/RootDocProcessor.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- *
- * 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.kududb.annotations.tools;
-
-import com.sun.javadoc.AnnotationDesc;
-import com.sun.javadoc.AnnotationTypeDoc;
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.ConstructorDoc;
-import com.sun.javadoc.Doc;
-import com.sun.javadoc.FieldDoc;
-import com.sun.javadoc.MethodDoc;
-import com.sun.javadoc.PackageDoc;
-import com.sun.javadoc.ProgramElementDoc;
-import com.sun.javadoc.RootDoc;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.kududb.annotations.InterfaceAudience;
-import org.kududb.annotations.InterfaceStability;
-
-/**
- * Process the {@link RootDoc} by substituting with (nested) proxy objects that
- * exclude elements with Private or LimitedPrivate annotations.
- * <p>
- * Based on code from http://www.sixlegs.com/blog/java/exclude-javadoc-tag.html.
- */
-class RootDocProcessor {
-
- static String stability = StabilityOptions.UNSTABLE_OPTION;
- static boolean treatUnannotatedClassesAsPrivate = false;
-
- public static RootDoc process(RootDoc root) {
- return (RootDoc) process(root, RootDoc.class);
- }
-
- private static Object process(Object obj, Class<?> type) {
- if (obj == null) {
- return null;
- }
- Class<?> cls = obj.getClass();
- if (cls.getName().startsWith("com.sun.")) {
- return getProxy(obj);
- } else if (obj instanceof Object[]) {
- Class<?> componentType = type.isArray() ? type.getComponentType()
- : cls.getComponentType();
- Object[] array = (Object[]) obj;
- Object[] newArray = (Object[]) Array.newInstance(componentType,
- array.length);
- for (int i = 0; i < array.length; ++i) {
- newArray[i] = process(array[i], componentType);
- }
- return newArray;
- }
- return obj;
- }
-
- private static Map<Object, Object> proxies =
- new WeakHashMap<Object, Object>();
-
- private static Object getProxy(Object obj) {
- Object proxy = proxies.get(obj);
- if (proxy == null) {
- proxy = Proxy.newProxyInstance(obj.getClass().getClassLoader(),
- obj.getClass().getInterfaces(), new ExcludeHandler(obj));
- proxies.put(obj, proxy);
- }
- return proxy;
- }
-
- private static class ExcludeHandler implements InvocationHandler {
- private Object target;
-
- public ExcludeHandler(Object target) {
- this.target = target;
- }
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- String methodName = method.getName();
- if (target instanceof Doc) {
- if (methodName.equals("isIncluded")) {
- Doc doc = (Doc) target;
- return !exclude(doc) && doc.isIncluded();
- }
- if (target instanceof RootDoc) {
- if (methodName.equals("classes")) {
- return filter(((RootDoc) target).classes(), ClassDoc.class);
- } else if (methodName.equals("specifiedClasses")) {
- return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
- } else if (methodName.equals("specifiedPackages")) {
- return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
- }
- } else if (target instanceof ClassDoc) {
- if (isFiltered(args)) {
- if (methodName.equals("methods")) {
- return filter(((ClassDoc) target).methods(true), MethodDoc.class);
- } else if (methodName.equals("fields")) {
- return filter(((ClassDoc) target).fields(true), FieldDoc.class);
- } else if (methodName.equals("innerClasses")) {
- return filter(((ClassDoc) target).innerClasses(true),
- ClassDoc.class);
- } else if (methodName.equals("constructors")) {
- return filter(((ClassDoc) target).constructors(true),
- ConstructorDoc.class);
- }
- }
- } else if (target instanceof PackageDoc) {
- if (methodName.equals("allClasses")) {
- if (isFiltered(args)) {
- return filter(((PackageDoc) target).allClasses(true),
- ClassDoc.class);
- } else {
- return filter(((PackageDoc) target).allClasses(), ClassDoc.class);
- }
- } else if (methodName.equals("annotationTypes")) {
- return filter(((PackageDoc) target).annotationTypes(),
- AnnotationTypeDoc.class);
- } else if (methodName.equals("enums")) {
- return filter(((PackageDoc) target).enums(),
- ClassDoc.class);
- } else if (methodName.equals("errors")) {
- return filter(((PackageDoc) target).errors(),
- ClassDoc.class);
- } else if (methodName.equals("exceptions")) {
- return filter(((PackageDoc) target).exceptions(),
- ClassDoc.class);
- } else if (methodName.equals("interfaces")) {
- return filter(((PackageDoc) target).interfaces(),
- ClassDoc.class);
- } else if (methodName.equals("ordinaryClasses")) {
- return filter(((PackageDoc) target).ordinaryClasses(),
- ClassDoc.class);
- }
- }
- }
-
- if (args != null) {
- if (methodName.equals("compareTo") || methodName.equals("equals")
- || methodName.equals("overrides")
- || methodName.equals("subclassOf")) {
- args[0] = unwrap(args[0]);
- }
- }
- try {
- return process(method.invoke(target, args), method.getReturnType());
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
-
- private static boolean exclude(Doc doc) {
- AnnotationDesc[] annotations = null;
- if (doc instanceof ProgramElementDoc) {
- annotations = ((ProgramElementDoc) doc).annotations();
- } else if (doc instanceof PackageDoc) {
- annotations = ((PackageDoc) doc).annotations();
- }
- if (annotations != null) {
- for (AnnotationDesc annotation : annotations) {
- String qualifiedTypeName = annotation.annotationType().qualifiedTypeName();
- if (qualifiedTypeName.equals(
- InterfaceAudience.Private.class.getCanonicalName())
- || qualifiedTypeName.equals(
- InterfaceAudience.LimitedPrivate.class.getCanonicalName())) {
- return true;
- }
- if (stability.equals(StabilityOptions.EVOLVING_OPTION)) {
- if (qualifiedTypeName.equals(
- InterfaceStability.Unstable.class.getCanonicalName())) {
- return true;
- }
- }
- if (stability.equals(StabilityOptions.STABLE_OPTION)) {
- if (qualifiedTypeName.equals(
- InterfaceStability.Unstable.class.getCanonicalName())
- || qualifiedTypeName.equals(
- InterfaceStability.Evolving.class.getCanonicalName())) {
- return true;
- }
- }
- }
- for (AnnotationDesc annotation : annotations) {
- String qualifiedTypeName =
- annotation.annotationType().qualifiedTypeName();
- if (qualifiedTypeName.equals(
- InterfaceAudience.Public.class.getCanonicalName())) {
- return false;
- }
- }
- }
- if (treatUnannotatedClassesAsPrivate) {
- return doc.isClass() || doc.isInterface() || doc.isAnnotationType();
- }
- return false;
- }
-
- private static Object[] filter(Doc[] array, Class<?> componentType) {
- if (array == null || array.length == 0) {
- return array;
- }
- List<Object> list = new ArrayList<Object>(array.length);
- for (Doc entry : array) {
- if (!exclude(entry)) {
- list.add(process(entry, componentType));
- }
- }
- return list.toArray((Object[]) Array.newInstance(componentType, list
- .size()));
- }
-
- private Object unwrap(Object proxy) {
- if (proxy instanceof Proxy)
- return ((ExcludeHandler) Proxy.getInvocationHandler(proxy)).target;
- return proxy;
- }
-
- private boolean isFiltered(Object[] args) {
- return args != null && Boolean.TRUE.equals(args[0]);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/kududb/annotations/tools/StabilityOptions.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/StabilityOptions.java b/java/interface-annotations/src/main/java/org/kududb/annotations/tools/StabilityOptions.java
deleted file mode 100644
index d5cf5e1..0000000
--- a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/StabilityOptions.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * 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.kududb.annotations.tools;
-
-import com.sun.javadoc.DocErrorReporter;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-class StabilityOptions {
- public static final String STABLE_OPTION = "-stable";
- public static final String EVOLVING_OPTION = "-evolving";
- public static final String UNSTABLE_OPTION = "-unstable";
-
- public static Integer optionLength(String option) {
- String opt = option.toLowerCase(Locale.ENGLISH);
- if (opt.equals(UNSTABLE_OPTION)) return 1;
- if (opt.equals(EVOLVING_OPTION)) return 1;
- if (opt.equals(STABLE_OPTION)) return 1;
- return null;
- }
-
- public static void validOptions(String[][] options,
- DocErrorReporter reporter) {
- for (int i = 0; i < options.length; i++) {
- String opt = options[i][0].toLowerCase(Locale.ENGLISH);
- if (opt.equals(UNSTABLE_OPTION)) {
- RootDocProcessor.stability = UNSTABLE_OPTION;
- } else if (opt.equals(EVOLVING_OPTION)) {
- RootDocProcessor.stability = EVOLVING_OPTION;
- } else if (opt.equals(STABLE_OPTION)) {
- RootDocProcessor.stability = STABLE_OPTION;
- }
- }
- }
-
- public static String[][] filterOptions(String[][] options) {
- List<String[]> optionsList = new ArrayList<String[]>();
- for (int i = 0; i < options.length; i++) {
- if (!options[i][0].equalsIgnoreCase(UNSTABLE_OPTION)
- && !options[i][0].equalsIgnoreCase(EVOLVING_OPTION)
- && !options[i][0].equalsIgnoreCase(STABLE_OPTION)) {
- optionsList.add(options[i]);
- }
- }
- String[][] filteredOptions = new String[optionsList.size()][];
- int i = 0;
- for (String[] option : optionsList) {
- filteredOptions[i++] = option;
- }
- return filteredOptions;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/interface-annotations/src/main/java/org/kududb/annotations/tools/package-info.java
----------------------------------------------------------------------
diff --git a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/package-info.java b/java/interface-annotations/src/main/java/org/kududb/annotations/tools/package-info.java
deleted file mode 100644
index ec0103b..0000000
--- a/java/interface-annotations/src/main/java/org/kududb/annotations/tools/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- *
- * 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.
- */
-@InterfaceAudience.Private
-package org.kududb.annotations.tools;
-
-import org.kududb.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/5c305689/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/CsvParser.java
----------------------------------------------------------------------
diff --git a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/CsvParser.java b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/CsvParser.java
new file mode 100644
index 0000000..945b82c
--- /dev/null
+++ b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/CsvParser.java
@@ -0,0 +1,162 @@
+/**
+ *
+ * Licensed 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. See accompanying LICENSE file.
+ */
+package org.kududb.mapreduce.tools;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
+import org.kududb.annotations.InterfaceAudience;
+import org.kududb.annotations.InterfaceStability;
+import org.kududb.client.Bytes;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Column-separated values parser that gives access to the different columns inside each line of
+ * data.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Unstable
+public class CsvParser {
+
+ private final byte separatorByte;
+
+ private final int maxColumnCount;
+
+ private final List<String> columnNames;
+
+ /**
+ * @param columnsSpecification the list of columns to parse out, comma separated.
+ * @param separatorStr The 1 byte separator.
+ */
+ public CsvParser(String columnsSpecification, String separatorStr) {
+ // Configure separator
+ byte[] separator = Bytes.fromString(separatorStr);
+ Preconditions.checkArgument(separator.length == 1, "CsvParser only supports single-byte " +
+ "separators");
+ separatorByte = separator[0];
+
+ // Configure columns
+ columnNames = Lists.newArrayList(Splitter.on(',').trimResults().split(columnsSpecification));
+
+ maxColumnCount = columnNames.size();
+ }
+
+ /**
+ * Creates a ParsedLine of a line of data.
+ * @param lineBytes Whole line as a byte array.
+ * @param length How long the line really is in the byte array
+ * @return A parsed line of CSV.
+ * @throws BadCsvLineException
+ */
+ public ParsedLine parse(byte[] lineBytes, int length) throws BadCsvLineException {
+ // Enumerate separator offsets
+ List<Integer> tabOffsets = new ArrayList<Integer>(maxColumnCount);
+ for (int i = 0; i < length; i++) {
+ if (lineBytes[i] == separatorByte) {
+ tabOffsets.add(i);
+ }
+ }
+ if (tabOffsets.isEmpty()) {
+ throw new BadCsvLineException("No delimiter");
+ }
+
+ // trailing separator shouldn't count as a column
+ if (lineBytes[length - 1] != separatorByte) {
+ tabOffsets.add(length);
+ }
+
+ if (tabOffsets.size() > maxColumnCount) {
+ throw new BadCsvLineException("Excessive columns");
+ }
+
+ if (tabOffsets.size() < maxColumnCount) {
+ throw new BadCsvLineException("Not enough columns");
+ }
+
+ return new ParsedLine(tabOffsets, lineBytes);
+ }
+
+ /**
+ * Helper class that knows where the columns are situated in the line.
+ */
+ class ParsedLine {
+ private final List<Integer> tabOffsets;
+ private final byte[] lineBytes;
+
+ ParsedLine(List<Integer> tabOffsets, byte[] lineBytes) {
+ this.tabOffsets = tabOffsets;
+ this.lineBytes = lineBytes;
+ }
+
+ /**
+ * Get the position for the given column.
+ * @param idx Column to lookup.
+ * @return Offset in the line.
+ */
+ public int getColumnOffset(int idx) {
+ if (idx > 0) {
+ return tabOffsets.get(idx - 1) + 1;
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * Get how many bytes the given column occupies.
+ * @param idx Column to lookup.
+ * @return Column's length.
+ */
+ public int getColumnLength(int idx) {
+ return tabOffsets.get(idx) - getColumnOffset(idx);
+ }
+
+ /**
+ * Get the number of columns in this file.
+ * @return Number of columns.
+ */
+ public int getColumnCount() {
+ return tabOffsets.size();
+ }
+
+ /**
+ * Get the bytes originally given for this line.
+ * @return Original byte array.
+ */
+ public byte[] getLineBytes() {
+ return lineBytes;
+ }
+
+ /**
+ * Get the given column's name.
+ * @param idx Column to lookup.
+ * @return Column's name.
+ */
+ public String getColumnName(int idx) {
+ return columnNames.get(idx);
+ }
+ }
+
+ /**
+ * Exception used when the CsvParser is unable to parse a line.
+ */
+ @SuppressWarnings("serial")
+ public static class BadCsvLineException extends Exception {
+ public BadCsvLineException(String err) {
+ super(err);
+ }
+ }
+}