WMSStoreInfo expandedStore = clone(info, true);
WMTSStoreInfo expandedStore = (WMTSStoreInfo) clone(info, true);
@Test public void testCloneStoreInfo() throws Exception { Catalog catalog = getCatalog(); DataStoreInfo source1 = catalog.getDataStores().get(0); DataStoreInfo clonedDs = catalog.getResourcePool().clone(source1, false); assertNotNull(source1); assertNotNull(clonedDs); assertEquals(source1, clonedDs); CoverageStoreInfo source2 = catalog.getCoverageStores().get(0); CoverageStoreInfo clonedCs = catalog.getResourcePool().clone(source2, false); assertNotNull(source2); assertNotNull(clonedCs); assertEquals(source2, clonedCs); }
throws IOException { CoverageStoreInfo expandedStore = clone(info, true);
throws IOException { DataStoreInfo expandedStore = clone(info, true);
/** * Returns the datastore factory used to create underlying resources for a datastore. * * <p>This method first uses {@link DataStoreInfo#getType()} to obtain the datastore. In the * event of a failure it falls back on {@link DataStoreInfo#getConnectionParameters()}. * * @param info The data store metadata. * @return The datastore factory, or null if no such factory could be found, or the factory is * not available. * @throws IOException Any I/O errors. */ public DataAccessFactory getDataStoreFactory(DataStoreInfo info) throws IOException { DataAccessFactory factory = null; DataStoreInfo expandedStore = clone(info, true); if (info.getType() != null) { factory = DataStoreUtils.aquireFactory(expandedStore.getType()); } if (factory == null && expandedStore.getConnectionParameters() != null) { Map<String, Serializable> params = getParams(expandedStore.getConnectionParameters(), catalog.getResourceLoader()); factory = DataStoreUtils.aquireFactory(params); } return factory; }
DataStoreInfo expandedDs = getCatalog().getResourcePool().clone(ds, true);
protected void onSuccessfulSave( final CoverageStoreInfo info, final Catalog catalog, CoverageStoreInfo savedStore) { // the StoreInfo save succeeded... try to present the list of coverages (well, _the_ // coverage while the getotools coverage api does not allow for more than one NewLayerPage layerChooserPage; CoverageStoreInfo expandedStore; try { expandedStore = catalog.getResourcePool().clone(savedStore, true); // The ID is assigned by the catalog and therefore cannot be cloned layerChooserPage = new NewLayerPage(savedStore.getId()); } catch (RuntimeException e) { LOGGER.log(Level.INFO, "Getting list of coverages for saved store " + info.getURL(), e); // doh, can't present the list of coverages, means saving the StoreInfo is meaningless. try { // be extra cautious catalog.remove(savedStore); } catch (RuntimeErrorException shouldNotHappen) { LOGGER.log(Level.WARNING, "Can't remove CoverageStoreInfo after adding it!", e); } // tell the caller why we failed... throw new IllegalArgumentException(e.getMessage(), e); } setResponsePage(layerChooserPage); } }
@Override protected void onSave(final CoverageStoreInfo info, AjaxRequestTarget target) throws IllegalArgumentException { final Catalog catalog = getCatalog(); /* * Try saving a copy of it so if the process fails somehow the original "info" does not end * up with an id set */ CoverageStoreInfo expandedStore = getCatalog().getResourcePool().clone(info, true); CoverageStoreInfo savedStore = catalog.getFactory().createCoverageStore(); // GR: this shouldn't fail, the Catalog.save(StoreInfo) API does not declare any action in // case // of a failure!... strange, why a save can't fail? // Still, be cautious and wrap it in a try/catch block so the page does not blow up try { // GeoServer Env substitution; validate first catalog.validate(expandedStore, false).throwIfInvalid(); // GeoServer Env substitution; force to *AVOID* resolving env placeholders... savedStore = catalog.getResourcePool().clone(info, false); // ... and save catalog.save(savedStore); } catch (RuntimeException e) { LOGGER.log(Level.INFO, "Adding the store for " + info.getURL(), e); throw new IllegalArgumentException( "The coverage store could not be saved. Failure message: " + e.getMessage()); } onSuccessfulSave(info, catalog, savedStore); }
backupFacade.getCatalog().getResourcePool().clone((CoverageStoreInfo) item, true); final String mosaicName = mosaicCoverageStore.getName(); final String mosaicUrlBase = mosaicCoverageStore.getURL();
backupFacade.getCatalog().getResourcePool().clone((CoverageStoreInfo) item, true); final String mosaicName = mosaicCoverageStore.getName(); final String mosaicUrlBase = mosaicCoverageStore.getURL();
CoverageStoreInfo expandedStore = resourcePool.clone(info, true); catalog.validate(expandedStore, false).throwIfInvalid();
/** * Performs the save of the store. * * <p>This method may be subclasses to provide custom save functionality. */ protected void doSaveStore(WMSStoreInfo info) { Catalog catalog = getCatalog(); // Cloning into "expandedStore" through the super class "clone" method WMSStoreInfo expandedStore = catalog.getResourcePool().clone(info, true); getCatalog().validate(expandedStore, false).throwIfInvalid(); getCatalog().save(info); doReturn(StorePage.class); }
/** * Performs the save of the store. * * <p>This method may be subclasses to provide custom save functionality. */ protected void doSaveStore(WMTSStoreInfo info) { Catalog catalog = getCatalog(); // Cloning into "expandedStore" through the super class "clone" method WMTSStoreInfo expandedStore = (WMTSStoreInfo) catalog.getResourcePool().clone(info, true); getCatalog().validate(expandedStore, false).throwIfInvalid(); getCatalog().save(info); doReturn(StorePage.class); }
resourcePool.clear(info); DataStoreInfo expandedStore = catalog.getResourcePool().clone(info, true);
expandedStore = getCatalog().getResourcePool().clone(dstore, true); } else if (store instanceof CoverageStoreInfo) { CoverageStoreInfo cstore = (CoverageStoreInfo) store; expandedStore = getCatalog().getResourcePool().clone(cstore, true); } else if (store instanceof WMSStoreInfo) { WMSStoreInfo wmsInfo = (WMSStoreInfo) store; expandedStore = getCatalog().getResourcePool().clone(wmsInfo, true); } else if (store instanceof WMTSStoreInfo) { WMTSStoreInfo wmsInfo = (WMTSStoreInfo) store; expandedStore = getCatalog().getResourcePool().clone(wmsInfo, true);
if (store instanceof DataStoreInfo) { DataStoreInfo dstore = (DataStoreInfo) store; DataStoreInfo expandedStore = getCatalog().getResourcePool().clone(dstore, true); CoverageStoreInfo cstore = (CoverageStoreInfo) store; CoverageStoreInfo expandedStore = getCatalog().getResourcePool().clone(cstore, true); WMTSStoreInfo wmsInfo = (WMTSStoreInfo) store; WMTSStoreInfo expandedStore = (WMTSStoreInfo) getCatalog().getResourcePool().clone(wmsInfo, true); WMSStoreInfo expandedStore = getCatalog().getResourcePool().clone(wmsInfo, true);