public String getJdbcUrl() { if (_datastore instanceof JdbcDatastore) { JdbcDatastore jdbcDatastore = (JdbcDatastore) _datastore; String url = jdbcDatastore.getJdbcUrl(); if (url == null) { url = jdbcDatastore.getDatasourceJndiUrl(); } return url; } else { return null; } }
@Override public boolean initialize(final JdbcDatastore datastore) { super.initialize(datastore); _connectionStringTextField.setText(datastore.getJdbcUrl()); return true; }
@Override public boolean initialize(final JdbcDatastore datastore) { super.initialize(datastore); final String url = datastore.getJdbcUrl(); NamedPatternMatch<UrlPart> match = null; NamedPattern<UrlPart> matchingUrlTemplate = null; for (final NamedPattern<UrlPart> urlTemplate : _urlTemplates) { matchingUrlTemplate = urlTemplate; match = urlTemplate.match(url); if (match != null) { logger.info("URL '{}' matched with template: {}", url, urlTemplate); break; } } if (match == null) { logger.info("Cannot handle jdbc url '{}', expected something to match: {}", url, _urlTemplates); return false; } return initializeFromMatch(datastore, matchingUrlTemplate, match); }
@Validate public void validate() { // The first time this method is invoked, the datastoreCatalog and // userPreferences fields haven't been populated yet, therefore we just // skip the check, because it is called a little bit later again, and // then these fields are populated. if (datastoreCatalog != null) { // Validate that the datastoreName doesn't conflict with one of the // datastores in the datastoreCatalog. final Datastore datastore = datastoreCatalog.getDatastore(datastoreName); if (datastore != null) { if (datastore instanceof JdbcDatastore && ((JdbcDatastore) datastore).getDriverClass() .equals(H2_DRIVER_CLASS_NAME)) { if (!((JdbcDatastore) datastore).getJdbcUrl().startsWith( H2_DATABASE_CONNECTION_PROTOCOL + userPreferences.getSaveDatastoreDirectory().getPath())) { throw new IllegalStateException("Datastore \"" + datastoreName + "\" is not located in \"Written datastores\" directory \"" + userPreferences .getSaveDatastoreDirectory().getPath() + "\"."); } } else { throw new IllegalStateException("Datastore \"" + datastoreName + "\" is not an H2 database, so it can't be used as a staging database."); } } } } }
final JdbcDatastore jdbcDatastore = (JdbcDatastore) datastore; if (considerOrderdbSpecialization && "jdbc:hsqldb:res:orderdb;readonly=true".equals(jdbcDatastore.getJdbcUrl())) { imagePath = "images/datastore-types/orderdb.png"; } else {
appendElement(ds, "url", datastore.getJdbcUrl()); appendElement(ds, "driver", datastore.getDriverClass()); appendElement(ds, "username", datastore.getUsername());
} else if (datastore instanceof JdbcDatastore) { final JdbcDatastore jdbcDatastore = (JdbcDatastore) datastore; final String jdbcUrl = jdbcDatastore.getJdbcUrl(); final String datasourceJndiUrl = jdbcDatastore.getDatasourceJndiUrl(); if (StringUtils.isNullOrEmpty(datasourceJndiUrl)) {