You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/07/22 20:54:03 UTC
[1/4] git commit: ACCUMULO-998 Use junit asserts and fix code
formatting for tests
Updated Branches:
refs/heads/master 1a48f7c34 -> 2ad6a8188
ACCUMULO-998 Use junit asserts and fix code formatting for tests
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/47d1f5fe
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/47d1f5fe
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/47d1f5fe
Branch: refs/heads/master
Commit: 47d1f5fe3ac2714bc4f7fa8baf413fbfd6ad8801
Parents: a943f32
Author: Christopher Tubbs <ct...@apache.org>
Authored: Mon Jul 22 14:31:50 2013 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Mon Jul 22 14:31:50 2013 -0400
----------------------------------------------------------------------
.../accumulo/core/file/rfile/RFileTest.java | 251 +++++++++----------
1 file changed, 113 insertions(+), 138 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/47d1f5fe/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index ebdb2d1..37b35a2 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -70,12 +70,10 @@ import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Test;
-
public class RFileTest {
private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<ByteSequence>();
-
static {
Logger.getLogger(org.apache.hadoop.io.compress.CodecPool.class).setLevel(Level.OFF);
Logger.getLogger(org.apache.hadoop.util.NativeCodeLoader.class).setLevel(Level.OFF);
@@ -174,7 +172,7 @@ public class RFileTest {
private FSDataInputStream in;
public Reader reader;
public SortedKeyValueIterator<Key,Value> iter;
-
+
public void openWriter(boolean startDLG) throws IOException {
if (outputFile == null) {
@@ -183,7 +181,7 @@ public class RFileTest {
dos = new FSDataOutputStream(baos, new FileSystem.Statistics("a"));
} else {
BufferedOutputStream bufos = new BufferedOutputStream(new FileOutputStream(outputFile));
- dos = new FSDataOutputStream(bufos, new FileSystem.Statistics("a"));
+ dos = new FSDataOutputStream(bufos, new FileSystem.Statistics("a"));
}
CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(dos, "gz", conf);
writer = new RFile.Writer(_cbw, 1000, 1000);
@@ -191,7 +189,7 @@ public class RFileTest {
if (startDLG)
writer.startDefaultLocalityGroup();
}
-
+
public void openWriter() throws IOException {
openWriter(true);
}
@@ -263,7 +261,7 @@ public class RFileTest {
trf.openWriter();
trf.closeWriter();
-
+
trf.openReader();
trf.iter.seek(new Range((Key) null, null), EMPTY_COL_FAMS, false);
assertFalse(trf.iter.hasTop());
@@ -352,10 +350,10 @@ public class RFileTest {
}
}
}
-
+
// trf.writer.append(nk("r1","cf1","cq1","L1", 55), nv("foo"));
trf.closeWriter();
-
+
trf.openReader();
// seek before everything
trf.iter.seek(new Range((Key) null, null), EMPTY_COL_FAMS, false);
@@ -448,7 +446,7 @@ public class RFileTest {
trf.iter.next();
}
}
-
+
trf.closeReader();
}
@@ -1266,8 +1264,8 @@ public class RFileTest {
count++;
indexIter.next();
}
-
- assert(count > 4);
+
+ assertTrue(count > 4);
trf.iter.seek(new Range(nk("r0000", "cf1", "cq1", "", 1), true, nk("r0001", "cf1", "cq1", "", 1), false), EMPTY_COL_FAMS, false);
@@ -1281,7 +1279,7 @@ public class RFileTest {
assertFalse(trf.iter.hasTop());
trf.iter.seek(new Range(nk("r0000", "cf1", "cq1", "", 1), false, nk("r0001", "cf1", "cq1", "", 1), true), EMPTY_COL_FAMS, false);
-
+
for (int i = 2048; i < 4096; i++) {
assertTrue(trf.iter.hasTop());
assertEquals(nk("r0001", "cf1", "cq1", "", 1), trf.iter.getTopKey());
@@ -1495,14 +1493,14 @@ public class RFileTest {
trf.openReader();
Set<ByteSequence> cfs = Collections.emptySet();
-
+
Random rand = new Random();
-
+
for (int count = 0; count < 100; count++) {
int start = rand.nextInt(2300);
Range range = new Range(nk(nf("r_", start), "cf1", "cq1", "L1", 42), nk(nf("r_", start + 100), "cf1", "cq1", "L1", 42));
-
+
trf.reader.seek(range, cfs, false);
int numToScan = rand.nextInt(100);
@@ -1515,12 +1513,12 @@ public class RFileTest {
assertTrue(trf.reader.hasTop());
assertEquals(nk(nf("r_", start + numToScan), "cf1", "cq1", "L1", 42), trf.reader.getTopKey());
-
+
// seek a little forward from the last range and read a few keys within the unconsumed portion of the last range
-
+
int start2 = start + numToScan + rand.nextInt(3);
int end2 = start2 + rand.nextInt(3);
-
+
range = new Range(nk(nf("r_", start2), "cf1", "cq1", "L1", 42), nk(nf("r_", end2), "cf1", "cq1", "L1", 42));
trf.reader.seek(range, cfs, false);
@@ -1531,13 +1529,12 @@ public class RFileTest {
}
assertFalse(trf.reader.hasTop());
-
+
}
trf.closeReader();
}
-
-
+
@Test(expected = NullPointerException.class)
public void testMissingUnreleasedVersions() throws Exception {
runVersionTest(5);
@@ -1604,12 +1601,11 @@ public class RFileTest {
reader.close();
}
-
- private AccumuloConfiguration setAndGetAccumuloConfig(String cryptoConfSetting) {
+ private AccumuloConfiguration setAndGetAccumuloConfig(String cryptoConfSetting) {
@SuppressWarnings("deprecation")
AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, cryptoConfSetting);
- ((SiteConfiguration)conf).clearAndNull();
+ ((SiteConfiguration) conf).clearAndNull();
return conf;
}
@@ -1619,25 +1615,24 @@ public class RFileTest {
} else {
System.clearProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
}
- ((SiteConfiguration)conf).clearAndNull();
+ ((SiteConfiguration) conf).clearAndNull();
}
-
-
+
@Test
public void testEncRFile1() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test1();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile2() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test2();
restoreOldConfiguration(oldSiteConfigProperty, conf);
@@ -1647,57 +1642,57 @@ public class RFileTest {
public void testEncRFile3() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test3();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile4() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test4();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile5() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test5();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile6() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test6();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile7() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test7();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile8() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test8();
restoreOldConfiguration(oldSiteConfigProperty, conf);
@@ -1707,38 +1702,37 @@ public class RFileTest {
public void testEncRFile9() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test9();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile10() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test10();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile11() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test11();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
@Test
public void testEncRFile12() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test12();
restoreOldConfiguration(oldSiteConfigProperty, conf);
@@ -1748,17 +1742,17 @@ public class RFileTest {
public void testEncRFile13() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test13();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
+
@Test
public void testEncRFile14() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test14();
restoreOldConfiguration(oldSiteConfigProperty, conf);
@@ -1768,7 +1762,7 @@ public class RFileTest {
public void testEncRFile16() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test16();
restoreOldConfiguration(oldSiteConfigProperty, conf);
@@ -1778,7 +1772,7 @@ public class RFileTest {
public void testEncRFile17() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test17();
restoreOldConfiguration(oldSiteConfigProperty, conf);
@@ -1788,7 +1782,7 @@ public class RFileTest {
public void testEncRFile18() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test18();
restoreOldConfiguration(oldSiteConfigProperty, conf);
@@ -1798,19 +1792,19 @@ public class RFileTest {
public void testEncRFile19() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+
test19();
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
-
- //@Test
+
+ @Test
public void testEncryptedRFiles() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
@SuppressWarnings("deprecation")
AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, CryptoTest.CRYPTO_ON_CONF);
- ((SiteConfiguration)conf).clearAndNull();
+ ((SiteConfiguration) conf).clearAndNull();
test1();
test2();
@@ -1821,71 +1815,66 @@ public class RFileTest {
test7();
test8();
-
if (oldSiteConfigProperty != null) {
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, oldSiteConfigProperty);
} else {
System.clearProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
}
- ((SiteConfiguration)conf).clearAndNull();
+ ((SiteConfiguration) conf).clearAndNull();
}
- //@Test
+ // @Test
public void testRootTabletFromServer() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
@SuppressWarnings("deprecation")
AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, CryptoTest.CRYPTO_ON_CONF);
- ((SiteConfiguration)conf).clearAndNull();
-
+ ((SiteConfiguration) conf).clearAndNull();
+
TestRFile trf = new TestRFile();
trf.preGeneratedInputFile = new File("/tmp/should_work.rf");
trf.openReader();
trf.iter.seek(new Range((Key) null, null), EMPTY_COL_FAMS, false);
- assert(trf.iter.hasTop());
+ assertTrue(trf.iter.hasTop());
- assert(trf.reader.getLastKey() != null);
+ assertTrue(trf.reader.getLastKey() != null);
trf.closeReader();
-
if (oldSiteConfigProperty != null) {
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, oldSiteConfigProperty);
} else {
System.clearProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
}
- ((SiteConfiguration)conf).clearAndNull();
-
- }
+ ((SiteConfiguration) conf).clearAndNull();
+
+ }
private static final int TOTAL_NUM_ROWS = 10;
private static final int ROW_MOD_VALUE = 10;
- //@Test
+ // @Test
// These tests will purge the disk cache when the run, so it's not recommended that they be run in development systems.
public void testEncryptedRFileWriteSpeed() throws Exception {
-
- System.out.println("Unencrypted Write, Unencrypted Read (Cache), Unencrypted Read (FS only), Encrypted Write, Encrypted Read (Cache), Encrypted Read (FS Only)");
+ System.out
+ .println("Unencrypted Write, Unencrypted Read (Cache), Unencrypted Read (FS only), Encrypted Write, Encrypted Read (Cache), Encrypted Read (FS Only)");
int numIterations = 1;
for (int i = 0; i < numIterations; i++) {
@SuppressWarnings("deprecation")
AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, CryptoTest.CRYPTO_OFF_CONF);
- ((SiteConfiguration)conf).clearAndNull();
-
+ ((SiteConfiguration) conf).clearAndNull();
+
TestRFile trf = new TestRFile();
trf.outputFile = new File("/tmp/testUnencryptedRfile.rf");
trf.openWriter();
-
-
double timeTickSize = 1000.0;
int numRowsRead = 0;
-
-
+
try {
performUnencryptedTests(trf, TOTAL_NUM_ROWS, ROW_MOD_VALUE, timeTickSize, true);
@@ -1895,28 +1884,26 @@ public class RFileTest {
} catch (Exception e) {
e.printStackTrace();
throw e;
- }
-
-
+ }
}
}
-
- private void performUnencryptedTests(TestRFile trf, int totalNumRows, int rowModValue, double timeTickSize, boolean first) throws IOException, InterruptedException {
+
+ private void performUnencryptedTests(TestRFile trf, int totalNumRows, int rowModValue, double timeTickSize, boolean first) throws IOException,
+ InterruptedException {
long start = System.currentTimeMillis();
-
writeRowsToRfile(trf, totalNumRows, rowModValue);
long end = System.currentTimeMillis();
- System.out.print(""+((end - start) / timeTickSize) + ", ");
+ System.out.print("" + ((end - start) / timeTickSize) + ", ");
trf.preGeneratedInputFile = trf.outputFile;
-
+
start = System.currentTimeMillis();
-
+
trf.openReader();
trf.iter.seek(new Range((Key) null, null), EMPTY_COL_FAMS, false);
int numRowsRead = 0;
@@ -1933,10 +1920,10 @@ public class RFileTest {
end = System.currentTimeMillis();
- System.out.print(""+((end - start) / timeTickSize) + ", ");
-
+ System.out.print("" + ((end - start) / timeTickSize) + ", ");
+
Runtime.getRuntime().exec("purge").waitFor();
-
+
start = System.currentTimeMillis();
trf.openReader();
@@ -1955,21 +1942,19 @@ public class RFileTest {
end = System.currentTimeMillis();
-
if (first) {
- System.out.print(""+((end - start) / timeTickSize)+", ");
+ System.out.print("" + ((end - start) / timeTickSize) + ", ");
} else {
- System.out.println(""+((end - start) / timeTickSize));
+ System.out.println("" + ((end - start) / timeTickSize));
}
-
-
- //trf.outputFile.delete();
+ // trf.outputFile.delete();
}
-
+
@SuppressWarnings("deprecation")
- private void performEncryptedTests(int totalNumRows, int rowModValue, double timeTickSize, int numRowsRead, boolean first) throws IOException, InterruptedException {
+ private void performEncryptedTests(int totalNumRows, int rowModValue, double timeTickSize, int numRowsRead, boolean first) throws IOException,
+ InterruptedException {
AccumuloConfiguration conf;
TestRFile trf;
long start;
@@ -1978,7 +1963,7 @@ public class RFileTest {
conf = AccumuloConfiguration.getSiteConfiguration();
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, CryptoTest.CRYPTO_ON_CONF);
- ((SiteConfiguration)conf).clearAndNull();
+ ((SiteConfiguration) conf).clearAndNull();
trf = new TestRFile();
trf.outputFile = new File("/tmp/testEncryptedRfile.rf");
@@ -1989,13 +1974,13 @@ public class RFileTest {
writeRowsToRfile(trf, totalNumRows, rowModValue);
end = System.currentTimeMillis();
-
- System.out.print(""+((end - start) / timeTickSize) + ", ");
-
+
+ System.out.print("" + ((end - start) / timeTickSize) + ", ");
+
trf.preGeneratedInputFile = trf.outputFile;
start = System.currentTimeMillis();
-
+
trf.openReader();
trf.iter.seek(new Range((Key) null, null), EMPTY_COL_FAMS, false);
@@ -2011,10 +1996,10 @@ public class RFileTest {
end = System.currentTimeMillis();
- System.out.print(""+((end - start) / timeTickSize)+", ");
-
+ System.out.print("" + ((end - start) / timeTickSize) + ", ");
+
Runtime.getRuntime().exec("purge").waitFor();
-
+
start = System.currentTimeMillis();
trf.openReader();
@@ -2034,16 +2019,15 @@ public class RFileTest {
end = System.currentTimeMillis();
if (first) {
- System.out.print(""+((end - start) / timeTickSize)+", ");
+ System.out.print("" + ((end - start) / timeTickSize) + ", ");
} else {
- System.out.println(""+((end - start) / timeTickSize));
+ System.out.println("" + ((end - start) / timeTickSize));
}
-
trf.outputFile.delete();
}
-
+
private int readRandomRowsFromRfile(TestRFile trf, int totalRowCount, int maxRowsToRead) throws IOException {
if (maxRowsToRead <= 0) {
return 0;
@@ -2053,7 +2037,7 @@ public class RFileTest {
Random rand = new Random(System.nanoTime());
int firstKeyNum = Math.abs(rand.nextInt()) % totalRowCount;
- //int lastKeyNum = Math.abs(rand.nextInt()) % totalRowCount;
+ // int lastKeyNum = Math.abs(rand.nextInt()) % totalRowCount;
int lastKeyNum = firstKeyNum + 1;
if (lastKeyNum >= totalRowCount) {
@@ -2088,7 +2072,7 @@ public class RFileTest {
return numRowsRead;
}
-
+
private void writeRowsToRfile(TestRFile trf, int numRowsToWriteAndRead, int rowModValue) throws IOException {
for (int i = 0; i < numRowsToWriteAndRead; i++) {
String rowID = nf("r_", (i % rowModValue));
@@ -2097,32 +2081,31 @@ public class RFileTest {
String colVis = "vis";
Key k = nk(rowID, colFam, colQual, colVis, i);
- Value v = nv(""+i);
+ Value v = nv("" + i);
trf.writer.append(k, v);
}
trf.closeWriter();
}
-
@Test
public void testRootTabletEncryption() throws Exception {
- // This tests that the normal set of operations used to populate a root tablet
+ // This tests that the normal set of operations used to populate a root tablet
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
@SuppressWarnings("deprecation")
AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, CryptoTest.CRYPTO_ON_CONF);
- ((SiteConfiguration)conf).clearAndNull();
-
+ ((SiteConfiguration) conf).clearAndNull();
+
// populate the root tablet with info about the default tablet
// the root tablet contains the key extent and locations of all the
// metadata tablets
- //String initRootTabFile = ServerConstants.getMetadataTableDir() + "/root_tablet/00000_00000."
- // + FileOperations.getNewFileExtension(AccumuloConfiguration.getDefaultConfiguration());
- //FileSKVWriter mfw = FileOperations.getInstance().openWriter(initRootTabFile, fs, conf, AccumuloConfiguration.getDefaultConfiguration());
+ // String initRootTabFile = ServerConstants.getMetadataTableDir() + "/root_tablet/00000_00000."
+ // + FileOperations.getNewFileExtension(AccumuloConfiguration.getDefaultConfiguration());
+ // FileSKVWriter mfw = FileOperations.getInstance().openWriter(initRootTabFile, fs, conf, AccumuloConfiguration.getDefaultConfiguration());
TestRFile testRfile = new TestRFile();
testRfile.openWriter();
@@ -2131,19 +2114,19 @@ public class RFileTest {
// mfw.startDefaultLocalityGroup();
- //mfw.startDefaultLocalityGroup();
+ // mfw.startDefaultLocalityGroup();
Text tableExtent = new Text(KeyExtent.getMetadataEntry(new Text(MetadataTable.ID), MetadataSchema.TabletsSection.getRange().getEndKey().getRow()));
// table tablet's directory
Key tableDirKey = new Key(tableExtent, TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily(),
TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), 0);
- mfw.append(tableDirKey, new Value(/*TABLE_TABLETS_TABLET_DIR*/"/table_info".getBytes()));
+ mfw.append(tableDirKey, new Value(/* TABLE_TABLETS_TABLET_DIR */"/table_info".getBytes()));
// table tablet time
Key tableTimeKey = new Key(tableExtent, TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnFamily(),
TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnQualifier(), 0);
- mfw.append(tableTimeKey, new Value((/*TabletTime.LOGICAL_TIME_ID*/ 'L' + "0").getBytes()));
+ mfw.append(tableTimeKey, new Value((/* TabletTime.LOGICAL_TIME_ID */'L' + "0").getBytes()));
// table tablet's prevrow
Key tablePrevRowKey = new Key(tableExtent, TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnFamily(),
@@ -2161,14 +2144,13 @@ public class RFileTest {
// default's time
Key defaultTimeKey = new Key(defaultExtent, TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnFamily(),
TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnQualifier(), 0);
- mfw.append(defaultTimeKey, new Value((/*TabletTime.LOGICAL_TIME_ID*/ 'L' + "0").getBytes()));
+ mfw.append(defaultTimeKey, new Value((/* TabletTime.LOGICAL_TIME_ID */'L' + "0").getBytes()));
// default's prevrow
Key defaultPrevRowKey = new Key(defaultExtent, TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnFamily(),
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnQualifier(), 0);
mfw.append(defaultPrevRowKey, KeyExtent.encodePrevEndRow(MetadataSchema.TabletsSection.getRange().getEndKey().getRow()));
-
testRfile.closeWriter();
if (true) {
@@ -2178,27 +2160,20 @@ public class RFileTest {
fileOutputStream.close();
}
-
-
-
testRfile.openReader();
testRfile.iter.seek(new Range((Key) null, null), EMPTY_COL_FAMS, false);
- assert(testRfile.iter.hasTop());
-
- assert(testRfile.reader.getLastKey() != null);
-
-
+ assertTrue(testRfile.iter.hasTop());
+ assertTrue(testRfile.reader.getLastKey() != null);
testRfile.closeReader();
-
+
if (oldSiteConfigProperty != null) {
System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, oldSiteConfigProperty);
} else {
System.clearProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
}
- ((SiteConfiguration)conf).clearAndNull();
-
- }
+ ((SiteConfiguration) conf).clearAndNull();
+
+ }
}
-
[2/4] ACCUMULO-1533 Clean up deprecated mapreduce and thrift code
Posted by ct...@apache.org.
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooCache.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooCache.java b/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooCache.java
deleted file mode 100644
index c1e30c6..0000000
--- a/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooCache.java
+++ /dev/null
@@ -1,40 +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.apache.accumulo.core.zookeeper;
-
-import org.apache.accumulo.fate.zookeeper.ZooReader;
-import org.apache.zookeeper.Watcher;
-
-/**
- * This class remains here for backwards compatibility.
- *
- * @deprecated since 1.5, replaced by {@link org.apache.accumulo.fate.zookeeper.ZooCache}
- */
-@Deprecated
-public class ZooCache extends org.apache.accumulo.fate.zookeeper.ZooCache {
- public ZooCache(String zooKeepers, int sessionTimeout) {
- super(zooKeepers, sessionTimeout);
- }
-
- public ZooCache(String zooKeepers, int sessionTimeout, Watcher watcher) {
- super(zooKeepers, sessionTimeout, watcher);
- }
-
- public ZooCache(ZooReader reader, Watcher watcher) {
- super(reader, watcher);
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java b/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
index 86dc4d2..17447e5 100644
--- a/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
@@ -16,10 +16,23 @@
*/
package org.apache.accumulo.core.zookeeper;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.file.FileUtil;
+import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.log4j.Logger;
public class ZooUtil extends org.apache.accumulo.fate.zookeeper.ZooUtil {
+
+ private static final Logger log = Logger.getLogger(ZooUtil.class);
+
public static String getRoot(final Instance instance) {
return getRoot(instance.getInstanceID());
}
@@ -27,4 +40,33 @@ public class ZooUtil extends org.apache.accumulo.fate.zookeeper.ZooUtil {
public static String getRoot(final String instanceId) {
return Constants.ZROOT + "/" + instanceId;
}
+
+ /**
+ * Utility to support certain client side utilities to minimize command-line options.
+ */
+ public static String getInstanceIDFromHdfs(Path instanceDirectory) {
+ try {
+ @SuppressWarnings("deprecation")
+ FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), AccumuloConfiguration.getSiteConfiguration());
+ FileStatus[] files = null;
+ try {
+ files = fs.listStatus(instanceDirectory);
+ } catch (FileNotFoundException ex) {
+ // ignored
+ }
+ log.debug("Trying to read instance id from " + instanceDirectory);
+ if (files == null || files.length == 0) {
+ log.error("unable obtain instance id at " + instanceDirectory);
+ throw new RuntimeException("Accumulo not initialized, there is no instance id at " + instanceDirectory);
+ } else if (files.length != 1) {
+ log.error("multiple potential instances in " + instanceDirectory);
+ throw new RuntimeException("Accumulo found multiple possible instance ids in " + instanceDirectory);
+ } else {
+ String result = files[0].getPath().getName();
+ return result;
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("Accumulo not initialized, there is no instance id at " + instanceDirectory, e);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/thrift/security.thrift
----------------------------------------------------------------------
diff --git a/core/src/main/thrift/security.thrift b/core/src/main/thrift/security.thrift
index 3f1a371..66235a8 100644
--- a/core/src/main/thrift/security.thrift
+++ b/core/src/main/thrift/security.thrift
@@ -17,39 +17,6 @@
namespace java org.apache.accumulo.core.security.thrift
namespace cpp org.apache.accumulo.core.security.thrift
-/**
-@deprecated since 1.5, see org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode
-*/
-enum SecurityErrorCode {
- DEFAULT_SECURITY_ERROR = 0,
- BAD_CREDENTIALS = 1,
- PERMISSION_DENIED = 2,
- USER_DOESNT_EXIST = 3,
- CONNECTION_ERROR = 4,
- USER_EXISTS = 5,
- GRANT_INVALID = 6,
- BAD_AUTHORIZATIONS = 7,
- INVALID_INSTANCEID = 8,
- TABLE_DOESNT_EXIST = 9,
- UNSUPPORTED_OPERATION = 10,
- INVALID_TOKEN = 11,
- AUTHENTICATOR_FAILED = 12,
- AUTHORIZOR_FAILED = 13,
- PERMISSIONHANDLER_FAILED = 14,
- TOKEN_EXPIRED = 15
- SERIALIZATION_ERROR = 16;
- INSUFFICIENT_PROPERTIES = 17;
-}
-
-/**
-@deprecated since 1.5
-*/
-struct AuthInfo {
- 1:string user,
- 2:binary password,
- 3:string instanceId
-}
-
struct TCredentials {
1:string principal,
2:string tokenClassName,
@@ -57,10 +24,3 @@ struct TCredentials {
4:string instanceId
}
-/**
-@deprecated since 1.5, see org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException
-*/
-exception ThriftSecurityException {
- 1:string user,
- 2:SecurityErrorCode code
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
index f160cb3..0a34575 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
@@ -451,12 +451,6 @@ public class TabletLocatorImplTest extends TestCase {
throw new UnsupportedOperationException();
}
- @Deprecated
- @Override
- public Connector getConnector(org.apache.accumulo.core.security.thrift.AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
- return getConnector(auth.user, auth.getPassword());
- }
-
@Override
public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
throw new UnsupportedOperationException();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index 0ee03a2..c9539c4 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -55,46 +55,6 @@ public class AccumuloInputFormatTest {
private static final String TEST_TABLE_1 = PREFIX + "_mapreduce_table_1";
/**
- * Test basic setting & getting of max versions.
- *
- * @throws IOException
- * Signals that an I/O exception has occurred.
- */
- @Deprecated
- @Test
- public void testMaxVersions() throws IOException {
- Job job = new Job();
- AccumuloInputFormat.setMaxVersions(job.getConfiguration(), 1);
- int version = AccumuloInputFormat.getMaxVersions(job.getConfiguration());
- assertEquals(1, version);
- }
-
- /**
- * Test max versions with an invalid value.
- *
- * @throws IOException
- * Signals that an I/O exception has occurred.
- */
- @Deprecated
- @Test(expected = IOException.class)
- public void testMaxVersionsLessThan1() throws IOException {
- Job job = new Job();
- AccumuloInputFormat.setMaxVersions(job.getConfiguration(), 0);
- }
-
- /**
- * Test no max version configured.
- *
- * @throws IOException
- */
- @Deprecated
- @Test
- public void testNoMaxVersion() throws IOException {
- Job job = new Job();
- assertEquals(-1, AccumuloInputFormat.getMaxVersions(job.getConfiguration()));
- }
-
- /**
* Check that the iterator configuration is getting stored in the Job conf correctly.
*
* @throws IOException
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
index 2ff881b..7554a49 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
@@ -25,13 +25,11 @@ import org.junit.Test;
*
*/
public class SecurityErrorCodeTest {
-
- @SuppressWarnings("deprecation")
+
@Test
public void testEnumsSame() {
HashSet<String> secNames1 = new HashSet<String>();
HashSet<String> secNames2 = new HashSet<String>();
- HashSet<String> secNames3 = new HashSet<String>();
for (SecurityErrorCode sec : SecurityErrorCode.values())
secNames1.add(sec.name());
@@ -39,10 +37,6 @@ public class SecurityErrorCodeTest {
for (org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode sec : org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.values())
secNames2.add(sec.name());
- for (org.apache.accumulo.core.security.thrift.SecurityErrorCode sec : org.apache.accumulo.core.security.thrift.SecurityErrorCode.values())
- secNames3.add(sec.name());
-
Assert.assertEquals(secNames1, secNames2);
- Assert.assertEquals(secNames1, secNames3);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index 37b35a2..a61d4bb 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -1798,7 +1798,7 @@ public class RFileTest {
restoreOldConfiguration(oldSiteConfigProperty, conf);
}
- @Test
+ // @Test
public void testEncryptedRFiles() throws Exception {
String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
@SuppressWarnings("deprecation")
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java b/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
index f306b86..2ad81cf 100644
--- a/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
+++ b/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
@@ -34,7 +34,6 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.core.util.OpTimer;
import org.apache.accumulo.core.util.StringUtil;
@@ -123,8 +122,7 @@ public class HdfsZooInstance implements Instance {
private static synchronized void _getInstanceID() {
if (instanceId == null) {
- @SuppressWarnings("deprecation")
- String instanceIdFromFile = ZooKeeperInstance.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
+ String instanceIdFromFile = ZooUtil.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
instanceId = instanceIdFromFile;
}
}
@@ -146,12 +144,7 @@ public class HdfsZooInstance implements Instance {
@Override
public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
- return getConnector(CredentialHelper.create(principal, token, getInstanceID()));
- }
-
- @SuppressWarnings("deprecation")
- private Connector getConnector(TCredentials cred) throws AccumuloException, AccumuloSecurityException {
- return new ConnectorImpl(this, cred);
+ return new ConnectorImpl(this, CredentialHelper.create(principal, token, getInstanceID()));
}
@Override
@@ -191,9 +184,4 @@ public class HdfsZooInstance implements Instance {
System.out.println("Masters: " + StringUtil.join(instance.getMasterLocations(), ", "));
}
- @Deprecated
- @Override
- public Connector getConnector(org.apache.accumulo.core.security.thrift.AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
- return getConnector(auth.user, auth.getPassword());
- }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java b/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
index d006498..18381c7 100644
--- a/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
+++ b/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
@@ -26,7 +26,6 @@ import java.util.TreeMap;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.zookeeper.ZooUtil;
@@ -61,13 +60,13 @@ public class ZooConfiguration extends AccumuloConfiguration {
if (instance == null) {
propCache = new ZooCache(parent.get(Property.INSTANCE_ZK_HOST), (int) parent.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT));
instance = new ZooConfiguration(parent);
- @SuppressWarnings("deprecation")
- String deprecatedInstanceIdFromHdfs = ZooKeeperInstance.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
+ String deprecatedInstanceIdFromHdfs = ZooUtil.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
instanceId = deprecatedInstanceIdFromHdfs;
}
return instance;
}
+ @Override
public void invalidateCache() {
if (propCache != null)
propCache.clear();
[4/4] git commit: Merge branch 'Merge ctubbsii changes for
ACCUMULO-998 and ACCUMULO-1533'
Posted by ct...@apache.org.
Merge branch 'Merge ctubbsii changes for ACCUMULO-998 and ACCUMULO-1533'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2ad6a818
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2ad6a818
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2ad6a818
Branch: refs/heads/master
Commit: 2ad6a818857ad0f2caabb0fa086ba1666968e413
Parents: 1a48f7c a69a9d6
Author: Christopher Tubbs <ct...@apache.org>
Authored: Mon Jul 22 14:34:29 2013 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Mon Jul 22 14:34:29 2013 -0400
----------------------------------------------------------------------
.../apache/accumulo/core/cli/ClientOpts.java | 4 +-
.../core/client/AccumuloSecurityException.java | 18 +-
.../apache/accumulo/core/client/Instance.java | 15 -
.../accumulo/core/client/ZooKeeperInstance.java | 61 +-
.../core/client/impl/ConnectorImpl.java | 1 -
.../mapreduce/AccumuloFileOutputFormat.java | 49 --
.../client/mapreduce/AccumuloOutputFormat.java | 164 -----
.../core/client/mapreduce/InputFormatBase.java | 385 ------------
.../accumulo/core/client/mock/MockInstance.java | 6 -
.../core/conf/AccumuloConfiguration.java | 18 +-
.../apache/accumulo/core/data/ColumnUpdate.java | 10 -
.../accumulo/core/security/thrift/AuthInfo.java | 616 -------------------
.../core/security/thrift/SecurityErrorCode.java | 112 ----
.../thrift/ThriftSecurityException.java | 521 ----------------
.../apache/accumulo/core/util/shell/Shell.java | 4 +-
.../core/util/shell/commands/FateCommand.java | 7 +-
.../accumulo/core/zookeeper/ZooCache.java | 40 --
.../apache/accumulo/core/zookeeper/ZooUtil.java | 42 ++
core/src/main/thrift/security.thrift | 40 --
.../core/client/impl/TabletLocatorImplTest.java | 6 -
.../mapreduce/AccumuloInputFormatTest.java | 40 --
.../client/security/SecurityErrorCodeTest.java | 8 +-
.../accumulo/core/file/rfile/RFileTest.java | 251 ++++----
.../accumulo/server/client/HdfsZooInstance.java | 16 +-
.../accumulo/server/conf/ZooConfiguration.java | 5 +-
25 files changed, 183 insertions(+), 2256 deletions(-)
----------------------------------------------------------------------
[3/4] git commit: ACCUMULO-1533 Clean up deprecated mapreduce and
thrift code
Posted by ct...@apache.org.
ACCUMULO-1533 Clean up deprecated mapreduce and thrift code
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a69a9d68
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a69a9d68
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a69a9d68
Branch: refs/heads/master
Commit: a69a9d68fb8f1e2e7455b75a5a1130e964d96a7d
Parents: 47d1f5f
Author: Christopher Tubbs <ct...@apache.org>
Authored: Mon Jul 22 14:33:03 2013 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Mon Jul 22 14:33:03 2013 -0400
----------------------------------------------------------------------
.../apache/accumulo/core/cli/ClientOpts.java | 4 +-
.../core/client/AccumuloSecurityException.java | 18 +-
.../apache/accumulo/core/client/Instance.java | 15 -
.../accumulo/core/client/ZooKeeperInstance.java | 61 +-
.../core/client/impl/ConnectorImpl.java | 1 -
.../mapreduce/AccumuloFileOutputFormat.java | 49 --
.../client/mapreduce/AccumuloOutputFormat.java | 164 -----
.../core/client/mapreduce/InputFormatBase.java | 385 ------------
.../accumulo/core/client/mock/MockInstance.java | 6 -
.../core/conf/AccumuloConfiguration.java | 18 +-
.../apache/accumulo/core/data/ColumnUpdate.java | 10 -
.../accumulo/core/security/thrift/AuthInfo.java | 616 -------------------
.../core/security/thrift/SecurityErrorCode.java | 112 ----
.../thrift/ThriftSecurityException.java | 521 ----------------
.../apache/accumulo/core/util/shell/Shell.java | 4 +-
.../core/util/shell/commands/FateCommand.java | 7 +-
.../accumulo/core/zookeeper/ZooCache.java | 40 --
.../apache/accumulo/core/zookeeper/ZooUtil.java | 42 ++
core/src/main/thrift/security.thrift | 40 --
.../core/client/impl/TabletLocatorImplTest.java | 6 -
.../mapreduce/AccumuloInputFormatTest.java | 40 --
.../client/security/SecurityErrorCodeTest.java | 8 +-
.../accumulo/core/file/rfile/RFileTest.java | 2 +-
.../accumulo/server/client/HdfsZooInstance.java | 16 +-
.../accumulo/server/conf/ZooConfiguration.java | 5 +-
25 files changed, 71 insertions(+), 2119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
index 8a2d6f0..ec6b198 100644
--- a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
+++ b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
@@ -42,6 +42,7 @@ import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.trace.instrument.Trace;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
@@ -221,8 +222,7 @@ public class ClientOpts extends Help {
};
this.zookeepers = config.get(Property.INSTANCE_ZK_HOST);
Path instanceDir = new Path(config.get(Property.INSTANCE_DFS_DIR), "instance_id");
- @SuppressWarnings("deprecation")
- String instanceIDFromFile = ZooKeeperInstance.getInstanceIDFromHdfs(instanceDir);
+ String instanceIDFromFile = ZooUtil.getInstanceIDFromHdfs(instanceDir);
return cachedInstance = new ZooKeeperInstance(UUID.fromString(instanceIDFromFile), zookeepers);
}
return cachedInstance = new ZooKeeperInstance(this.instance, this.zookeepers);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java b/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
index 04ba4e7..f626f4d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
@@ -94,7 +94,7 @@ public class AccumuloSecurityException extends Exception {
* @param errorcode
* the specific reason for this exception
* @param tableInfo
- * the relevant tableInfo for the security violation
+ * the relevant tableInfo for the security violation
* @param cause
* the exception that caused this violation
*/
@@ -123,7 +123,7 @@ public class AccumuloSecurityException extends Exception {
* @param errorcode
* the specific reason for this exception
* @param tableInfo
- * the relevant tableInfo for the security violation
+ * the relevant tableInfo for the security violation
*/
public AccumuloSecurityException(final String user, final SecurityErrorCode errorcode, final String tableInfo) {
super(getDefaultErrorMessage(errorcode));
@@ -158,25 +158,17 @@ public class AccumuloSecurityException extends Exception {
* @return the specific reason for this exception
* @since 1.5.0
*/
-
+
public org.apache.accumulo.core.client.security.SecurityErrorCode getSecurityErrorCode() {
return org.apache.accumulo.core.client.security.SecurityErrorCode.valueOf(errorCode.name());
}
-
- /**
- * @return the specific reason for this exception
- *
- * @deprecated since 1.5.0; Use {@link #getSecurityErrorCode()} instead.
- */
- public org.apache.accumulo.core.security.thrift.SecurityErrorCode getErrorCode() {
- return org.apache.accumulo.core.security.thrift.SecurityErrorCode.valueOf(errorCode.name());
- }
+ @Override
public String getMessage() {
StringBuilder message = new StringBuilder();
message.append("Error ").append(errorCode);
message.append(" for user ").append(user);
- if(!StringUtils.isEmpty(tableInfo)) {
+ if (!StringUtils.isEmpty(tableInfo)) {
message.append(" on table ").append(tableInfo);
}
message.append(" - ").append(super.getMessage());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/client/Instance.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/Instance.java b/core/src/main/java/org/apache/accumulo/core/client/Instance.java
index 3b04281..0796059 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/Instance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/Instance.java
@@ -90,21 +90,6 @@ public interface Instance {
/**
* Returns a connection to accumulo.
*
- * @param auth
- * An Credentials object.
- * @return the accumulo Connector
- * @throws AccumuloException
- * when a generic exception occurs
- * @throws AccumuloSecurityException
- * when a user's credentials are invalid
- * @deprecated since 1.5, use {@link #getConnector(String, AuthenticationToken)} with {@link PasswordToken}
- */
- @Deprecated
- public abstract Connector getConnector(org.apache.accumulo.core.security.thrift.AuthInfo auth) throws AccumuloException, AccumuloSecurityException;
-
- /**
- * Returns a connection to accumulo.
- *
* @param user
* a valid accumulo user
* @param pass
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 5b56adb..07f5fd4 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@ -16,8 +16,6 @@
*/
package org.apache.accumulo.core.client;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List;
@@ -29,20 +27,14 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.file.FileUtil;
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.accumulo.core.util.ByteBufferUtil;
-import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.OpTimer;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooCache;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -220,12 +212,7 @@ public class ZooKeeperInstance implements Instance {
@Override
public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
- return getConnector(CredentialHelper.create(principal, token, getInstanceID()));
- }
-
- @SuppressWarnings("deprecation")
- private Connector getConnector(TCredentials credential) throws AccumuloException, AccumuloSecurityException {
- return new ConnectorImpl(this, credential);
+ return new ConnectorImpl(this, CredentialHelper.create(principal, token, getInstanceID()));
}
@Override
@@ -249,19 +236,7 @@ public class ZooKeeperInstance implements Instance {
}
/**
- * @deprecated Use {@link #lookupInstanceName(org.apache.accumulo.fate.zookeeper.ZooCache, UUID)} instead
- */
- @Deprecated
- public static String lookupInstanceName(org.apache.accumulo.core.zookeeper.ZooCache zooCache, UUID instanceId) {
- return lookupInstanceName((ZooCache) zooCache, instanceId);
- }
-
- /**
* Given a zooCache and instanceId, look up the instance name.
- *
- * @param zooCache
- * @param instanceId
- * @return the instance name
*/
public static String lookupInstanceName(ZooCache zooCache, UUID instanceId) {
ArgumentChecker.notNull(zooCache, instanceId);
@@ -275,38 +250,4 @@ public class ZooKeeperInstance implements Instance {
return null;
}
- /**
- * To be moved to server code. Only lives here to support certain client side utilities to minimize command-line options.
- */
- @Deprecated
- public static String getInstanceIDFromHdfs(Path instanceDirectory) {
- try {
- FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), AccumuloConfiguration.getSiteConfiguration());
- FileStatus[] files = null;
- try {
- files = fs.listStatus(instanceDirectory);
- } catch (FileNotFoundException ex) {
- // ignored
- }
- log.debug("Trying to read instance id from " + instanceDirectory);
- if (files == null || files.length == 0) {
- log.error("unable obtain instance id at " + instanceDirectory);
- throw new RuntimeException("Accumulo not initialized, there is no instance id at " + instanceDirectory);
- } else if (files.length != 1) {
- log.error("multiple potential instances in " + instanceDirectory);
- throw new RuntimeException("Accumulo found multiple possible instance ids in " + instanceDirectory);
- } else {
- String result = files[0].getPath().getName();
- return result;
- }
- } catch (IOException e) {
- throw new RuntimeException("Accumulo not initialized, there is no instance id at " + instanceDirectory, e);
- }
- }
-
- @Deprecated
- @Override
- public Connector getConnector(org.apache.accumulo.core.security.thrift.AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
- return getConnector(auth.user, auth.password);
- }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
index 3c6e445..3858cdc 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
@@ -51,7 +51,6 @@ public class ConnectorImpl extends Connector {
private TableOperations tableops = null;
private InstanceOperations instanceops = null;
- @Deprecated
public ConnectorImpl(Instance instance, TCredentials cred) throws AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(instance, cred);
this.instance = instance;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
index cfcefda..d78219c 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
@@ -19,7 +19,6 @@ package org.apache.accumulo.core.client.mapreduce;
import java.io.IOException;
import java.util.Arrays;
-import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.mapreduce.lib.util.FileOutputConfigurator;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
@@ -28,14 +27,12 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.file.FileOperations;
import org.apache.accumulo.core.file.FileSKVWriter;
-import org.apache.accumulo.core.file.rfile.RFile;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.commons.collections.map.LRUMap;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobContext;
-import org.apache.hadoop.mapreduce.OutputFormat;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
@@ -177,50 +174,4 @@ public class AccumuloFileOutputFormat extends FileOutputFormat<Key,Value> {
};
}
- // ----------------------------------------------------------------------------------------------------
- // Everything below this line is deprecated and should go away in future versions
- // ----------------------------------------------------------------------------------------------------
-
- /**
- * @deprecated since 1.5.0; Retrieve the relevant block size from {@link #getAccumuloConfiguration(JobContext)} and configure hadoop's
- * io.seqfile.compress.blocksize with the same value. No longer needed, as {@link RFile} does not use this field.
- */
- @Deprecated
- protected static void handleBlockSize(Configuration conf) {
- conf.setInt("io.seqfile.compress.blocksize",
- (int) FileOutputConfigurator.getAccumuloConfiguration(CLASS, conf).getMemoryInBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE));
- }
-
- /**
- * @deprecated since 1.5.0; This method does nothing. Only 'rf' type is supported.
- */
- @Deprecated
- public static void setFileType(Configuration conf, String type) {}
-
- /**
- * @deprecated since 1.5.0; Use {@link #setFileBlockSize(Job, long)}, {@link #setDataBlockSize(Job, long)}, or {@link #setIndexBlockSize(Job, long)} instead.
- */
- @Deprecated
- public static void setBlockSize(Configuration conf, int blockSize) {
- FileOutputConfigurator.setDataBlockSize(CLASS, conf, blockSize);
- }
-
- /**
- * @deprecated since 1.5.0; This {@link OutputFormat} does not communicate with Accumulo. If this is needed, subclasses must implement their own
- * configuration.
- */
- @Deprecated
- public static void setZooKeeperInstance(Configuration conf, String instanceName, String zooKeepers) {
- FileOutputConfigurator.setZooKeeperInstance(CLASS, conf, instanceName, zooKeepers);
- }
-
- /**
- * @deprecated since 1.5.0; This {@link OutputFormat} does not communicate with Accumulo. If this is needed, subclasses must implement their own
- * configuration.
- */
- @Deprecated
- protected static Instance getInstance(Configuration conf) {
- return FileOutputConfigurator.getInstance(CLASS, conf);
- }
-
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
index 69e7e2e..49bd3e1 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
@@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -38,13 +37,11 @@ import org.apache.accumulo.core.client.mapreduce.lib.util.OutputConfigurator;
import org.apache.accumulo.core.client.mock.MockInstance;
import org.apache.accumulo.core.client.security.SecurityErrorCode;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.data.ColumnUpdate;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobContext;
@@ -536,165 +533,4 @@ public class AccumuloOutputFormat extends OutputFormat<Text,Mutation> {
}
}
- // ----------------------------------------------------------------------------------------------------
- // Everything below this line is deprecated and should go away in future versions
- // ----------------------------------------------------------------------------------------------------
-
- /**
- * @deprecated since 1.5.0; Use {@link #setConnectorInfo(Job, String, AuthenticationToken)}, {@link #setCreateTables(Job, boolean)}, and
- * {@link #setDefaultTableName(Job, String)} instead.
- */
- @Deprecated
- public static void setOutputInfo(Configuration conf, String user, byte[] passwd, boolean createTables, String defaultTable) {
- try {
- OutputConfigurator.setConnectorInfo(CLASS, conf, user, new PasswordToken(passwd));
- } catch (AccumuloSecurityException e) {
- throw new RuntimeException(e);
- }
- OutputConfigurator.setCreateTables(CLASS, conf, createTables);
- OutputConfigurator.setDefaultTableName(CLASS, conf, defaultTable);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setZooKeeperInstance(Job, String, String)} instead.
- */
- @Deprecated
- public static void setZooKeeperInstance(Configuration conf, String instanceName, String zooKeepers) {
- OutputConfigurator.setZooKeeperInstance(CLASS, conf, instanceName, zooKeepers);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setMockInstance(Job, String)} instead.
- */
- @Deprecated
- public static void setMockInstance(Configuration conf, String instanceName) {
- OutputConfigurator.setMockInstance(CLASS, conf, instanceName);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setBatchWriterOptions(Job, BatchWriterConfig)} instead.
- */
- @Deprecated
- public static void setMaxMutationBufferSize(Configuration conf, long numberOfBytes) {
- BatchWriterConfig bwConfig = OutputConfigurator.getBatchWriterOptions(CLASS, conf);
- bwConfig.setMaxMemory(numberOfBytes);
- OutputConfigurator.setBatchWriterOptions(CLASS, conf, bwConfig);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setBatchWriterOptions(Job, BatchWriterConfig)} instead.
- */
- @Deprecated
- public static void setMaxLatency(Configuration conf, int numberOfMilliseconds) {
- BatchWriterConfig bwConfig = OutputConfigurator.getBatchWriterOptions(CLASS, conf);
- bwConfig.setMaxLatency(numberOfMilliseconds, TimeUnit.MILLISECONDS);
- OutputConfigurator.setBatchWriterOptions(CLASS, conf, bwConfig);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setBatchWriterOptions(Job, BatchWriterConfig)} instead.
- */
- @Deprecated
- public static void setMaxWriteThreads(Configuration conf, int numberOfThreads) {
- BatchWriterConfig bwConfig = OutputConfigurator.getBatchWriterOptions(CLASS, conf);
- bwConfig.setMaxWriteThreads(numberOfThreads);
- OutputConfigurator.setBatchWriterOptions(CLASS, conf, bwConfig);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setLogLevel(Job, Level)} instead.
- */
- @Deprecated
- public static void setLogLevel(Configuration conf, Level level) {
- OutputConfigurator.setLogLevel(CLASS, conf, level);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setSimulationMode(Job, boolean)} instead.
- */
- @Deprecated
- public static void setSimulationMode(Configuration conf) {
- OutputConfigurator.setSimulationMode(CLASS, conf, true);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getToken(JobContext)} instead.
- */
- @Deprecated
- protected static String getPrincipal(Configuration conf) {
- return OutputConfigurator.getPrincipal(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getToken(JobContext)} instead.
- */
- @Deprecated
- protected static byte[] getToken(Configuration conf) {
- return OutputConfigurator.getToken(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #canCreateTables(JobContext)} instead.
- */
- @Deprecated
- protected static boolean canCreateTables(Configuration conf) {
- return OutputConfigurator.canCreateTables(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getDefaultTableName(JobContext)} instead.
- */
- @Deprecated
- protected static String getDefaultTableName(Configuration conf) {
- return OutputConfigurator.getDefaultTableName(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getInstance(JobContext)} instead.
- */
- @Deprecated
- protected static Instance getInstance(Configuration conf) {
- return OutputConfigurator.getInstance(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getBatchWriterOptions(JobContext)} instead.
- */
- @Deprecated
- protected static long getMaxMutationBufferSize(Configuration conf) {
- return OutputConfigurator.getBatchWriterOptions(CLASS, conf).getMaxMemory();
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getBatchWriterOptions(JobContext)} instead.
- */
- @Deprecated
- protected static int getMaxLatency(Configuration conf) {
- return (int) OutputConfigurator.getBatchWriterOptions(CLASS, conf).getMaxLatency(TimeUnit.MILLISECONDS);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getBatchWriterOptions(JobContext)} instead.
- */
- @Deprecated
- protected static int getMaxWriteThreads(Configuration conf) {
- return OutputConfigurator.getBatchWriterOptions(CLASS, conf).getMaxWriteThreads();
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getLogLevel(JobContext)} instead.
- */
- @Deprecated
- protected static Level getLogLevel(Configuration conf) {
- return OutputConfigurator.getLogLevel(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getSimulationMode(JobContext)} instead.
- */
- @Deprecated
- protected static boolean getSimulationMode(Configuration conf) {
- return OutputConfigurator.getSimulationMode(CLASS, conf);
- }
-
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
index ea40e02..8308a63 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
@@ -19,12 +19,9 @@ package org.apache.accumulo.core.client.mapreduce;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.net.InetAddress;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
@@ -34,7 +31,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.StringTokenizer;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -55,14 +51,12 @@ import org.apache.accumulo.core.client.impl.TabletLocator;
import org.apache.accumulo.core.client.mapreduce.lib.util.InputConfigurator;
import org.apache.accumulo.core.client.mock.MockInstance;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.PartialKey;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.user.VersioningIterator;
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
@@ -999,385 +993,6 @@ public abstract class InputFormatBase<K,V> extends InputFormat<K,V> {
}
}
- // ----------------------------------------------------------------------------------------------------
- // Everything below this line is deprecated and should go away in future versions
- // ----------------------------------------------------------------------------------------------------
-
- /**
- * @deprecated since 1.5.0; Use {@link #setScanIsolation(Job, boolean)} instead.
- */
- @Deprecated
- public static void setIsolated(Configuration conf, boolean enable) {
- InputConfigurator.setScanIsolation(CLASS, conf, enable);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setLocalIterators(Job, boolean)} instead.
- */
- @Deprecated
- public static void setLocalIterators(Configuration conf, boolean enable) {
- InputConfigurator.setLocalIterators(CLASS, conf, enable);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setConnectorInfo(Job, String, AuthenticationToken)}, {@link #setInputTableName(Job, String)}, and
- * {@link #setScanAuthorizations(Job, Authorizations)} instead.
- */
- @Deprecated
- public static void setInputInfo(Configuration conf, String user, byte[] passwd, String table, Authorizations auths) {
- try {
- InputConfigurator.setConnectorInfo(CLASS, conf, user, new PasswordToken(passwd));
- } catch (AccumuloSecurityException e) {
- throw new RuntimeException(e);
- }
- InputConfigurator.setInputTableName(CLASS, conf, table);
- InputConfigurator.setScanAuthorizations(CLASS, conf, auths);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setZooKeeperInstance(Job, String, String)} instead.
- */
- @Deprecated
- public static void setZooKeeperInstance(Configuration conf, String instanceName, String zooKeepers) {
- InputConfigurator.setZooKeeperInstance(CLASS, conf, instanceName, zooKeepers);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setMockInstance(Job, String)} instead.
- */
- @Deprecated
- public static void setMockInstance(Configuration conf, String instanceName) {
- InputConfigurator.setMockInstance(CLASS, conf, instanceName);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setRanges(Job, Collection)} instead.
- */
- @Deprecated
- public static void setRanges(Configuration conf, Collection<Range> ranges) {
- InputConfigurator.setRanges(CLASS, conf, ranges);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setAutoAdjustRanges(Job, boolean)} instead.
- */
- @Deprecated
- public static void disableAutoAdjustRanges(Configuration conf) {
- InputConfigurator.setAutoAdjustRanges(CLASS, conf, false);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #addIterator(Job, IteratorSetting)} to add the {@link VersioningIterator} instead.
- */
- @Deprecated
- public static void setMaxVersions(Configuration conf, int maxVersions) throws IOException {
- IteratorSetting vers = new IteratorSetting(1, "vers", VersioningIterator.class);
- try {
- VersioningIterator.setMaxVersions(vers, maxVersions);
- } catch (IllegalArgumentException e) {
- throw new IOException(e);
- }
- InputConfigurator.addIterator(CLASS, conf, vers);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setOfflineTableScan(Job, boolean)} instead.
- */
- @Deprecated
- public static void setScanOffline(Configuration conf, boolean scanOff) {
- InputConfigurator.setOfflineTableScan(CLASS, conf, scanOff);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #fetchColumns(Job, Collection)} instead.
- */
- @Deprecated
- public static void fetchColumns(Configuration conf, Collection<Pair<Text,Text>> columnFamilyColumnQualifierPairs) {
- InputConfigurator.fetchColumns(CLASS, conf, columnFamilyColumnQualifierPairs);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #setLogLevel(Job, Level)} instead.
- */
- @Deprecated
- public static void setLogLevel(Configuration conf, Level level) {
- InputConfigurator.setLogLevel(CLASS, conf, level);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #addIterator(Job, IteratorSetting)} instead.
- */
- @Deprecated
- public static void addIterator(Configuration conf, IteratorSetting cfg) {
- InputConfigurator.addIterator(CLASS, conf, cfg);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #isIsolated(JobContext)} instead.
- */
- @Deprecated
- protected static boolean isIsolated(Configuration conf) {
- return InputConfigurator.isIsolated(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #usesLocalIterators(JobContext)} instead.
- */
- @Deprecated
- protected static boolean usesLocalIterators(Configuration conf) {
- return InputConfigurator.usesLocalIterators(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getPrincipal(JobContext)} instead.
- */
- @Deprecated
- protected static String getPrincipal(Configuration conf) {
- return InputConfigurator.getPrincipal(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getToken(JobContext)} instead.
- */
- @Deprecated
- protected static byte[] getToken(Configuration conf) {
- return InputConfigurator.getToken(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getInputTableName(JobContext)} instead.
- */
- @Deprecated
- protected static String getTablename(Configuration conf) {
- return InputConfigurator.getInputTableName(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getScanAuthorizations(JobContext)} instead.
- */
- @Deprecated
- protected static Authorizations getAuthorizations(Configuration conf) {
- return InputConfigurator.getScanAuthorizations(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getInstance(JobContext)} instead.
- */
- @Deprecated
- protected static Instance getInstance(Configuration conf) {
- return InputConfigurator.getInstance(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getTabletLocator(JobContext)} instead.
- */
- @Deprecated
- protected static TabletLocator getTabletLocator(Configuration conf) throws TableNotFoundException {
- return InputConfigurator.getTabletLocator(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getRanges(JobContext)} instead.
- */
- @Deprecated
- protected static List<Range> getRanges(Configuration conf) throws IOException {
- return InputConfigurator.getRanges(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getFetchedColumns(JobContext)} instead.
- */
- @Deprecated
- protected static Set<Pair<Text,Text>> getFetchedColumns(Configuration conf) {
- return InputConfigurator.getFetchedColumns(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getAutoAdjustRanges(JobContext)} instead.
- */
- @Deprecated
- protected static boolean getAutoAdjustRanges(Configuration conf) {
- return InputConfigurator.getAutoAdjustRanges(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getLogLevel(JobContext)} instead.
- */
- @Deprecated
- protected static Level getLogLevel(Configuration conf) {
- return InputConfigurator.getLogLevel(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #validateOptions(JobContext)} instead.
- */
- @Deprecated
- protected static void validateOptions(Configuration conf) throws IOException {
- InputConfigurator.validateOptions(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #addIterator(Job, IteratorSetting)} to add the {@link VersioningIterator} instead.
- */
- @Deprecated
- protected static int getMaxVersions(Configuration conf) {
- // This is so convoluted, because the only reason to get the number of maxVersions is to construct the same type of IteratorSetting object we have to
- // deconstruct to get at this option in the first place, but to preserve correct behavior, this appears necessary.
- List<IteratorSetting> iteratorSettings = InputConfigurator.getIterators(CLASS, conf);
- for (IteratorSetting setting : iteratorSettings) {
- if ("vers".equals(setting.getName()) && 1 == setting.getPriority() && VersioningIterator.class.getName().equals(setting.getIteratorClass())) {
- if (setting.getOptions().containsKey("maxVersions"))
- return Integer.parseInt(setting.getOptions().get("maxVersions"));
- else
- return -1;
- }
- }
- return -1;
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #isOfflineScan(JobContext)} instead.
- */
- @Deprecated
- protected static boolean isOfflineScan(Configuration conf) {
- return InputConfigurator.isOfflineScan(CLASS, conf);
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getIterators(JobContext)} instead.
- */
- @Deprecated
- protected static List<AccumuloIterator> getIterators(Configuration conf) {
- List<IteratorSetting> iteratorSettings = InputConfigurator.getIterators(CLASS, conf);
- List<AccumuloIterator> deprecatedIterators = new ArrayList<AccumuloIterator>(iteratorSettings.size());
- for (IteratorSetting setting : iteratorSettings) {
- AccumuloIterator deprecatedIter = new AccumuloIterator(new String(setting.getPriority() + AccumuloIterator.FIELD_SEP + setting.getIteratorClass()
- + AccumuloIterator.FIELD_SEP + setting.getName()));
- deprecatedIterators.add(deprecatedIter);
- }
- return deprecatedIterators;
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link #getIterators(JobContext)} instead.
- */
- @Deprecated
- protected static List<AccumuloIteratorOption> getIteratorOptions(Configuration conf) {
- List<IteratorSetting> iteratorSettings = InputConfigurator.getIterators(CLASS, conf);
- List<AccumuloIteratorOption> deprecatedIteratorOptions = new ArrayList<AccumuloIteratorOption>(iteratorSettings.size());
- for (IteratorSetting setting : iteratorSettings) {
- for (Entry<String,String> opt : setting.getOptions().entrySet()) {
- String deprecatedOption;
- try {
- deprecatedOption = new String(setting.getName() + AccumuloIteratorOption.FIELD_SEP + URLEncoder.encode(opt.getKey(), "UTF-8")
- + AccumuloIteratorOption.FIELD_SEP + URLEncoder.encode(opt.getValue(), "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- deprecatedIteratorOptions.add(new AccumuloIteratorOption(deprecatedOption));
- }
- }
- return deprecatedIteratorOptions;
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link IteratorSetting} instead.
- */
- @Deprecated
- static class AccumuloIterator {
-
- private static final String FIELD_SEP = ":";
-
- private int priority;
- private String iteratorClass;
- private String iteratorName;
-
- public AccumuloIterator(int priority, String iteratorClass, String iteratorName) {
- this.priority = priority;
- this.iteratorClass = iteratorClass;
- this.iteratorName = iteratorName;
- }
-
- // Parses out a setting given an string supplied from an earlier toString() call
- public AccumuloIterator(String iteratorSetting) {
- // Parse the string to expand the iterator
- StringTokenizer tokenizer = new StringTokenizer(iteratorSetting, FIELD_SEP);
- priority = Integer.parseInt(tokenizer.nextToken());
- iteratorClass = tokenizer.nextToken();
- iteratorName = tokenizer.nextToken();
- }
-
- public int getPriority() {
- return priority;
- }
-
- public String getIteratorClass() {
- return iteratorClass;
- }
-
- public String getIteratorName() {
- return iteratorName;
- }
-
- @Override
- public String toString() {
- return new String(priority + FIELD_SEP + iteratorClass + FIELD_SEP + iteratorName);
- }
-
- }
-
- /**
- * @deprecated since 1.5.0; Use {@link IteratorSetting} instead.
- */
- @Deprecated
- static class AccumuloIteratorOption {
- private static final String FIELD_SEP = ":";
-
- private String iteratorName;
- private String key;
- private String value;
-
- public AccumuloIteratorOption(String iteratorName, String key, String value) {
- this.iteratorName = iteratorName;
- this.key = key;
- this.value = value;
- }
-
- // Parses out an option given a string supplied from an earlier toString() call
- public AccumuloIteratorOption(String iteratorOption) {
- StringTokenizer tokenizer = new StringTokenizer(iteratorOption, FIELD_SEP);
- this.iteratorName = tokenizer.nextToken();
- try {
- this.key = URLDecoder.decode(tokenizer.nextToken(), "UTF-8");
- this.value = URLDecoder.decode(tokenizer.nextToken(), "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- }
-
- public String getIteratorName() {
- return iteratorName;
- }
-
- public String getKey() {
- return key;
- }
-
- public String getValue() {
- return value;
- }
-
- @Override
- public String toString() {
- try {
- return new String(iteratorName + FIELD_SEP + URLEncoder.encode(key, "UTF-8") + FIELD_SEP + URLEncoder.encode(value, "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- }
-
- }
-
// use reflection to pull the Configuration out of the JobContext for Hadoop 1 and Hadoop 2 compatibility
static Configuration getConfiguration(JobContext context) {
try {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
index c0829df..f37994d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
@@ -148,12 +148,6 @@ public class MockInstance implements Instance {
this.conf = conf;
}
- @Deprecated
- @Override
- public Connector getConnector(org.apache.accumulo.core.security.thrift.AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
- return getConnector(auth.user, auth.password);
- }
-
@Override
public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
Connector conn = new MockConnector(principal, acu, this);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
index 28f24ef..28cb0bd 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
@@ -32,6 +32,7 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str
public abstract String get(Property property);
+ @Override
public abstract Iterator<Entry<String,String>> iterator();
private void checkType(Property property, PropertyType type) {
@@ -45,15 +46,17 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str
/**
* This method returns all properties in a map of string->string under the given prefix property.
- * @param property the prefix property, and must be of type PropertyType.PREFIX
+ *
+ * @param property
+ * the prefix property, and must be of type PropertyType.PREFIX
* @return a map of strings to strings of the resulting properties
*/
- public Map<String, String> getAllPropertiesWithPrefix(Property property) {
+ public Map<String,String> getAllPropertiesWithPrefix(Property property) {
checkType(property, PropertyType.PREFIX);
- Map<String, String> propMap = new HashMap<String, String>();
+ Map<String,String> propMap = new HashMap<String,String>();
- for (Entry<String, String> entry : this) {
+ for (Entry<String,String> entry : this) {
if (entry.getKey().startsWith(property.getKey())) {
propMap.put(entry.getKey(), entry.getValue());
}
@@ -153,8 +156,8 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str
return DefaultConfiguration.getInstance();
}
- // Only here for Shell option-free start-up
/**
+ * Only here for Shell option-free start-up
*
* @deprecated not for client use
*/
@@ -178,7 +181,6 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str
return maxFilesPerTablet;
}
- public void invalidateCache() {
- // overridden in ZooConfiguration
- }
+ // overridden in ZooConfiguration
+ public void invalidateCache() {}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java b/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java
index 691ec0e..641ca3a 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java
@@ -43,16 +43,6 @@ public class ColumnUpdate {
this.val = val;
}
- /**
- * @deprecated use setTimestamp(long);
- * @param timestamp
- */
- @Deprecated
- public void setSystemTimestamp(long timestamp) {
- if (hasTimestamp)
- throw new IllegalStateException("Cannot set system timestamp when user set a timestamp");
- }
-
public boolean hasTimestamp() {
return hasTimestamp;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/security/thrift/AuthInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/thrift/AuthInfo.java b/core/src/main/java/org/apache/accumulo/core/security/thrift/AuthInfo.java
deleted file mode 100644
index 9df1d29..0000000
--- a/core/src/main/java/org/apache/accumulo/core/security/thrift/AuthInfo.java
+++ /dev/null
@@ -1,616 +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.
- */
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.accumulo.core.security.thrift;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @deprecated since 1.5
- */
-@SuppressWarnings("all") public class AuthInfo implements org.apache.thrift.TBase<AuthInfo, AuthInfo._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthInfo");
-
- private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceId", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new AuthInfoStandardSchemeFactory());
- schemes.put(TupleScheme.class, new AuthInfoTupleSchemeFactory());
- }
-
- public String user; // required
- public ByteBuffer password; // required
- public String instanceId; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- USER((short)1, "user"),
- PASSWORD((short)2, "password"),
- INSTANCE_ID((short)3, "instanceId");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // USER
- return USER;
- case 2: // PASSWORD
- return PASSWORD;
- case 3: // INSTANCE_ID
- return INSTANCE_ID;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
- tmpMap.put(_Fields.INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("instanceId", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthInfo.class, metaDataMap);
- }
-
- public AuthInfo() {
- }
-
- public AuthInfo(
- String user,
- ByteBuffer password,
- String instanceId)
- {
- this();
- this.user = user;
- this.password = password;
- this.instanceId = instanceId;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public AuthInfo(AuthInfo other) {
- if (other.isSetUser()) {
- this.user = other.user;
- }
- if (other.isSetPassword()) {
- this.password = org.apache.thrift.TBaseHelper.copyBinary(other.password);
-;
- }
- if (other.isSetInstanceId()) {
- this.instanceId = other.instanceId;
- }
- }
-
- public AuthInfo deepCopy() {
- return new AuthInfo(this);
- }
-
- @Override
- public void clear() {
- this.user = null;
- this.password = null;
- this.instanceId = null;
- }
-
- public String getUser() {
- return this.user;
- }
-
- public AuthInfo setUser(String user) {
- this.user = user;
- return this;
- }
-
- public void unsetUser() {
- this.user = null;
- }
-
- /** Returns true if field user is set (has been assigned a value) and false otherwise */
- public boolean isSetUser() {
- return this.user != null;
- }
-
- public void setUserIsSet(boolean value) {
- if (!value) {
- this.user = null;
- }
- }
-
- public byte[] getPassword() {
- setPassword(org.apache.thrift.TBaseHelper.rightSize(password));
- return password == null ? null : password.array();
- }
-
- public ByteBuffer bufferForPassword() {
- return password;
- }
-
- public AuthInfo setPassword(byte[] password) {
- setPassword(password == null ? (ByteBuffer)null : ByteBuffer.wrap(password));
- return this;
- }
-
- public AuthInfo setPassword(ByteBuffer password) {
- this.password = password;
- return this;
- }
-
- public void unsetPassword() {
- this.password = null;
- }
-
- /** Returns true if field password is set (has been assigned a value) and false otherwise */
- public boolean isSetPassword() {
- return this.password != null;
- }
-
- public void setPasswordIsSet(boolean value) {
- if (!value) {
- this.password = null;
- }
- }
-
- public String getInstanceId() {
- return this.instanceId;
- }
-
- public AuthInfo setInstanceId(String instanceId) {
- this.instanceId = instanceId;
- return this;
- }
-
- public void unsetInstanceId() {
- this.instanceId = null;
- }
-
- /** Returns true if field instanceId is set (has been assigned a value) and false otherwise */
- public boolean isSetInstanceId() {
- return this.instanceId != null;
- }
-
- public void setInstanceIdIsSet(boolean value) {
- if (!value) {
- this.instanceId = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case USER:
- if (value == null) {
- unsetUser();
- } else {
- setUser((String)value);
- }
- break;
-
- case PASSWORD:
- if (value == null) {
- unsetPassword();
- } else {
- setPassword((ByteBuffer)value);
- }
- break;
-
- case INSTANCE_ID:
- if (value == null) {
- unsetInstanceId();
- } else {
- setInstanceId((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case USER:
- return getUser();
-
- case PASSWORD:
- return getPassword();
-
- case INSTANCE_ID:
- return getInstanceId();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case USER:
- return isSetUser();
- case PASSWORD:
- return isSetPassword();
- case INSTANCE_ID:
- return isSetInstanceId();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof AuthInfo)
- return this.equals((AuthInfo)that);
- return false;
- }
-
- public boolean equals(AuthInfo that) {
- if (that == null)
- return false;
-
- boolean this_present_user = true && this.isSetUser();
- boolean that_present_user = true && that.isSetUser();
- if (this_present_user || that_present_user) {
- if (!(this_present_user && that_present_user))
- return false;
- if (!this.user.equals(that.user))
- return false;
- }
-
- boolean this_present_password = true && this.isSetPassword();
- boolean that_present_password = true && that.isSetPassword();
- if (this_present_password || that_present_password) {
- if (!(this_present_password && that_present_password))
- return false;
- if (!this.password.equals(that.password))
- return false;
- }
-
- boolean this_present_instanceId = true && this.isSetInstanceId();
- boolean that_present_instanceId = true && that.isSetInstanceId();
- if (this_present_instanceId || that_present_instanceId) {
- if (!(this_present_instanceId && that_present_instanceId))
- return false;
- if (!this.instanceId.equals(that.instanceId))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(AuthInfo other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- AuthInfo typedOther = (AuthInfo)other;
-
- lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUser()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPassword()).compareTo(typedOther.isSetPassword());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPassword()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, typedOther.password);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetInstanceId()).compareTo(typedOther.isSetInstanceId());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetInstanceId()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instanceId, typedOther.instanceId);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("AuthInfo(");
- boolean first = true;
-
- sb.append("user:");
- if (this.user == null) {
- sb.append("null");
- } else {
- sb.append(this.user);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("password:");
- if (this.password == null) {
- sb.append("null");
- } else {
- org.apache.thrift.TBaseHelper.toString(this.password, sb);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("instanceId:");
- if (this.instanceId == null) {
- sb.append("null");
- } else {
- sb.append(this.instanceId);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class AuthInfoStandardSchemeFactory implements SchemeFactory {
- public AuthInfoStandardScheme getScheme() {
- return new AuthInfoStandardScheme();
- }
- }
-
- private static class AuthInfoStandardScheme extends StandardScheme<AuthInfo> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, AuthInfo struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // USER
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.user = iprot.readString();
- struct.setUserIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // PASSWORD
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.password = iprot.readBinary();
- struct.setPasswordIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // INSTANCE_ID
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.instanceId = iprot.readString();
- struct.setInstanceIdIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, AuthInfo struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.user != null) {
- oprot.writeFieldBegin(USER_FIELD_DESC);
- oprot.writeString(struct.user);
- oprot.writeFieldEnd();
- }
- if (struct.password != null) {
- oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
- oprot.writeBinary(struct.password);
- oprot.writeFieldEnd();
- }
- if (struct.instanceId != null) {
- oprot.writeFieldBegin(INSTANCE_ID_FIELD_DESC);
- oprot.writeString(struct.instanceId);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class AuthInfoTupleSchemeFactory implements SchemeFactory {
- public AuthInfoTupleScheme getScheme() {
- return new AuthInfoTupleScheme();
- }
- }
-
- private static class AuthInfoTupleScheme extends TupleScheme<AuthInfo> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, AuthInfo struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetUser()) {
- optionals.set(0);
- }
- if (struct.isSetPassword()) {
- optionals.set(1);
- }
- if (struct.isSetInstanceId()) {
- optionals.set(2);
- }
- oprot.writeBitSet(optionals, 3);
- if (struct.isSetUser()) {
- oprot.writeString(struct.user);
- }
- if (struct.isSetPassword()) {
- oprot.writeBinary(struct.password);
- }
- if (struct.isSetInstanceId()) {
- oprot.writeString(struct.instanceId);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, AuthInfo struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(3);
- if (incoming.get(0)) {
- struct.user = iprot.readString();
- struct.setUserIsSet(true);
- }
- if (incoming.get(1)) {
- struct.password = iprot.readBinary();
- struct.setPasswordIsSet(true);
- }
- if (incoming.get(2)) {
- struct.instanceId = iprot.readString();
- struct.setInstanceIdIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/security/thrift/SecurityErrorCode.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/thrift/SecurityErrorCode.java b/core/src/main/java/org/apache/accumulo/core/security/thrift/SecurityErrorCode.java
deleted file mode 100644
index 7aa0dd2..0000000
--- a/core/src/main/java/org/apache/accumulo/core/security/thrift/SecurityErrorCode.java
+++ /dev/null
@@ -1,112 +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.
- */
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.accumulo.core.security.thrift;
-
-
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.thrift.TEnum;
-
-/**
- * @deprecated since 1.5, see org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode
- */
-@SuppressWarnings("all") public enum SecurityErrorCode implements org.apache.thrift.TEnum {
- DEFAULT_SECURITY_ERROR(0),
- BAD_CREDENTIALS(1),
- PERMISSION_DENIED(2),
- USER_DOESNT_EXIST(3),
- CONNECTION_ERROR(4),
- USER_EXISTS(5),
- GRANT_INVALID(6),
- BAD_AUTHORIZATIONS(7),
- INVALID_INSTANCEID(8),
- TABLE_DOESNT_EXIST(9),
- UNSUPPORTED_OPERATION(10),
- INVALID_TOKEN(11),
- AUTHENTICATOR_FAILED(12),
- AUTHORIZOR_FAILED(13),
- PERMISSIONHANDLER_FAILED(14),
- TOKEN_EXPIRED(15),
- SERIALIZATION_ERROR(16),
- INSUFFICIENT_PROPERTIES(17);
-
- private final int value;
-
- private SecurityErrorCode(int value) {
- this.value = value;
- }
-
- /**
- * Get the integer value of this enum value, as defined in the Thrift IDL.
- */
- public int getValue() {
- return value;
- }
-
- /**
- * Find a the enum type by its integer value, as defined in the Thrift IDL.
- * @return null if the value is not found.
- */
- public static SecurityErrorCode findByValue(int value) {
- switch (value) {
- case 0:
- return DEFAULT_SECURITY_ERROR;
- case 1:
- return BAD_CREDENTIALS;
- case 2:
- return PERMISSION_DENIED;
- case 3:
- return USER_DOESNT_EXIST;
- case 4:
- return CONNECTION_ERROR;
- case 5:
- return USER_EXISTS;
- case 6:
- return GRANT_INVALID;
- case 7:
- return BAD_AUTHORIZATIONS;
- case 8:
- return INVALID_INSTANCEID;
- case 9:
- return TABLE_DOESNT_EXIST;
- case 10:
- return UNSUPPORTED_OPERATION;
- case 11:
- return INVALID_TOKEN;
- case 12:
- return AUTHENTICATOR_FAILED;
- case 13:
- return AUTHORIZOR_FAILED;
- case 14:
- return PERMISSIONHANDLER_FAILED;
- case 15:
- return TOKEN_EXPIRED;
- case 16:
- return SERIALIZATION_ERROR;
- case 17:
- return INSUFFICIENT_PROPERTIES;
- default:
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftSecurityException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftSecurityException.java b/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftSecurityException.java
deleted file mode 100644
index c7b2fcb..0000000
--- a/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftSecurityException.java
+++ /dev/null
@@ -1,521 +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.
- */
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.accumulo.core.security.thrift;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @deprecated since 1.5, see org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException
- */
-@SuppressWarnings("all") public class ThriftSecurityException extends TException implements org.apache.thrift.TBase<ThriftSecurityException, ThriftSecurityException._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftSecurityException");
-
- private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("code", org.apache.thrift.protocol.TType.I32, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new ThriftSecurityExceptionStandardSchemeFactory());
- schemes.put(TupleScheme.class, new ThriftSecurityExceptionTupleSchemeFactory());
- }
-
- public String user; // required
- /**
- *
- * @see SecurityErrorCode
- */
- public SecurityErrorCode code; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- USER((short)1, "user"),
- /**
- *
- * @see SecurityErrorCode
- */
- CODE((short)2, "code");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // USER
- return USER;
- case 2: // CODE
- return CODE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.CODE, new org.apache.thrift.meta_data.FieldMetaData("code", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SecurityErrorCode.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftSecurityException.class, metaDataMap);
- }
-
- public ThriftSecurityException() {
- }
-
- public ThriftSecurityException(
- String user,
- SecurityErrorCode code)
- {
- this();
- this.user = user;
- this.code = code;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public ThriftSecurityException(ThriftSecurityException other) {
- if (other.isSetUser()) {
- this.user = other.user;
- }
- if (other.isSetCode()) {
- this.code = other.code;
- }
- }
-
- public ThriftSecurityException deepCopy() {
- return new ThriftSecurityException(this);
- }
-
- @Override
- public void clear() {
- this.user = null;
- this.code = null;
- }
-
- public String getUser() {
- return this.user;
- }
-
- public ThriftSecurityException setUser(String user) {
- this.user = user;
- return this;
- }
-
- public void unsetUser() {
- this.user = null;
- }
-
- /** Returns true if field user is set (has been assigned a value) and false otherwise */
- public boolean isSetUser() {
- return this.user != null;
- }
-
- public void setUserIsSet(boolean value) {
- if (!value) {
- this.user = null;
- }
- }
-
- /**
- *
- * @see SecurityErrorCode
- */
- public SecurityErrorCode getCode() {
- return this.code;
- }
-
- /**
- *
- * @see SecurityErrorCode
- */
- public ThriftSecurityException setCode(SecurityErrorCode code) {
- this.code = code;
- return this;
- }
-
- public void unsetCode() {
- this.code = null;
- }
-
- /** Returns true if field code is set (has been assigned a value) and false otherwise */
- public boolean isSetCode() {
- return this.code != null;
- }
-
- public void setCodeIsSet(boolean value) {
- if (!value) {
- this.code = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case USER:
- if (value == null) {
- unsetUser();
- } else {
- setUser((String)value);
- }
- break;
-
- case CODE:
- if (value == null) {
- unsetCode();
- } else {
- setCode((SecurityErrorCode)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case USER:
- return getUser();
-
- case CODE:
- return getCode();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case USER:
- return isSetUser();
- case CODE:
- return isSetCode();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof ThriftSecurityException)
- return this.equals((ThriftSecurityException)that);
- return false;
- }
-
- public boolean equals(ThriftSecurityException that) {
- if (that == null)
- return false;
-
- boolean this_present_user = true && this.isSetUser();
- boolean that_present_user = true && that.isSetUser();
- if (this_present_user || that_present_user) {
- if (!(this_present_user && that_present_user))
- return false;
- if (!this.user.equals(that.user))
- return false;
- }
-
- boolean this_present_code = true && this.isSetCode();
- boolean that_present_code = true && that.isSetCode();
- if (this_present_code || that_present_code) {
- if (!(this_present_code && that_present_code))
- return false;
- if (!this.code.equals(that.code))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(ThriftSecurityException other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- ThriftSecurityException typedOther = (ThriftSecurityException)other;
-
- lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUser()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetCode()).compareTo(typedOther.isSetCode());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetCode()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.code, typedOther.code);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("ThriftSecurityException(");
- boolean first = true;
-
- sb.append("user:");
- if (this.user == null) {
- sb.append("null");
- } else {
- sb.append(this.user);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("code:");
- if (this.code == null) {
- sb.append("null");
- } else {
- sb.append(this.code);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class ThriftSecurityExceptionStandardSchemeFactory implements SchemeFactory {
- public ThriftSecurityExceptionStandardScheme getScheme() {
- return new ThriftSecurityExceptionStandardScheme();
- }
- }
-
- private static class ThriftSecurityExceptionStandardScheme extends StandardScheme<ThriftSecurityException> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftSecurityException struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // USER
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.user = iprot.readString();
- struct.setUserIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // CODE
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.code = SecurityErrorCode.findByValue(iprot.readI32());
- struct.setCodeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, ThriftSecurityException struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.user != null) {
- oprot.writeFieldBegin(USER_FIELD_DESC);
- oprot.writeString(struct.user);
- oprot.writeFieldEnd();
- }
- if (struct.code != null) {
- oprot.writeFieldBegin(CODE_FIELD_DESC);
- oprot.writeI32(struct.code.getValue());
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class ThriftSecurityExceptionTupleSchemeFactory implements SchemeFactory {
- public ThriftSecurityExceptionTupleScheme getScheme() {
- return new ThriftSecurityExceptionTupleScheme();
- }
- }
-
- private static class ThriftSecurityExceptionTupleScheme extends TupleScheme<ThriftSecurityException> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, ThriftSecurityException struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetUser()) {
- optionals.set(0);
- }
- if (struct.isSetCode()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetUser()) {
- oprot.writeString(struct.user);
- }
- if (struct.isSetCode()) {
- oprot.writeI32(struct.code.getValue());
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, ThriftSecurityException struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.user = iprot.readString();
- struct.setUserIsSet(true);
- }
- if (incoming.get(1)) {
- struct.code = SecurityErrorCode.findByValue(iprot.readI32());
- struct.setCodeIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
index ef3e519..2b8d96e 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
@@ -140,6 +140,7 @@ import org.apache.accumulo.core.util.shell.commands.UserCommand;
import org.apache.accumulo.core.util.shell.commands.UserPermissionsCommand;
import org.apache.accumulo.core.util.shell.commands.UsersCommand;
import org.apache.accumulo.core.util.shell.commands.WhoAmICommand;
+import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooReader;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
@@ -396,11 +397,10 @@ public class Shell extends ShellOptions {
}
}
- @SuppressWarnings("deprecation")
private static Instance getDefaultInstance(AccumuloConfiguration conf) {
String keepers = conf.get(Property.INSTANCE_ZK_HOST);
Path instanceDir = new Path(conf.get(Property.INSTANCE_DFS_DIR), "instance_id");
- return new ZooKeeperInstance(UUID.fromString(ZooKeeperInstance.getInstanceIDFromHdfs(instanceDir)), keepers);
+ return new ZooKeeperInstance(UUID.fromString(ZooUtil.getInstanceIDFromHdfs(instanceDir)), keepers);
}
public Connector getConnector() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a69a9d68/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java
index 8a4d0ce..6bf4f30 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java
@@ -137,16 +137,15 @@ public class FateCommand extends Command {
return failedCommand ? 1 : 0;
}
- @SuppressWarnings("deprecation")
protected synchronized IZooReaderWriter getZooReaderWriter(Instance instance, String secret) {
-
+
if (secret == null) {
+ @SuppressWarnings("deprecation")
AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
secret = conf.get(Property.INSTANCE_SECRET);
}
- return new ZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), SCHEME,
- (USER + ":" + secret).getBytes());
+ return new ZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), SCHEME, (USER + ":" + secret).getBytes());
}
@Override