/** * Read in the configuration from the String encoded configuration * * @param bytes * to read from * @return A valid configuration * @throws IOException * if the configuration could not be read */ private static Configuration readConfiguration(String bytes) throws IOException { return readConfiguration(Bytes.toBytes(bytes)); }
/** * 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); }
conf = readConfiguration(e.getValue().get()); } catch (IOException e1) {
Configuration internal = readConfiguration(e.getSecond());
/** * Read in the configuration from the String encoded configuration * * @param bytes * to read from * @return A valid configuration * @throws IOException * if the configuration could not be read */ private static Configuration readConfiguration(String bytes) throws IOException { return readConfiguration(Bytes.toBytes(bytes)); }
/** * Read in the configuration from the String encoded configuration * * @param bytes * to read from * @return A valid configuration * @throws IOException * if the configuration could not be read */ private static Configuration readConfiguration(String bytes) throws IOException { return readConfiguration(Bytes.toBytes(bytes)); }
/** * 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); }
conf = readConfiguration(e.getValue().get()); } catch (IOException e1) {
conf = readConfiguration(e.getValue().get()); } catch (IOException e1) {
Configuration internal = readConfiguration(e.getSecond());
Configuration internal = readConfiguration(e.getSecond());