Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
7ce32fb
First prototype code implementation for an oracle adapter. Not testet…
romanost03 Mar 23, 2025
ae898db
First UI for schema discovery and code for communication between UI w…
romanost03 Mar 23, 2025
85c6bd3
Implement "createTable" in the oracle source and adding code for comp…
romanost03 Mar 23, 2025
1168485
Bug fix in Oracle Adapter. It is now listed on adapter sources.
romanost03 Mar 26, 2025
638b081
Add functionality to iterate for Postgresql-Database information and …
romanost03 Mar 29, 2025
d35f3ea
Typo correction in OracleStore.java
romanost03 Mar 29, 2025
7ce29fe
Remove first prototype of schema discovery UI.
romanost03 Apr 2, 2025
f4a8412
Correct the connection for the oracle adapter and open TODOS for this…
romanost03 Apr 6, 2025
94ed87e
Changes in OracleSource.java, so the query in the "getExportedColumns…
romanost03 Apr 10, 2025
cee60f8
New interface and funcionality for adapters for retrieving their meta…
romanost03 Apr 16, 2025
913c6e0
First code changes in AdapterTemplate.java and Http-Request for previ…
romanost03 Apr 18, 2025
859b166
Functionality for deriving metadata and preview from adapter (hardcod…
romanost03 Apr 22, 2025
cf625df
PostgreSQL adapter delivers metadata and preview of data properly and…
romanost03 Apr 25, 2025
e31df9c
Expended Node-class so different types of nodes can be saved in the m…
romanost03 Apr 30, 2025
f6d0b99
Removed hardcodet schema- and table name from getExportedColumns in t…
romanost03 May 2, 2025
96a90b7
Selected metadata (attributes) are saved in the corresponding adapter…
romanost03 May 4, 2025
a48d17b
Added new JDBC_TYPE_TO_NAME mapping in PolyType.java such that Mysql'…
romanost03 May 7, 2025
de237fb
Oracle adapter supports MetadataProvider Interface now. All unnecessa…
romanost03 May 7, 2025
7b28a76
Changes in table setting of monetdb adapter and override of "getExpor…
romanost03 May 8, 2025
c6dae6c
MonetdbSource.java implements now MetadaProvider interface.
romanost03 May 8, 2025
9e071f1
Change in "getExportedColumns" so the columns exported doesn't rely o…
romanost03 May 9, 2025
10b6b46
Added SchemaFilter.java enum, so all unnecessary schemas while gettin…
romanost03 May 9, 2025
26c3080
Changes in excel-adapter so deploying works and functionality as meta…
romanost03 May 18, 2025
8dd96d0
Mysql- and oracle adapter are calculating the right preview now for a…
romanost03 May 18, 2025
5e64461
Modified code for a preview request, so Excel Files are handled prope…
romanost03 May 18, 2025
6015417
Code change in "getExportedColumns" in AbstractJdbcSource.java takes …
romanost03 May 18, 2025
364d6b7
Added functionality of observer to observe metadata changes for deplo…
romanost03 May 23, 2025
b11accc
CSV - and Excel Adapter now deployed as MetadataProvider. AbstractLis…
romanost03 Jun 2, 2025
ff3c47c
Changes in metadata observer and new buffer. UI pulls changes from Ch…
romanost03 Jun 6, 2025
b92394b
MetadataProvider.java supports getter for metadata now
romanost03 Jun 6, 2025
31326c1
Excel-Source column indexing bugfix.
romanost03 Jun 6, 2025
24d26dc
Include new crud-route for checking metadata changes
romanost03 Jun 12, 2025
24cbb0c
Add TableFilter.java for filtering in "fetchMetadataTree"
romanost03 Jun 12, 2025
9ba6f7d
Remove ChangeBuffer in PublisherManager.java
romanost03 Jun 12, 2025
045de25
Table fix: Querying data for sourced rely now on physical table names.
romanost03 Jun 12, 2025
026b340
Recreating metadata-change observer. Newly added/removed metadata is …
romanost03 Jun 13, 2025
0562438
Removed Optional<> datatype from fetching metadata changes.
romanost03 Jun 14, 2025
c4b47a9
Code for applying changes on new metadata. Adding new configuration p…
romanost03 Jun 16, 2025
53c5079
Aliases for columns are now send with when deploying new source.
romanost03 Jun 16, 2025
124f804
Add new metadata to catalog when something was added.
romanost03 Jun 20, 2025
9adaad7
Adding/Removing metadata changes works now.
romanost03 Jun 21, 2025
756f915
Add more metadata from nodes which are send to UI.
romanost03 Jun 21, 2025
485cb31
Bugfix in removing tables: Tables without any columns are deleted aut…
romanost03 Jun 23, 2025
4439ec9
Differ between warning of metadata change and critical change.
romanost03 Jun 23, 2025
835031f
Bugfix while adding new configuration for data source.
romanost03 Jun 24, 2025
ea6526d
Bugfix: remove unnecessary metadata when reconfigure.
romanost03 Jun 24, 2025
c8aa141
Add method for removing connection handler when not used anymore.
romanost03 Jun 24, 2025
6b6c396
Merge branch 'master' into metadataFeature
romanost03 Jun 24, 2025
1a2c195
Bugfixes for oracle- and mysql adapter. Add metadata provider for JSO…
romanost03 Jun 26, 2025
e1fbf26
Bugfix in excel-source: Can now deploy subset of columns.
romanost03 Jun 26, 2025
d8a5468
Bugfix in csv-source: Can now deploy subset of column.
romanost03 Jun 26, 2025
d749129
Bugfix: Deleting tables when configuration metadata works properly.
romanost03 Jun 28, 2025
71a5ac2
Merge remote-tracking branch 'origin/metadataFeature' into metadataFe…
romanost03 Jun 28, 2025
edb49d2
Bugfix in excelsource: getExportedColumns retrieves all sheets now. A…
romanost03 Jun 28, 2025
09c2861
Bugfix for jdbc-adapter. Parallel connections to database are possibl…
romanost03 Jun 29, 2025
0299303
Bugfix: New metadata tree is now marked with previous marked and exis…
romanost03 Jun 29, 2025
ea6f3e0
Add logs for every source to PublisherManager.java
romanost03 Jun 30, 2025
b9c0944
Bugfix for getExportedColumns: Double columns are filtered correctly …
romanost03 Jun 30, 2025
212f6c9
Bugfix for fetching metadata and exported columns: connectionHandler …
romanost03 Jul 1, 2025
e050b06
Bugfix when adding metadata and deploy.
romanost03 Jul 1, 2025
9297ec7
Minor improvements/delete unnecessary code.
romanost03 Jul 16, 2025
6f9f347
Bufix: Delete Logs when removing Adapter. Minor code improvements.
romanost03 Aug 5, 2025
d721b75
Create ephemeral adapter for comparison of new and old metadata.
romanost03 Aug 6, 2025
8721918
Bugfix: Multiple InputStreams for Excel are ignored.
romanost03 Aug 7, 2025
b9fbe01
Functionality for reuploading Excel- or CSV files (early stage).
romanost03 Aug 8, 2025
3559cd6
Bugfix during config deletion.
romanost03 Aug 11, 2025
e2e3280
Code cleaning and minor improvements.
romanost03 Aug 11, 2025
7a40a40
Bugfix: Meta Acknowledgements correctly displays success or error.
romanost03 Aug 12, 2025
330d7df
Code cleaning and removing logs.
romanost03 Aug 12, 2025
0c7e0d4
Delete adapter-directory when dropping source.
romanost03 Aug 12, 2025
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
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ allprojects {

implementation group: "org.slf4j", name: "slf4j-api", version: slf4j_api_version // MIT
implementation group: "org.apache.logging.log4j", name: "log4j-slf4j2-impl", version: log4j_slf4j_impl_version // Apache 2.0
implementation 'org.postgresql:postgresql:42.7.2'
implementation group: 'com.oracle.database.jdbc', name: 'ojdbc8', version: '19.8.0.0'

testCompileOnly(group: 'org.pf4j', name: 'pf4j', version: pf4j_version) {
exclude group: "org.slf4j"
Expand Down
39 changes: 38 additions & 1 deletion core/src/main/java/org/polypheny/db/adapter/AdapterManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@
import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializer;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
import org.apache.calcite.linq4j.tree.Expression;
import org.apache.calcite.linq4j.tree.Expressions;
import org.jetbrains.annotations.NotNull;
Expand All @@ -37,8 +42,10 @@
import org.polypheny.db.catalog.entity.LogicalAdapter.AdapterType;
import org.polypheny.db.catalog.entity.allocation.AllocationEntity;
import org.polypheny.db.catalog.exceptions.GenericRuntimeException;
import org.polypheny.db.schemaDiscovery.MetadataProvider;


@Slf4j
public class AdapterManager {

public static Expression ADAPTER_MANAGER_EXPRESSION = Expressions.call( AdapterManager.class, "getInstance" );
Expand Down Expand Up @@ -177,7 +184,6 @@ public Adapter<?> addAdapter( String adapterName, String uniqueName, AdapterType

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


for ( AbstractAdapterSetting setting : adapterTemplate.settings ) {
if ( setting.appliesTo.stream().noneMatch( s -> s.appliesTo( mode ) ) ) {
settings.remove( setting.name );
Expand Down Expand Up @@ -217,6 +223,30 @@ public void removeAdapter( long adapterId ) {
// Shutdown store
adapterInstance.shutdownAndRemoveListeners();

// Delete directory if exist
try {
var s = adapterInstance.getCurrentSettings();
if ( s != null && s.containsKey( "directory" ) ) {
String dirStr = s.get( "directory" );
if ( dirStr != null && !dirStr.isBlank() ) {
Path dir = Paths.get( dirStr ).normalize();
if ( Files.isDirectory( dir ) ) {
Files.walk( dir )
.sorted( java.util.Comparator.reverseOrder() )
.forEach( p -> {
try {
Files.deleteIfExists( p );
} catch ( IOException ignored ) {
}
} );
log.info( "Deleted adapter directory: {}", dir.toAbsolutePath().toString() );
}
}
}
} catch ( Exception e ) {
log.warn( "Could not delete adapter directory: {}", e.toString() );
}

// Remove store from maps
adapterById.remove( adapterInstance.getAdapterId() );
adapterByName.remove( adapterInstance.getUniqueName() );
Expand All @@ -238,6 +268,13 @@ public void restoreAdapters( List<LogicalAdapter> adapters ) {
}


public Optional<MetadataProvider> getMetadataProvider( String uniqueName ) {
return getSource( uniqueName )
.filter( mp -> mp instanceof MetadataProvider )
.map( mp -> (MetadataProvider) mp );
}


public record AdapterInformation( String name, String description, AdapterType type, List<AbstractAdapterSetting> settings, List<DeployMode> modes ) {

public static JsonSerializer<AdapterInformation> getSerializer() {
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/polypheny/db/adapter/DataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.polypheny.db.catalog.catalogs.AdapterCatalog;
import org.polypheny.db.catalog.entity.LogicalAdapter.AdapterType;
import org.polypheny.db.catalog.logistic.DataModel;
import org.polypheny.db.schemaDiscovery.MetadataProvider;
import org.polypheny.db.type.PolyType;

@Getter
public abstract class DataSource<S extends AdapterCatalog> extends Adapter<S> implements ExtensionPoint {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2019-2025 The Polypheny Project
*
* 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.polypheny.db.adapter.MetadataObserver;

import org.polypheny.db.adapter.Adapter;
import org.polypheny.db.schemaDiscovery.AbstractNode;
import org.polypheny.db.schemaDiscovery.MetadataProvider;

public interface AbstractListener<P extends Adapter & MetadataProvider> {

void onMetadataChange( P adapter, AbstractNode node, String hash );

boolean isAvailable();

void applyChange( String[] metadata );

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2019-2025 The Polypheny Project
*
* 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.polypheny.db.adapter.MetadataObserver;

public interface AbstractPublisher {

String getAdapterUniqueName();

void start();

void stop();

void runCheck();

AbstractListener getListener();


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2019-2025 The Polypheny Project
*
* 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.polypheny.db.adapter.MetadataObserver;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.polypheny.db.adapter.MetadataObserver.PublisherManager.ChangeStatus;
import org.polypheny.db.adapter.MetadataObserver.Utils.MetaDiffUtil.DiffResult;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;

@Value
@AllArgsConstructor
public class ChangeLogEntry {

@JsonProperty
String adapterName;
@JsonProperty
Instant timestamp;
@JsonProperty
List<String> messages;
@JsonProperty
ChangeStatus severity;


public class DiffMessageUtil {

private DiffMessageUtil() {
}


public static List<String> toMessages( DiffResult diff ) {
List<String> msgs = new ArrayList<>();

diff.getAdded()
.forEach( p -> msgs.add( "Added metadata " + p ) );

diff.getRemoved()
.forEach( p -> msgs.add( "Removed metadata " + p ) );

diff.getChanged()
.forEach( p -> msgs.add( "Changed metadata " + p ) );

return msgs;
}

}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright 2019-2025 The Polypheny Project
*
* 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.polypheny.db.adapter.MetadataObserver;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.polypheny.db.adapter.MetadataObserver.PublisherManager.ChangeStatus;

import java.time.Duration;
import java.time.Instant;
import java.util.List;

@Value
@AllArgsConstructor
public class ChangeLogView {

@JsonProperty
String adapterName;

@JsonProperty
String timestamp;

@JsonProperty
List<String> messages;

@JsonProperty
ChangeStatus severity;


public static ChangeLogView from( ChangeLogEntry e ) {
return new ChangeLogView(
e.getAdapterName(),
rel( e.getTimestamp() ),
e.getMessages(),
e.getSeverity()
);
}


private static String rel( Instant then ) {
long s = Duration.between( then, Instant.now() ).getSeconds();
if ( s < 0 ) {
s = 0;
}

if ( s < 60 ) {
return s == 1 ? "1 second ago" : s + " seconds ago";
}
long m = s / 60;
if ( m < 60 ) {
return m == 1 ? "1 minute ago" : m + " minutes ago";
}
long h = m / 60;
if ( h < 24 ) {
return h == 1 ? "1 hour ago" : h + " hours ago";
}
long d = h / 24;
if ( d < 7 ) {
return d == 1 ? "1 day ago" : d + " days ago";
}
long w = d / 7;
if ( w < 5 ) {
return w == 1 ? "1 week ago" : w + " weeks ago";
}
long mo = d / 30;
if ( mo < 12 ) {
return mo == 1 ? "1 month ago" : mo + " months ago";
}
long y = d / 365;
return y == 1 ? "1 year ago" : y + " years ago";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2019-2025 The Polypheny Project
*
* 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.polypheny.db.adapter.MetadataObserver;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class HashCache {

private static final HashCache INSTANCE = new HashCache();

private final Map<String, String> cache = new ConcurrentHashMap<>();


private HashCache() {
}


public static HashCache getInstance() {
return INSTANCE;
}


public void put( String uniqueName, String hash ) {
this.cache.put( uniqueName, hash );
}


public String getHash( String uniqueName ) {
return this.cache.get( uniqueName );
}


}
Loading
Loading