http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/client/security/tokens/NullToken.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/NullToken.java b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/NullToken.java index 474b4a1..530b41f 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/NullToken.java +++ b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/NullToken.java @@ -28,42 +28,39 @@ import javax.security.auth.DestroyFailedException; * @since 1.5.0 */ public class NullToken implements AuthenticationToken { - + @Override - public void readFields(DataInput arg0) throws IOException { - } - + public void readFields(DataInput arg0) throws IOException {} + @Override - public void write(DataOutput arg0) throws IOException { - } - + public void write(DataOutput arg0) throws IOException {} + @Override - public void destroy() throws DestroyFailedException { - } - + public void destroy() throws DestroyFailedException {} + @Override public boolean isDestroyed() { return false; } - + @Override public NullToken clone() { return new NullToken(); } - + @Override public boolean equals(Object obj) { return obj instanceof NullToken; } - + @Override public void init(Properties properties) {} - + @Override public Set<TokenProperty> getProperties() { return Collections.emptySet(); } - + @Override public int hashCode() { return 0;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/client/security/tokens/PasswordToken.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/PasswordToken.java b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/PasswordToken.java index 53a0bcf..eb1abe6 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/PasswordToken.java +++ b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/PasswordToken.java @@ -39,28 +39,28 @@ import org.apache.hadoop.io.WritableUtils; public class PasswordToken implements AuthenticationToken { private byte[] password = null; - + public byte[] getPassword() { return Arrays.copyOf(password, password.length); } - + /** * Constructor for use with {@link Writable}. Call {@link #readFields(DataInput)}. */ public PasswordToken() { password = new byte[0]; } - + /** * Constructs a token from a copy of the password. Destroying the argument after construction will not destroy the copy in this token, and destroying this * token will only destroy the copy held inside this token, not the argument. - * + * * Password tokens created with this constructor will store the password as UTF-8 bytes. */ public PasswordToken(CharSequence password) { setPassword(CharBuffer.wrap(password)); } - + /** * Constructs a token from a copy of the password. Destroying the argument after construction will not destroy the copy in this token, and destroying this * token will only destroy the copy held inside this token, not the argument. @@ -68,7 +68,7 @@ public class PasswordToken implements AuthenticationToken { public PasswordToken(byte[] password) { this.password = Arrays.copyOf(password, password.length); } - + /** * Constructs a token from a copy of the password. Destroying the argument after construction will not destroy the copy in this token, and destroying this * token will only destroy the copy held inside this token, not the argument. @@ -76,33 +76,33 @@ public class PasswordToken implements AuthenticationToken { public PasswordToken(ByteBuffer password) { this.password = ByteBufferUtil.toBytes(password); } - + @Override public void readFields(DataInput arg0) throws IOException { password = WritableUtils.readCompressedByteArray(arg0); } - + @Override public void write(DataOutput arg0) throws IOException { WritableUtils.writeCompressedByteArray(arg0, password); } - + @Override public void destroy() throws DestroyFailedException { Arrays.fill(password, (byte) 0x00); password = null; } - + @Override public boolean isDestroyed() { return password == null; } - + @Override public int hashCode() { return Arrays.hashCode(password); } - + @Override public boolean equals(Object obj) { if (this == obj) @@ -114,7 +114,7 @@ public class PasswordToken implements AuthenticationToken { PasswordToken other = (PasswordToken) obj; return Arrays.equals(password, other.password); } - + @Override public PasswordToken clone() { try { @@ -144,7 +144,7 @@ public class PasswordToken implements AuthenticationToken { } } } - + @Override public void init(Properties properties) { if (properties.containsKey("password")) { @@ -152,7 +152,7 @@ public class PasswordToken implements AuthenticationToken { } else throw new IllegalArgumentException("Missing 'password' property"); } - + @Override public Set<TokenProperty> getProperties() { Set<TokenProperty> internal = new LinkedHashSet<TokenProperty>(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/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 813633c..cb075a9 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 @@ -42,7 +42,8 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str /** * Determines whether to accept a property based on its key. * - * @param key property key + * @param key + * property key * @return true to accept property (pass filter) */ boolean accept(String key); @@ -68,7 +69,8 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str /** * Creates a new filter. * - * @param prefix prefix of property keys to accept + * @param prefix + * prefix of property keys to accept */ public PrefixFilter(String prefix) { this.prefix = prefix; @@ -81,28 +83,29 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str } private static final Logger log = Logger.getLogger(AccumuloConfiguration.class); - + /** * Gets a property value from this configuration. * - * @param property property to get + * @param property + * property to get * @return property value */ public abstract String get(Property property); - + /** - * Returns property key/value pairs in this configuration. The pairs include - * those defined in this configuration which pass the given filter, and those + * Returns property key/value pairs in this configuration. The pairs include those defined in this configuration which pass the given filter, and those * supplied from the parent configuration which are not included from here. * - * @param props properties object to populate - * @param filter filter for accepting properties from this configuration + * @param props + * properties object to populate + * @param filter + * filter for accepting properties from this configuration */ public abstract void getProperties(Map<String,String> props, PropertyFilter filter); /** - * Returns an iterator over property key/value pairs in this configuration. - * Some implementations may elect to omit properties. + * Returns an iterator over property key/value pairs in this configuration. Some implementations may elect to omit properties. * * @return iterator over properties */ @@ -112,7 +115,7 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str getProperties(entries, new AllFilter()); return entries.entrySet().iterator(); } - + private void checkType(Property property, PropertyType type) { if (!property.getType().equals(type)) { String msg = "Configuration method intended for type " + type + " called with a " + property.getType() + " argument (" + property.getKey() + ")"; @@ -121,54 +124,54 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str throw err; } } - + /** * Gets all properties under the given prefix in this configuration. * - * @param property prefix property, must be of type PropertyType.PREFIX + * @param property + * prefix property, must be of type PropertyType.PREFIX * @return a map of property keys to values - * @throws IllegalArgumentException if property is not a prefix + * @throws IllegalArgumentException + * if property is not a prefix */ public Map<String,String> getAllPropertiesWithPrefix(Property property) { checkType(property, PropertyType.PREFIX); - + Map<String,String> propMap = new HashMap<String,String>(); getProperties(propMap, new PrefixFilter(property.getKey())); return propMap; } - + /** - * Gets a property of type {@link PropertyType#MEMORY}, interpreting the - * value properly. + * Gets a property of type {@link PropertyType#MEMORY}, interpreting the value properly. * - * @param property property to get + * @param property + * property to get * @return property value - * @throws IllegalArgumentException if the property is of the wrong type + * @throws IllegalArgumentException + * if the property is of the wrong type * @see #getMemoryInBytes(String) */ public long getMemoryInBytes(Property property) { checkType(property, PropertyType.MEMORY); - + String memString = get(property); return getMemoryInBytes(memString); } - + /** - * Interprets a string specifying a memory size. A memory size is specified - * as a long integer followed by an optional B (bytes), K (KB), M (MB), or - * G (GB). + * Interprets a string specifying a memory size. A memory size is specified as a long integer followed by an optional B (bytes), K (KB), M (MB), or G (GB). * - * @param str string value + * @param str + * string value * @return interpreted memory size */ static public long getMemoryInBytes(String str) { int multiplier = 0; char lastChar = str.charAt(str.length() - 1); - + if (lastChar == 'b') { - log.warn("The 'b' in " + str + - " is being considered as bytes. " + - "Setting memory by bits is not supported"); + log.warn("The 'b' in " + str + " is being considered as bytes. " + "Setting memory by bits is not supported"); } try { switch (Character.toUpperCase(lastChar)) { @@ -184,34 +187,33 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str return Long.parseLong(str); } } catch (Exception ex) { - throw new IllegalArgumentException("The value '" + str + - "' is not a valid memory setting. A valid value would a number " + - "possibily followed by an optional 'G', 'M', 'K', or 'B'."); + throw new IllegalArgumentException("The value '" + str + "' is not a valid memory setting. A valid value would a number " + + "possibily followed by an optional 'G', 'M', 'K', or 'B'."); } } - + /** - * Gets a property of type {@link PropertyType#TIMEDURATION}, interpreting the - * value properly. + * Gets a property of type {@link PropertyType#TIMEDURATION}, interpreting the value properly. * - * @param property property to get + * @param property + * property to get * @return property value - * @throws IllegalArgumentException if the property is of the wrong type + * @throws IllegalArgumentException + * if the property is of the wrong type * @see #getTimeInMillis(String) */ public long getTimeInMillis(Property property) { checkType(property, PropertyType.TIMEDURATION); - + return getTimeInMillis(get(property)); } - + /** - * Interprets a string specifying a time duration. A time duration is - * specified as a long integer followed by an optional d (days), h (hours), - * m (minutes), s (seconds), or ms (milliseconds). A value without a unit - * is interpreted as seconds. + * Interprets a string specifying a time duration. A time duration is specified as a long integer followed by an optional d (days), h (hours), m (minutes), s + * (seconds), or ms (milliseconds). A value without a unit is interpreted as seconds. * - * @param str string value + * @param str + * string value * @return interpreted time duration in milliseconds */ static public long getTimeInMillis(String str) { @@ -233,40 +235,42 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str return Long.parseLong(str) * 1000; } } - + /** - * Gets a property of type {@link PropertyType#BOOLEAN}, interpreting the - * value properly (using <code>Boolean.parseBoolean()</code>). + * Gets a property of type {@link PropertyType#BOOLEAN}, interpreting the value properly (using <code>Boolean.parseBoolean()</code>). * - * @param property property to get + * @param property + * property to get * @return property value - * @throws IllegalArgumentException if the property is of the wrong type + * @throws IllegalArgumentException + * if the property is of the wrong type */ public boolean getBoolean(Property property) { checkType(property, PropertyType.BOOLEAN); return Boolean.parseBoolean(get(property)); } - + /** - * Gets a property of type {@link PropertyType#FRACTION}, interpreting the - * value properly. + * Gets a property of type {@link PropertyType#FRACTION}, interpreting the value properly. * - * @param property property to get + * @param property + * property to get * @return property value - * @throws IllegalArgumentException if the property is of the wrong type + * @throws IllegalArgumentException + * if the property is of the wrong type * @see #getFraction(String) */ public double getFraction(Property property) { checkType(property, PropertyType.FRACTION); - + return getFraction(get(property)); } - + /** - * Interprets a string specifying a fraction. A fraction is specified as a - * double. An optional % at the end signifies a percentage. + * Interprets a string specifying a fraction. A fraction is specified as a double. An optional % at the end signifies a percentage. * - * @param str string value + * @param str + * string value * @return interpreted fraction as a decimal value */ public double getFraction(String str) { @@ -274,19 +278,20 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str return Double.parseDouble(str.substring(0, str.length() - 1)) / 100.0; return Double.parseDouble(str); } - + /** - * Gets a property of type {@link PropertyType#PORT}, interpreting the - * value properly (as an integer within the range of non-privileged ports). + * Gets a property of type {@link PropertyType#PORT}, interpreting the value properly (as an integer within the range of non-privileged ports). * - * @param property property to get + * @param property + * property to get * @return property value - * @throws IllegalArgumentException if the property is of the wrong type + * @throws IllegalArgumentException + * if the property is of the wrong type * @see #getTimeInMillis(String) */ public int getPort(Property property) { checkType(property, PropertyType.PORT); - + String portString = get(property); int port = Integer.parseInt(portString); if (port != 0) { @@ -297,37 +302,40 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str } return port; } - + /** - * Gets a property of type {@link PropertyType#COUNT}, interpreting the - * value properly (as an integer). + * Gets a property of type {@link PropertyType#COUNT}, interpreting the value properly (as an integer). * - * @param property property to get + * @param property + * property to get * @return property value - * @throws IllegalArgumentException if the property is of the wrong type + * @throws IllegalArgumentException + * if the property is of the wrong type * @see #getTimeInMillis(String) */ public int getCount(Property property) { checkType(property, PropertyType.COUNT); - + String countString = get(property); return Integer.parseInt(countString); } - + /** - * Gets a property of type {@link PropertyType#PATH}, interpreting the - * value properly, replacing supported environment variables. + * Gets a property of type {@link PropertyType#PATH}, interpreting the value properly, replacing supported environment variables. * - * @param property property to get + * @param property + * property to get * @return property value - * @throws IllegalArgumentException if the property is of the wrong type + * @throws IllegalArgumentException + * if the property is of the wrong type * @see Constants#PATH_PROPERTY_ENV_VARS */ public String getPath(Property property) { checkType(property, PropertyType.PATH); String pathString = get(property); - if (pathString == null) return null; + if (pathString == null) + return null; for (String replaceableEnvVar : Constants.PATH_PROPERTY_ENV_VARS) { String envValue = System.getenv(replaceableEnvVar); @@ -347,21 +355,25 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str public static synchronized DefaultConfiguration getDefaultConfiguration() { return DefaultConfiguration.getInstance(); } - + /** * Gets the configuration specific to a table. * - * @param conn connector (used to find table name) - * @param tableId table ID + * @param conn + * connector (used to find table name) + * @param tableId + * table ID * @return configuration containing table properties - * @throws TableNotFoundException if the table is not found - * @throws AccumuloException if there is a problem communicating to Accumulo + * @throws TableNotFoundException + * if the table is not found + * @throws AccumuloException + * if there is a problem communicating to Accumulo */ public static AccumuloConfiguration getTableConfiguration(Connector conn, String tableId) throws TableNotFoundException, AccumuloException { String tableName = Tables.getTableName(conn.getInstance(), tableId); return new ConfigurationCopy(conn.tableOperations().getProperties(tableName)); } - + /** * Gets the maximum number of files per tablet from this configuration. * @@ -375,26 +387,29 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str maxFilesPerTablet = getCount(Property.TSERV_SCAN_MAX_OPENFILES) - 1; log.debug("Max files per tablet " + maxFilesPerTablet); } - + return maxFilesPerTablet; } - + // overridden in ZooConfiguration public void invalidateCache() {} - + /** * Creates a new instance of a class specified in a configuration property. * - * @param property property specifying class name - * @param base base class of type - * @param defaultInstance instance to use if creation fails + * @param property + * property specifying class name + * @param base + * base class of type + * @param defaultInstance + * instance to use if creation fails * @return new class instance, or default instance if creation failed * @see AccumuloVFSClassLoader */ public <T> T instantiateClassProperty(Property property, Class<T> base, T defaultInstance) { String clazzName = get(property); T instance = null; - + try { Class<? extends T> clazz = AccumuloVFSClassLoader.loadClass(clazzName, base); instance = clazz.newInstance(); @@ -402,12 +417,12 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str } catch (Exception e) { log.warn("Failed to load class ", e); } - + if (instance == null) { log.info("Using " + defaultInstance.getClass().getName()); instance = defaultInstance; } return instance; } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java index 3754b02..99e3920 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java @@ -24,19 +24,19 @@ import org.apache.log4j.Logger; * A utility class for validating {@link AccumuloConfiguration} instances. */ public class ConfigSanityCheck { - + private static final Logger log = Logger.getLogger(ConfigSanityCheck.class); private static final String PREFIX = "BAD CONFIG "; - + /** - * Validates the given configuration entries. A valid configuration contains only - * valid properties (i.e., defined or otherwise valid) that are not prefixes - * and whose values are formatted correctly for their property types. A valid - * configuration also contains a value for property + * Validates the given configuration entries. A valid configuration contains only valid properties (i.e., defined or otherwise valid) that are not prefixes + * and whose values are formatted correctly for their property types. A valid configuration also contains a value for property * {@link Property#INSTANCE_ZK_TIMEOUT} within a valid range. * - * @param entries iterable through configuration keys and values - * @throws SanityCheckException if a fatal configuration error is found + * @param entries + * iterable through configuration keys and values + * @throws SanityCheckException + * if a fatal configuration error is found */ public static void validate(Iterable<Entry<String,String>> entries) { String instanceZkTimeoutKey = Property.INSTANCE_ZK_TIMEOUT.getKey(); @@ -60,42 +60,41 @@ public class ConfigSanityCheck { } if (instanceZkTimeoutValue != null) { - checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, - new CheckTimeDurationBetween(1000, 300000)); + checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000, 300000)); } } - + private interface CheckTimeDuration { boolean check(long propVal); - + String getDescription(Property prop); } - + private static class CheckTimeDurationBetween implements CheckTimeDuration { long min, max; - + CheckTimeDurationBetween(long x, long y) { min = Math.min(x, y); max = Math.max(x, y); } - + @Override public boolean check(long propVal) { return propVal >= min && propVal <= max; } - + @Override public String getDescription(Property prop) { return "ensure " + min + " <= " + prop + " <= " + max; } } - + private static void checkTimeDuration(Property prop, String value, CheckTimeDuration chk) { verifyPropertyTypes(PropertyType.TIMEDURATION, prop); if (!chk.check(AccumuloConfiguration.getTimeInMillis(value))) fatal(PREFIX + chk.getDescription(prop)); } - + private static void verifyPropertyTypes(PropertyType type, Property... properties) { for (Property prop : properties) if (prop.getType() != type) @@ -111,7 +110,9 @@ public class ConfigSanityCheck { /** * Creates a new exception with the given message. */ - public SanityCheckException(String msg) { super(msg); } + public SanityCheckException(String msg) { + super(msg); + } } private static void fatal(String msg) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java index 2b1945d..8326725 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java @@ -22,44 +22,45 @@ import java.util.Map; import java.util.Map.Entry; /** - * An {@link AccumuloConfiguration} which holds a flat copy of properties - * defined in another configuration + * An {@link AccumuloConfiguration} which holds a flat copy of properties defined in another configuration */ public class ConfigurationCopy extends AccumuloConfiguration { final Map<String,String> copy = Collections.synchronizedMap(new HashMap<String,String>()); - + /** * Creates a new configuration. * - * @param config configuration property key/value pairs to copy + * @param config + * configuration property key/value pairs to copy */ public ConfigurationCopy(Map<String,String> config) { this(config.entrySet()); } - + /** * Creates a new configuration. * - * @param config configuration property iterable to use for copying + * @param config + * configuration property iterable to use for copying */ public ConfigurationCopy(Iterable<Entry<String,String>> config) { for (Entry<String,String> entry : config) { copy.put(entry.getKey(), entry.getValue()); } } - + /** * Creates a new empty configuration. */ public ConfigurationCopy() { this(new HashMap<String,String>()); } - + @Override public String get(Property property) { return copy.get(property.getKey()); } - + @Override public void getProperties(Map<String,String> props, PropertyFilter filter) { for (Entry<String,String> entry : copy.entrySet()) { @@ -68,25 +69,29 @@ public class ConfigurationCopy extends AccumuloConfiguration { } } } - + /** * Sets a property in this configuration. * - * @param prop property to set - * @param value property value + * @param prop + * property to set + * @param value + * property value */ public void set(Property prop, String value) { copy.put(prop.getKey(), value); } - + /** * Sets a property in this configuration. * - * @param key key of property to set - * @param value property value + * @param key + * key of property to set + * @param value + * property value */ public void set(String key, String value) { copy.put(key, value); } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java index 60d1996..f15e6ec 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java @@ -356,10 +356,10 @@ class ConfigurationDocGen { } /* - * Generates documentation for conf/accumulo-site.xml file usage. Arguments - * are: "--generate-doc", file to write to. + * Generates documentation for conf/accumulo-site.xml file usage. Arguments are: "--generate-doc", file to write to. * * @param args command-line arguments + * * @throws IllegalArgumentException if args is invalid */ public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException { http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationObserver.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationObserver.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationObserver.java index 46f8692..8a62d26 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationObserver.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationObserver.java @@ -18,8 +18,8 @@ package org.apache.accumulo.core.conf; public interface ConfigurationObserver { void propertyChanged(String key); - + void propertiesChanged(); - + void sessionExpired(); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java b/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java index 33b1848..81fe540 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java @@ -314,10 +314,10 @@ public class CredentialProviderFactoryShim { Preconditions.checkNotNull(credentialProviders); return getConfiguration(new Configuration(CachedConfiguration.getInstance()), credentialProviders); } - + /** * Adds the Credential Provider configuration elements to the provided {@link Configuration}. - * + * * @param conf * Existing Hadoop Configuration * @param credentialProviders http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java index e473772..09dc0c9 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java @@ -22,8 +22,7 @@ import java.util.Map; import java.util.Map.Entry; /** - * An {@link AccumuloConfiguration} that contains only default values for - * properties. This class is a singleton. + * An {@link AccumuloConfiguration} that contains only default values for properties. This class is a singleton. */ public class DefaultConfiguration extends AccumuloConfiguration { private final static Map<String,String> resolvedProps; http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/Experimental.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Experimental.java b/core/src/main/java/org/apache/accumulo/core/conf/Experimental.java index 0d1059a..e2b4cec 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/Experimental.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/Experimental.java @@ -26,5 +26,5 @@ import java.lang.annotation.RetentionPolicy; @Inherited @Retention(RetentionPolicy.RUNTIME) @interface Experimental { - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/Interpolated.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Interpolated.java b/core/src/main/java/org/apache/accumulo/core/conf/Interpolated.java index 1390db2..df5b6f8 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/Interpolated.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/Interpolated.java @@ -22,7 +22,7 @@ import java.lang.annotation.RetentionPolicy; /** * An annotation to denote {@link AccumuloConfiguration} {@link Property} keys, whose values should be interpolated with system properties. - * + * * Interpolated items need to be careful, as JVM properties could be updates and we may want that propogated when those changes occur. Currently only * VFS_CLASSLOADER_CACHE_DIR, which isn't ZK mutable, is interpolated, so this shouldn't be an issue as java.io.tmpdir also shouldn't be changing. */ http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/Property.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java index e054a5f..ce5de85 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java @@ -168,7 +168,8 @@ public enum Property { @Experimental GENERAL_VOLUME_CHOOSER("general.volume.chooser", "org.apache.accumulo.server.fs.PerTableVolumeChooser", PropertyType.CLASSNAME, "The class that will be used to select which volume will be used to create new files."), - GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS("general.security.credential.provider.paths", "", PropertyType.STRING, "Comma-separated list of paths to CredentialProviders"), + GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS("general.security.credential.provider.paths", "", PropertyType.STRING, + "Comma-separated list of paths to CredentialProviders"), GENERAL_LEGACY_METRICS("general.legacy.metrics", "false", PropertyType.BOOLEAN, "Use the old metric infrastructure configured by accumulo-metrics.xml, instead of Hadoop Metrics2"), @@ -182,7 +183,8 @@ public enum Property { MASTER_BULK_RETRIES("master.bulk.retries", "3", PropertyType.COUNT, "The number of attempts to bulk-load a file before giving up."), MASTER_BULK_THREADPOOL_SIZE("master.bulk.threadpool.size", "5", PropertyType.COUNT, "The number of threads to use when coordinating a bulk-import."), MASTER_BULK_TIMEOUT("master.bulk.timeout", "5m", PropertyType.TIMEDURATION, "The time to wait for a tablet server to process a bulk import request"), - MASTER_BULK_RENAME_THREADS("master.bulk.rename.threadpool.size", "20", PropertyType.COUNT, "The number of threads to use when moving user files to bulk ingest directories under accumulo control"), + MASTER_BULK_RENAME_THREADS("master.bulk.rename.threadpool.size", "20", PropertyType.COUNT, + "The number of threads to use when moving user files to bulk ingest directories under accumulo control"), MASTER_MINTHREADS("master.server.threads.minimum", "20", PropertyType.COUNT, "The minimum number of threads to use to handle incoming requests."), MASTER_THREADCHECK("master.server.threadcheck.time", "1s", PropertyType.TIMEDURATION, "The time between adjustments of the server thread pool."), MASTER_RECOVERY_DELAY("master.recovery.delay", "10s", PropertyType.TIMEDURATION, @@ -196,8 +198,10 @@ public enum Property { MASTER_REPLICATION_SCAN_INTERVAL("master.replication.status.scan.interval", "30s", PropertyType.TIMEDURATION, "Amount of time to sleep before scanning the status section of the replication table for new data"), MASTER_REPLICATION_COORDINATOR_PORT("master.replication.coordinator.port", "10001", PropertyType.PORT, "Port for the replication coordinator service"), - MASTER_REPLICATION_COORDINATOR_MINTHREADS("master.replication.coordinator.minthreads", "4", PropertyType.COUNT, "Minimum number of threads dedicated to answering coordinator requests"), - MASTER_REPLICATION_COORDINATOR_THREADCHECK("master.replication.coordinator.threadcheck.time", "5s", PropertyType.TIMEDURATION, "The time between adjustments of the coordinator thread pool"), + MASTER_REPLICATION_COORDINATOR_MINTHREADS("master.replication.coordinator.minthreads", "4", PropertyType.COUNT, + "Minimum number of threads dedicated to answering coordinator requests"), + MASTER_REPLICATION_COORDINATOR_THREADCHECK("master.replication.coordinator.threadcheck.time", "5s", PropertyType.TIMEDURATION, + "The time between adjustments of the coordinator thread pool"), // properties that are specific to tablet server behavior TSERV_PREFIX("tserver.", null, PropertyType.PREFIX, "Properties in this category affect the behavior of the tablet servers"), @@ -208,12 +212,11 @@ public enum Property { TSERV_PORTSEARCH("tserver.port.search", "false", PropertyType.BOOLEAN, "if the ports above are in use, search higher ports until one is available"), TSERV_CLIENTPORT("tserver.port.client", "9997", PropertyType.PORT, "The port used for handling client connections on the tablet servers"), @Deprecated - TSERV_MUTATION_QUEUE_MAX("tserver.mutation.queue.max", "1M", PropertyType.MEMORY, - "This setting is deprecated. See tserver.total.mutation.queue.max. " - + "The amount of memory to use to store write-ahead-log mutations-per-session before flushing them. Since the buffer is per write session, consider the" - + " max number of concurrent writer when configuring. When using Hadoop 2, Accumulo will call hsync() on the WAL . For a small number of " - + "concurrent writers, increasing this buffer size decreases the frequncy of hsync calls. For a large number of concurrent writers a small buffers " - + "size is ok because of group commit."), + TSERV_MUTATION_QUEUE_MAX("tserver.mutation.queue.max", "1M", PropertyType.MEMORY, "This setting is deprecated. See tserver.total.mutation.queue.max. " + + "The amount of memory to use to store write-ahead-log mutations-per-session before flushing them. Since the buffer is per write session, consider the" + + " max number of concurrent writer when configuring. When using Hadoop 2, Accumulo will call hsync() on the WAL . For a small number of " + + "concurrent writers, increasing this buffer size decreases the frequncy of hsync calls. For a large number of concurrent writers a small buffers " + + "size is ok because of group commit."), TSERV_TOTAL_MUTATION_QUEUE_MAX("tserver.total.mutation.queue.max", "50M", PropertyType.MEMORY, "The amount of memory used to store write-ahead-log mutations before flushing them."), TSERV_TABLET_SPLIT_FINDMIDPOINT_MAXOPEN("tserver.tablet.split.midpoint.files.max", "30", PropertyType.COUNT, @@ -294,11 +297,14 @@ public enum Property { TSERV_WAL_SYNC_METHOD("tserver.wal.sync.method", "hsync", PropertyType.STRING, "This property is deprecated. Use table.durability instead."), TSERV_ASSIGNMENT_DURATION_WARNING("tserver.assignment.duration.warning", "10m", PropertyType.TIMEDURATION, "The amount of time an assignment can run " + " before the server will print a warning along with the current stack trace. Meant to help debug stuck assignments"), - TSERV_REPLICATION_REPLAYERS("tserver.replication.replayer.", null, PropertyType.PREFIX, "Allows configuration of implementation used to apply replicated data"), + TSERV_REPLICATION_REPLAYERS("tserver.replication.replayer.", null, PropertyType.PREFIX, + "Allows configuration of implementation used to apply replicated data"), TSERV_REPLICATION_DEFAULT_HANDLER("tserver.replication.default.replayer", "org.apache.accumulo.tserver.replication.BatchWriterReplicationReplayer", PropertyType.CLASSNAME, "Default AccumuloReplicationReplayer implementation"), - TSERV_REPLICATION_BW_REPLAYER_MEMORY("tserver.replication.batchwriter.replayer.memory", "50M", PropertyType.MEMORY, "Memory to provide to batchwriter to replay mutations for replication"), - TSERV_ASSIGNMENT_MAXCONCURRENT("tserver.assignment.concurrent.max", "2", PropertyType.COUNT, "The number of threads available to load tablets. Recoveries are still performed serially."), + TSERV_REPLICATION_BW_REPLAYER_MEMORY("tserver.replication.batchwriter.replayer.memory", "50M", PropertyType.MEMORY, + "Memory to provide to batchwriter to replay mutations for replication"), + TSERV_ASSIGNMENT_MAXCONCURRENT("tserver.assignment.concurrent.max", "2", PropertyType.COUNT, + "The number of threads available to load tablets. Recoveries are still performed serially."), // properties that are specific to logger server behavior LOGGER_PREFIX("logger.", null, PropertyType.PREFIX, "Properties in this category affect the behavior of the write-ahead logger servers"), @@ -332,8 +338,10 @@ public enum Property { MONITOR_SSL_TRUSTSTORE("monitor.ssl.trustStore", "", PropertyType.PATH, "The truststore for enabling monitor SSL."), @Sensitive MONITOR_SSL_TRUSTSTOREPASS("monitor.ssl.trustStorePassword", "", PropertyType.STRING, "The truststore password for enabling monitor SSL."), - MONITOR_SSL_INCLUDE_CIPHERS("monitor.ssl.include.ciphers", "", PropertyType.STRING, "A comma-separated list of allows SSL Ciphers, see monitor.ssl.exclude.ciphers to disallow ciphers"), - MONITOR_SSL_EXCLUDE_CIPHERS("monitor.ssl.exclude.ciphers", "", PropertyType.STRING, "A comma-separated list of disallowed SSL Ciphers, see mmonitor.ssl.include.ciphers to allow ciphers"), + MONITOR_SSL_INCLUDE_CIPHERS("monitor.ssl.include.ciphers", "", PropertyType.STRING, + "A comma-separated list of allows SSL Ciphers, see monitor.ssl.exclude.ciphers to disallow ciphers"), + MONITOR_SSL_EXCLUDE_CIPHERS("monitor.ssl.exclude.ciphers", "", PropertyType.STRING, + "A comma-separated list of disallowed SSL Ciphers, see mmonitor.ssl.include.ciphers to allow ciphers"), MONITOR_SSL_INCLUDE_PROTOCOLS("monitor.ssl.include.protocols", "TLSv1,TLSv1.1,TLSv1.2", PropertyType.STRING, "A comma-separate list of allowed SSL protocols"), MONITOR_LOCK_CHECK_INTERVAL("monitor.lock.check.interval", "5s", PropertyType.TIMEDURATION, @@ -342,7 +350,8 @@ public enum Property { + "the date shown on the 'Recent Logs' monitor page"), TRACE_PREFIX("trace.", null, PropertyType.PREFIX, "Properties in this category affect the behavior of distributed tracing."), - TRACE_SPAN_RECEIVERS("trace.span.receivers", "org.apache.accumulo.tracer.ZooTraceClient", PropertyType.CLASSNAMELIST, "A list of span receiver classes to send trace spans"), + TRACE_SPAN_RECEIVERS("trace.span.receivers", "org.apache.accumulo.tracer.ZooTraceClient", PropertyType.CLASSNAMELIST, + "A list of span receiver classes to send trace spans"), TRACE_SPAN_RECEIVER_PREFIX("trace.span.receiver.", null, PropertyType.PREFIX, "Prefix for span receiver configuration properties"), TRACE_ZK_PATH("trace.span.receiver.zookeeper.path", Constants.ZTRACERS, PropertyType.STRING, "The zookeeper node where tracers are registered"), TRACE_PORT("trace.port.client", "12234", PropertyType.PORT, "The listening port for the trace server"), @@ -413,11 +422,10 @@ public enum Property { + ",org.apache.accumulo.core.file.keyfunctor.ColumnFamilyFunctor, and org.apache.accumulo.core.file.keyfunctor.ColumnQualifierFunctor are" + " allowable values. One can extend any of the above mentioned classes to perform specialized parsing of the key. "), TABLE_BLOOM_HASHTYPE("table.bloom.hash.type", "murmur", PropertyType.STRING, "The bloom filter hash type"), - TABLE_DURABILITY("table.durability", "sync", PropertyType.DURABILITY, "The durability used to write to the write-ahead log." + - " Legal values are: none, which skips the write-ahead log; " + - "log, which sends the data to the write-ahead log, but does nothing to make it durable; " + - "flush, which pushes data to the file system; and " + - "sync, which ensures the data is written to disk."), + TABLE_DURABILITY("table.durability", "sync", PropertyType.DURABILITY, "The durability used to write to the write-ahead log." + + " Legal values are: none, which skips the write-ahead log; " + + "log, which sends the data to the write-ahead log, but does nothing to make it durable; " + "flush, which pushes data to the file system; and " + + "sync, which ensures the data is written to disk."), TABLE_FAILURES_IGNORE("table.failures.ignore", "false", PropertyType.BOOLEAN, "If you want queries for your table to hang or fail when data is missing from the system, " + "then set this to false. When this set to true missing data will be reported but queries " @@ -447,9 +455,12 @@ public enum Property { + "These iterators can take options if additional properties are set that look like this property, " + "but are suffixed with a period, followed by 'opt' followed by another period, and a property name.\n" + "For example, table.iterator.minc.vers.opt.maxVersions = 3"), - TABLE_ITERATOR_SCAN_PREFIX(TABLE_ITERATOR_PREFIX.getKey() + IteratorScope.scan.name() + ".", null, PropertyType.PREFIX, "Convenience prefix to find options for the scan iterator scope"), - TABLE_ITERATOR_MINC_PREFIX(TABLE_ITERATOR_PREFIX.getKey() + IteratorScope.minc.name() + ".", null, PropertyType.PREFIX, "Convenience prefix to find options for the minc iterator scope"), - TABLE_ITERATOR_MAJC_PREFIX(TABLE_ITERATOR_PREFIX.getKey() + IteratorScope.majc.name() + ".", null, PropertyType.PREFIX, "Convenience prefix to find options for the majc iterator scope"), + TABLE_ITERATOR_SCAN_PREFIX(TABLE_ITERATOR_PREFIX.getKey() + IteratorScope.scan.name() + ".", null, PropertyType.PREFIX, + "Convenience prefix to find options for the scan iterator scope"), + TABLE_ITERATOR_MINC_PREFIX(TABLE_ITERATOR_PREFIX.getKey() + IteratorScope.minc.name() + ".", null, PropertyType.PREFIX, + "Convenience prefix to find options for the minc iterator scope"), + TABLE_ITERATOR_MAJC_PREFIX(TABLE_ITERATOR_PREFIX.getKey() + IteratorScope.majc.name() + ".", null, PropertyType.PREFIX, + "Convenience prefix to find options for the majc iterator scope"), TABLE_LOCALITY_GROUP_PREFIX("table.group.", null, PropertyType.PREFIX, "Properties in this category are per-table properties that define locality groups in a table. These properties start " + "with the category prefix, followed by a name, followed by a period, and followed by a property for that group.\n" @@ -465,9 +476,9 @@ public enum Property { TABLE_COMPACTION_STRATEGY_PREFIX("table.majc.compaction.strategy.opts.", null, PropertyType.PREFIX, "Properties in this category are used to configure the compaction strategy."), TABLE_REPLICATION("table.replication", "false", PropertyType.BOOLEAN, "Is replication enabled for the given table"), - TABLE_REPLICATION_TARGET("table.replication.target.", null, PropertyType.PREFIX, "Enumerate a mapping of other systems which this table should " + - "replicate their data to. The key suffix is the identifying cluster name and the value is an identifier for a location on the target system, " + - "e.g. the ID of the table on the target to replicate to"), + TABLE_REPLICATION_TARGET("table.replication.target.", null, PropertyType.PREFIX, "Enumerate a mapping of other systems which this table should " + + "replicate their data to. The key suffix is the identifying cluster name and the value is an identifier for a location on the target system, " + + "e.g. the ID of the table on the target to replicate to"), @Experimental TABLE_VOLUME_CHOOSER("table.volume.chooser", "org.apache.accumulo.server.fs.RandomVolumeChooser", PropertyType.CLASSNAME, "The class that will be used to select which volume will be used to create new files for this table."), @@ -498,21 +509,28 @@ public enum Property { REPLICATION_PEER_USER("replication.peer.user.", null, PropertyType.PREFIX, "The username to provide when authenticating with the given peer"), @Sensitive REPLICATION_PEER_PASSWORD("replication.peer.password.", null, PropertyType.PREFIX, "The password to provide when authenticating with the given peer"), - REPLICATION_NAME("replication.name", "", PropertyType.STRING, "Name of this cluster with respect to replication. Used to identify this instance from other peers"), + REPLICATION_NAME("replication.name", "", PropertyType.STRING, + "Name of this cluster with respect to replication. Used to identify this instance from other peers"), REPLICATION_MAX_WORK_QUEUE("replication.max.work.queue", "1000", PropertyType.COUNT, "Upper bound of the number of files queued for replication"), - REPLICATION_WORK_ASSIGNMENT_SLEEP("replication.work.assignment.sleep", "30s", PropertyType.TIMEDURATION, "Amount of time to sleep between replication work assignment"), + REPLICATION_WORK_ASSIGNMENT_SLEEP("replication.work.assignment.sleep", "30s", PropertyType.TIMEDURATION, + "Amount of time to sleep between replication work assignment"), REPLICATION_WORKER_THREADS("replication.worker.threads", "4", PropertyType.COUNT, "Size of the threadpool that each tabletserver devotes to replicating data"), - REPLICATION_RECEIPT_SERVICE_PORT("replication.receipt.service.port", "10002", PropertyType.PORT, "Listen port used by thrift service in tserver listening for replication"), - REPLICATION_WORK_ATTEMPTS("replication.work.attempts", "10", PropertyType.COUNT, "Number of attempts to try to replicate some data before giving up and letting it naturally be retried later"), + REPLICATION_RECEIPT_SERVICE_PORT("replication.receipt.service.port", "10002", PropertyType.PORT, + "Listen port used by thrift service in tserver listening for replication"), + REPLICATION_WORK_ATTEMPTS("replication.work.attempts", "10", PropertyType.COUNT, + "Number of attempts to try to replicate some data before giving up and letting it naturally be retried later"), REPLICATION_MIN_THREADS("replication.receiver.min.threads", "1", PropertyType.COUNT, "Minimum number of threads for replication"), - REPLICATION_THREADCHECK("replication.receiver.threadcheck.time", "30s", PropertyType.TIMEDURATION, "The time between adjustments of the replication thread pool."), + REPLICATION_THREADCHECK("replication.receiver.threadcheck.time", "30s", PropertyType.TIMEDURATION, + "The time between adjustments of the replication thread pool."), REPLICATION_MAX_UNIT_SIZE("replication.max.unit.size", "64M", PropertyType.MEMORY, "Maximum size of data to send in a replication message"), REPLICATION_WORK_ASSIGNER("replication.work.assigner", "org.apache.accumulo.master.replication.UnorderedWorkAssigner", PropertyType.CLASSNAME, "Replication WorkAssigner implementation to use"), REPLICATION_DRIVER_DELAY("replication.driver.delay", "0s", PropertyType.TIMEDURATION, "Amount of time to wait before the replication work loop begins in the master."), - REPLICATION_WORK_PROCESSOR_DELAY("replication.work.processor.delay", "0s", PropertyType.TIMEDURATION, "Amount of time to wait before first checking for replication work, not useful outside of tests"), - REPLICATION_WORK_PROCESSOR_PERIOD("replication.work.processor.period", "0s", PropertyType.TIMEDURATION, "Amount of time to wait before re-checking for replication work, not useful outside of tests"), + REPLICATION_WORK_PROCESSOR_DELAY("replication.work.processor.delay", "0s", PropertyType.TIMEDURATION, + "Amount of time to wait before first checking for replication work, not useful outside of tests"), + REPLICATION_WORK_PROCESSOR_PERIOD("replication.work.processor.period", "0s", PropertyType.TIMEDURATION, + "Amount of time to wait before re-checking for replication work, not useful outside of tests"), ; @@ -820,7 +838,6 @@ public enum Property { return instance; } - /** * Creates a new instance of a class specified in a configuration property. The table classpath context is used if set. * http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java index bf39da9..09055d5 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java @@ -22,8 +22,7 @@ import org.apache.accumulo.core.Constants; import org.apache.hadoop.fs.Path; /** - * Types of {@link Property} values. Each type has a short name, a description, - * and a regex which valid values match. All of these fields are optional. + * Types of {@link Property} values. Each type has a short name, a description, and a regex which valid values match. All of these fields are optional. */ public enum PropertyType { PREFIX(null, null, null), @@ -99,7 +98,7 @@ public enum PropertyType { String getFormatDescription() { return format; } - + /** * Checks if the given value is valid for this type. * http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/Sensitive.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Sensitive.java b/core/src/main/java/org/apache/accumulo/core/conf/Sensitive.java index 42371f0..57dfec8 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/Sensitive.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/Sensitive.java @@ -26,5 +26,5 @@ import java.lang.annotation.RetentionPolicy; @Inherited @Retention(RetentionPolicy.RUNTIME) @interface Sensitive { - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java index b74335c..f0c9e59 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java @@ -25,18 +25,15 @@ import org.apache.hadoop.conf.Configuration; import org.apache.log4j.Logger; /** - * An {@link AccumuloConfiguration} which loads properties from an XML file, - * usually accumulo-site.xml. This implementation supports defaulting undefined + * An {@link AccumuloConfiguration} which loads properties from an XML file, usually accumulo-site.xml. This implementation supports defaulting undefined * property values to a parent configuration's definitions. * <p> - * The system property "org.apache.accumulo.config.file" can be used to specify - * the location of the XML configuration file on the classpath. If the system + * The system property "org.apache.accumulo.config.file" can be used to specify the location of the XML configuration file on the classpath. If the system * property is not defined, it defaults to "accumulo-site.xml". * <p> * This class is a singleton. * <p> - * <b>Note</b>: Client code should not use this class, and it may be deprecated - * in the future. + * <b>Note</b>: Client code should not use this class, and it may be deprecated in the future. */ public class SiteConfiguration extends AccumuloConfiguration { private static final Logger log = Logger.getLogger(SiteConfiguration.class); @@ -52,13 +49,14 @@ public class SiteConfiguration extends AccumuloConfiguration { SiteConfiguration(AccumuloConfiguration parent) { SiteConfiguration.parent = parent; } - + /** - * Gets an instance of this class. A new instance is only created on the first - * call, and so the parent configuration cannot be changed later. + * Gets an instance of this class. A new instance is only created on the first call, and so the parent configuration cannot be changed later. * - * @param parent parent (default) configuration - * @throws RuntimeException if the configuration is invalid + * @param parent + * parent (default) configuration + * @throws RuntimeException + * if the configuration is invalid */ synchronized public static SiteConfiguration getInstance(AccumuloConfiguration parent) { if (instance == null) { @@ -67,7 +65,7 @@ public class SiteConfiguration extends AccumuloConfiguration { } return instance; } - + synchronized public static SiteConfiguration getInstance() { return getInstance(DefaultConfiguration.getInstance()); } @@ -161,8 +159,7 @@ public class SiteConfiguration extends AccumuloConfiguration { } /** - * Clears the configuration properties in this configuration (but not the - * parent). This method supports testing and should not be called. + * Clears the configuration properties in this configuration (but not the parent). This method supports testing and should not be called. */ synchronized public static void clearInstance() { instance = null; @@ -175,11 +172,8 @@ public class SiteConfiguration extends AccumuloConfiguration { getXmlConfig().clear(); } - /** - * Clears the configuration properties in this configuration (but not the - * parent) and nulls it. This method supports testing and should not be - * called. + * Clears the configuration properties in this configuration (but not the parent) and nulls it. This method supports testing and should not be called. */ public synchronized void clearAndNull() { if (xmlConfig != null) { @@ -191,8 +185,10 @@ public class SiteConfiguration extends AccumuloConfiguration { /** * Sets a property. This method supports testing and should not be called. * - * @param property property to set - * @param value property value + * @param property + * property to set + * @param value + * property value */ public void set(Property property, String value) { set(property.getKey(), value); @@ -201,8 +197,10 @@ public class SiteConfiguration extends AccumuloConfiguration { /** * Sets a property. This method supports testing and should not be called. * - * @param key key of property to set - * @param value property value + * @param key + * key of property to set + * @param value + * property value */ public void set(String key, String value) { getXmlConfig().set(key, value); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java index 3c5f797..e95088a 100644 --- a/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java +++ b/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java @@ -44,7 +44,7 @@ import org.apache.accumulo.core.security.Authorizations; * </p> */ public interface Constraint { - + /** * The environment within which a constraint exists. */ @@ -55,14 +55,14 @@ public interface Constraint { * @return key extent */ KeyExtent getExtent(); - + /** * Gets the user within the environment. * * @return user */ String getUser(); - + /** * Gets the authorizations in the environment. * @@ -79,23 +79,25 @@ public interface Constraint { */ AuthorizationContainer getAuthorizationsContainer(); } - + /** * Gets a short, one-sentence description of what a given violation code means. * - * @param violationCode numeric violation code + * @param violationCode + * numeric violation code * @return matching violation description */ String getViolationDescription(short violationCode); - + /** - * Checks a mutation for constraint violations. If the mutation contains no violations, returns null. Otherwise, returns - * a list of violation codes. + * Checks a mutation for constraint violations. If the mutation contains no violations, returns null. Otherwise, returns a list of violation codes. * * Violation codes must be non-negative. Negative violation codes are reserved for system use. * - * @param env constraint environment - * @param mutation mutation to check + * @param env + * constraint environment + * @param mutation + * mutation to check * @return list of violation codes, or null if none */ List<Short> check(Environment env, Mutation mutation); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java index 88b7eea..7cc42c1 100644 --- a/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java +++ b/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java @@ -26,30 +26,30 @@ import org.apache.accumulo.core.data.Mutation; * A constraints that limits the size of keys to 1mb. */ public class DefaultKeySizeConstraint implements Constraint { - + protected static final short MAX__KEY_SIZE_EXCEEDED_VIOLATION = 1; protected static final long maxSize = 1048576; // 1MB default size - + @Override public String getViolationDescription(short violationCode) { - + switch (violationCode) { case MAX__KEY_SIZE_EXCEEDED_VIOLATION: return "Key was larger than 1MB"; } - + return null; } - + final static List<Short> NO_VIOLATIONS = new ArrayList<Short>(); - + @Override public List<Short> check(Environment env, Mutation mutation) { // fast size check if (mutation.numBytes() < maxSize) return NO_VIOLATIONS; - + List<Short> violations = new ArrayList<Short>(); for (ColumnUpdate cu : mutation.getUpdates()) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/constraints/Violations.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/Violations.java b/core/src/main/java/org/apache/accumulo/core/constraints/Violations.java index eda1a67..1db13cd 100644 --- a/core/src/main/java/org/apache/accumulo/core/constraints/Violations.java +++ b/core/src/main/java/org/apache/accumulo/core/constraints/Violations.java @@ -28,42 +28,42 @@ import org.apache.accumulo.core.data.ConstraintViolationSummary; * A class for accumulating constraint violations across a number of mutations. */ public class Violations { - + private static class CVSKey { private String className; private short vcode; - + CVSKey(ConstraintViolationSummary cvs) { this.className = cvs.constrainClass; this.vcode = cvs.violationCode; } - + @Override public int hashCode() { return className.hashCode() + vcode; } - + @Override public boolean equals(Object o) { if (o instanceof CVSKey) return equals((CVSKey) o); return false; } - + public boolean equals(CVSKey ocvsk) { return className.equals(ocvsk.className) && vcode == ocvsk.vcode; } } - + private HashMap<CVSKey,ConstraintViolationSummary> cvsmap; - + /** * Creates a new empty object. */ public Violations() { cvsmap = new HashMap<CVSKey,ConstraintViolationSummary>(); } - + /** * Checks if this object is empty, i.e., that no violations have been added. * @@ -72,54 +72,56 @@ public class Violations { public boolean isEmpty() { return cvsmap.isEmpty(); } - + private void add(CVSKey cvsk, ConstraintViolationSummary cvs) { ConstraintViolationSummary existingCvs = cvsmap.get(cvsk); - + if (existingCvs == null) { cvsmap.put(cvsk, cvs); } else { existingCvs.numberOfViolatingMutations += cvs.numberOfViolatingMutations; } } - + /** - * Adds a violation. If a matching violation was already added, then its - * count is increased. + * Adds a violation. If a matching violation was already added, then its count is increased. * - * @param cvs summary of violation + * @param cvs + * summary of violation */ public void add(ConstraintViolationSummary cvs) { CVSKey cvsk = new CVSKey(cvs); add(cvsk, cvs); } - + /** * Adds all violations from the given object to this one. * - * @param violations violations to add + * @param violations + * violations to add */ public void add(Violations violations) { Set<Entry<CVSKey,ConstraintViolationSummary>> es = violations.cvsmap.entrySet(); - + for (Entry<CVSKey,ConstraintViolationSummary> entry : es) { add(entry.getKey(), entry.getValue()); } - + } - + /** * Adds a list of violations. * - * @param cvsList list of violation summaries + * @param cvsList + * list of violation summaries */ public void add(List<ConstraintViolationSummary> cvsList) { for (ConstraintViolationSummary constraintViolationSummary : cvsList) { add(constraintViolationSummary); } - + } - + /** * Gets the violations as a list of summaries. * @@ -128,5 +130,5 @@ public class Violations { public List<ConstraintViolationSummary> asList() { return new ArrayList<ConstraintViolationSummary>(cvsmap.values()); } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java b/core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java index 954fef3..31b1204 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java +++ b/core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java @@ -25,67 +25,67 @@ import java.nio.ByteBuffer; * An implementation of {@link ByteSequence} that uses a backing byte array. */ public class ArrayByteSequence extends ByteSequence implements Serializable { - + private static final long serialVersionUID = 1L; protected byte data[]; protected int offset; protected int length; - + /** - * Creates a new sequence. The given byte array is used directly as the - * backing array, so later changes made to the array reflect into the new - * sequence. + * Creates a new sequence. The given byte array is used directly as the backing array, so later changes made to the array reflect into the new sequence. * - * @param data byte data + * @param data + * byte data */ public ArrayByteSequence(byte data[]) { this.data = data; this.offset = 0; this.length = data.length; } - + /** - * Creates a new sequence from a subsequence of the given byte array. The - * given byte array is used directly as the backing array, so later changes - * made to the (relevant portion of the) array reflect into the new sequence. + * Creates a new sequence from a subsequence of the given byte array. The given byte array is used directly as the backing array, so later changes made to the + * (relevant portion of the) array reflect into the new sequence. * - * @param data byte data - * @param offset starting offset in byte array (inclusive) - * @param length number of bytes to include in sequence - * @throws IllegalArgumentException if the offset or length are out of bounds - * for the given byte array + * @param data + * byte data + * @param offset + * starting offset in byte array (inclusive) + * @param length + * number of bytes to include in sequence + * @throws IllegalArgumentException + * if the offset or length are out of bounds for the given byte array */ public ArrayByteSequence(byte data[], int offset, int length) { - + if (offset < 0 || offset > data.length || length < 0 || (offset + length) > data.length) { throw new IllegalArgumentException(" Bad offset and/or length data.length = " + data.length + " offset = " + offset + " length = " + length); } - + this.data = data; this.offset = offset; this.length = length; - + } - + /** - * Creates a new sequence from the given string. The bytes are determined from - * the string using the default platform encoding. + * Creates a new sequence from the given string. The bytes are determined from the string using the default platform encoding. * - * @param s string to represent as bytes + * @param s + * string to represent as bytes */ public ArrayByteSequence(String s) { this(s.getBytes(UTF_8)); } - + /** - * Creates a new sequence based on a byte buffer. If the byte buffer has an - * array, that array (and the buffer's offset and limit) are used; otherwise, - * a new backing array is created and a relative bulk get is performed to - * transfer the buffer's contents (starting at its current position and - * not beyond its limit). + * Creates a new sequence based on a byte buffer. If the byte buffer has an array, that array (and the buffer's offset and limit) are used; otherwise, a new + * backing array is created and a relative bulk get is performed to transfer the buffer's contents (starting at its current position and not beyond its + * limit). * - * @param buffer byte buffer + * @param buffer + * byte buffer */ public ArrayByteSequence(ByteBuffer buffer) { this.length = buffer.remaining(); @@ -102,58 +102,58 @@ public class ArrayByteSequence extends ByteSequence implements Serializable { @Override public byte byteAt(int i) { - + if (i < 0) { throw new IllegalArgumentException("i < 0, " + i); } - + if (i >= length) { throw new IllegalArgumentException("i >= length, " + i + " >= " + length); } - + return data[offset + i]; } - + @Override public byte[] getBackingArray() { return data; } - + @Override public boolean isBackedByArray() { return true; } - + @Override public int length() { return length; } - + @Override public int offset() { return offset; } - + @Override public ByteSequence subSequence(int start, int end) { - + if (start > end || start < 0 || end > length) { throw new IllegalArgumentException("Bad start and/end start = " + start + " end=" + end + " offset=" + offset + " length=" + length); } - + return new ArrayByteSequence(data, offset + start, end - start); } - + @Override public byte[] toArray() { if (offset == 0 && length == data.length) return data; - + byte[] copy = new byte[length]; System.arraycopy(data, offset, copy, 0, length); return copy; } - + public String toString() { return new String(data, offset, length, UTF_8); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/data/ByteSequence.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/ByteSequence.java b/core/src/main/java/org/apache/accumulo/core/data/ByteSequence.java index 196cb11..ce8dab0 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/ByteSequence.java +++ b/core/src/main/java/org/apache/accumulo/core/data/ByteSequence.java @@ -22,93 +22,95 @@ import org.apache.hadoop.io.WritableComparator; * A sequence of bytes. */ public abstract class ByteSequence implements Comparable<ByteSequence> { - + /** * Gets a byte within this sequence. * - * @param i index into sequence + * @param i + * index into sequence * @return byte - * @throws IllegalArgumentException if i is out of range + * @throws IllegalArgumentException + * if i is out of range */ public abstract byte byteAt(int i); - + /** * Gets the length of this sequence. * * @return sequence length */ public abstract int length(); - + /** * Returns a portion of this sequence. * - * @param start index of subsequence start (inclusive) - * @param end index of subsequence end (exclusive) + * @param start + * index of subsequence start (inclusive) + * @param end + * index of subsequence end (exclusive) */ public abstract ByteSequence subSequence(int start, int end); - + /** - * Returns a byte array containing the bytes in this sequence. This method - * may copy the sequence data or may return a backing byte array directly. + * Returns a byte array containing the bytes in this sequence. This method may copy the sequence data or may return a backing byte array directly. * * @return byte array */ public abstract byte[] toArray(); - + /** * Determines whether this sequence is backed by a byte array. * * @return true if sequence is backed by a byte array */ public abstract boolean isBackedByArray(); - + /** * Gets the backing byte array for this sequence. * * @return byte array */ public abstract byte[] getBackingArray(); - + /** - * Gets the offset for this sequence. This value represents the starting - * point for the sequence in the backing array, if there is one. + * Gets the offset for this sequence. This value represents the starting point for the sequence in the backing array, if there is one. * * @return offset (inclusive) */ public abstract int offset(); - + /** - * Compares the two given byte sequences, byte by byte, returning a negative, - * zero, or positive result if the first sequence is less than, equal to, or - * greater than the second. The comparison is performed starting with the - * first byte of each sequence, and proceeds until a pair of bytes differs, - * or one sequence runs out of byte (is shorter). A shorter sequence is - * considered less than a longer one. + * Compares the two given byte sequences, byte by byte, returning a negative, zero, or positive result if the first sequence is less than, equal to, or + * greater than the second. The comparison is performed starting with the first byte of each sequence, and proceeds until a pair of bytes differs, or one + * sequence runs out of byte (is shorter). A shorter sequence is considered less than a longer one. * - * @param bs1 first byte sequence to compare - * @param bs2 second byte sequence to compare + * @param bs1 + * first byte sequence to compare + * @param bs2 + * second byte sequence to compare * @return comparison result */ public static int compareBytes(ByteSequence bs1, ByteSequence bs2) { - + int minLen = Math.min(bs1.length(), bs2.length()); - + for (int i = 0; i < minLen; i++) { int a = (bs1.byteAt(i) & 0xff); int b = (bs2.byteAt(i) & 0xff); - + if (a != b) { return a - b; } } - + return bs1.length() - bs2.length(); } - + /** * Compares this byte sequence to another. * - * @param obs byte sequence to compare + * @param obs + * byte sequence to compare * @return comparison result * @see #compareBytes(ByteSequence, ByteSequence) */ @@ -116,28 +118,28 @@ public abstract class ByteSequence implements Comparable<ByteSequence> { if (isBackedByArray() && obs.isBackedByArray()) { return WritableComparator.compareBytes(getBackingArray(), offset(), length(), obs.getBackingArray(), obs.offset(), obs.length()); } - + return compareBytes(this, obs); } - + @Override public boolean equals(Object o) { if (o instanceof ByteSequence) { ByteSequence obs = (ByteSequence) o; - + if (this == o) return true; - + if (length() != obs.length()) return false; - + return compareTo(obs) == 0; } - + return false; - + } - + @Override public int hashCode() { int hash = 1; @@ -152,5 +154,5 @@ public abstract class ByteSequence implements Comparable<ByteSequence> { } return hash; } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/data/Column.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/Column.java b/core/src/main/java/org/apache/accumulo/core/data/Column.java index f259912..294226a 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/Column.java +++ b/core/src/main/java/org/apache/accumulo/core/data/Column.java @@ -23,6 +23,7 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.nio.ByteBuffer; + import org.apache.accumulo.core.data.thrift.TColumn; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator; @@ -31,7 +32,7 @@ import org.apache.hadoop.io.WritableComparator; * A column, specified by family, qualifier, and visibility. */ public class Column implements WritableComparable<Column> { - + static private int compareBytes(byte[] a, byte[] b) { if (a == null && b == null) return 0; @@ -41,12 +42,12 @@ public class Column implements WritableComparable<Column> { return 1; return WritableComparator.compareBytes(a, 0, a.length, b, 0, b.length); } - + /** - * Compares this column to another. Column families are compared first, then - * qualifiers, then visibilities. + * Compares this column to another. Column families are compared first, then qualifiers, then visibilities. * - * @param that column to compare + * @param that + * column to compare * @return comparison result */ public int compareTo(Column that) { @@ -59,7 +60,7 @@ public class Column implements WritableComparable<Column> { return result; return compareBytes(this.columnVisibility, that.columnVisibility); } - + public void readFields(DataInput in) throws IOException { if (in.readBoolean()) { int len = in.readInt(); @@ -68,7 +69,7 @@ public class Column implements WritableComparable<Column> { } else { columnFamily = null; } - + if (in.readBoolean()) { int len = in.readInt(); columnQualifier = new byte[len]; @@ -76,7 +77,7 @@ public class Column implements WritableComparable<Column> { } else { columnQualifier = null; } - + if (in.readBoolean()) { int len = in.readInt(); columnVisibility = new byte[len]; @@ -85,7 +86,7 @@ public class Column implements WritableComparable<Column> { columnVisibility = null; } } - + @Override public void write(DataOutput out) throws IOException { if (columnFamily == null) { @@ -95,7 +96,7 @@ public class Column implements WritableComparable<Column> { out.writeInt(columnFamily.length); out.write(columnFamily); } - + if (columnQualifier == null) { out.writeBoolean(false); } else { @@ -103,7 +104,7 @@ public class Column implements WritableComparable<Column> { out.writeInt(columnQualifier.length); out.write(columnQualifier); } - + if (columnVisibility == null) { out.writeBoolean(false); } else { @@ -112,39 +113,43 @@ public class Column implements WritableComparable<Column> { out.write(columnVisibility); } } - + public byte[] columnFamily; public byte[] columnQualifier; public byte[] columnVisibility; - + /** * Creates a new blank column. */ public Column() {} - + /** - * Creates a new column. - * - * @param columnFamily family - * @param columnQualifier qualifier - * @param columnVisibility visibility - */ + * Creates a new column. + * + * @param columnFamily + * family + * @param columnQualifier + * qualifier + * @param columnVisibility + * visibility + */ public Column(byte[] columnFamily, byte[] columnQualifier, byte[] columnVisibility) { this(); this.columnFamily = columnFamily; this.columnQualifier = columnQualifier; this.columnVisibility = columnVisibility; } - + /** * Creates a new column. * - * @param tcol Thrift column + * @param tcol + * Thrift column */ public Column(TColumn tcol) { this(toBytes(tcol.columnFamily), toBytes(tcol.columnQualifier), toBytes(tcol.columnVisibility)); } - + @Override public boolean equals(Object that) { if (that == null) @@ -153,29 +158,30 @@ public class Column implements WritableComparable<Column> { return this.equals((Column) that); return false; } - + /** * Checks if this column equals another. * - * @param that column to compare + * @param that + * column to compare * @return true if this column equals that, false otherwise */ public boolean equals(Column that) { return this.compareTo(that) == 0; } - + private static int hash(byte[] b) { if (b == null) return 0; - + return WritableComparator.hashBytes(b, b.length); } - + @Override public int hashCode() { return hash(columnFamily) + hash(columnQualifier) + hash(columnVisibility); } - + /** * Gets the column family. Not a defensive copy. * @@ -184,7 +190,7 @@ public class Column implements WritableComparable<Column> { public byte[] getColumnFamily() { return columnFamily; } - + /** * Gets the column qualifier. Not a defensive copy. * @@ -193,7 +199,7 @@ public class Column implements WritableComparable<Column> { public byte[] getColumnQualifier() { return columnQualifier; } - + /** * Gets the column visibility. Not a defensive copy. * @@ -202,19 +208,19 @@ public class Column implements WritableComparable<Column> { public byte[] getColumnVisibility() { return columnVisibility; } - + /** - * Gets a string representation of this column. The family, qualifier, and - * visibility are interpreted as strings using the platform default encoding; - * nulls are interpreted as empty strings. + * Gets a string representation of this column. The family, qualifier, and visibility are interpreted as strings using the platform default encoding; nulls + * are interpreted as empty strings. * * @return string form of column */ public String toString() { - return new String(columnFamily == null ? new byte[0] : columnFamily, UTF_8) + ":" + new String(columnQualifier == null ? new byte[0] : columnQualifier, UTF_8) + ":" + return new String(columnFamily == null ? new byte[0] : columnFamily, UTF_8) + ":" + + new String(columnQualifier == null ? new byte[0] : columnQualifier, UTF_8) + ":" + new String(columnVisibility == null ? new byte[0] : columnVisibility, UTF_8); } - + /** * Converts this column to Thrift. * @@ -224,5 +230,5 @@ public class Column implements WritableComparable<Column> { return new TColumn(columnFamily == null ? null : ByteBuffer.wrap(columnFamily), columnQualifier == null ? null : ByteBuffer.wrap(columnQualifier), columnVisibility == null ? null : ByteBuffer.wrap(columnVisibility)); } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/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 2768b35..4f52214 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 @@ -20,10 +20,10 @@ import java.util.Arrays; /** * A single column and value pair within a {@link Mutation}. - * + * */ public class ColumnUpdate { - + private byte[] columnFamily; private byte[] columnQualifier; private byte[] columnVisibility; @@ -31,17 +31,24 @@ public class ColumnUpdate { private boolean hasTimestamp; private byte[] val; private boolean deleted; - + /** * Creates a new column update. * - * @param cf column family - * @param cq column qualifier - * @param cv column visibility - * @param hasts true if the update specifies a timestamp - * @param ts timestamp - * @param deleted delete marker - * @param val cell value + * @param cf + * column family + * @param cq + * column qualifier + * @param cv + * column visibility + * @param hasts + * true if the update specifies a timestamp + * @param ts + * timestamp + * @param deleted + * delete marker + * @param val + * cell value */ public ColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) { this.columnFamily = cf; @@ -52,7 +59,7 @@ public class ColumnUpdate { this.deleted = deleted; this.val = val; } - + /** * Gets whether this update specifies a timestamp. * @@ -61,7 +68,7 @@ public class ColumnUpdate { public boolean hasTimestamp() { return hasTimestamp; } - + /** * Gets the column family for this update. Not a defensive copy. * @@ -70,7 +77,7 @@ public class ColumnUpdate { public byte[] getColumnFamily() { return columnFamily; } - + /** * Gets the column qualifier for this update. Not a defensive copy. * @@ -79,7 +86,7 @@ public class ColumnUpdate { public byte[] getColumnQualifier() { return columnQualifier; } - + /** * Gets the column visibility for this update. * @@ -88,7 +95,7 @@ public class ColumnUpdate { public byte[] getColumnVisibility() { return columnVisibility; } - + /** * Gets the timestamp for this update. * @@ -97,7 +104,7 @@ public class ColumnUpdate { public long getTimestamp() { return this.timestamp; } - + /** * Gets the delete marker for this update. * @@ -106,7 +113,7 @@ public class ColumnUpdate { public boolean isDeleted() { return this.deleted; } - + /** * Gets the cell value for this update. * @@ -115,13 +122,13 @@ public class ColumnUpdate { public byte[] getValue() { return this.val; } - + @Override public String toString() { - return Arrays.toString(columnFamily) + ":" + Arrays.toString(columnQualifier) + " [" - + Arrays.toString(columnVisibility) + "] " + (hasTimestamp ? timestamp : "NO_TIME_STAMP") + " " + Arrays.toString(val) + " " + deleted; + return Arrays.toString(columnFamily) + ":" + Arrays.toString(columnQualifier) + " [" + Arrays.toString(columnVisibility) + "] " + + (hasTimestamp ? timestamp : "NO_TIME_STAMP") + " " + Arrays.toString(val) + " " + deleted; } - + @Override public boolean equals(Object obj) { if (!(obj instanceof ColumnUpdate)) @@ -131,7 +138,7 @@ public class ColumnUpdate { && Arrays.equals(getColumnVisibility(), upd.getColumnVisibility()) && isDeleted() == upd.isDeleted() && Arrays.equals(getValue(), upd.getValue()) && hasTimestamp() == upd.hasTimestamp() && getTimestamp() == upd.getTimestamp(); } - + @Override public int hashCode() { return Arrays.hashCode(columnFamily) + Arrays.hashCode(columnQualifier) + Arrays.hashCode(columnVisibility)