@Override public void validate(String token) throws ConfigurationException { try { if (token.length() % 2 == 1) token = "0" + token; Hex.hexToBytes(token); } catch (NumberFormatException e) { throw new ConfigurationException("Token " + token + " contains non-hex digits"); } }
public void validateConfiguration() throws ConfigurationException { String pfilename = System.getProperty(SimpleAuthenticator.PASSWD_FILENAME_PROPERTY); if (pfilename == null) { throw new ConfigurationException("When using " + this.getClass().getCanonicalName() + " " + SimpleAuthenticator.PASSWD_FILENAME_PROPERTY + " properties must be defined."); } }
public void validateConfiguration() throws ConfigurationException { String afilename = System.getProperty(ACCESS_FILENAME_PROPERTY); if (afilename == null) { throw new ConfigurationException(String.format("When using %s, '%s' property must be defined.", this .getClass().getCanonicalName(), ACCESS_FILENAME_PROPERTY)); } }
public void check() throws ConfigurationException { if (!nullProperties.isEmpty()) { throw new ConfigurationException("Invalid yaml. Those properties " + nullProperties + " are not valid", false); } if (!missingProperties.isEmpty()) { throw new ConfigurationException("Invalid yaml. Please remove properties " + missingProperties + " from your cassandra.yaml", false); } } }
public void check() throws ConfigurationException { if (!nullProperties.isEmpty()) { throw new ConfigurationException("Invalid yaml. Those properties " + nullProperties + " are not valid", false); } if (!missingProperties.isEmpty()) { throw new ConfigurationException("Invalid yaml. Please remove properties " + missingProperties + " from your cassandra.yaml", false); } } }
public static String resourceToFile(String filename) throws ConfigurationException { ClassLoader loader = FBUtilities.class.getClassLoader(); URL scpurl = loader.getResource(filename); if (scpurl == null) throw new ConfigurationException("unable to locate " + filename); return new File(scpurl.getFile()).getAbsolutePath(); }
public void validateOptions() throws ConfigurationException { if (configOptions == null || configOptions.get("replication_factor") == null) { throw new ConfigurationException("SimpleStrategy requires a replication_factor strategy option."); } validateReplicationFactor(configOptions.get("replication_factor")); }
public static Pair<ColumnDefinition, IndexTarget.Type> parse(CFMetaData cfm, IndexMetadata indexDef) { String target = indexDef.options.get("target"); assert target != null : String.format("No target definition found for index %s", indexDef.name); Pair<ColumnDefinition, IndexTarget.Type> result = parse(cfm, target); if (result == null) throw new ConfigurationException(String.format("Unable to parse targets for index %s (%s)", indexDef.name, target)); return result; }
public UUID getId() throws ConfigurationException { String id = getSimple(KW_ID); try { return id != null ? UUID.fromString(id) : null; } catch (IllegalArgumentException e) { throw new ConfigurationException("Invalid table id", e); } }
public void validateOptions() throws ConfigurationException { for (Entry<String, String> e : this.configOptions.entrySet()) { if (e.getKey().equalsIgnoreCase("replication_factor")) throw new ConfigurationException("replication_factor is an option for SimpleStrategy, not NetworkTopologyStrategy"); validateReplicationFactor(e.getValue()); } }
private void validateExpectedOptions() throws ConfigurationException { Collection expectedOptions = recognizedOptions(); if (expectedOptions == null) return; for (String key : configOptions.keySet()) { if (!expectedOptions.contains(key)) throw new ConfigurationException(String.format("Unrecognized strategy option {%s} passed to %s for keyspace %s", key, getClass().getSimpleName(), keyspaceName)); } } }
public static <T> ReversedType<T> getInstance(TypeParser parser) throws ConfigurationException, SyntaxException { List<AbstractType<?>> types = parser.getTypeParameters(); if (types.size() != 1) throw new ConfigurationException("ReversedType takes exactly one argument, " + types.size() + " given"); return getInstance((AbstractType<T>) types.get(0)); }
public static void applyInitialTokens() { if (conf.initial_token != null) { Collection<String> tokens = tokensFromString(conf.initial_token); if (tokens.size() != conf.num_tokens) throw new ConfigurationException("The number of initial tokens (by initial_token) specified is different from num_tokens value", false); for (String token : tokens) partitioner.getTokenFactory().validate(token); } }
public static void announceKeyspaceDrop(String ksName, boolean announceLocally) throws ConfigurationException { KeyspaceMetadata oldKsm = Schema.instance.getKSMetaData(ksName); if (oldKsm == null) throw new ConfigurationException(String.format("Cannot drop non existing keyspace '%s'.", ksName)); logger.info("Drop Keyspace '{}'", oldKsm.name); announce(SchemaKeyspace.makeDropKeyspaceMutation(oldKsm, FBUtilities.timestampMicros()), announceLocally); }
private static void addViewUpdateToMutationBuilder(ViewDefinition view, Mutation.SimpleBuilder builder) { view.metadata.validate(); ViewDefinition oldView = Schema.instance.getView(view.ksName, view.viewName); if (oldView == null) throw new ConfigurationException(String.format("Cannot update non existing materialized view '%s' in keyspace '%s'.", view.viewName, view.ksName)); oldView.metadata.validateCompatibility(view.metadata); logger.info("Update view '{}/{}' From {} To {}", view.ksName, view.viewName, oldView, view); SchemaKeyspace.makeUpdateViewMutation(builder, oldView, view); }
public static void announceKeyspaceDrop(String ksName, boolean announceLocally) throws ConfigurationException { KeyspaceMetadata oldKsm = Schema.instance.getKSMetaData(ksName); if (oldKsm == null) throw new ConfigurationException(String.format("Cannot drop non existing keyspace '%s'.", ksName)); logger.info("Drop Keyspace '{}'", oldKsm.name); announce(SchemaKeyspace.makeDropKeyspaceMutation(oldKsm, FBUtilities.timestampMicros()), announceLocally); }
/** * Transform this raw statement into a CreateTableStatement. */ public ParsedStatement.Prepared prepare(ClientState clientState) throws RequestValidationException { KeyspaceMetadata ksm = Schema.instance.getKSMetaData(keyspace()); if (ksm == null) throw new ConfigurationException(String.format("Keyspace %s doesn't exist", keyspace())); return prepare(ksm.types); }
public static void announceViewDrop(String ksName, String viewName, boolean announceLocally) throws ConfigurationException { ViewDefinition view = Schema.instance.getView(ksName, viewName); if (view == null) throw new ConfigurationException(String.format("Cannot drop non existing materialized view '%s' in keyspace '%s'.", viewName, ksName)); KeyspaceMetadata ksm = Schema.instance.getKSMetaData(ksName); logger.info("Drop table '{}/{}'", view.ksName, view.viewName); announce(SchemaKeyspace.makeDropViewMutation(ksm, view, FBUtilities.timestampMicros()), announceLocally); }
public TableParams asAlteredTableParams(TableParams previous) { if (getId() != null) throw new ConfigurationException("Cannot alter table id."); return build(TableParams.builder(previous)); }
public TableParams asAlteredTableParams(TableParams previous) { if (getId() != null) throw new ConfigurationException("Cannot alter table id."); return build(TableParams.builder(previous)); }