Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move and Store the Data Source and Data Store Logos on Polypheny-DB #485

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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 @@ -64,7 +64,7 @@ private AdapterManager() {
public static long addAdapterTemplate( Class<? extends Adapter<?>> clazz, String adapterName, Function4<Long, String, Map<String, String>, Adapter<?>> deployer ) {
List<AbstractAdapterSetting> settings = AdapterTemplate.getAllSettings( clazz );
AdapterProperties properties = clazz.getAnnotation( AdapterProperties.class );
return Catalog.getInstance().createAdapterTemplate( clazz, adapterName, properties.description(), List.of( properties.usedModes() ), settings, deployer );
return Catalog.getInstance().createAdapterTemplate( clazz, adapterName, properties.description(), List.of( properties.usedModes() ), settings, deployer, properties.logo() );
}


Expand Down Expand Up @@ -184,7 +184,7 @@ public Adapter<?> addAdapter( String adapterName, String uniqueName, AdapterType

AdapterTemplate adapterTemplate = AdapterTemplate.fromString( adapterName, adapterType );

long adapterId = Catalog.getInstance().createAdapter( uniqueName, adapterName, adapterType, settings, mode );
long adapterId = Catalog.getInstance().createAdapter( uniqueName, adapterName, adapterTemplate.adapterLogo, adapterType, settings, mode );
try {
Adapter<?> adapter = adapterTemplate.getDeployer().get( adapterId, uniqueName, settings );
adapterByName.put( adapter.getUniqueName(), adapter );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

String name();

String logo();

malikrafsan marked this conversation as resolved.
Show resolved Hide resolved
String description();

DeployMode[] usedModes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public class AdapterTemplate {
public List<DeployMode> modes;
public long id;
public String description;
public String adapterLogo;


public AdapterTemplate( long id, Class<?> clazz, String adapterName, List<AbstractAdapterSetting> settings, List<DeployMode> modes, String description, Function4<Long, String, Map<String, String>, Adapter<?>> deployer ) {
public AdapterTemplate( long id, Class<?> clazz, String adapterName, List<AbstractAdapterSetting> settings, List<DeployMode> modes, String description, Function4<Long, String, Map<String, String>, Adapter<?>> deployer, String adapterLogo) {
this.id = id;
this.adapterName = adapterName;
this.description = description;
Expand All @@ -57,6 +57,7 @@ public AdapterTemplate( long id, Class<?> clazz, String adapterName, List<Abstra
this.modes = modes;
this.adapterType = getAdapterType( clazz );
this.deployer = deployer;
this.adapterLogo = adapterLogo;
}


Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/polypheny/db/catalog/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void removeObserver( PropertyChangeListener listener ) {
* @param mode
* @return The id of the newly added adapter
*/
public abstract long createAdapter( String uniqueName, String clazz, AdapterType type, Map<String, String> settings, DeployMode mode );
public abstract long createAdapter( String uniqueName, String clazz, String adapterLogo, AdapterType type, Map<String, String> settings, DeployMode mode );

/**
* Update settings of an adapter
Expand Down Expand Up @@ -230,7 +230,7 @@ public void removeObserver( PropertyChangeListener listener ) {
*/
public abstract void dropQueryInterface( long id );

public abstract long createAdapterTemplate( Class<? extends Adapter<?>> clazz, String adapterName, String description, List<DeployMode> modes, List<AbstractAdapterSetting> settings, Function4<Long, String, Map<String, String>, Adapter<?>> deployer );
public abstract long createAdapterTemplate( Class<? extends Adapter<?>> clazz, String adapterName, String description, List<DeployMode> modes, List<AbstractAdapterSetting> settings, Function4<Long, String, Map<String, String>, Adapter<?>> deployer, String adapterLogo );


public abstract void createInterfaceTemplate( String name, QueryInterfaceTemplate queryInterfaceTemplate );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public class LogicalAdapter implements PolyObject {
public String adapterTypeName;
@Serialize
public DeployMode mode;
@Serialize
public String adapterLogo;


public enum AdapterType {STORE, SOURCE}
Expand All @@ -60,12 +62,14 @@ public LogicalAdapter(
@Deserialize("id") final long id,
@Deserialize("uniqueName") @NonNull final String uniqueName,
@Deserialize("adapterName") @NonNull final String adapterName,
@Deserialize("adapterLogo") @NonNull final String adapterLogo,
@Deserialize("type") @NonNull final AdapterType adapterType,
@Deserialize("mode") @NotNull final DeployMode mode,
@Deserialize("settings") @NonNull final Map<String, String> settings ) {
this.id = id;
this.uniqueName = uniqueName;
this.adapterName = adapterName;
this.adapterLogo = adapterLogo;
this.type = adapterType;
this.settings = new HashMap<>( settings );
this.adapterTypeName = getAdapterName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ public void dropNamespace( long id ) {


@Override
public long createAdapter( String uniqueName, String clazz, AdapterType type, Map<String, String> settings, DeployMode mode ) {
public long createAdapter( String uniqueName, String clazz, String adapterLogo, AdapterType type, Map<String, String> settings, DeployMode mode ) {
long id = idBuilder.getNewAdapterId();
adapters.put( id, new LogicalAdapter( id, uniqueName, clazz, type, mode, settings ) );
adapters.put( id, new LogicalAdapter( id, uniqueName, clazz, adapterLogo, type, mode, settings ) );
change();
return id;
}
Expand Down Expand Up @@ -427,9 +427,9 @@ public void dropQueryInterface( long id ) {


@Override
public long createAdapterTemplate( Class<? extends Adapter<?>> clazz, String adapterName, String description, List<DeployMode> modes, List<AbstractAdapterSetting> settings, Function4<Long, String, Map<String, String>, Adapter<?>> deployer ) {
public long createAdapterTemplate( Class<? extends Adapter<?>> clazz, String adapterName, String description, List<DeployMode> modes, List<AbstractAdapterSetting> settings, Function4<Long, String, Map<String, String>, Adapter<?>> deployer, String adapterLogo ) {
long id = idBuilder.getNewAdapterTemplateId();
adapterTemplates.put( id, new AdapterTemplate( id, clazz, adapterName, settings, modes, description, deployer ) );
adapterTemplates.put( id, new AdapterTemplate( id, clazz, adapterName, settings, modes, description, deployer, adapterLogo ) );
change();
return id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void dropNamespace( long id ) {


@Override
public long createAdapter( String uniqueName, String clazz, AdapterType type, Map<String, String> settings, DeployMode mode ) {
public long createAdapter( String uniqueName, String clazz, String adapterLogo, AdapterType type, Map<String, String> settings, DeployMode mode ) {
throw new NotImplementedException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
@Slf4j
@AdapterProperties(
name = "Cottontail-DB",
logo = "assets/dbms-logos/cottontaildb.png",
description = "Cottontail-DB is a column store aimed at multimedia retrieval. It is optimized for classical boolean as well as vector-space retrieval.",
usedModes = { DeployMode.EMBEDDED, DeployMode.REMOTE },
defaultMode = DeployMode.EMBEDDED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
@Extension
@AdapterProperties(
name = "CSV",
logo = "assets/dbms-logos/csv.png",
description = "An adapter for querying CSV files. The location of the directory containing the CSV files can be specified. Currently, this adapter only supports read operations.",
usedModes = DeployMode.EMBEDDED,
defaultMode = DeployMode.EMBEDDED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void stop() {
@Extension
@AdapterProperties(
name = "Ethereum",
logo = "assets/dbms-logos/ethereum.png",
description = "An adapter for querying the Ethereum blockchain. It uses the ethereum JSON-RPC API. Currently, this adapter only supports read operations.",
usedModes = DeployMode.REMOTE,
defaultMode = DeployMode.REMOTE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
@Slf4j
@AdapterProperties(
name = "Excel",
logo = "assets/dbms-logos/xls.png",
description = "An adapter for querying Excel files. The location of the directory containing the Excel files can be specified. Currently, this adapter only supports read operations.",
usedModes = DeployMode.EMBEDDED,
defaultMode = DeployMode.EMBEDDED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
@Extension
@AdapterProperties(
name = "File",
logo = "fa fa-file-image-o",
description = "An adapter that stores all data as files. It is especially suitable for multimedia collections.",
usedModes = DeployMode.EMBEDDED,
defaultMode = DeployMode.EMBEDDED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
@Slf4j
@AdapterProperties(
name = "QFS",
logo = "fa fa-folder-open-o",
description = "This data source maps a file system on the Polypheny-DB host system as a relational entity and allows to query it.",
usedModes = DeployMode.EMBEDDED,
defaultMode = DeployMode.EMBEDDED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
@Slf4j
@AdapterProperties(
name = "GoogleSheets",
logo = "assets/dbms-logos/google.png",
description = "An adapter for querying online Google Sheets, using the Google Sheets Java API. Currently, this adapter only supports read operations.",
usedModes = DeployMode.REMOTE,
defaultMode = DeployMode.REMOTE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
@Slf4j
@AdapterProperties(
name = "HSQLDB",
logo = "assets/dbms-logos/hsqldb.png",
description = "Java-based relational database system. It supports an in-memory and a persistent file based mode. Deploying a HSQLDB instance requires no additional dependencies to be installed or servers to be set up.",
usedModes = DeployMode.EMBEDDED,
defaultMode = DeployMode.EMBEDDED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
@Slf4j
@AdapterProperties(
name = "MonetDB",
logo = "assets/dbms-logos/monetdb.png",
description = "MonetDB is an execute-source column-oriented database management system. It is based on an optimistic concurrency control.",
usedModes = DeployMode.REMOTE,
defaultMode = DeployMode.REMOTE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
@Slf4j
@AdapterProperties(
name = "MonetDB",
logo = "assets/dbms-logos/monetdb.png",
description = "MonetDB is an execute-source column-oriented database management system. It is based on an optimistic concurrency control.",
usedModes = { DeployMode.REMOTE, DeployMode.DOCKER },
defaultMode = DeployMode.DOCKER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public void stop() {
@Extension
@AdapterProperties(
name = "MongoDB",
logo = "assets/dbms-logos/mongodb.png",
description = "MongoDB is a document-oriented database system.",
usedModes = { DeployMode.REMOTE, DeployMode.DOCKER },
defaultMode = DeployMode.DOCKER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void addStoreSnapshot( AdapterCatalog snapshot ) {


@Override
public long createAdapterTemplate( Class<? extends Adapter<?>> clazz, String adapterName, String description, List<DeployMode> modes, List<AbstractAdapterSetting> settings, Function4<Long, String, Map<String, String>, Adapter<?>> deployer ) {
public long createAdapterTemplate( Class<? extends Adapter<?>> clazz, String adapterName, String description, List<DeployMode> modes, List<AbstractAdapterSetting> settings, Function4<Long, String, Map<String, String>, Adapter<?>> deployer, String adapterLogo ) {
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void stop() {
@Slf4j
@AdapterProperties(
name = "MySQL",
logo = "assets/dbms-logos/mysql.png",
description = "Data source adapter for the relational database systems MariaDB and MySQL.",
usedModes = DeployMode.REMOTE,
defaultMode = DeployMode.REMOTE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private static String getMappingLabel( long id ) {
@Slf4j
@AdapterProperties(
name = "Neo4j",
logo = "assets/dbms-logos/neo4j.png",
description = "Neo4j is a graph-model based database system. It stores data in a graph structure which consists of nodes and edges.",
usedModes = { DeployMode.DOCKER, DeployMode.REMOTE },
defaultMode = DeployMode.DOCKER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
@Slf4j
@AdapterProperties(
name = "PostgreSQL",
logo = "assets/dbms-logos/postgres.svg",
description = "Relational database system optimized for transactional workload that provides an advanced set of features. PostgreSQL is fully ACID compliant and ensures that all requirements are met.",
usedModes = DeployMode.REMOTE,
defaultMode = DeployMode.REMOTE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
@Slf4j
@AdapterProperties(
name = "PostgreSQL",
logo = "assets/dbms-logos/postgres.svg",
description = "Relational database system optimized for transactional workload that provides an advanced set of features. PostgreSQL is fully ACID compliant and ensures that all requirements are met.",
usedModes = { DeployMode.REMOTE, DeployMode.DOCKER },
defaultMode = DeployMode.DOCKER)
Expand Down
1 change: 1 addition & 0 deletions webui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jar {
attributes "Version": "$project.version"
}
from("$buildDir/webapp") // include webapp files
from("$buildDir/public") // include public files
duplicatesStrategy = 'include'
}
java {
Expand Down
5 changes: 5 additions & 0 deletions webui/src/main/java/org/polypheny/db/webui/HttpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import io.javalin.Javalin;
import io.javalin.http.Context;
import io.javalin.http.staticfiles.Location;
import io.javalin.plugin.json.JavalinJackson;
import io.javalin.websocket.WsConfig;
import java.io.BufferedReader;
Expand Down Expand Up @@ -88,6 +89,10 @@ public static HttpServer getInstance() {
config.jsonMapper( new JavalinJackson( mapper ) );
config.enableCorsForAllOrigins();
config.addStaticFiles( staticFileConfig -> staticFileConfig.directory = "webapp/" );
config.addStaticFiles( staticFileConfig -> {
staticFileConfig.directory = "public/";
staticFileConfig.hostedPath = "/public";
});
} ).start( RuntimeConfig.WEBUI_SERVER_PORT.getInteger() );
private Crud crud;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@
import org.polypheny.db.catalog.entity.LogicalAdapter.AdapterType;
import org.polypheny.db.docker.DockerManager;

public record AdapterTemplateModel(@JsonProperty String adapterName, @JsonProperty AdapterType adapterType, @JsonProperty List<AdapterSettingsModel> settings, @JsonProperty String description, @JsonProperty List<DeployMode> modes) {
public record AdapterTemplateModel(@JsonProperty String adapterName, @JsonProperty String adapterLogo, @JsonProperty AdapterType adapterType, @JsonProperty List<AdapterSettingsModel> settings, @JsonProperty String description, @JsonProperty List<DeployMode> modes) {


public AdapterTemplateModel(
@NotNull String adapterName,
@NotNull String adapterLogo,
@NotNull AdapterType adapterType,
@NotNull List<AdapterSettingsModel> settings,
@NotNull String description,
@NotNull List<DeployMode> modes ) {
this.adapterName = adapterName;
this.adapterLogo = adapterLogo;
this.adapterType = adapterType;
this.settings = settings;
this.description = description;
Expand All @@ -59,6 +61,7 @@ public static AdapterTemplateModel from( AdapterTemplate template ) {

return new AdapterTemplateModel(
template.adapterName,
template.adapterLogo,
template.adapterType,
settings,
template.description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,22 @@ public class AdapterModel extends IdEntity {
@JsonProperty
public List<IndexMethodModel> indexMethods;

@JsonProperty
public String adapterLogo;


public AdapterModel(
@JsonProperty("id") @Nullable Long id,
@JsonProperty("name") @Nullable String name,
@JsonProperty("adapterName") String adapterName,
@JsonProperty("adapterLogo") String adapterLogo,
@JsonProperty("type") AdapterType type,
@JsonProperty("settings") Map<String, AdapterSettingValueModel> settings,
@JsonProperty("mode") DeployMode mode,
@JsonProperty("indexMethods") List<IndexMethodModel> indexMethods ) {
super( id, name );
this.adapterName = adapterName;
this.adapterLogo = adapterLogo;
this.type = type;
this.settings = settings;
this.mode = mode;
Expand All @@ -83,6 +88,7 @@ public static AdapterModel from( LogicalAdapter adapter ) {
adapter.id,
adapter.uniqueName,
adapter.adapterName,
adapter.adapterLogo,
adapter.type,
settings,
adapter.mode,
Expand Down
malikrafsan marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move the logos to each plugin directly?
When they have to be included in the core modules, it removes the separation between plugins and core.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean move the logo file? It seems like it would be a bit complicated as currently in this MR, we serve the logo files if the files are inside public directory from resources

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading