This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo-examples.git
The following commit(s) were added to refs/heads/main by this push: new 333873d Update examples build and dependencies (#84) 333873d is described below commit 333873d8ea691da24c1664393e32322d97c2aac6 Author: Christopher Tubbs <ctubb...@apache.org> AuthorDate: Mon Dec 13 13:15:48 2021 -0500 Update examples build and dependencies (#84) * Use latest Apache parent pom (24) * Use Console instead of JLine to simplify things, since JLine isn't needed * Use Accumulo parent POM for version resolution * Update sortpom, impsort, and formatter * Remove malformed javadocs * Suppress deprecation warnings to reduce noise for examples of deprecated code * Remove unused variables (static log objects) --- pom.xml | 94 +++++++--------------- .../java/org/apache/accumulo/examples/Common.java | 2 - .../accumulo/examples/client/TracingExample.java | 1 + .../examples/filedata/CharacterHistogram.java | 1 + .../examples/filedata/ChunkInputFormat.java | 5 +- .../accumulo/examples/filedata/FileDataIngest.java | 4 - .../examples/mapreduce/bulk/BulkIngestExample.java | 4 - .../apache/accumulo/examples/reservations/ARS.java | 25 +++--- .../accumulo/examples/sample/SampleExample.java | 9 +-- .../examples/filedata/ChunkInputFormatIT.java | 1 + 10 files changed, 50 insertions(+), 96 deletions(-) diff --git a/pom.xml b/pom.xml index f47110c..6f85a88 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache</groupId> <artifactId>apache</artifactId> - <version>23</version> + <version>24</version> </parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-examples</artifactId> @@ -33,18 +33,28 @@ <hadoop.version>3.3.0</hadoop.version> <htrace.hadoop.version>4.1.0-incubating</htrace.hadoop.version> <htrace.version>3.2.0-incubating</htrace.version> - <log4j.version>2.14.0</log4j.version> <maven.compiler.release>11</maven.compiler.release> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> + <minimalJavaBuildVersion>11</minimalJavaBuildVersion> + <minimalMavenBuildVersion>3.5.0</minimalMavenBuildVersion> + <!-- timestamp for reproducible outputs, updated on release by the release plugin --> + <project.build.outputTimestamp>2020-12-17T22:06:50Z</project.build.outputTimestamp> <zookeeper.version>3.5.9</zookeeper.version> </properties> <dependencyManagement> <dependencies> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>29.0-jre</version> + <groupId>org.apache.accumulo</groupId> + <artifactId>accumulo-project</artifactId> + <version>${accumulo.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.apache.htrace</groupId> + <artifactId>htrace-core</artifactId> + <version>${htrace.version}</version> </dependency> </dependencies> </dependencyManagement> @@ -52,89 +62,65 @@ <dependency> <groupId>com.beust</groupId> <artifactId>jcommander</artifactId> - <version>1.72</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> <dependency> - <groupId>commons-configuration</groupId> - <artifactId>commons-configuration</artifactId> - <version>1.10</version> - </dependency> - <dependency> - <groupId>jline</groupId> - <artifactId>jline</artifactId> - <version>2.14.6</version> - </dependency> - <dependency> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-core</artifactId> - <version>${accumulo.version}</version> </dependency> <dependency> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-hadoop-mapreduce</artifactId> - <version>${accumulo.version}</version> </dependency> <dependency> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-tracer</artifactId> - <version>${accumulo.version}</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-client</artifactId> - <version>${hadoop.version}</version> </dependency> <dependency> <groupId>org.apache.htrace</groupId> <artifactId>htrace-core</artifactId> - <version>${htrace.version}</version> </dependency> <dependency> <groupId>org.apache.htrace</groupId> <artifactId>htrace-core4</artifactId> - <version>${htrace.hadoop.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> - <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> - <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> - <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> - <version>${zookeeper.version}</version> </dependency> <!-- Test dependencies --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.13.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-minicluster</artifactId> - <version>${accumulo.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-test</artifactId> - <version>${accumulo.version}</version> <scope>test</scope> </dependency> </dependencies> @@ -145,7 +131,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.1</version> <configuration> <optimize>true</optimize> </configuration> @@ -153,15 +138,17 @@ <plugin> <groupId>com.github.ekryd.sortpom</groupId> <artifactId>sortpom-maven-plugin</artifactId> - <version>2.10.0</version> + <version>3.0.0</version> <configuration> - <predefinedSortOrder>recommended_2008_06</predefinedSortOrder> <createBackupFile>false</createBackupFile> - <lineSeparator>\n</lineSeparator> <expandEmptyElements>false</expandEmptyElements> + <keepBlankLines>false</keepBlankLines> + <lineSeparator>\n</lineSeparator> <nrOfIndentSpace>2</nrOfIndentSpace> + <predefinedSortOrder>recommended_2008_06</predefinedSortOrder> <sortDependencies>scope,groupId,artifactId</sortDependencies> <sortProperties>true</sortProperties> + <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement> <verifyFail>Stop</verifyFail> </configuration> </plugin> @@ -175,30 +162,6 @@ <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-enforcer-plugin</artifactId> - <executions> - <execution> - <!-- must be same id as in the apache parent pom, to override the version --> - <id>enforce-maven-version</id> - <goals> - <goal>enforce</goal> - </goals> - <phase>validate</phase> - <configuration> - <rules> - <requireMavenVersion> - <version>[3.5.0,)</version> - </requireMavenVersion> - <requireJavaVersion> - <version>[11,)</version> - </requireJavaVersion> - </rules> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <executions> <execution> @@ -214,7 +177,7 @@ <!-- This was added to ensure project only uses public API --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> - <version>3.1.0</version> + <version>3.1.2</version> <configuration> <configLocation>contrib/checkstyle.xml</configLocation> </configuration> @@ -222,7 +185,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>8.29</version> + <version>9.1</version> </dependency> </dependencies> <executions> @@ -237,7 +200,7 @@ <plugin> <groupId>net.revelc.code</groupId> <artifactId>impsort-maven-plugin</artifactId> - <version>1.3.0</version> + <version>1.6.2</version> <configuration> <removeUnused>true</removeUnused> <groups>java.,javax.,org.,com.</groups> @@ -275,19 +238,20 @@ <plugin> <groupId>net.revelc.code.formatter</groupId> <artifactId>formatter-maven-plugin</artifactId> - <version>2.10.0</version> + <version>2.17.1</version> <configuration> - <configFile>${eclipseFormatterStyle}</configFile> <compilerCompliance>${maven.compiler.source}</compilerCompliance> <compilerSource>${maven.compiler.source}</compilerSource> <compilerTargetPlatform>${maven.compiler.target}</compilerTargetPlatform> + <configFile>${eclipseFormatterStyle}</configFile> <lineEnding>LF</lineEnding> <overrideConfigCompilerVersion>true</overrideConfigCompilerVersion> - <skipJsFormatting>true</skipJsFormatting> + <removeTrailingWhitespace>true</removeTrailingWhitespace> + <skipCssFormatting>true</skipCssFormatting> <skipHtmlFormatting>true</skipHtmlFormatting> - <skipXmlFormatting>true</skipXmlFormatting> + <skipJsFormatting>true</skipJsFormatting> <skipJsonFormatting>true</skipJsonFormatting> - <skipCssFormatting>true</skipCssFormatting> + <skipXmlFormatting>true</skipXmlFormatting> </configuration> <executions> <execution> diff --git a/src/main/java/org/apache/accumulo/examples/Common.java b/src/main/java/org/apache/accumulo/examples/Common.java index 69d1043..5fb99df 100644 --- a/src/main/java/org/apache/accumulo/examples/Common.java +++ b/src/main/java/org/apache/accumulo/examples/Common.java @@ -29,8 +29,6 @@ public class Common { * AccumuloClient instance * @param table * The name of the table to be created - * @throws AccumuloException - * @throws AccumuloSecurityException */ public static void createTableWithNamespace(final AccumuloClient client, final String table) throws AccumuloException, AccumuloSecurityException { diff --git a/src/main/java/org/apache/accumulo/examples/client/TracingExample.java b/src/main/java/org/apache/accumulo/examples/client/TracingExample.java index 5891b96..77c04ea 100644 --- a/src/main/java/org/apache/accumulo/examples/client/TracingExample.java +++ b/src/main/java/org/apache/accumulo/examples/client/TracingExample.java @@ -119,6 +119,7 @@ public class TracingExample { scope.close(); } + @SuppressWarnings("deprecation") private void readEntries(Opts opts) throws TableNotFoundException { Scanner scanner = client.createScanner(opts.getTableName(), opts.auths); diff --git a/src/main/java/org/apache/accumulo/examples/filedata/CharacterHistogram.java b/src/main/java/org/apache/accumulo/examples/filedata/CharacterHistogram.java index 26bc73e..01c08bc 100644 --- a/src/main/java/org/apache/accumulo/examples/filedata/CharacterHistogram.java +++ b/src/main/java/org/apache/accumulo/examples/filedata/CharacterHistogram.java @@ -79,6 +79,7 @@ public class CharacterHistogram { String visibilities = ""; } + @SuppressWarnings("deprecation") public static void main(String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(CharacterHistogram.class.getName(), args); diff --git a/src/main/java/org/apache/accumulo/examples/filedata/ChunkInputFormat.java b/src/main/java/org/apache/accumulo/examples/filedata/ChunkInputFormat.java index 3a29f8d..914375f 100644 --- a/src/main/java/org/apache/accumulo/examples/filedata/ChunkInputFormat.java +++ b/src/main/java/org/apache/accumulo/examples/filedata/ChunkInputFormat.java @@ -22,7 +22,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; -import org.apache.accumulo.core.client.mapreduce.InputFormatBase; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.examples.util.FormatUtil; @@ -37,7 +36,9 @@ import com.google.common.collect.PeekingIterator; * An InputFormat that turns the file data ingested with {@link FileDataIngest} into an InputStream * using {@link ChunkInputStream}. Mappers used with this InputFormat must close the InputStream. */ -public class ChunkInputFormat extends InputFormatBase<List<Entry<Key,Value>>,InputStream> { +@SuppressWarnings("deprecation") +public class ChunkInputFormat extends + org.apache.accumulo.core.client.mapreduce.InputFormatBase<List<Entry<Key,Value>>,InputStream> { @Override public RecordReader<List<Entry<Key,Value>>,InputStream> createRecordReader(InputSplit split, TaskAttemptContext context) { diff --git a/src/main/java/org/apache/accumulo/examples/filedata/FileDataIngest.java b/src/main/java/org/apache/accumulo/examples/filedata/FileDataIngest.java index d649ac8..4249bcd 100644 --- a/src/main/java/org/apache/accumulo/examples/filedata/FileDataIngest.java +++ b/src/main/java/org/apache/accumulo/examples/filedata/FileDataIngest.java @@ -37,8 +37,6 @@ import org.apache.accumulo.examples.Common; import org.apache.accumulo.examples.cli.BatchWriterOpts; import org.apache.accumulo.examples.cli.ClientOnRequiredTable; import org.apache.hadoop.io.Text; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.beust.jcommander.Parameter; @@ -47,8 +45,6 @@ import com.beust.jcommander.Parameter; */ public class FileDataIngest { - private static final Logger log = LoggerFactory.getLogger(FileDataIngest.class); - public static final Text CHUNK_CF = new Text("~chunk"); public static final Text REFS_CF = new Text("refs"); public static final String REFS_ORIG_FILE = "name"; diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java b/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java index 0225731..aa163aa 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java @@ -37,8 +37,6 @@ import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Example map reduce job that bulk ingest data into an accumulo table. The expected input is text @@ -46,8 +44,6 @@ import org.slf4j.LoggerFactory; */ public final class BulkIngestExample { - private static final Logger log = LoggerFactory.getLogger(BulkIngestExample.class); - static final String workDir = "tmp/bulkWork"; static final String inputDir = "bulk"; static final String outputFile = "bulk/test_1.txt"; diff --git a/src/main/java/org/apache/accumulo/examples/reservations/ARS.java b/src/main/java/org/apache/accumulo/examples/reservations/ARS.java index 572487b..852cb26 100644 --- a/src/main/java/org/apache/accumulo/examples/reservations/ARS.java +++ b/src/main/java/org/apache/accumulo/examples/reservations/ARS.java @@ -37,8 +37,6 @@ import org.apache.hadoop.io.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jline.console.ConsoleReader; - /** * Accumulo Reservation System : An example reservation system using Accumulo. Supports atomic * reservations of a resource at a date. Wait list are also supported. In order to keep the example @@ -250,11 +248,12 @@ public class ARS { } public static void main(String[] args) throws Exception { - final ConsoleReader reader = new ConsoleReader(); + var console = System.console(); + var out = System.out; ARS ars = null; while (true) { - String line = reader.readLine(">"); + String line = console.readLine(">"); if (line == null) break; @@ -272,7 +271,7 @@ public class ARS { @Override public void run() { try { - reader.println(" " + String.format("%20s", tokens[whoIndex]) + " : " + out.println(" " + String.format("%20s", tokens[whoIndex]) + " : " + fars.reserve(tokens[1], tokens[2], tokens[whoIndex])); } catch (Exception e) { log.warn("Could not write to the ConsoleReader.", e); @@ -294,9 +293,9 @@ public class ARS { } else if (tokens[0].equals("list") && tokens.length == 3 && ars != null) { List<String> reservations = ars.list(tokens[1], tokens[2]); if (reservations.size() > 0) { - reader.println(" Reservation holder : " + reservations.get(0)); + out.println(" Reservation holder : " + reservations.get(0)); if (reservations.size() > 1) - reader.println(" Wait list : " + reservations.subList(1, reservations.size())); + out.println(" Wait list : " + reservations.subList(1, reservations.size())); } } else if (tokens[0].equals("quit") && tokens.length == 1) { break; @@ -307,18 +306,18 @@ public class ARS { .as(tokens[3], tokens[4]).build(); if (client.tableOperations().exists(tokens[5])) { ars = new ARS(client, tokens[5]); - reader.println(" connected"); + out.println(" connected"); } else { - reader.println(" No Such Table"); + out.println(" No Such Table"); } } else { System.out.println(" Commands : "); if (ars == null) { - reader.println(" connect <instance> <zookeepers> <user> <pass> <table>"); + out.println(" connect <instance> <zookeepers> <user> <pass> <table>"); } else { - reader.println(" reserve <what> <when> <who> {who}"); - reader.println(" cancel <what> <when> <who>"); - reader.println(" list <what> <when>"); + out.println(" reserve <what> <when> <who> {who}"); + out.println(" cancel <what> <when> <who>"); + out.println(" list <what> <when>"); } } } diff --git a/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java b/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java index 304f33a..5845fa3 100644 --- a/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java +++ b/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java @@ -26,7 +26,6 @@ import org.apache.accumulo.core.client.SampleNotPresentException; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.admin.CompactionConfig; -import org.apache.accumulo.core.client.admin.CompactionStrategyConfig; import org.apache.accumulo.core.client.sample.RowSampler; import org.apache.accumulo.core.client.sample.SamplerConfiguration; import org.apache.accumulo.core.data.Key; @@ -37,8 +36,6 @@ import org.apache.accumulo.examples.cli.BatchWriterOpts; import org.apache.accumulo.examples.cli.ClientOnDefaultTable; import org.apache.accumulo.examples.client.RandomBatchWriter; import org.apache.accumulo.examples.shard.CutoffIntersectingIterator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableMap; @@ -49,11 +46,10 @@ import com.google.common.collect.ImmutableMap; */ public class SampleExample { - private static final Logger log = LoggerFactory.getLogger(SampleExample.class); - // a compaction strategy that only selects files for compaction that have no sample data or sample // data created in a different way than the tables - static final CompactionStrategyConfig NO_SAMPLE_STRATEGY = new CompactionStrategyConfig( + @SuppressWarnings("removal") + static final org.apache.accumulo.core.client.admin.CompactionStrategyConfig NO_SAMPLE_STRATEGY = new org.apache.accumulo.core.client.admin.CompactionStrategyConfig( "org.apache.accumulo.tserver.compaction.strategies.ConfigurableCompactionStrategy") .setOptions(Collections.singletonMap("SF_NO_SAMPLE", "")); @@ -63,6 +59,7 @@ public class SampleExample { } } + @SuppressWarnings("removal") public static void main(String[] args) throws Exception { Opts opts = new Opts(); BatchWriterOpts bwOpts = new BatchWriterOpts(); diff --git a/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java b/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java index 5756493..ee0900a 100644 --- a/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java +++ b/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java @@ -239,6 +239,7 @@ public class ChunkInputFormatIT extends AccumuloClusterHarness { } } + @SuppressWarnings("deprecation") @Override public int run(String[] args) throws Exception { if (args.length != 2) {