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/02/28 22:14:59 UTC
svn commit: r1451350 - in /accumulo/branches/ACCUMULO-259-polishing:
core/src/main/java/org/apache/accumulo/core/cli/
core/src/main/java/org/apache/accumulo/core/client/
core/src/main/java/org/apache/accumulo/core/client/impl/
core/src/main/java/org/ap...
Author: ctubbsii
Date: Thu Feb 28 21:14:58 2013
New Revision: 1451350
URL: http://svn.apache.org/r1451350
Log:
ACCUMULO-1026 Minimize the impact of deprecation and suppression of deprecation warnings throughout the code, especially related to the security APIs and the Connector
Modified:
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/Connector.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java
accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/trace/TraceFileSystem.java
accumulo/branches/ACCUMULO-259-polishing/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java
accumulo/branches/ACCUMULO-259-polishing/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java Thu Feb 28 21:14:58 2013
@@ -163,7 +163,6 @@ public class ClientOpts extends Help {
protected Instance cachedInstance = null;
- @SuppressWarnings("deprecation")
synchronized public Instance getInstance() {
if (cachedInstance != null)
return cachedInstance;
@@ -196,7 +195,9 @@ 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");
- return cachedInstance = new ZooKeeperInstance(UUID.fromString(ZooKeeperInstance.getInstanceIDFromHdfs(instanceDir)), zookeepers);
+ @SuppressWarnings("deprecation")
+ String instanceIDFromFile = ZooKeeperInstance.getInstanceIDFromHdfs(instanceDir);
+ return cachedInstance = new ZooKeeperInstance(UUID.fromString(instanceIDFromFile), zookeepers);
}
return cachedInstance = new ZooKeeperInstance(this.instance, this.zookeepers);
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/Connector.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/Connector.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/Connector.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/Connector.java Thu Feb 28 21:14:58 2013
@@ -27,38 +27,7 @@ import org.apache.accumulo.core.security
*
* The Connector enforces security on the client side by forcing all API calls to be accompanied by user credentials.
*/
-public class Connector {
- final Connector impl;
-
- /**
- * Construct a Connector from an {@link Instance}
- *
- * @deprecated Not for client use
- * @param instance
- * contains the precise connection information to identify the running accumulo instance
- * @param user
- * a valid accumulo user
- * @param password
- * the password for the user
- * @throws AccumuloException
- * when a generic exception occurs
- * @throws AccumuloSecurityException
- * when a user's credentials are invalid
- * @see Instance#getConnector(String user, byte[] password)
- */
- @Deprecated
- public Connector(Instance instance, String user, byte[] password) throws AccumuloException, AccumuloSecurityException {
- impl = instance.getConnector(user, password);
- }
-
- /**
- * @see Instance#getConnector(String user, byte[] password)
- * @deprecated Not for client use
- */
- @Deprecated
- public Connector() {
- impl = null;
- }
+public abstract class Connector {
/**
* Factory method to create a BatchScanner connected to Accumulo.
@@ -76,9 +45,7 @@ public class Connector {
* @throws TableNotFoundException
* when the specified table doesn't exist
*/
- public BatchScanner createBatchScanner(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException {
- return impl.createBatchScanner(tableName, authorizations, numQueryThreads);
- }
+ public abstract BatchScanner createBatchScanner(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException;
/**
* Factory method to create a BatchDeleter connected to Accumulo.
@@ -101,13 +68,11 @@ public class Connector {
* @return BatchDeleter object for configuring and deleting
* @throws TableNotFoundException
* when the specified table doesn't exist
- * @deprecated As of 1.5, replaced by {@link #createBatchDeleter(String, Authorizations, int, BatchWriterConfig)}
+ * @deprecated since 1.5.0; Use {@link #createBatchDeleter(String, Authorizations, int, BatchWriterConfig)} instead.
*/
@Deprecated
- public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency,
- int maxWriteThreads) throws TableNotFoundException {
- return impl.createBatchDeleter(tableName, authorizations, numQueryThreads, maxMemory, maxLatency, maxWriteThreads);
- }
+ public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency,
+ int maxWriteThreads) throws TableNotFoundException;
/**
*
@@ -124,12 +89,10 @@ public class Connector {
* @return BatchDeleter object for configuring and deleting
* @throws TableNotFoundException
*/
-
- public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
- throws TableNotFoundException {
- return impl.createBatchDeleter(tableName, authorizations, numQueryThreads, config);
- }
-
+
+ public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
+ throws TableNotFoundException;
+
/**
* Factory method to create a BatchWriter connected to Accumulo.
*
@@ -145,12 +108,10 @@ public class Connector {
* @return BatchWriter object for configuring and writing data to
* @throws TableNotFoundException
* when the specified table doesn't exist
- * @deprecated As of 1.5, replaced by {@link #createBatchWriter(String, BatchWriterConfig)}
+ * @deprecated since 1.5.0; Use {@link #createBatchWriter(String, BatchWriterConfig)} instead.
*/
@Deprecated
- public BatchWriter createBatchWriter(String tableName, long maxMemory, long maxLatency, int maxWriteThreads) throws TableNotFoundException {
- return impl.createBatchWriter(tableName, maxMemory, maxLatency, maxWriteThreads);
- }
+ public abstract BatchWriter createBatchWriter(String tableName, long maxMemory, long maxLatency, int maxWriteThreads) throws TableNotFoundException;
/**
* Factory method to create a BatchWriter connected to Accumulo.
@@ -162,11 +123,9 @@ public class Connector {
* @return BatchWriter object for configuring and writing data to
* @throws TableNotFoundException
*/
-
- public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException {
- return impl.createBatchWriter(tableName, config);
- }
-
+
+ public abstract BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException;
+
/**
* Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch writers can queue data for multiple tables, which is good for
* ingesting data into multiple tables from the same source
@@ -179,12 +138,10 @@ public class Connector {
* the maximum number of threads to use for writing data to the tablet servers
*
* @return MultiTableBatchWriter object for configuring and writing data to
- * @deprecated As of 1.5, replaced by {@link #createMultiTableBatchWriter(BatchWriterConfig)}
+ * @deprecated since 1.5.0; Use {@link #createMultiTableBatchWriter(BatchWriterConfig)} instead.
*/
@Deprecated
- public MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads) {
- return impl.createMultiTableBatchWriter(maxMemory, maxLatency, maxWriteThreads);
- }
+ public abstract MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads);
/**
* Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch writers can queue data for multiple tables. Also data for
@@ -194,10 +151,8 @@ public class Connector {
* configuration used to create multi-table batch writer
* @return MultiTableBatchWriter object for configuring and writing data to
*/
-
- public MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config) {
- return impl.createMultiTableBatchWriter(config);
- }
+
+ public abstract MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config);
/**
* Factory method to create a Scanner connected to Accumulo.
@@ -213,52 +168,40 @@ public class Connector {
* @throws TableNotFoundException
* when the specified table doesn't exist
*/
- public Scanner createScanner(String tableName, Authorizations authorizations) throws TableNotFoundException {
- return impl.createScanner(tableName, authorizations);
- }
+ public abstract Scanner createScanner(String tableName, Authorizations authorizations) throws TableNotFoundException;
/**
* Accessor method for internal instance object.
*
* @return the internal instance object
*/
- public Instance getInstance() {
- return impl.getInstance();
- }
+ public abstract Instance getInstance();
/**
* Get the current user for this connector
*
* @return the user name
*/
- public String whoami() {
- return impl.whoami();
- }
+ public abstract String whoami();
/**
* Retrieves a TableOperations object to perform table functions, such as create and delete.
*
* @return an object to manipulate tables
*/
- public synchronized TableOperations tableOperations() {
- return impl.tableOperations();
- }
+ public abstract TableOperations tableOperations();
/**
* Retrieves a SecurityOperations object to perform user security operations, such as creating users.
*
* @return an object to modify users and permissions
*/
- public synchronized SecurityOperations securityOperations() {
- return impl.securityOperations();
- }
+ public abstract SecurityOperations securityOperations();
/**
* Retrieves an InstanceOperations object to modify instance configuration.
*
* @return an object to modify instance configuration
*/
- public synchronized InstanceOperations instanceOperations() {
- return impl.instanceOperations();
- }
+ public abstract InstanceOperations instanceOperations();
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java Thu Feb 28 21:14:58 2013
@@ -73,11 +73,11 @@ public class ZooKeeperInstance implement
private String instanceId = null;
private String instanceName = null;
- private ZooCache zooCache;
+ private final ZooCache zooCache;
- private String zooKeepers;
+ private final String zooKeepers;
- private int zooKeepersSessionTimeOut;
+ private final int zooKeepersSessionTimeOut;
/**
*
@@ -221,14 +221,13 @@ public class ZooKeeperInstance implement
return getConnector(user, ByteBufferUtil.toBytes(pass));
}
- // Suppress deprecation, ConnectorImpl is deprecated to warn clients against using.
@Override
public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
return getConnector(CredentialHelper.create(principal, token, getInstanceID()));
}
@Override
- @SuppressWarnings("deprecation")
+ @Deprecated
public Connector getConnector(TCredentials credential) throws AccumuloException, AccumuloSecurityException {
return new ConnectorImpl(this, credential);
}
@@ -279,7 +278,9 @@ public class ZooKeeperInstance implement
return null;
}
- // To be moved to server code. Only lives here to support the Accumulo Shell
+ /**
+ * 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 {
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java Thu Feb 28 21:14:58 2013
@@ -45,19 +45,12 @@ import org.apache.accumulo.core.util.Arg
import org.apache.accumulo.trace.instrument.Tracer;
public class ConnectorImpl extends Connector {
- private Instance instance;
- private TCredentials credentials;
+ private final Instance instance;
+ private final TCredentials credentials;
private SecurityOperations secops = null;
private TableOperations tableops = null;
private InstanceOperations instanceops = null;
- /**
- *
- * Use {@link Instance#getConnector(String, byte[])}
- *
- * @see Instance#getConnector(String user, byte[] password)
- * @deprecated Not for client use
- */
@Deprecated
public ConnectorImpl(Instance instance, TCredentials cred) throws AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(instance, cred);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java Thu Feb 28 21:14:58 2013
@@ -38,13 +38,11 @@ public class MockConnector extends Conne
private final MockAccumulo acu;
private final Instance instance;
- MockConnector(String username, Instance instance) {
+ MockConnector(String username, MockInstance instance) {
this(username, new MockAccumulo(MockInstance.getDefaultFileSystem()), instance);
}
- @SuppressWarnings("deprecation")
- // Not really deprecated, just discouraging client use.
- MockConnector(String username, MockAccumulo acu, Instance instance) {
+ MockConnector(String username, MockAccumulo acu, MockInstance instance) {
this.username = username;
this.acu = acu;
this.instance = instance;
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java Thu Feb 28 21:14:58 2013
@@ -37,18 +37,17 @@ import com.beust.jcommander.Parameter;
public class PrintInfo {
static class Opts extends Help {
- @Parameter(names={"-d", "--dump"}, description="dump the key/value pairs")
+ @Parameter(names = {"-d", "--dump"}, description = "dump the key/value pairs")
boolean dump = false;
- @Parameter(names={"--historgram"}, description="print a histogram of the key-value sizes")
+ @Parameter(names = {"--historgram"}, description = "print a histogram of the key-value sizes")
boolean histogram = false;
- @Parameter(description=" <file> { <file> ... }")
+ @Parameter(description = " <file> { <file> ... }")
List<String> files = new ArrayList<String>();
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
@SuppressWarnings("deprecation")
- //Not for client use
FileSystem fs = FileUtil.getFileSystem(conf, AccumuloConfiguration.getSiteConfiguration());
Opts opts = new Opts();
opts.parseArgs(PrintInfo.class.getName(), args);
@@ -60,7 +59,7 @@ public class PrintInfo {
long countBuckets[] = new long[11];
long sizeBuckets[] = new long[countBuckets.length];
long totalSize = 0;
-
+
for (String arg : opts.files) {
Path path = new Path(arg);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java Thu Feb 28 21:14:58 2013
@@ -34,29 +34,28 @@ public class PrintInfo {
FSDataInputStream fsin = fs.open(path);
BCFile.Reader bcfr = null;
try {
- bcfr = new BCFile.Reader(fsin, fs.getFileStatus(path).getLen(), conf);
-
- Set<Entry<String,MetaIndexEntry>> es = bcfr.metaIndex.index.entrySet();
-
- for (Entry<String,MetaIndexEntry> entry : es) {
- PrintStream out = System.out;
- out.println("Meta block : " + entry.getKey());
- out.println(" Raw size : " + String.format("%,d", entry.getValue().getRegion().getRawSize()) + " bytes");
- out.println(" Compressed size : " + String.format("%,d", entry.getValue().getRegion().getCompressedSize()) + " bytes");
- out.println(" Compression type : " + entry.getValue().getCompressionAlgorithm().getName());
- out.println();
- }
+ bcfr = new BCFile.Reader(fsin, fs.getFileStatus(path).getLen(), conf);
+
+ Set<Entry<String,MetaIndexEntry>> es = bcfr.metaIndex.index.entrySet();
+
+ for (Entry<String,MetaIndexEntry> entry : es) {
+ PrintStream out = System.out;
+ out.println("Meta block : " + entry.getKey());
+ out.println(" Raw size : " + String.format("%,d", entry.getValue().getRegion().getRawSize()) + " bytes");
+ out.println(" Compressed size : " + String.format("%,d", entry.getValue().getRegion().getCompressedSize()) + " bytes");
+ out.println(" Compression type : " + entry.getValue().getCompressionAlgorithm().getName());
+ out.println();
+ }
} finally {
- if (bcfr != null) {
- bcfr.close();
- }
+ if (bcfr != null) {
+ bcfr.close();
+ }
}
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
@SuppressWarnings("deprecation")
- // Not for client use
FileSystem fs = FileUtil.getFileSystem(conf, AccumuloConfiguration.getSiteConfiguration());
Path path = new Path(args[0]);
printMetaBlockInfo(conf, fs, path);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java Thu Feb 28 21:14:58 2013
@@ -28,7 +28,10 @@ import org.apache.log4j.Logger;
/**
* This factory module exists to assist other classes in loading crypto modules.
+ *
+ * @deprecated This feature is experimental and may go away in future versions.
*/
+@Deprecated
public class CryptoModuleFactory {
private static Logger log = Logger.getLogger(CryptoModuleFactory.class);
@@ -40,14 +43,12 @@ public class CryptoModuleFactory {
* @return a class implementing the CryptoModule interface. It will *never* return null; rather, it will return a class which obeys the interface but makes no
* changes to the underlying data.
*/
-
- @SuppressWarnings("deprecation")
public static CryptoModule getCryptoModule(AccumuloConfiguration conf) {
String cryptoModuleClassname = conf.get(Property.CRYPTO_MODULE_CLASS);
return getCryptoModule(cryptoModuleClassname);
}
- @SuppressWarnings({"rawtypes", "deprecation"})
+ @SuppressWarnings({"rawtypes"})
public static CryptoModule getCryptoModule(String cryptoModuleClassname) {
log.debug(String.format("About to instantiate crypto module %s", cryptoModuleClassname));
@@ -172,37 +173,46 @@ public class CryptoModuleFactory {
return context;
}
+ @Override
public SecretKeyEncryptionStrategyContext getNewContext() {
return new SecretKeyEncryptionStrategyContext() {
+ @Override
public byte[] getPlaintextSecretKey() {
return plaintextSecretKey;
}
+ @Override
public void setPlaintextSecretKey(byte[] plaintextSecretKey) {
this.plaintextSecretKey = plaintextSecretKey;
}
+ @Override
public byte[] getEncryptedSecretKey() {
return encryptedSecretKey;
}
+ @Override
public void setEncryptedSecretKey(byte[] encryptedSecretKey) {
this.encryptedSecretKey = encryptedSecretKey;
}
+ @Override
public String getOpaqueKeyEncryptionKeyID() {
return opaqueKeyEncryptionKeyID;
}
+ @Override
public void setOpaqueKeyEncryptionKeyID(String opaqueKeyEncryptionKeyID) {
this.opaqueKeyEncryptionKeyID = opaqueKeyEncryptionKeyID;
}
+ @Override
public Map<String,String> getContext() {
return context;
}
+ @Override
public void setContext(Map<String,String> context) {
this.context = context;
}
@@ -216,7 +226,6 @@ public class CryptoModuleFactory {
}
- @SuppressWarnings("deprecation")
private static class NullCryptoModule implements CryptoModule {
@Override
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java Thu Feb 28 21:14:58 2013
@@ -44,9 +44,9 @@ import org.apache.log4j.Logger;
* This class contains the gritty details around setting up encrypted streams for reading and writing the log file. It obeys the interface CryptoModule, which
* other developers can implement to change out this logic as necessary.
*
+ * @deprecated This feature is experimental and may go away in future versions.
*/
-
-@SuppressWarnings("deprecation")
+@Deprecated
public class DefaultCryptoModule implements CryptoModule {
// This is how *I* like to format my variable declarations. Your mileage may vary.
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java Thu Feb 28 21:14:58 2013
@@ -170,8 +170,8 @@ public class Shell extends ShellOptions
private Connector connector;
protected ConsoleReader reader;
private TCredentials credentials;
- private Class<? extends Formatter> defaultFormatterClass = DefaultFormatter.class;
- private Class<? extends Formatter> binaryFormatterClass = BinaryFormatter.class;
+ private final Class<? extends Formatter> defaultFormatterClass = DefaultFormatter.class;
+ private final Class<? extends Formatter> binaryFormatterClass = BinaryFormatter.class;
public Map<String,List<IteratorSetting>> scanIteratorOptions = new HashMap<String,List<IteratorSetting>>();
public Map<String,List<IteratorSetting>> iteratorProfiles = new HashMap<String,List<IteratorSetting>>();
@@ -342,19 +342,22 @@ public class Shell extends ShellOptions
return configError;
}
- @SuppressWarnings("deprecation")
protected void setInstance(CommandLine cl) {
// should only be one instance option set
instance = null;
if (cl.hasOption(fakeOption.getLongOpt())) {
instance = new MockInstance("fake");
} else if (cl.hasOption(hdfsZooInstance.getOpt())) {
- instance = getDefaultInstance(AccumuloConfiguration.getSiteConfiguration());
+ @SuppressWarnings("deprecation")
+ AccumuloConfiguration deprecatedSiteConfiguration = AccumuloConfiguration.getSiteConfiguration();
+ instance = getDefaultInstance(deprecatedSiteConfiguration);
} else if (cl.hasOption(zooKeeperInstance.getOpt())) {
String[] zkOpts = cl.getOptionValues(zooKeeperInstance.getOpt());
instance = new ZooKeeperInstance(zkOpts[0], zkOpts[1]);
} else {
- instance = getDefaultInstance(AccumuloConfiguration.getSiteConfiguration());
+ @SuppressWarnings("deprecation")
+ AccumuloConfiguration deprecatedSiteConfiguration = AccumuloConfiguration.getSiteConfiguration();
+ instance = getDefaultInstance(deprecatedSiteConfiguration);
}
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java Thu Feb 28 21:14:58 2013
@@ -29,12 +29,10 @@ import org.apache.accumulo.core.client.A
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.iterators.AggregatingIterator;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.iterators.OptionDescriber;
import org.apache.accumulo.core.iterators.OptionDescriber.IteratorOptions;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
-import org.apache.accumulo.core.iterators.aggregation.Aggregator;
import org.apache.accumulo.core.iterators.user.AgeOffFilter;
import org.apache.accumulo.core.iterators.user.RegExFilter;
import org.apache.accumulo.core.iterators.user.ReqVisFilter;
@@ -49,14 +47,14 @@ import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
-@SuppressWarnings("deprecation")
public class SetIterCommand extends Command {
private Option mincScopeOpt, majcScopeOpt, scanScopeOpt, nameOpt, priorityOpt;
private Option aggTypeOpt, ageoffTypeOpt, regexTypeOpt, versionTypeOpt, reqvisTypeOpt, classnameTypeOpt;
- public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
- IOException, ShellCommandException {
+ @Override
+ public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException,
+ TableNotFoundException, IOException, ShellCommandException {
final int priority = Integer.parseInt(cl.getOptionValue(priorityOpt.getOpt()));
@@ -64,7 +62,9 @@ public class SetIterCommand extends Comm
String classname = cl.getOptionValue(classnameTypeOpt.getOpt());
if (cl.hasOption(aggTypeOpt.getOpt())) {
Shell.log.warn("aggregators are deprecated");
- classname = AggregatingIterator.class.getName();
+ @SuppressWarnings("deprecation")
+ String deprecatedClassName = org.apache.accumulo.core.iterators.AggregatingIterator.class.getName();
+ classname = deprecatedClassName;
} else if (cl.hasOption(regexTypeOpt.getOpt())) {
classname = RegExFilter.class.getName();
} else if (cl.hasOption(ageoffTypeOpt.getOpt())) {
@@ -78,26 +78,27 @@ public class SetIterCommand extends Comm
if (!shellState.getConnector().instanceOperations().testClassLoad(classname, SortedKeyValueIterator.class.getName())) {
throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + classname + " as type "
+ SortedKeyValueIterator.class.getName());
- }
+ }
final String name = cl.getOptionValue(nameOpt.getOpt(), setUpOptions(shellState.getReader(), classname, options));
final String aggregatorClass = options.get("aggregatorClass");
- if (aggregatorClass != null && !shellState.getConnector().instanceOperations().testClassLoad(aggregatorClass, Aggregator.class.getName())) {
+ @SuppressWarnings("deprecation")
+ String deprecatedAggregatorClassName = org.apache.accumulo.core.iterators.aggregation.Aggregator.class.getName();
+ if (aggregatorClass != null && !shellState.getConnector().instanceOperations().testClassLoad(aggregatorClass, deprecatedAggregatorClassName)) {
throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + aggregatorClass + " as type "
- + Aggregator.class.getName());
- }
+ + deprecatedAggregatorClassName);
+ }
setTableProperties(cl, shellState, priority, options, classname, name);
return 0;
}
protected void setTableProperties(final CommandLine cl, final Shell shellState, final int priority, final Map<String,String> options, final String classname,
- final String name)
- throws AccumuloException, AccumuloSecurityException, ShellCommandException, TableNotFoundException {
+ final String name) throws AccumuloException, AccumuloSecurityException, ShellCommandException, TableNotFoundException {
// remove empty values
final String tableName = OptUtil.getTableOpt(cl, shellState);
-
+
for (Iterator<Entry<String,String>> i = options.entrySet().iterator(); i.hasNext();) {
final Entry<String,String> entry = i.next();
if (entry.getValue() == null || entry.getValue().isEmpty()) {
@@ -116,12 +117,13 @@ public class SetIterCommand extends Comm
}
if (scopes.isEmpty()) {
throw new IllegalArgumentException("You must select at least one scope to configure");
- }
+ }
final IteratorSetting setting = new IteratorSetting(priority, name, classname, options);
shellState.getConnector().tableOperations().attachIterator(tableName, setting, scopes);
}
- private static String setUpOptions(final ConsoleReader reader, final String className, final Map<String,String> options) throws IOException, ShellCommandException {
+ private static String setUpOptions(final ConsoleReader reader, final String className, final Map<String,String> options) throws IOException,
+ ShellCommandException {
String input;
OptionDescriber skvi;
Class<? extends OptionDescriber> clazz;
@@ -215,6 +217,7 @@ public class SetIterCommand extends Comm
return "sets a table-specific iterator";
}
+ @Override
public Options getOptions() {
final Options o = new Options();
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java Thu Feb 28 21:14:58 2013
@@ -127,10 +127,11 @@ public class HdfsZooInstance implements
return instanceId;
}
- @SuppressWarnings("deprecation")
private static synchronized void _getInstanceID() {
if (instanceId == null) {
- instanceId = ZooKeeperInstance.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
+ @SuppressWarnings("deprecation")
+ String instanceIdFromFile = ZooKeeperInstance.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
+ instanceId = instanceIdFromFile;
}
}
@@ -156,7 +157,7 @@ public class HdfsZooInstance implements
}
@Override
- @SuppressWarnings("deprecation")
+ @Deprecated
public Connector getConnector(TCredentials cred) throws AccumuloException, AccumuloSecurityException {
return new ConnectorImpl(this, cred);
}
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java Thu Feb 28 21:14:58 2013
@@ -57,12 +57,13 @@ public class ZooConfiguration extends Ac
return instance;
}
- @SuppressWarnings("deprecation")
synchronized public static ZooConfiguration getInstance(AccumuloConfiguration parent) {
if (instance == null) {
propCache = new ZooCache(parent.get(Property.INSTANCE_ZK_HOST), (int) parent.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT));
instance = new ZooConfiguration(parent);
- instanceId = ZooKeeperInstance.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
+ @SuppressWarnings("deprecation")
+ String deprecatedInstanceIdFromHdfs = ZooKeeperInstance.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
+ instanceId = deprecatedInstanceIdFromHdfs;
}
return instance;
}
@@ -87,6 +88,7 @@ public class ZooConfiguration extends Ac
return value;
}
+ @Override
public String get(Property property) {
if (Property.isFixedZooPropertyKey(property)) {
if (fixedProps.containsKey(property.getKey())) {
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java Thu Feb 28 21:14:58 2013
@@ -22,7 +22,6 @@ import org.apache.accumulo.core.Constant
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.SecurityOperationsImpl;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.CredentialHelper;
@@ -33,6 +32,7 @@ import org.apache.accumulo.core.security
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.core.security.tokens.AuthenticationToken;
import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.master.Master;
import org.apache.accumulo.server.security.handler.Authenticator;
import org.apache.accumulo.server.security.handler.Authorizor;
@@ -71,26 +71,23 @@ public class SecurityOperation {
return instance;
}
- @SuppressWarnings("deprecation")
protected static Authorizor getAuthorizor(String instanceId, boolean initialize) {
- Authorizor toRet = Master.createInstanceFromPropertyName(AccumuloConfiguration.getSiteConfiguration(), Property.INSTANCE_SECURITY_AUTHORIZOR,
+ Authorizor toRet = Master.createInstanceFromPropertyName(ServerConfiguration.getSiteConfiguration(), Property.INSTANCE_SECURITY_AUTHORIZOR,
Authorizor.class, ZKAuthorizor.getInstance());
toRet.initialize(instanceId, initialize);
return toRet;
}
- @SuppressWarnings("deprecation")
protected static Authenticator getAuthenticator(String instanceId, boolean initialize) {
- Authenticator toRet = Master.createInstanceFromPropertyName(AccumuloConfiguration.getSiteConfiguration(), Property.INSTANCE_SECURITY_AUTHENTICATOR,
+ Authenticator toRet = Master.createInstanceFromPropertyName(ServerConfiguration.getSiteConfiguration(), Property.INSTANCE_SECURITY_AUTHENTICATOR,
Authenticator.class, ZKAuthenticator.getInstance());
toRet.initialize(instanceId, initialize);
return toRet;
}
- @SuppressWarnings("deprecation")
protected static PermissionHandler getPermHandler(String instanceId, boolean initialize) {
- PermissionHandler toRet = Master.createInstanceFromPropertyName(AccumuloConfiguration.getSiteConfiguration(),
- Property.INSTANCE_SECURITY_PERMISSION_HANDLER, PermissionHandler.class, ZKPermHandler.getInstance());
+ PermissionHandler toRet = Master.createInstanceFromPropertyName(ServerConfiguration.getSiteConfiguration(), Property.INSTANCE_SECURITY_PERMISSION_HANDLER,
+ PermissionHandler.class, ZKPermHandler.getInstance());
toRet.initialize(instanceId, initialize);
return toRet;
}
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java Thu Feb 28 21:14:58 2013
@@ -40,7 +40,6 @@ import org.apache.accumulo.core.conf.Acc
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.security.crypto.CryptoModuleFactory;
import org.apache.accumulo.core.util.Daemon;
import org.apache.accumulo.core.util.StringUtil;
import org.apache.accumulo.server.logger.LogFileKey;
@@ -79,7 +78,7 @@ public class DfsLogger {
Set<TServerInstance> getCurrentTServers();
}
- private LinkedBlockingQueue<DfsLogger.LogWork> workQueue = new LinkedBlockingQueue<DfsLogger.LogWork>();
+ private final LinkedBlockingQueue<DfsLogger.LogWork> workQueue = new LinkedBlockingQueue<DfsLogger.LogWork>();
private final Object closeLock = new Object();
@@ -150,7 +149,7 @@ public class DfsLogger {
}
public static class LoggerOperation {
- private LogWork work;
+ private final LogWork work;
public LoggerOperation(LogWork work) {
this.work = work;
@@ -200,7 +199,7 @@ public class DfsLogger {
return getFileName().hashCode();
}
- private ServerResources conf;
+ private final ServerResources conf;
private FSDataOutputStream logFile;
private DataOutputStream encryptingLogFile = null;
private Path logPath;
@@ -262,8 +261,8 @@ public class DfsLogger {
// Initialize the crypto operations.
@SuppressWarnings("deprecation")
- org.apache.accumulo.core.security.crypto.CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf.getConfiguration().get(
- Property.CRYPTO_MODULE_CLASS));
+ org.apache.accumulo.core.security.crypto.CryptoModule cryptoModule = org.apache.accumulo.core.security.crypto.CryptoModuleFactory.getCryptoModule(conf
+ .getConfiguration().get(Property.CRYPTO_MODULE_CLASS));
// Initialize the log file with a header and the crypto params used to set up this log file.
logFile.write(LOG_FILE_HEADER_V2.getBytes());
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java Thu Feb 28 21:14:58 2013
@@ -34,7 +34,6 @@ import org.apache.accumulo.core.client.I
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.master.thrift.RecoveryStatus;
-import org.apache.accumulo.core.security.crypto.CryptoModuleFactory;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.SimpleThreadPool;
import org.apache.accumulo.core.zookeeper.ZooUtil;
@@ -103,7 +102,7 @@ public class LogSorter {
String formerThreadName = Thread.currentThread().getName();
int part = 0;
try {
-
+
// the following call does not throw an exception if the file/dir does not exist
fs.delete(new Path(destPath), true);
@@ -136,7 +135,8 @@ public class LogSorter {
}
@SuppressWarnings("deprecation")
- org.apache.accumulo.core.security.crypto.CryptoModule cryptoOps = CryptoModuleFactory.getCryptoModule(cryptoModuleName);
+ org.apache.accumulo.core.security.crypto.CryptoModule cryptoOps = org.apache.accumulo.core.security.crypto.CryptoModuleFactory
+ .getCryptoModule(cryptoModuleName);
@SuppressWarnings("deprecation")
InputStream decryptingInputStream = cryptoOps.getDecryptingInputStream(input, cryptoOpts);
@@ -231,7 +231,7 @@ public class LogSorter {
}
ThreadPoolExecutor threadPool;
- private Instance instance;
+ private final Instance instance;
public LogSorter(Instance instance, FileSystem fs, AccumuloConfiguration conf) {
this.instance = instance;
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/trace/TraceFileSystem.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/trace/TraceFileSystem.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/trace/TraceFileSystem.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/trace/TraceFileSystem.java Thu Feb 28 21:14:58 2013
@@ -19,9 +19,9 @@ package org.apache.accumulo.server.trace
import java.io.IOException;
import java.net.URI;
+import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.accumulo.trace.instrument.Span;
import org.apache.accumulo.trace.instrument.Trace;
-import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.ContentSummary;
@@ -266,14 +266,13 @@ public class TraceFileSystem extends Fil
}
}
- @SuppressWarnings("deprecation")
@Override
public boolean isDirectory(Path f) throws IOException {
Span span = Trace.start("isDirectory");
if (Trace.isTracing())
span.data("path", f.toString());
try {
- return impl.isDirectory(f);
+ return impl.getFileStatus(f).isDir();
} finally {
span.stop();
}
Modified: accumulo/branches/ACCUMULO-259-polishing/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java Thu Feb 28 21:14:58 2013
@@ -16,8 +16,10 @@
*/
package org.apache.accumulo.start.classloader.vfs.providers;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import org.apache.commons.vfs2.RandomAccessContent;
import org.apache.hadoop.fs.FSDataInputStream;
@@ -25,338 +27,302 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
/**
- * Provides random access to content in an HdfsFileObject. Currently this only supports read operations. All write
- * operations throw an {@link UnsupportedOperationException}.
+ * Provides random access to content in an HdfsFileObject. Currently this only supports read operations. All write operations throw an
+ * {@link UnsupportedOperationException}.
*
* @since 2.1
*/
-public class HdfsRandomAccessContent implements RandomAccessContent
-{
- private final FileSystem fs;
- private final Path path;
- private final FSDataInputStream fis;
-
- /**
- *
- * @param path
- * A Hadoop Path
- * @param fs
- * A Hadoop FileSystem
- * @throws IOException
- * when the path cannot be processed.
- */
- public HdfsRandomAccessContent(final Path path, final FileSystem fs) throws IOException
- {
- this.fs = fs;
- this.path = path;
- this.fis = this.fs.open(this.path);
- }
-
- /**
- * @see org.apache.commons.vfs2.RandomAccessContent#close()
- */
- @Override
- public void close() throws IOException
- {
- this.fis.close();
- }
-
- /**
- * @see org.apache.commons.vfs2.RandomAccessContent#getFilePointer()
- */
- @Override
- public long getFilePointer() throws IOException
- {
- return this.fis.getPos();
- }
-
- /**
- * @see org.apache.commons.vfs2.RandomAccessContent#getInputStream()
- */
- @Override
- public InputStream getInputStream() throws IOException
- {
- return this.fis;
- }
-
- /**
- * @see org.apache.commons.vfs2.RandomAccessContent#length()
- */
- @Override
- public long length() throws IOException
- {
- return this.fs.getFileStatus(this.path).getLen();
- }
-
- /**
- * @see java.io.DataInput#readBoolean()
- */
- @Override
- public boolean readBoolean() throws IOException
- {
- return this.fis.readBoolean();
- }
-
- /**
- * @see java.io.DataInput#readByte()
- */
- @Override
- public byte readByte() throws IOException
- {
- return this.fis.readByte();
- }
-
- /**
- * @see java.io.DataInput#readChar()
- */
- @Override
- public char readChar() throws IOException
- {
- return this.fis.readChar();
- }
-
- /**
- * @see java.io.DataInput#readDouble()
- */
- @Override
- public double readDouble() throws IOException
- {
- return this.fis.readDouble();
- }
-
- /**
- * @see java.io.DataInput#readFloat()
- */
- @Override
- public float readFloat() throws IOException
- {
- return this.fis.readFloat();
- }
-
- /**
- * @see java.io.DataInput#readFully(byte[])
- */
- @Override
- public void readFully(final byte[] b) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataInput#readFully(byte[], int, int)
- */
- @Override
- public void readFully(final byte[] b, final int off, final int len) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataInput#readInt()
- */
- @Override
- public int readInt() throws IOException
- {
- return this.fis.readInt();
- }
-
- /**
- * @see java.io.DataInput#readLine()
- */
- @Override
- @SuppressWarnings("deprecation")
- public String readLine() throws IOException
- {
- return this.fis.readLine();
- }
-
- /**
- * @see java.io.DataInput#readLong()
- */
- @Override
- public long readLong() throws IOException
- {
- return this.fis.readLong();
- }
-
- /**
- * @see java.io.DataInput#readShort()
- */
- @Override
- public short readShort() throws IOException
- {
- return this.fis.readShort();
- }
-
- /**
- * @see java.io.DataInput#readUnsignedByte()
- */
- @Override
- public int readUnsignedByte() throws IOException
- {
- return this.fis.readUnsignedByte();
- }
-
- /**
- * @see java.io.DataInput#readUnsignedShort()
- */
- @Override
- public int readUnsignedShort() throws IOException
- {
- return this.fis.readUnsignedShort();
- }
-
- /**
- * @see java.io.DataInput#readUTF()
- */
- @Override
- public String readUTF() throws IOException
- {
- return this.fis.readUTF();
- }
-
- /**
- * @see org.apache.commons.vfs2.RandomAccessContent#seek(long)
- */
- @Override
- public void seek(final long pos) throws IOException
- {
- this.fis.seek(pos);
- }
-
- /**
- * @see java.io.DataInput#skipBytes(int)
- */
- @Override
- public int skipBytes(final int n) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#write(byte[])
- */
- @Override
- public void write(final byte[] b) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#write(byte[], int, int)
- */
- @Override
- public void write(final byte[] b, final int off, final int len) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#write(int)
- */
- @Override
- public void write(final int b) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeBoolean(boolean)
- */
- @Override
- public void writeBoolean(final boolean v) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeByte(int)
- */
- @Override
- public void writeByte(final int v) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeBytes(java.lang.String)
- */
- @Override
- public void writeBytes(final String s) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeChar(int)
- */
- @Override
- public void writeChar(final int v) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeChars(java.lang.String)
- */
- @Override
- public void writeChars(final String s) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeDouble(double)
- */
- @Override
- public void writeDouble(final double v) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeFloat(float)
- */
- @Override
- public void writeFloat(final float v) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeInt(int)
- */
- @Override
- public void writeInt(final int v) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeLong(long)
- */
- @Override
- public void writeLong(final long v) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeShort(int)
- */
- @Override
- public void writeShort(final int v) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.io.DataOutput#writeUTF(java.lang.String)
- */
- @Override
- public void writeUTF(final String s) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
+public class HdfsRandomAccessContent implements RandomAccessContent {
+ private final FileSystem fs;
+ private final Path path;
+ private final FSDataInputStream fis;
+
+ /**
+ *
+ * @param path
+ * A Hadoop Path
+ * @param fs
+ * A Hadoop FileSystem
+ * @throws IOException
+ * when the path cannot be processed.
+ */
+ public HdfsRandomAccessContent(final Path path, final FileSystem fs) throws IOException {
+ this.fs = fs;
+ this.path = path;
+ this.fis = this.fs.open(this.path);
+ }
+
+ /**
+ * @see org.apache.commons.vfs2.RandomAccessContent#close()
+ */
+ @Override
+ public void close() throws IOException {
+ this.fis.close();
+ }
+
+ /**
+ * @see org.apache.commons.vfs2.RandomAccessContent#getFilePointer()
+ */
+ @Override
+ public long getFilePointer() throws IOException {
+ return this.fis.getPos();
+ }
+
+ /**
+ * @see org.apache.commons.vfs2.RandomAccessContent#getInputStream()
+ */
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return this.fis;
+ }
+
+ /**
+ * @see org.apache.commons.vfs2.RandomAccessContent#length()
+ */
+ @Override
+ public long length() throws IOException {
+ return this.fs.getFileStatus(this.path).getLen();
+ }
+
+ /**
+ * @see java.io.DataInput#readBoolean()
+ */
+ @Override
+ public boolean readBoolean() throws IOException {
+ return this.fis.readBoolean();
+ }
+
+ /**
+ * @see java.io.DataInput#readByte()
+ */
+ @Override
+ public byte readByte() throws IOException {
+ return this.fis.readByte();
+ }
+
+ /**
+ * @see java.io.DataInput#readChar()
+ */
+ @Override
+ public char readChar() throws IOException {
+ return this.fis.readChar();
+ }
+
+ /**
+ * @see java.io.DataInput#readDouble()
+ */
+ @Override
+ public double readDouble() throws IOException {
+ return this.fis.readDouble();
+ }
+
+ /**
+ * @see java.io.DataInput#readFloat()
+ */
+ @Override
+ public float readFloat() throws IOException {
+ return this.fis.readFloat();
+ }
+
+ /**
+ * @see java.io.DataInput#readFully(byte[])
+ */
+ @Override
+ public void readFully(final byte[] b) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataInput#readFully(byte[], int, int)
+ */
+ @Override
+ public void readFully(final byte[] b, final int off, final int len) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataInput#readInt()
+ */
+ @Override
+ public int readInt() throws IOException {
+ return this.fis.readInt();
+ }
+
+ /**
+ * @see java.io.DataInput#readLine()
+ */
+ @Override
+ public String readLine() throws IOException {
+ BufferedReader d = new BufferedReader(new InputStreamReader(this.fis));
+ return d.readLine();
+ }
+
+ /**
+ * @see java.io.DataInput#readLong()
+ */
+ @Override
+ public long readLong() throws IOException {
+ return this.fis.readLong();
+ }
+
+ /**
+ * @see java.io.DataInput#readShort()
+ */
+ @Override
+ public short readShort() throws IOException {
+ return this.fis.readShort();
+ }
+
+ /**
+ * @see java.io.DataInput#readUnsignedByte()
+ */
+ @Override
+ public int readUnsignedByte() throws IOException {
+ return this.fis.readUnsignedByte();
+ }
+
+ /**
+ * @see java.io.DataInput#readUnsignedShort()
+ */
+ @Override
+ public int readUnsignedShort() throws IOException {
+ return this.fis.readUnsignedShort();
+ }
+
+ /**
+ * @see java.io.DataInput#readUTF()
+ */
+ @Override
+ public String readUTF() throws IOException {
+ return this.fis.readUTF();
+ }
+
+ /**
+ * @see org.apache.commons.vfs2.RandomAccessContent#seek(long)
+ */
+ @Override
+ public void seek(final long pos) throws IOException {
+ this.fis.seek(pos);
+ }
+
+ /**
+ * @see java.io.DataInput#skipBytes(int)
+ */
+ @Override
+ public int skipBytes(final int n) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#write(byte[])
+ */
+ @Override
+ public void write(final byte[] b) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#write(byte[], int, int)
+ */
+ @Override
+ public void write(final byte[] b, final int off, final int len) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#write(int)
+ */
+ @Override
+ public void write(final int b) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeBoolean(boolean)
+ */
+ @Override
+ public void writeBoolean(final boolean v) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeByte(int)
+ */
+ @Override
+ public void writeByte(final int v) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeBytes(java.lang.String)
+ */
+ @Override
+ public void writeBytes(final String s) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeChar(int)
+ */
+ @Override
+ public void writeChar(final int v) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeChars(java.lang.String)
+ */
+ @Override
+ public void writeChars(final String s) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeDouble(double)
+ */
+ @Override
+ public void writeDouble(final double v) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeFloat(float)
+ */
+ @Override
+ public void writeFloat(final float v) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeInt(int)
+ */
+ @Override
+ public void writeInt(final int v) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeLong(long)
+ */
+ @Override
+ public void writeLong(final long v) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeShort(int)
+ */
+ @Override
+ public void writeShort(final int v) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.io.DataOutput#writeUTF(java.lang.String)
+ */
+ @Override
+ public void writeUTF(final String s) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
}
Modified: accumulo/branches/ACCUMULO-259-polishing/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java?rev=1451350&r1=1451349&r2=1451350&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java Thu Feb 28 21:14:58 2013
@@ -56,7 +56,8 @@ public class MetadataBatchScanTest {
*/
public static void main(String[] args) throws Exception {
- final Connector connector = new ZooKeeperInstance("acu14", "localhost").getConnector(SecurityConstants.getSystemCredentials());
+ final Connector connector = new ZooKeeperInstance("acu14", "localhost")
+ .getConnector(SecurityConstants.SYSTEM_PRINCIPAL, SecurityConstants.getSystemToken());
TreeSet<Long> splits = new TreeSet<Long>();
Random r = new Random(42);
@@ -205,6 +206,7 @@ public class MetadataBatchScanTest {
count2.addStat(ss.count2);
}
+ @Override
public String toString() {
return "[" + delta1 + "] [" + delta2 + "]";
}