use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PGCoverageStore method createCoverageReference.
private GridCoverageResource createCoverageReference(final GenericName name, Version version) throws DataStoreException {
if (version == null) {
try {
// grab the latest
VersionControl vc = new PGVersionControl(this, name);
final List<Version> versions = vc.list();
if (versions.isEmpty()) {
final Calendar cal = Calendar.getInstance(PGVersionControl.GMT0);
cal.setTimeInMillis(0);
version = vc.createVersion(cal.getTime());
} else {
version = versions.get(versions.size() - 1);
}
} catch (VersioningException ex) {
throw new DataStoreException(ex.getMessage(), ex);
}
}
return new PGCoverageResource(this, name, version);
}
use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PostgresComplexTypeTest method reload.
private void reload(boolean simpleType) throws DataStoreException, VersioningException {
if (store != null) {
store.close();
}
// open in complex type to delete all types
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(false);
store = (PostgresStore) DataStores.open(params);
while (!store.getNames().isEmpty()) {
// we get the list each type because relations may delete multiple types each time
final GenericName n = store.getNames().iterator().next();
final VersionControl vc = store.getVersioning(n.toString());
vc.dropVersioning();
store.deleteFeatureType(n.toString());
}
assertTrue(store.getNames().isEmpty());
store.close();
// reopen the way it was asked
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(simpleType);
store = (PostgresStore) DataStores.open(params);
assertTrue(store.getNames().isEmpty());
}
use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PostgresCoverageTest method reload.
private void reload(boolean simpleType) throws DataStoreException, VersioningException {
if (store != null) {
store.close();
}
// open in complex type to delete all types
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(false);
store = (PostgresStore) DataStores.open(params);
while (!store.getNames().isEmpty()) {
// we get the list each type because relations may delete multiple types each time
final GenericName n = store.getNames().iterator().next();
final VersionControl vc = store.getVersioning(n.toString());
vc.dropVersioning();
store.deleteFeatureType(n.toString());
}
assertTrue(store.getNames().isEmpty());
store.close();
// reopen the way it was asked
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(simpleType);
store = (PostgresStore) DataStores.open(params);
assertTrue(store.getNames().isEmpty());
}
use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PostgresSpatialQueryTest method reload.
private void reload(boolean simpleType) throws DataStoreException, VersioningException {
if (store != null) {
store.close();
}
// open in complex type to delete all types
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(false);
store = (PostgresStore) DataStores.open(params);
for (GenericName n : store.getNames()) {
VersionControl vc = store.getVersioning(n.toString());
vc.dropVersioning();
store.deleteFeatureType(n.toString());
}
assertTrue(store.getNames().isEmpty());
store.close();
// reopen the way it was asked
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(simpleType);
store = (PostgresStore) DataStores.open(params);
assertTrue(store.getNames().isEmpty());
}
use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PostgresVersioningTest method reload.
private void reload(boolean simpleType) throws DataStoreException, VersioningException {
if (store != null) {
store.close();
}
// open in complex type to delete all types
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(false);
store = (PostgresStore) DataStores.open(params);
for (GenericName n : store.getNames()) {
VersionControl vc = store.getVersioning(n.toString());
vc.dropVersioning();
store.deleteFeatureType(n.toString());
}
assertTrue(store.getNames().isEmpty());
store.close();
// reopen the way it was asked
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(simpleType);
store = (PostgresStore) DataStores.open(params);
assertTrue(store.getNames().isEmpty());
// delete historisation functions, he must create them himself
store.dropHSFunctions();
}
Aggregations