public boolean accumuloTableExists() { if (!config.hasRequiredAdminProps()) { throw new IllegalArgumentException("Admin configuration is missing required properties"); } AccumuloClient client = AccumuloUtil.getClient(config); return client.tableOperations().exists(config.getAccumuloTable()); } }
public boolean accumuloTableExists() { if (!config.hasRequiredAdminProps()) { throw new IllegalArgumentException("Admin configuration is missing required properties"); } Connector conn = AccumuloUtil.getConnector(config); return conn.tableOperations().exists(config.getAccumuloTable()); } }
@Override public void updateSharedConfig() { if (!config.hasRequiredAdminProps()) { throw new IllegalArgumentException("Admin configuration is missing required properties"); } Properties sharedProps = new Properties(); Iterator<String> iter = config.getKeys(); while (iter.hasNext()) { String key = iter.next(); if (!key.startsWith(FluoConfiguration.CONNECTION_PREFIX)) { sharedProps.setProperty(key, config.getRawString(key)); } } try { CuratorFramework curator = getAppCurator(); ObserverUtil.initialize(curator, config); ByteArrayOutputStream baos = new ByteArrayOutputStream(); sharedProps.store(baos, "Shared java props"); CuratorUtil.putData(curator, ZookeeperPath.CONFIG_SHARED, baos.toByteArray(), CuratorUtil.NodeExistsPolicy.OVERWRITE); } catch (Exception e) { throw new FluoException("Failed to update shared configuration in Zookeeper", e); } }
@Override public void updateSharedConfig() { if (!config.hasRequiredAdminProps()) { throw new IllegalArgumentException("Admin configuration is missing required properties"); } if (applicationRunning()) { throw new FluoException("Error - The Fluo '" + config.getApplicationName() + "' application" + " is already running and must be stopped before updating shared configuration. " + " Aborted update."); } Properties sharedProps = new Properties(); Iterator<String> iter = config.getKeys(); while (iter.hasNext()) { String key = iter.next(); if (!key.startsWith(FluoConfiguration.CONNECTION_PREFIX)) { sharedProps.setProperty(key, config.getRawString(key)); } } try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { CuratorFramework curator = getAppCurator(); ObserverUtil.initialize(curator, config); sharedProps.store(baos, "Shared java props"); CuratorUtil.putData(curator, ZookeeperPath.CONFIG_SHARED, baos.toByteArray(), CuratorUtil.NodeExistsPolicy.OVERWRITE); } catch (Exception e) { throw new FluoException("Failed to update shared configuration in Zookeeper", e); } }
@Override public void remove() { if (!config.hasRequiredAdminProps()) { throw new IllegalArgumentException("Admin configuration is missing required properties");
if (!config.hasRequiredAdminProps()) { System.err.println("Error - Required properties are not set in " + propsPath); System.exit(-1);
if (!config.hasRequiredAdminProps()) { System.err.println("Error - Required properties are not set in " + propsPath); System.exit(-1);
+ " is already running and must be stopped before removing. Aborted remove."); if (!config.hasRequiredAdminProps()) { throw new IllegalArgumentException("Admin configuration is missing required properties");
if (!config.hasRequiredAdminProps()) { System.err.println("Error - Required properties are not set in " + opts.getAppPropsPath()); System.exit(-1);
@Override public void initialize(InitializationOptions opts) throws AlreadyInitializedException, TableExistsException { if (!config.hasRequiredAdminProps()) { throw new IllegalArgumentException("Admin configuration is missing required properties");
@Override public void initialize(InitializationOptions opts) throws AlreadyInitializedException, TableExistsException { if (!config.hasRequiredAdminProps()) { throw new IllegalArgumentException("Admin configuration is missing required properties");
/** * Returns true if required properties for MiniFluo are set */ public boolean hasRequiredMiniFluoProps() { boolean valid = true; if (getMiniStartAccumulo()) { // ensure that client properties are not set since we are using MiniAccumulo valid &= verifyStringPropNotSet(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP); valid &= verifyStringPropNotSet(ACCUMULO_PASSWORD_PROP, CLIENT_ACCUMULO_PASSWORD_PROP); valid &= verifyStringPropNotSet(ACCUMULO_INSTANCE_PROP, CLIENT_ACCUMULO_INSTANCE_PROP); valid &= verifyStringPropNotSet(ACCUMULO_ZOOKEEPERS_PROP, CLIENT_ACCUMULO_ZOOKEEPERS_PROP); valid &= verifyStringPropNotSet(CONNECTION_ZOOKEEPERS_PROP, CLIENT_ZOOKEEPER_CONNECT_PROP); if (valid == false) { log.error("Client properties should not be set in your configuration if MiniFluo is " + "configured to start its own accumulo (indicated by fluo.mini.start.accumulo being " + "set to true)"); } } else { valid &= hasRequiredClientProps(); valid &= hasRequiredAdminProps(); valid &= hasRequiredOracleProps(); valid &= hasRequiredWorkerProps(); } return valid; }
/** * Returns true if required properties for MiniFluo are set */ public boolean hasRequiredMiniFluoProps() { boolean valid = true; if (getMiniStartAccumulo()) { // ensure that client properties are not set since we are using MiniAccumulo valid &= verifyStringPropNotSet(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP); valid &= verifyStringPropNotSet(ACCUMULO_PASSWORD_PROP, CLIENT_ACCUMULO_PASSWORD_PROP); valid &= verifyStringPropNotSet(ACCUMULO_INSTANCE_PROP, CLIENT_ACCUMULO_INSTANCE_PROP); valid &= verifyStringPropNotSet(ACCUMULO_ZOOKEEPERS_PROP, CLIENT_ACCUMULO_ZOOKEEPERS_PROP); valid &= verifyStringPropNotSet(CONNECTION_ZOOKEEPERS_PROP, CLIENT_ZOOKEEPER_CONNECT_PROP); if (valid == false) { log.error("Client properties should not be set in your configuration if MiniFluo is " + "configured to start its own accumulo (indicated by fluo.mini.start.accumulo being " + "set to true)"); } } else { valid &= hasRequiredClientProps(); valid &= hasRequiredAdminProps(); valid &= hasRequiredOracleProps(); valid &= hasRequiredWorkerProps(); } return valid; }