Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java42
1 files changed, 31 insertions, 11 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java
index 8d42d07226..e5d7109d19 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java
@@ -31,16 +31,36 @@ class SimpleCatalogStrategy
this.database = database;
}
- public boolean supportsCatalogs() {
- return true;
- }
-
@SuppressWarnings("unchecked")
- public List<Catalog> getCatalogs() {
- return this.database.getCatalogs();
- }
-
- public List<Schema> getSchemas() {
- return Collections.emptyList();
- }
+ public boolean supportsCatalogs() {
+ // DTP allows for optional support of catalogs in extensions
+ List<Catalog> catalogs = this.database.getCatalogs();
+ if ((catalogs == null) || catalogs.isEmpty()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Catalog> getCatalogs() {
+ List<Catalog> catalogs = this.database.getCatalogs();
+ // DTP allows for optional support of catalogs in extensions
+ if ((catalogs == null) || catalogs.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ return catalogs;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Schema> getSchemas() {
+ List<Catalog> catalogs = this.database.getCatalogs();
+ // if there are no catalogs, the database must hold the schemata directly
+ if ((catalogs == null) || catalogs.isEmpty()) {
+ return this.database.getSchemas();
+ }
+
+ return Collections.emptyList();
+ }
}

Back to the top