Search in sources :

Example 1 with NormalizedDatabaseName

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;
}
Also used : NormalizedDatabaseName(org.neo4j.configuration.helpers.NormalizedDatabaseName)

Example 2 with 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;
    }
}
Also used : NormalizedDatabaseName(org.neo4j.configuration.helpers.NormalizedDatabaseName) CommandFailedException(org.neo4j.cli.CommandFailedException) IOException(java.io.IOException) CommandFailedException(org.neo4j.cli.CommandFailedException)

Example 3 with NormalizedDatabaseName

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());
}
Also used : NormalizedDatabaseName(org.neo4j.configuration.helpers.NormalizedDatabaseName)

Example 4 with NormalizedDatabaseName

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)));
}
Also used : TextValue(org.neo4j.values.storable.TextValue) ProcedureException(org.neo4j.internal.kernel.api.exceptions.ProcedureException) NormalizedDatabaseName(org.neo4j.configuration.helpers.NormalizedDatabaseName)

Aggregations

NormalizedDatabaseName (org.neo4j.configuration.helpers.NormalizedDatabaseName)4 IOException (java.io.IOException)1 CommandFailedException (org.neo4j.cli.CommandFailedException)1 ProcedureException (org.neo4j.internal.kernel.api.exceptions.ProcedureException)1 TextValue (org.neo4j.values.storable.TextValue)1