@Override protected boolean onSubmit(AjaxRequestTarget target, Component contents) { doSaveStore(info); accepted = true; return true; }
/** * Creates a new datastore configuration page to edit the properties of the given data store * * @param dataStoreInfoId the datastore id to modify, as per {@link DataStoreInfo#getId()} */ public DataAccessEditPage(final String dataStoreInfoId) throws IllegalArgumentException { final Catalog catalog = getCatalog(); final DataStoreInfo dataStoreInfo = catalog.getDataStore(dataStoreInfoId); if (null == dataStoreInfo) { throw new IllegalArgumentException("DataStore " + dataStoreInfoId + " not found"); } initUI(dataStoreInfo); }
/** * Uses a "name" parameter to locate the datastore * @param parameters */ public DataAccessEditPage(PageParameters parameters) { String wsName = parameters.getString(WS_NAME); String storeName = parameters.getString(STORE_NAME); DataStoreInfo dsi = getCatalog().getDataStoreByName(wsName, storeName); if(dsi == null) { error(new ParamResourceModel("DataAccessEditPage.notFound", this, wsName, storeName).getString()); doReturn(StorePage.class); return; } try { initUI(dsi); } catch (IllegalArgumentException e) { error(e.getMessage()); doReturn(StorePage.class); return; } }
final Catalog catalog = getCatalog(); final ResourcePool resourcePool = catalog.getResourcePool(); resourcePool.clear(info); LOGGER.finer("connection parameters verified for store " + info.getName() + ". Got a " + dataStore.getClass().getName()); doSaveStore(info); doReturn(StorePage.class); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error obtaining datastore with the modified values", e); confirmSaveOnConnectionFailure(info, requestTarget, e); } catch (RuntimeException e) { LOGGER.log(Level.WARNING, "Error obtaining datastore with the modified values", e); confirmSaveOnConnectionFailure(info, requestTarget, e); doSaveStore(info); doReturn(StorePage.class);
final Exception error) { getCatalog().getResourcePool().clear(info);
protected void initUI(final DataStoreInfo dataStoreInfo) { // the confirm dialog dialog = new GeoServerDialog("dialog"); add(dialog); super.initUI(dataStoreInfo); if (dataStoreInfo.getId() != null) { //null id means detached from catalog, don't bother with uniqueness check final String wsId = dataStoreInfo.getWorkspace().getId(); workspacePanel.getFormComponent().add( new CheckExistingResourcesInWorkspaceValidator(dataStoreInfo.getId(), wsId)); } }
/** * Creates a new edit page directly from a store object. */ public DataAccessEditPage(DataStoreInfo store) { initUI(store); }
/** * Uses a "name" parameter to locate the datastore * * @param parameters */ public DataAccessEditPage(PageParameters parameters) { String wsName = parameters.get(WS_NAME).toOptionalString(); String storeName = parameters.get(STORE_NAME).toString(); DataStoreInfo dsi = getCatalog().getDataStoreByName(wsName, storeName); if (dsi == null) { getSession() .error( new ParamResourceModel( "DataAccessEditPage.notFound", this, wsName, storeName) .getString()); doReturn(StorePage.class); return; } try { initUI(dsi); } catch (IllegalArgumentException e) { error(e.getMessage()); doReturn(StorePage.class); return; } }
final Catalog catalog = getCatalog(); final ResourcePool resourcePool = catalog.getResourcePool(); resourcePool.clear(info); + ". Got a " + dataStore.getClass().getName()); doSaveStore(info); doReturn(StorePage.class); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error obtaining datastore with the modified values", e); confirmSaveOnConnectionFailure(info, requestTarget, e); } catch (RuntimeException e) { LOGGER.log(Level.WARNING, "Error obtaining datastore with the modified values", e); confirmSaveOnConnectionFailure(info, requestTarget, e); doSaveStore(info); doReturn(StorePage.class);
final AjaxRequestTarget requestTarget, final Exception error) { getCatalog().getResourcePool().clear(info);
protected void initUI(final DataStoreInfo dataStoreInfo) { // the confirm dialog dialog = new GeoServerDialog("dialog"); add(dialog); super.initUI(dataStoreInfo); if (dataStoreInfo.getId() != null) { // null id means detached from catalog, don't bother with uniqueness check final String wsId = dataStoreInfo.getWorkspace().getId(); workspacePanel .getFormComponent() .add( new CheckExistingResourcesInWorkspaceValidator( dataStoreInfo.getId(), wsId)); } }
/** Creates a new edit page directly from a store object. */ public DataAccessEditPage(DataStoreInfo store) { initUI(store); }
/** * Creates a new datastore configuration page to edit the properties of the given data store * * @param dataStoreInfoId * the datastore id to modify, as per {@link DataStoreInfo#getId()} */ public DataAccessEditPage(final String dataStoreInfoId) throws IllegalArgumentException { final Catalog catalog = getCatalog(); final DataStoreInfo dataStoreInfo = catalog.getDataStore(dataStoreInfoId); if (null == dataStoreInfo) { throw new IllegalArgumentException("DataStore " + dataStoreInfoId + " not found"); } initUI(dataStoreInfo); }
/** * Performs the save of the store. * <p> * This method may be subclasses to provide custom save functionality. * </p> */ protected void doSaveStore(final DataStoreInfo info) { try { final Catalog catalog = getCatalog(); // The namespace may have changed, in which case we need to update the store resources NamespaceInfo namespace = catalog.getNamespaceByPrefix(info.getWorkspace().getName()); List<FeatureTypeInfo> configuredResources = catalog.getResourcesByStore(info, FeatureTypeInfo.class); for (FeatureTypeInfo alreadyConfigured : configuredResources) { alreadyConfigured.setNamespace(namespace); } ResourcePool resourcePool = catalog.getResourcePool(); resourcePool.clear(info); catalog.save(info); // save the resources after saving the store for (FeatureTypeInfo alreadyConfigured : configuredResources) { catalog.save(alreadyConfigured); } LOGGER.finer("Saved store " + info.getName()); } catch (Exception e) { LOGGER.log(Level.WARNING, "Error saving data store to catalog", e); throw new IllegalArgumentException("Error saving data store:" + e.getMessage()); } }
@Override protected boolean onSubmit(AjaxRequestTarget target, Component contents) { doSaveStore(info); accepted = true; return true; }
final Catalog catalog = getCatalog();