Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<driver id="redis:redis"/>
<driver id="s3:rustfs"/>
<driver id="mongodb:mongodb"/>
<driver id="files:http"/>
</extension>


Expand Down
1 change: 1 addition & 0 deletions server/bundles/io.stackblaze.dbeaver.ext.files/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Stackblaze Volume Files Driver
Bundle-Vendor: Stackblaze
Bundle-SymbolicName: io.stackblaze.dbeaver.ext.files;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-21
Bundle-ActivationPolicy: lazy
Bundle-Localization: OSGI-INF/l10n/bundle
Bundle-ClassPath: .
Require-Bundle: org.jkiss.dbeaver.model;visibility:=reexport,
org.jkiss.dbeaver.model.sql;visibility:=reexport,
org.jkiss.dbeaver.registry;visibility:=reexport
Export-Package: io.stackblaze.dbeaver.ext.files,
io.stackblaze.dbeaver.ext.files.model
Automatic-Module-Name: io.stackblaze.dbeaver.ext.files
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
meta.io.stackblaze.dbeaver.ext.files.model.FilesFolder.name.name=Name
meta.io.stackblaze.dbeaver.ext.files.model.FilesFolder.path.name=Path
meta.io.stackblaze.dbeaver.ext.files.model.FilesEntry.name.name=Name
meta.io.stackblaze.dbeaver.ext.files.model.FilesEntry.size.name=Size
meta.io.stackblaze.dbeaver.ext.files.model.FilesEntry.path.name=Path
27 changes: 27 additions & 0 deletions server/bundles/io.stackblaze.dbeaver.ext.files/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Stackblaze leftover-volume files driver for CloudBeaver CE

Native (non-JDBC) datasource so CloudBeaver can browse a leftover PVC
through the HTTP listing sidecar kubero-server mounts on the volume.

## Driver id

`files:http` (provider `files`, driver `http`)

## Tree

```
connection
├── wp-content/ (folder)
│ └── uploads/ (folder)
│ └── img.jpg (file — Data tab shows name/size/preview)
└── wp-config.php (file)
```

Connects to `http://{host}:{port}` with the connection password as a
Bearer token. Endpoints: `GET /health`, `GET /ls?path=`, `GET /cat?path=`.

## Build notes

- No extra JARs — uses `java.net.http.HttpClient`.
- Registered in `io.cloudbeaver.resources.drivers.base` and included in
`io.cloudbeaver.server.feature`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = target/classes/
bin.includes = .,\
META-INF/,\
OSGI-INF/,\
plugin.xml
46 changes: 46 additions & 0 deletions server/bundles/io.stackblaze.dbeaver.ext.files/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="org.jkiss.dbeaver.dataSourceProvider">
<datasource
class="io.stackblaze.dbeaver.ext.files.FilesDataSourceProvider"
description="Browse a leftover volume over HTTP (Stackblaze)"
id="files"
label="Files"
dialect="files">

<tree path="files" label="Volume">
<items label="Item" path="item" property="items" icon="#folder">
<items label="Item" path="item" property="items" icon="#document"/>
</items>
</tree>

<drivers managable="true">
<driver
id="http"
label="Volume files"
category="Files"
description="HTTP file listing for leftover Kubernetes volumes"
categories="files,volume,storage"
webURL="https://stackblaze.com/"
defaultPort="8080"
defaultUser=""
sampleURL="http://{host}:{port}"
supportedConfigurationTypes="MANUAL,URL"
promotesSingleConnection="true">
<parameter name="supports-references" value="false"/>
<parameter name="supports-indexes" value="false"/>
<parameter name="supports-stored-code" value="false"/>
</driver>
</drivers>
</datasource>
</extension>

<extension point="org.jkiss.dbeaver.sqlDialect">
<dialect
id="files"
label="Files"
class="io.stackblaze.dbeaver.ext.files.model.FilesSQLDialect"
description="Volume file browsing"/>
</extension>
</plugin>
15 changes: 15 additions & 0 deletions server/bundles/io.stackblaze.dbeaver.ext.files/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.cloudbeaver</groupId>
<artifactId>bundles</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>io.stackblaze.dbeaver.ext.files</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.stackblaze.dbeaver.ext.files;

public final class FilesConstants {
public static final String DRIVER_ID = "http";
public static final String PROVIDER_ID = "files";
public static final String FULL_DRIVER_ID = "files:http";
public static final int DEFAULT_PORT = 8080;
public static final int PREVIEW_CHARS = 8_192;
/** Hard ceiling for a real (Save-to-file) content fetch — matches the sidecar's own cap. */
public static final long MAX_DOWNLOAD_BYTES = 100L * 1024 * 1024;

private FilesConstants() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package io.stackblaze.dbeaver.ext.files;

import io.stackblaze.dbeaver.ext.files.model.FilesDataSource;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DatabaseURL;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.impl.AbstractDataSourceProvider;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.utils.CommonUtils;

/**
* Native (non-JDBC) leftover-volume file browser for CloudBeaver CE.
*/
public class FilesDataSourceProvider extends AbstractDataSourceProvider {

public FilesDataSourceProvider() {
super(FilesDataSource.class);
}

@Override
public long getFeatures() {
return FEATURE_CATALOGS;
}

@Override
public boolean providesDriverClasses(@NotNull DBPDriver driver) {
return false;
}

@NotNull
@Override
public String getConnectionURL(@NotNull DBPDriver driver, @NotNull DBPConnectionConfiguration connectionInfo) {
String template = driver.getSampleURL();
if (!CommonUtils.isEmpty(template)) {
try {
return DatabaseURL.generateUrlByTemplate(driver, connectionInfo);
} catch (DBException e) {
// Fall through to the constructed http URL.
}
}
String host = CommonUtils.notEmpty(connectionInfo.getHostName());
String port = CommonUtils.notEmpty(connectionInfo.getHostPort());
return "http://" + host + ":" + port;
}

@NotNull
@Override
public FilesDataSource openDataSource(
@NotNull DBRProgressMonitor monitor,
@NotNull DBPDataSourceContainer container
) throws DBException {
return new FilesDataSource(monitor, container);
}
}
Loading
Loading