/** * Check to see if the Constraint is currently set. * * @param desc * {@link HTableDescriptor} to check * @param clazz * {@link Constraint} class to check for. * @return <tt>true</tt> if the {@link Constraint} is present, even if it is * disabled. <tt>false</tt> otherwise. */ public static boolean has(HTableDescriptor desc, Class<? extends Constraint> clazz) { return getKeyValueForClass(desc, clazz) != null; }
/** * Check to see if the given constraint is enabled. * * @param desc * {@link HTableDescriptor} to check. * @param clazz * {@link Constraint} to check for * @return <tt>true</tt> if the {@link Constraint} is present and enabled. * <tt>false</tt> otherwise. * @throws IOException * If the constraint has improperly stored in the table */ public static boolean enabled(HTableDescriptor desc, Class<? extends Constraint> clazz) throws IOException { // get the kv Pair<String, String> entry = getKeyValueForClass(desc, clazz); // its not enabled so just return false. In fact, its not even present! if (entry == null) { return false; } // get the info about the constraint Configuration conf = readConfiguration(entry.getSecond()); return conf.getBoolean(ENABLED_KEY, false); }
/** * Change the whether the constraint (if it is already present) is enabled or * disabled. */ private static void changeConstraintEnabled(HTableDescriptor desc, Class<? extends Constraint> clazz, boolean enabled) throws IOException { // get the original constraint Pair<String, String> entry = getKeyValueForClass(desc, clazz); if (entry == null) { throw new IllegalArgumentException("Constraint: " + clazz.getName() + " is not associated with this table. You can't enable it!"); } // create a new configuration from that conf Configuration conf = readConfiguration(entry.getSecond()); // set that it is enabled conf.setBoolean(ENABLED_KEY, enabled); // write it back out writeConstraint(desc, entry.getFirst(), conf); }
throws IOException, IllegalArgumentException { Pair<String, String> e = getKeyValueForClass(desc, clazz);
/** * Check to see if the Constraint is currently set. * * @param desc * {@link HTableDescriptor} to check * @param clazz * {@link Constraint} class to check for. * @return <tt>true</tt> if the {@link Constraint} is present, even if it is * disabled. <tt>false</tt> otherwise. */ public static boolean has(HTableDescriptor desc, Class<? extends Constraint> clazz) { return getKeyValueForClass(desc, clazz) != null; }
/** * Check to see if the Constraint is currently set. * * @param desc * {@link HTableDescriptor} to check * @param clazz * {@link Constraint} class to check for. * @return <tt>true</tt> if the {@link Constraint} is present, even if it is * disabled. <tt>false</tt> otherwise. */ public static boolean has(HTableDescriptor desc, Class<? extends Constraint> clazz) { return getKeyValueForClass(desc, clazz) != null; }
/** * Check to see if the given constraint is enabled. * * @param desc * {@link HTableDescriptor} to check. * @param clazz * {@link Constraint} to check for * @return <tt>true</tt> if the {@link Constraint} is present and enabled. * <tt>false</tt> otherwise. * @throws IOException * If the constraint has improperly stored in the table */ public static boolean enabled(HTableDescriptor desc, Class<? extends Constraint> clazz) throws IOException { // get the kv Pair<String, String> entry = getKeyValueForClass(desc, clazz); // its not enabled so just return false. In fact, its not even present! if (entry == null) { return false; } // get the info about the constraint Configuration conf = readConfiguration(entry.getSecond()); return conf.getBoolean(ENABLED_KEY, false); }
/** * Check to see if the given constraint is enabled. * * @param desc * {@link HTableDescriptor} to check. * @param clazz * {@link Constraint} to check for * @return <tt>true</tt> if the {@link Constraint} is present and enabled. * <tt>false</tt> otherwise. * @throws IOException * If the constraint has improperly stored in the table */ public static boolean enabled(HTableDescriptor desc, Class<? extends Constraint> clazz) throws IOException { // get the kv Pair<String, String> entry = getKeyValueForClass(desc, clazz); // its not enabled so just return false. In fact, its not even present! if (entry == null) { return false; } // get the info about the constraint Configuration conf = readConfiguration(entry.getSecond()); return conf.getBoolean(ENABLED_KEY, false); }
/** * Change the whether the constraint (if it is already present) is enabled or * disabled. */ private static void changeConstraintEnabled(HTableDescriptor desc, Class<? extends Constraint> clazz, boolean enabled) throws IOException { // get the original constraint Pair<String, String> entry = getKeyValueForClass(desc, clazz); if (entry == null) { throw new IllegalArgumentException("Constraint: " + clazz.getName() + " is not associated with this table. You can't enable it!"); } // create a new configuration from that conf Configuration conf = readConfiguration(entry.getSecond()); // set that it is enabled conf.setBoolean(ENABLED_KEY, enabled); // write it back out writeConstraint(desc, entry.getFirst(), conf); }
/** * Change the whether the constraint (if it is already present) is enabled or * disabled. */ private static void changeConstraintEnabled(HTableDescriptor desc, Class<? extends Constraint> clazz, boolean enabled) throws IOException { // get the original constraint Pair<String, String> entry = getKeyValueForClass(desc, clazz); if (entry == null) { throw new IllegalArgumentException("Constraint: " + clazz.getName() + " is not associated with this table. You can't enable it!"); } // create a new configuration from that conf Configuration conf = readConfiguration(entry.getSecond()); // set that it is enabled conf.setBoolean(ENABLED_KEY, enabled); // write it back out writeConstraint(desc, entry.getFirst(), conf); }
throws IOException, IllegalArgumentException { Pair<String, String> e = getKeyValueForClass(desc, clazz);
throws IOException, IllegalArgumentException { Pair<String, String> e = getKeyValueForClass(desc, clazz);