From abec1f7286e66bae8f72bce17049cb046a2e58c0 Mon Sep 17 00:00:00 2001 From: serge-rider Date: Sun, 27 Oct 2024 11:50:06 +0100 Subject: [PATCH] dbeaver/pro#3404 Java NIO path support --- .../src/org/jkiss/api/NioPathProvider.java | 32 +++++++++++++++++++ .../api/ObjectWithContextParameters.java | 32 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 modules/org.jkiss.utils/src/org/jkiss/api/NioPathProvider.java create mode 100644 modules/org.jkiss.utils/src/org/jkiss/api/ObjectWithContextParameters.java diff --git a/modules/org.jkiss.utils/src/org/jkiss/api/NioPathProvider.java b/modules/org.jkiss.utils/src/org/jkiss/api/NioPathProvider.java new file mode 100644 index 0000000..4fe8b06 --- /dev/null +++ b/modules/org.jkiss.utils/src/org/jkiss/api/NioPathProvider.java @@ -0,0 +1,32 @@ +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jkiss.api; + +import org.jkiss.code.NotNull; + +import java.io.IOException; +import java.nio.file.Path; + +/** + * Provides implementation of file system Path by URI + */ +public interface NioPathProvider { + + @NotNull + Path getPathByStringOrUri(@NotNull ObjectWithContextParameters context, @NotNull String pathOrUri) throws IOException; + +} diff --git a/modules/org.jkiss.utils/src/org/jkiss/api/ObjectWithContextParameters.java b/modules/org.jkiss.utils/src/org/jkiss/api/ObjectWithContextParameters.java new file mode 100644 index 0000000..0d5c955 --- /dev/null +++ b/modules/org.jkiss.utils/src/org/jkiss/api/ObjectWithContextParameters.java @@ -0,0 +1,32 @@ +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jkiss.api; + +import java.util.Map; + +/** + * Object with contextual information + */ +public interface ObjectWithContextParameters { + + Map getObjectContextParameters(); + + Object getObjectContextParameter(String name); + + void setObjectContextParameter(String name, Object value); + +}