use of org.neo4j.procedure.Mode.DBMS in project neo4j by neo4j.
the class BuiltInDbmsProcedures method listConfig.
@Admin
@SystemProcedure
@Description("List the currently active config of Neo4j.")
@Procedure(name = "dbms.listConfig", mode = DBMS)
public Stream<ConfigResult> listConfig(@Name(value = "searchString", defaultValue = "") String searchString) {
String lowerCasedSearchString = searchString.toLowerCase();
List<ConfigResult> results = new ArrayList<>();
Config config = graph.getDependencyResolver().resolveDependency(Config.class);
config.getValues().forEach((setting, value) -> {
if (!setting.internal() && setting.name().toLowerCase().contains(lowerCasedSearchString)) {
results.add(new ConfigResult(setting, value));
}
});
return results.stream().sorted(Comparator.comparing(c -> c.name));
}
use of org.neo4j.procedure.Mode.DBMS in project neo4j by neo4j.
the class BuiltInDbmsProcedures method listClientConfig.
@Internal
@SystemProcedure
@Description("Return config settings interesting to clients (e.g. Neo4j Browser)")
@Procedure(name = "dbms.clientConfig", mode = DBMS)
public Stream<ConfigResult> listClientConfig() {
List<ConfigResult> results = new ArrayList<>();
Set<String> browserSettings = Stream.of("browser.allow_outgoing_connections", "browser.credential_timeout", "browser.retain_connection_credentials", "browser.retain_editor_history", "dbms.security.auth_enabled", "browser.remote_content_hostname_whitelist", "browser.post_connect_cmd", "dbms.default_database").collect(Collectors.toCollection(HashSet::new));
Config config = graph.getDependencyResolver().resolveDependency(Config.class);
config.getValues().forEach((setting, value) -> {
if (browserSettings.contains(setting.name().toLowerCase())) {
results.add(new ConfigResult(setting, value));
}
});
return results.stream().sorted(Comparator.comparing(c -> c.name));
}
use of org.neo4j.procedure.Mode.DBMS in project neo4j by neo4j.
the class BuiltInDbmsProcedures method setTXMetaData.
@Description("Attaches a map of data to the transaction. The data will be printed when listing queries, and " + "inserted into the query log.")
@Procedure(name = "tx.setMetaData", mode = DBMS)
public void setTXMetaData(@Name(value = "data") Map<String, Object> data) {
int totalCharSize = data.entrySet().stream().mapToInt(e -> e.getKey().length() + ((e.getValue() != null) ? e.getValue().toString().length() : 0)).sum();
if (totalCharSize >= HARD_CHAR_LIMIT) {
throw new IllegalArgumentException(format("Invalid transaction meta-data, expected the total number of chars for " + "keys and values to be less than %d, got %d", HARD_CHAR_LIMIT, totalCharSize));
}
InternalTransaction internalTransaction = (InternalTransaction) this.transaction;
graph.getDependencyResolver().resolveDependency(TransactionManager.class).findTransactionContaining(internalTransaction).ifPresentOrElse(parent -> parent.setMetaData(data), () -> internalTransaction.setMetaData(data));
}
use of org.neo4j.procedure.Mode.DBMS in project neo4j by neo4j.
the class BuiltInDbmsProcedures method listConnections.
@SystemProcedure
@Description("List all accepted network connections at this instance that are visible to the user.")
@Procedure(name = "dbms.listConnections", mode = DBMS)
public Stream<ListConnectionResult> listConnections() {
NetworkConnectionTracker connectionTracker = getConnectionTracker();
ZoneId timeZone = getConfiguredTimeZone();
return connectionTracker.activeConnections().stream().filter(connection -> isAdminOrSelf(connection.username())).map(connection -> new ListConnectionResult(connection, timeZone));
}
use of org.neo4j.procedure.Mode.DBMS in project neo4j by neo4j.
the class BuiltInDbmsProcedures method listFunctions.
@Deprecated(since = "4.3.0", forRemoval = true)
@SystemProcedure
@Description("List all functions in the DBMS.")
@Procedure(name = "dbms.functions", mode = DBMS, deprecatedBy = "SHOW FUNCTIONS command")
public Stream<FunctionResult> listFunctions() {
DependencyResolver resolver = graph.getDependencyResolver();
QueryExecutionEngine queryExecutionEngine = resolver.resolveDependency(QueryExecutionEngine.class);
List<FunctionInformation> providedLanguageFunctions = queryExecutionEngine.getProvidedLanguageFunctions();
var globalProcedures = resolver.resolveDependency(GlobalProcedures.class);
// gets you all functions provided by the query language
Stream<FunctionResult> languageFunctions = providedLanguageFunctions.stream().map(FunctionResult::new);
// gets you all non-aggregating functions that are registered in the db (incl. those from libs like apoc)
Stream<FunctionResult> loadedFunctions = globalProcedures.getAllNonAggregatingFunctions().map(f -> new FunctionResult(f, false));
// gets you all aggregation functions that are registered in the db (incl. those from libs like apoc)
Stream<FunctionResult> loadedAggregationFunctions = globalProcedures.getAllAggregatingFunctions().map(f -> new FunctionResult(f, true));
return Stream.concat(Stream.concat(languageFunctions, loadedFunctions), loadedAggregationFunctions).sorted(Comparator.comparing(a -> a.name));
}
Aggregations