use of org.neo4j.configuration.helpers.NormalizedDatabaseName in project neo4j by neo4j.
the class TransactionId method normalizeAndValidateDatabaseName.
private static NormalizedDatabaseName normalizeAndValidateDatabaseName(String databaseName) {
NormalizedDatabaseName normalizedDatabaseName = new NormalizedDatabaseName(databaseName);
DatabaseNameValidator.validateInternalDatabaseName(normalizedDatabaseName);
return normalizedDatabaseName;
}
use of org.neo4j.configuration.helpers.NormalizedDatabaseName in project neo4j by neo4j.
the class PushToCloudCommand method execute.
@Override
public void execute() {
try {
if ((database == null || isBlank(database.name())) && (dump == null || isBlank(dump.toString()))) {
database = new NormalizedDatabaseName(DEFAULT_DATABASE_NAME);
}
if (isBlank(username)) {
if (isBlank(username = cons.readLine("%s", "Neo4j aura username (default: neo4j):"))) {
username = "neo4j";
}
}
char[] pass;
if (isBlank(password)) {
if ((pass = cons.readPassword("Neo4j aura password for %s:", username)).length == 0) {
throw new CommandFailedException("Please supply a password, either by '--password' parameter, 'NEO4J_PASSWORD' environment variable, or prompt");
}
} else {
pass = password.toCharArray();
}
String consoleURL = buildConsoleURI(boltURI);
String bearerToken = copier.authenticate(verbose, consoleURL, username, pass, overwrite);
Uploader uploader = prepareUploader(dump, database, tmpDumpFile);
uploader.process(consoleURL, bearerToken);
} catch (Exception e) {
if (verbose) {
e.printStackTrace(ctx.out());
}
throw e;
}
}
use of org.neo4j.configuration.helpers.NormalizedDatabaseName in project neo4j by neo4j.
the class DefaultSystemGraphComponent method initializeSystemGraphModel.
@Override
public void initializeSystemGraphModel(GraphDatabaseService system) throws InvalidArgumentsException {
newDefaultDb(system);
newDb(system, new NormalizedDatabaseName(SYSTEM_DATABASE_NAME), false, NAMED_SYSTEM_DATABASE_ID.databaseId().uuid());
}
use of org.neo4j.configuration.helpers.NormalizedDatabaseName in project neo4j by neo4j.
the class DatabaseStateProcedure method extractDatabaseId.
protected NamedDatabaseId extractDatabaseId(AnyValue[] input) throws ProcedureException {
if (input.length != 1) {
throw new IllegalArgumentException("Illegal input:" + Arrays.toString(input));
}
var rawName = input[0];
if (!(rawName instanceof TextValue)) {
throw new IllegalArgumentException(format("Parameter '%s' value should have a string representation. Instead: %s", PARAMETER_NAME, rawName));
}
var name = new NormalizedDatabaseName(((TextValue) rawName).stringValue());
return idRepository.getByName(name).orElseThrow(() -> new ProcedureException(DatabaseNotFound, format("Unable to retrieve the status " + "for database with name %s because no database with this name exists!", name)));
}
Aggregations