diff --git a/config/src/main/java/org/polypheny/db/util/PolyphenyMode.java b/config/src/main/java/org/polypheny/db/util/PolyMode.java similarity index 96% rename from config/src/main/java/org/polypheny/db/util/PolyphenyMode.java rename to config/src/main/java/org/polypheny/db/util/PolyMode.java index 8c79512f80..3f01c0583a 100644 --- a/config/src/main/java/org/polypheny/db/util/PolyphenyMode.java +++ b/config/src/main/java/org/polypheny/db/util/PolyMode.java @@ -16,7 +16,7 @@ package org.polypheny.db.util; -public enum PolyphenyMode { +public enum PolyMode { PRODUCTION, DEVELOPMENT, TEST, diff --git a/config/src/main/java/org/polypheny/db/util/PolyphenyHomeDirManager.java b/config/src/main/java/org/polypheny/db/util/PolyphenyHomeDirManager.java index 27b77e12e7..6b03ebf649 100644 --- a/config/src/main/java/org/polypheny/db/util/PolyphenyHomeDirManager.java +++ b/config/src/main/java/org/polypheny/db/util/PolyphenyHomeDirManager.java @@ -39,7 +39,7 @@ public class PolyphenyHomeDirManager { private File root; private final List dirs = new ArrayList<>(); private final List deleteOnExit = new ArrayList<>(); - private static PolyphenyMode mode; + private static PolyMode mode; public static PolyphenyHomeDirManager getInstance() { @@ -77,7 +77,7 @@ private PolyphenyHomeDirManager() { } - public static PolyphenyHomeDirManager setModeAndGetInstance( PolyphenyMode mode ) { + public static PolyphenyHomeDirManager setModeAndGetInstance( PolyMode mode ) { if ( PolyphenyHomeDirManager.mode != null ) { throw new RuntimeException( "Could not set the mode." ); } diff --git a/core/src/main/java/org/polypheny/db/algebra/enumerable/EnumerableScan.java b/core/src/main/java/org/polypheny/db/algebra/enumerable/EnumerableScan.java index a66abebddd..7e9a0f8043 100644 --- a/core/src/main/java/org/polypheny/db/algebra/enumerable/EnumerableScan.java +++ b/core/src/main/java/org/polypheny/db/algebra/enumerable/EnumerableScan.java @@ -52,7 +52,7 @@ import org.polypheny.db.schema.types.ScannableEntity; import org.polypheny.db.schema.types.StreamableEntity; import org.polypheny.db.util.BuiltInMethod; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; /** @@ -256,7 +256,7 @@ public Result implement( EnumerableAlgImplementor implementor, Prefer pref ) { @Override public AlgOptCost computeSelfCost( AlgOptPlanner planner, AlgMetadataQuery mq ) { - if ( Catalog.mode == PolyphenyMode.TEST ) { + if ( Catalog.mode == PolyMode.TEST ) { // normally this enumerable is not used by Polypheny and is therefore "removed" by an infinite cost, // but theoretically it is able to handle scans on the application layer // this is tested by different instances and should then lead to a finite selfCost diff --git a/core/src/main/java/org/polypheny/db/catalog/Catalog.java b/core/src/main/java/org/polypheny/db/catalog/Catalog.java index 639a40cb48..bf35749b58 100644 --- a/core/src/main/java/org/polypheny/db/catalog/Catalog.java +++ b/core/src/main/java/org/polypheny/db/catalog/Catalog.java @@ -48,7 +48,7 @@ import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.iface.QueryInterfaceManager.QueryInterfaceTemplate; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; public abstract class Catalog implements ExtensionPoint { @@ -69,7 +69,7 @@ public abstract class Catalog implements ExtensionPoint { private static Catalog INSTANCE = null; public static boolean resetCatalog; public static boolean memoryCatalog; - public static PolyphenyMode mode; + public static PolyMode mode; public static final Expression CATALOG_EXPRESSION = Expressions.call( Catalog.class, "getInstance" ); diff --git a/core/src/main/java/org/polypheny/db/docker/DockerContainer.java b/core/src/main/java/org/polypheny/db/docker/DockerContainer.java index 5146869c84..d3c6cb31fe 100644 --- a/core/src/main/java/org/polypheny/db/docker/DockerContainer.java +++ b/core/src/main/java/org/polypheny/db/docker/DockerContainer.java @@ -41,7 +41,7 @@ import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.config.RuntimeConfig; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; /** * The container is the main interaction instance for calling classes when interacting with Docker. @@ -127,7 +127,7 @@ public int execute( List cmd ) throws IOException { public static String getPhysicalUniqueName( String uniqueName ) { // while not all Docker containers belong to an adapter we annotate it anyway String name = "polypheny_" + RuntimeConfig.INSTANCE_UUID.getString() + "_" + uniqueName; - if ( Catalog.mode != PolyphenyMode.TEST ) { + if ( Catalog.mode != PolyMode.TEST ) { return name; } return name + "_test"; diff --git a/core/src/main/java/org/polypheny/db/docker/DockerManager.java b/core/src/main/java/org/polypheny/db/docker/DockerManager.java index 44a6e6cbd7..29b1ef183d 100644 --- a/core/src/main/java/org/polypheny/db/docker/DockerManager.java +++ b/core/src/main/java/org/polypheny/db/docker/DockerManager.java @@ -32,7 +32,7 @@ import org.polypheny.db.config.ConfigDocker; import org.polypheny.db.config.ConfigManager; import org.polypheny.db.config.RuntimeConfig; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; public final class DockerManager { @@ -53,7 +53,7 @@ public static DockerManager getInstance() { public Optional getInstanceById( int instanceId ) { // Tests expect a localhost docker instance with id 0 - if ( Catalog.mode == PolyphenyMode.TEST && instanceId == 0 ) { + if ( Catalog.mode == PolyMode.TEST && instanceId == 0 ) { return dockerInstances.values().stream().filter( d -> d.getHost().equals( "localhost" ) ).findFirst(); } return Optional.ofNullable( dockerInstances.get( instanceId ) ); diff --git a/core/src/test/java/org/polypheny/db/adapter/index/CowHashIndexTest.java b/core/src/test/java/org/polypheny/db/adapter/index/CowHashIndexTest.java index 92c5efe631..3f1037a010 100644 --- a/core/src/test/java/org/polypheny/db/adapter/index/CowHashIndexTest.java +++ b/core/src/test/java/org/polypheny/db/adapter/index/CowHashIndexTest.java @@ -31,15 +31,15 @@ import org.polypheny.db.type.entity.PolyInteger; import org.polypheny.db.type.entity.PolyValue; import org.polypheny.db.util.Pair; +import org.polypheny.db.util.PolyMode; import org.polypheny.db.util.PolyphenyHomeDirManager; -import org.polypheny.db.util.PolyphenyMode; public class CowHashIndexTest { @BeforeClass public static void init() { - PolyphenyHomeDirManager.setModeAndGetInstance( PolyphenyMode.TEST ); + PolyphenyHomeDirManager.setModeAndGetInstance( PolyMode.TEST ); } @Test diff --git a/core/src/test/java/org/polypheny/db/rex/RexBuilderTest.java b/core/src/test/java/org/polypheny/db/rex/RexBuilderTest.java index 2a81f8e004..db16823316 100644 --- a/core/src/test/java/org/polypheny/db/rex/RexBuilderTest.java +++ b/core/src/test/java/org/polypheny/db/rex/RexBuilderTest.java @@ -56,8 +56,8 @@ import org.polypheny.db.util.Collation; import org.polypheny.db.util.DateString; import org.polypheny.db.util.NlsString; +import org.polypheny.db.util.PolyMode; import org.polypheny.db.util.PolyphenyHomeDirManager; -import org.polypheny.db.util.PolyphenyMode; import org.polypheny.db.util.TimeString; import org.polypheny.db.util.TimestampString; import org.polypheny.db.util.TimestampWithTimeZoneString; @@ -72,7 +72,7 @@ public class RexBuilderTest { @BeforeClass public static void init() { try { - PolyphenyHomeDirManager.setModeAndGetInstance( PolyphenyMode.TEST ); + PolyphenyHomeDirManager.setModeAndGetInstance( PolyMode.TEST ); } catch ( Exception e ) { // can fail } diff --git a/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java b/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java index 8c078772c7..f820cb2d53 100644 --- a/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java +++ b/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java @@ -80,8 +80,8 @@ import org.polypheny.db.transaction.TransactionException; import org.polypheny.db.transaction.TransactionManager; import org.polypheny.db.transaction.TransactionManagerImpl; +import org.polypheny.db.util.PolyMode; import org.polypheny.db.util.PolyphenyHomeDirManager; -import org.polypheny.db.util.PolyphenyMode; import org.polypheny.db.view.MaterializedViewManager; import org.polypheny.db.view.MaterializedViewManagerImpl; import org.polypheny.db.webui.ConfigService; @@ -115,7 +115,7 @@ public class PolyphenyDb { public boolean memoryCatalog = false; @Option(name = { "-mode" }, description = "Special system configuration for running tests", typeConverterProvider = PolyModesConverter.class) - public PolyphenyMode mode = PolyphenyMode.PRODUCTION; + public PolyMode mode = PolyMode.PRODUCTION; @Option(name = { "-gui" }, description = "Show splash screen on startup and add taskbar gui") public boolean desktopMode = false; @@ -184,7 +184,7 @@ public void runPolyphenyDb() { } // Configuration shall not be persisted - ConfigManager.memoryMode = (mode == PolyphenyMode.TEST || memoryCatalog); + ConfigManager.memoryMode = (mode == PolyMode.TEST || memoryCatalog); ConfigManager.resetCatalogOnStartup = resetCatalog; // Select behavior depending on arguments @@ -241,7 +241,7 @@ public void runPolyphenyDb() { } // Backup content of Polypheny folder - if ( mode == PolyphenyMode.TEST || memoryCatalog ) { + if ( mode == PolyMode.TEST || memoryCatalog ) { if ( dirManager.checkIfExists( "_test_backup" ) ) { throw new GenericRuntimeException( "Unable to backup the Polypheny folder since there is already a backup folder." ); } @@ -287,7 +287,7 @@ public void runPolyphenyDb() { } } - if ( mode == PolyphenyMode.TEST ) { + if ( mode == PolyMode.TEST ) { uuid = "polypheny-test"; } @@ -410,7 +410,7 @@ public void join( final long millis ) throws InterruptedException { DdlManager.setAndGetInstance( new DdlManagerImpl( catalog ) ); // Add config and monitoring test page for UI testing - if ( mode == PolyphenyMode.TEST ) { + if ( mode == PolyMode.TEST ) { new UiTestingConfigPage(); new UiTestingMonitoringPage(); } @@ -473,12 +473,12 @@ public void join( final long millis ) throws InterruptedException { private boolean initializeDockerManager() { if ( AutoDocker.getInstance().isAvailable() ) { - if ( mode == PolyphenyMode.TEST ) { + if ( mode == PolyMode.TEST ) { resetDocker = true; Catalog.resetDocker = true; } boolean success = AutoDocker.getInstance().doAutoConnect(); - if ( mode == PolyphenyMode.TEST && !success ) { + if ( mode == PolyMode.TEST && !success ) { // AutoDocker does not work in Windows containers if ( !System.getenv( "RUNNER_OS" ).equals( "Windows" ) ) { log.error( "Failed to connect to docker instance" ); @@ -559,7 +559,7 @@ private Catalog startCatalog() { private void restore( Authenticator authenticator, Catalog catalog ) { PolyPluginManager.startUp( transactionManager, authenticator ); - if ( !resetCatalog && mode != PolyphenyMode.TEST ) { + if ( !resetCatalog && mode != PolyMode.TEST ) { Catalog.getInstance().restore(); } Catalog.getInstance().updateSnapshot(); diff --git a/dbms/src/main/java/org/polypheny/db/cli/PolyphenyModesConverter.java b/dbms/src/main/java/org/polypheny/db/cli/PolyModesConverter.java similarity index 77% rename from dbms/src/main/java/org/polypheny/db/cli/PolyphenyModesConverter.java rename to dbms/src/main/java/org/polypheny/db/cli/PolyModesConverter.java index 7572f9750a..8f1e6671fa 100644 --- a/dbms/src/main/java/org/polypheny/db/cli/PolyphenyModesConverter.java +++ b/dbms/src/main/java/org/polypheny/db/cli/PolyModesConverter.java @@ -23,10 +23,10 @@ import com.github.rvesse.airline.types.TypeConverter; import java.util.Arrays; import lombok.extern.slf4j.Slf4j; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; @Slf4j -public class PolyphenyModesConverter extends DefaultTypeConverter { +public class PolyModesConverter extends DefaultTypeConverter { @Override public TypeConverter getTypeConverter( OptionMetadata option, ParseState state ) { @@ -44,22 +44,22 @@ public TypeConverter getTypeConverter( ArgumentsMetadata arguments, ParseSta public Object convert( String name, Class type, String value ) { String adjustedName = value.toUpperCase(); - if ( Arrays.stream( PolyphenyMode.values() ).anyMatch( v -> v.name().equals( adjustedName ) ) ) { - return PolyphenyMode.valueOf( adjustedName.toUpperCase() ); + if ( Arrays.stream( PolyMode.values() ).anyMatch( v -> v.name().equals( adjustedName ) ) ) { + return PolyMode.valueOf( adjustedName.toUpperCase() ); } switch ( adjustedName.toLowerCase() ) { case "t": - return PolyphenyMode.TEST; + return PolyMode.TEST; case "b": case "bench": - return PolyphenyMode.BENCHMARK; + return PolyMode.BENCHMARK; case "d": case "dev": - return PolyphenyMode.DEVELOPMENT; + return PolyMode.DEVELOPMENT; } log.warn( "Could not find the mode: " + adjustedName ); - return PolyphenyMode.PRODUCTION; + return PolyMode.PRODUCTION; } } diff --git a/dbms/src/test/java/org/polypheny/db/TestHelper.java b/dbms/src/test/java/org/polypheny/db/TestHelper.java index f1c02eabaf..0b56964a37 100644 --- a/dbms/src/test/java/org/polypheny/db/TestHelper.java +++ b/dbms/src/test/java/org/polypheny/db/TestHelper.java @@ -67,7 +67,7 @@ import org.polypheny.db.type.entity.PolyString; import org.polypheny.db.type.entity.PolyValue; import org.polypheny.db.util.Pair; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; import org.polypheny.db.webui.HttpServer; import org.polypheny.db.webui.models.results.DocResult; import org.polypheny.db.webui.models.results.GraphResult; @@ -95,7 +95,7 @@ private TestHelper() { log.info( "Starting Polypheny-DB..." ); Runnable runnable = () -> { - polyphenyDb.mode = PolyphenyMode.TEST; + polyphenyDb.mode = PolyMode.TEST; String defaultStoreName = System.getProperty( "storeId.default" ); if ( defaultStoreName != null ) { polyphenyDb.defaultStoreName = defaultStoreName; diff --git a/plugins/monetdb-adapter/src/main/java/org/polypheny/db/adapter/monetdb/stores/MonetdbStore.java b/plugins/monetdb-adapter/src/main/java/org/polypheny/db/adapter/monetdb/stores/MonetdbStore.java index da9d23287d..1a9fb5ad1c 100644 --- a/plugins/monetdb-adapter/src/main/java/org/polypheny/db/adapter/monetdb/stores/MonetdbStore.java +++ b/plugins/monetdb-adapter/src/main/java/org/polypheny/db/adapter/monetdb/stores/MonetdbStore.java @@ -341,7 +341,7 @@ protected String getTypeString( PolyType type ) { @Override public String getDefaultPhysicalNamespaceName() { - return "public" + getAdapterId(); + return "public"; } diff --git a/plugins/sql-language/src/test/java/org/polypheny/db/sql/PlannerTest.java b/plugins/sql-language/src/test/java/org/polypheny/db/sql/PlannerTest.java index 3b11372f2b..606282fc63 100644 --- a/plugins/sql-language/src/test/java/org/polypheny/db/sql/PlannerTest.java +++ b/plugins/sql-language/src/test/java/org/polypheny/db/sql/PlannerTest.java @@ -115,7 +115,7 @@ import org.polypheny.db.type.checker.OperandTypes; import org.polypheny.db.type.inference.ReturnTypes; import org.polypheny.db.util.Optionality; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; import org.polypheny.db.util.Util; @@ -125,7 +125,7 @@ public class PlannerTest extends SqlLanguageDependent { static { - Catalog.mode = PolyphenyMode.TEST; + Catalog.mode = PolyMode.TEST; } diff --git a/plugins/sql-language/src/test/java/org/polypheny/db/sql/util/PlannerImplMock.java b/plugins/sql-language/src/test/java/org/polypheny/db/sql/util/PlannerImplMock.java index d886e2cbd7..34e2318660 100644 --- a/plugins/sql-language/src/test/java/org/polypheny/db/sql/util/PlannerImplMock.java +++ b/plugins/sql-language/src/test/java/org/polypheny/db/sql/util/PlannerImplMock.java @@ -59,7 +59,7 @@ import org.polypheny.db.tools.Program; import org.polypheny.db.tools.ValidationException; import org.polypheny.db.util.Conformance; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; import org.polypheny.db.util.SourceStringReader; @@ -69,7 +69,7 @@ public class PlannerImplMock implements Planner { static { - Catalog.mode = PolyphenyMode.TEST; + Catalog.mode = PolyMode.TEST; } diff --git a/webui/src/main/java/org/polypheny/db/webui/crud/LanguageCrud.java b/webui/src/main/java/org/polypheny/db/webui/crud/LanguageCrud.java index 6d17fa23b9..efe8c4ab47 100644 --- a/webui/src/main/java/org/polypheny/db/webui/crud/LanguageCrud.java +++ b/webui/src/main/java/org/polypheny/db/webui/crud/LanguageCrud.java @@ -66,7 +66,7 @@ import org.polypheny.db.type.PolyType; import org.polypheny.db.type.entity.PolyValue; import org.polypheny.db.type.entity.graph.PolyGraph; -import org.polypheny.db.util.PolyphenyMode; +import org.polypheny.db.util.PolyMode; import org.polypheny.db.webui.Crud; import org.polypheny.db.webui.TemporalFileManager; import org.polypheny.db.webui.models.IndexModel; @@ -399,7 +399,7 @@ public static List computeResultData( final List> rows private static String toJson( @Nullable PolyValue src ) { return src == null ? null - : Catalog.mode == PolyphenyMode.TEST ? src.toTypedJson() : src.toJson(); + : Catalog.mode == PolyMode.TEST ? src.toTypedJson() : src.toJson(); }