private void checkWarnings() { Long imageIOFileCachingThreshold = ImageIOExt.getFilesystemThreshold(); if (null == imageIOFileCachingThreshold || 0L >= imageIOFileCachingThreshold.longValue()) { String warningMsg = new ResourceModel("GWC.ImageIOFileCachingThresholdUnsetWarning").getObject(); super.warn(warningMsg); } }
public DiskQuotaSettingsPage() { GWC gwc = getGWC(); final boolean diskQuotaModuleDisabled = gwc.getDiskQuotaConfig() == null; // use a dettached copy of dq config to support the tabbed pane final DiskQuotaConfig diskQuotaConfig; if (diskQuotaModuleDisabled) { diskQuotaConfig = new DiskQuotaConfig(); // fake diskQuotaConfig.setDefaults(); } else { diskQuotaConfig = gwc.getDiskQuotaConfig().clone(); } final Form<Map<String, Serializable>> form; form = new Form<Map<String, Serializable>>("form"); add(form); final IModel<DiskQuotaConfig> diskQuotaModel = new Model<DiskQuotaConfig>(diskQuotaConfig); final DiskQuotaConfigPanel diskQuotaConfigPanel = new DiskQuotaConfigPanel("diskQuotaPanel", diskQuotaModel); if (diskQuotaModuleDisabled) { diskQuotaConfigPanel.setEnabled(false); super.warn(new ResourceModel("DiskQuotaSettingsPage.disabledWarning").getObject()); } form.add(diskQuotaConfigPanel); form.add( new Button("submit") { private static final long serialVersionUID = 1L; @Override public void onSubmit() { GWC gwc = getGWC(); if (!diskQuotaModuleDisabled) { StorageUnit chosenUnit = diskQuotaConfigPanel.getStorageUnit(); // REVISIT: it seems Wicket is sending back a plain string instead of a String chosenQuotaStr = String.valueOf(diskQuotaConfigPanel.getQuotaValue()); Double chosenQuota; try { chosenQuota = Double.valueOf(chosenQuotaStr); } catch (NumberFormatException e) { form.error(chosenQuotaStr + " is not a valid floating point number"); // TODO: // localize return; } if (chosenQuota.doubleValue() <= 0D) { form.error("Quota has to be > 0"); return; } DiskQuotaConfig dqConfig = diskQuotaModel.getObject(); dqConfig.getGlobalQuota().setValue(chosenQuota.doubleValue(), chosenUnit); gwc.saveDiskQuotaConfig(dqConfig); } doReturn(); } }); form.add( new GeoServerAjaxFormLink("cancel") { private static final long serialVersionUID = 1L; @Override protected void onClick(AjaxRequestTarget target, Form form) { doReturn(); } }); checkWarnings(); }