@Override public void verifyModification(ConfigOption option) { Preconditions.checkArgument (graph.getConfiguration().isUpgradeAllowed(option.getName()) || option.getType() != ConfigOption.Type.FIXED, "Cannot change the fixed configuration option: %s", option); Preconditions.checkArgument(option.getType() != ConfigOption.Type.LOCAL, "Cannot change the local configuration option: %s", option); if (option.getType() == ConfigOption.Type.GLOBAL_OFFLINE) { //Verify that there no other open JanusGraph graph instance and no open transactions Set<String> openInstances = getOpenInstancesInternal(); assert openInstances.size() > 0; Preconditions.checkArgument(openInstances.size() < 2, "Cannot change offline config option [%s] since multiple instances are currently open: %s", option, openInstances); Preconditions.checkArgument(openInstances.contains(graph.getConfiguration().getUniqueGraphId()), "Only one open instance (" + openInstances.iterator().next() + "), but it's not the current one (" + graph.getConfiguration().getUniqueGraphId() + ")"); //Indicate that this graph must be closed graphShutdownRequired = true; } } };
public static String toString(ConfigElement element) { String result = element.getName(); if (element.isNamespace()) { result = "+ " + result; if (((ConfigNamespace)element).isUmbrella()) result += " [*]"; } else { result = "- " + result; ConfigOption option = (ConfigOption)element; result+= " ["; switch (option.getType()) { case FIXED: result+="f"; break; case GLOBAL_OFFLINE: result+="g!"; break; case GLOBAL: result+="g"; break; case MASKABLE: result+="m"; break; case LOCAL: result+="l"; break; } result+=","+option.getDatatype().getSimpleName(); result+=","+option.getDefaultValue(); result+="]"; } result = result + "\n"; String desc = element.getDescription(); result+="\t"+'"'+desc.substring(0, Math.min(desc.length(), 50))+'"'; return result; }
private String getTableLineForOption(ConfigOption o, String prefix) { final List<String> colData = new ArrayList<>(10); String name = prefix + o.getName(); if (o.isDeprecated()) { ConfigOption<?> successor = o.getDeprecationReplacement(); if (null == successor) { name = "[deprecation-warning]*Deprecated* [line-through]#" + name + "#"; } else { name = "[deprecation-warning]*Deprecated. See " + getFullPath(successor) + "* [line-through]#" + name + "#"; } } colData.add(name); colData.add(removeDelim(o.getDescription())); colData.add(o.getDatatype().getSimpleName()); colData.add(removeDelim(getStringForDefaultValue(o))); if (showMutability) colData.add(o.getType().toString()); String line = Joiner.on(DELIM_PADDING + DELIM + DELIM_PADDING).join(colData); if (DELIM_AT_LINE_START) { line = DELIM + DELIM_PADDING + line; } if (DELIM_AT_LINE_END) { line = line + DELIM_PADDING + DELIM; } return line; }
defaultValue += opt.getDefaultValue(); String mut = "# Mutability: " + opt.getType(); if (opt.isManaged()) { mut += "\n#\n# "; if (opt.getType().equals(ConfigOption.Type.FIXED)) { mut += "This setting is " + opt.getType() + " and cannot be changed after bootstrapping JanusGraph."; } else { final String warning = "Settings with mutability " + opt.getType() + " are centrally managed in " + "JanusGraph's storage backend. After starting the database for the first time, " + "this file's copy of this setting is ignored. Use JanusGraph's Management " +
private <A> void setIllegalGraphOption(ConfigOption<A> opt, ConfigOption.Type requiredType, A attemptedValue) { // Sanity check: make sure the Type of the configuration option is what we expect final ConfigOption.Type type = opt.getType(); Preconditions.checkState(type.equals(requiredType)); Preconditions.checkArgument(requiredType.equals(ConfigOption.Type.LOCAL) || requiredType.equals(ConfigOption.Type.FIXED)); // Get full string path of config option final String path = ConfigElement.getPath(opt); // Try to read the option try { mgmt.get(path); } catch (Throwable t) { log.debug("Caught expected exception", t); } // Try to modify the option try { mgmt.set(path, attemptedValue); mgmt.commit(); fail("Option " + path + " with type " + type + " should not be modifiable in the persistent graph config"); } catch (Throwable t) { log.debug("Caught expected exception", t); } }
private <A> void setAndCheckGraphOption(ConfigOption<A> opt, ConfigOption.Type requiredType, A firstValue, A secondValue) { Preconditions.checkState(opt.getType().equals(requiredType)); final EnumSet<ConfigOption.Type> allowedTypes = EnumSet.of(ConfigOption.Type.GLOBAL, ConfigOption.Type.GLOBAL_OFFLINE, ConfigOption.Type.MASKABLE); Preconditions.checkState(allowedTypes.contains(opt.getType())); if (opt.getType().equals(ConfigOption.Type.GLOBAL_OFFLINE)) { try { mgmt.set(path, firstValue);
String fullOptionName = ConfigElement.getPath(pid.element, pid.umbrellaElements); String template = "Local setting {}={} (Type: {}) is overridden by globally managed value ({}). Use the {} interface instead of the local configuration to control this setting."; Object replacements[] = new Object[] { fullOptionName, localValue, opt.getType(), storeValue, ManagementSystem.class.getSimpleName() }; if (managedOverridesAllowed) { // Lower log severity when this is enabled log.warn(template, replacements);
Preconditions.checkState(ALLOW_STALE_CONFIG.getType().equals(ConfigOption.Type.MASKABLE)); Preconditions.checkState(!customCommitTime.equals(MAX_COMMIT_TIME.getDefaultValue()));
logger.debug("Kerberos is NOT enabled."); logger.debug("KERBEROS_ENABLED name is " + KERBEROS_ENABLED.getName() + " and it is" + (KERBEROS_ENABLED.isOption() ? " " : " not") + " an option."); logger.debug("KERBEROS_ENABLED type is " + KERBEROS_ENABLED.getType().name());