Refine search
@Override public String getTitle() { if (title == null && metadata != null) { title = metadata.get("title", String.class); } return title; }
/** Create a new {@link CoverageInfo} for this {@link CoverageView} */ public CoverageInfo createCoverageInfo( String name, CoverageStoreInfo storeInfo, CatalogBuilder builder) throws Exception { Catalog catalog = storeInfo.getCatalog(); CoverageInfo coverageInfo = catalog.getFactory().createCoverage(); CoverageInfo info = buildCoverageInfo(builder, storeInfo, coverageInfo, name); info.getMetadata().put(CoverageView.COVERAGE_VIEW, this); info.setName(name); info.setNativeCoverageName(name); return info; }
Integer readTimeout = null; if (metadata != null) { maxConnections = metadata.get("maxConnections", Integer.class); connectTimeout = metadata.get("connectTimeout", Integer.class); readTimeout = metadata.get("readTimeout", Integer.class); metadata.remove("maxConnections"); metadata.remove("connectTimeout"); metadata.remove("readTimeout"); Integer readTimeout = null; if (metadata != null) { maxConnections = metadata.get("maxConnections", Integer.class); connectTimeout = metadata.get("connectTimeout", Integer.class); readTimeout = metadata.get("readTimeout", Integer.class); metadata.remove("maxConnections"); metadata.remove("connectTimeout"); metadata.remove("readTimeout");
private MetadataMap cloneMetadataMap(MetadataMap original) { MetadataMap clone = new MetadataMap(); for (Entry<String, Serializable> entry : original.entrySet()) { String key = entry.getKey(); Serializable value = entry.getValue(); if (value instanceof CatalogInfo) { CatalogInfo replacement = replaceCatalogInfo((CatalogInfo) value); if (replacement != null) { value = replacement; } } clone.put(key, value); } return clone; }
/** * Configures the dimension of a vector layer * * @param featureTypeName The feature type name * @param dimensionName The dimension name (key in the resource metadata map) * @param presentation The chosen presentation * @param resolution The resolution * @param units The units * @param unitSymbol The unit symbol */ protected void setupRasterDimension( QName layer, String dimensionName, DimensionPresentation presentation, Double resolution, String units, String unitSymbol) { CoverageInfo info = getCatalog().getCoverageByName(layer.getLocalPart()); DimensionInfo di = new DimensionInfoImpl(); di.setEnabled(true); di.setPresentation(presentation); if (resolution != null) { di.setResolution(new BigDecimal(resolution)); } di.setUnits(units); di.setUnitSymbol(unitSymbol); info.getMetadata().put(dimensionName, di); getCatalog().save(info); }
@After public void removeRasterDimensions() { CoverageInfo info = getCatalog().getCoverageByName(WATTEMP.getLocalPart()); info.getMetadata().remove(ResourceInfo.CUSTOM_DIMENSION_PREFIX + DIMENSION_NAME); getCatalog().save(info); }
protected void setupFeatureElevationDimension(DimensionDefaultValueSetting defaultValue) { FeatureTypeInfo info = getCatalog().getFeatureTypeByName(ELEVATION_WITH_START_END.getLocalPart()); DimensionInfo di = new DimensionInfoImpl(); di.setEnabled(true); di.setAttribute("startElevation"); di.setDefaultValue(defaultValue); di.setPresentation(DimensionPresentation.LIST); info.getMetadata().put(ResourceInfo.ELEVATION, di); getCatalog().save(info); }
WorkspaceInfo ws = catalog.getWorkspaceByName(MockData.CITE_PREFIX); WorkspaceInfo ws2 = serialize(ws); assertSame(ModificationProxy.unwrap(ws), ModificationProxy.unwrap(ws2)); NamespaceInfo ns = catalog.getNamespaceByPrefix(MockData.CITE_PREFIX); NamespaceInfo ns2 = serialize(ns); assertSame(ModificationProxy.unwrap(ns), ModificationProxy.unwrap(ns2)); DataStoreInfo ds = catalog.getDataStoreByName(MockData.CITE_PREFIX); DataStoreInfo ds2 = serialize(ds); assertSame(ModificationProxy.unwrap(ds), ModificationProxy.unwrap(ds2)); CoverageStoreInfo cs = catalog.getCoverageStoreByName(MockData.TASMANIA_DEM.getLocalPart()); CoverageStoreInfo cs2 = serialize(cs); assertSame(ModificationProxy.unwrap(cs), ModificationProxy.unwrap(cs2)); lim.getMetadata().put(key, ws); LayerInfo lim3 = serialize(lim); assertSame(ModificationProxy.unwrap(lim), ModificationProxy.unwrap(lim3)); assertSame( ModificationProxy.unwrap(lim.getMetadata().get(key)), ModificationProxy.unwrap(lim3.getMetadata().get(key)));
private void setupESRIFormatByDefault(GeoServer geoServer, Boolean value) throws IOException { WFSInfo wfsInfo = geoServer.getService(WFSInfo.class); MetadataMap metadata = wfsInfo.getMetadata(); metadata.put(ShapeZipOutputFormat.SHAPE_ZIP_DEFAULT_PRJ_IS_ESRI, value); geoServer.save(wfsInfo); }
public Filter getFilter(WMSMapContent context, Layer layer) { Catalog catalog = gs.getCatalog(); Set<String> featuresInTile = Collections.emptySet(); try { featureType = catalog.getFeatureTypeByName(featureSource.getName()); String dataDir = catalog.getResourceLoader().getBaseDirectory().getCanonicalPath(); tableName = getDatabaseName(context, layer); featuresPerTile = featureType.getMetadata().get( "kml.regionateFeatureLimit",Integer.class ); if (featuresPerTile == null || featuresPerTile.intValue() <= 1) featuresPerTile = 64; throw new ServiceException(featureType.getName() + " is geometryless, cannot generate KML!"); ReferencedEnvelope tileEnvelope = tile.getEnvelope(); if (!envelopeMatch(tileEnvelope, requestedEnvelope)) throw new ServiceException( "Invalid bounding box request, it does not fit " + "the nearest regionating tile. Requested area: " "Error occurred while pre-processing regionated features", t); throw new ServiceException("Failure while pre-processing regionated features", t);
@Test public void testModifyMetadata() { // set default namespace addNamespace(); addDataStore(); TestListener l = new TestListener(); catalog.addListener(l); FeatureTypeInfo ft = catalog.getFactory().createFeatureType(); ft.setName("ftName"); ft.setDescription("ftDescription"); ft.setStore(ds); assertTrue(l.added.isEmpty()); catalog.add(ft); assertEquals(1, l.added.size()); assertEquals(ft, l.added.get(0).getSource()); ft = catalog.getFeatureTypeByName("ftName"); ft.getMetadata().put("newValue", "abcd"); MetadataMap newMetadata = new MetadataMap(ft.getMetadata()); catalog.save(ft); assertEquals(1, l.modified.size()); assertEquals(ft, l.modified.get(0).getSource()); assertTrue(l.modified.get(0).getPropertyNames().contains("metadata")); assertTrue(l.modified.get(0).getOldValues().contains(new MetadataMap())); assertTrue(l.modified.get(0).getNewValues().contains(newMetadata)); }
/** * Looks up the elevation configuration, throws an exception if not found * * @param resourceInfo * @param dimensionName */ public DimensionInfo getDimensionInfo(ResourceInfo resourceInfo, String dimensionName) { DimensionInfo info = resourceInfo.getMetadata().get(dimensionName, DimensionInfo.class); if (info == null || !info.isEnabled()) { throw new ServiceException( "Layer " + resourceInfo.prefixedName() + " does not have " + dimensionName + " support enabled"); } return info; }
@Override public void initialize(GeoServer geoServer) throws Exception { // Add a new Element to the metadata map GeoServerInfo global = geoServer.getGlobal(); MetadataMap metadata = global.getSettings().getMetadata(); if(!metadata.containsKey(NetCDFSettingsContainer.NETCDFOUT_KEY)){ metadata.put(NetCDFSettingsContainer.NETCDFOUT_KEY, new NetCDFSettingsContainer()); geoServer.save(global); } } }
public void testUpgradeDirectWMSIntegrationFlag() throws Exception { // no gwc-gs.xml exists, so that initialization runs when(configPersister.findConfigFile()).thenReturn(null); // no catalog layers for this test List<LayerInfo> layers = ImmutableList.of(); List<LayerGroupInfo> groups = ImmutableList.of(); when(rawCatalog.getLayers()).thenReturn(layers); when(rawCatalog.getLayerGroups()).thenReturn(groups); WMSInfoImpl wmsInfo = new WMSInfoImpl(); // initialize wmsInfo with a value for the old direct wms integration flag wmsInfo.getMetadata().put(GWCInitializer.WMS_INTEGRATION_ENABLED_KEY, Boolean.TRUE); // make sure WMSInfo exists when(geoServer.getService(eq(WMSInfo.class))).thenReturn(wmsInfo); ArgumentCaptor<GWCConfig> captor = ArgumentCaptor.forClass(GWCConfig.class); // run layer initialization initializer.initialize(geoServer); verify(configPersister, times(2)).save(captor.capture()); assertTrue(captor.getAllValues().get(0).isDirectWMSIntegrationEnabled()); assertFalse(wmsInfo.getMetadata().containsKey(GWCInitializer.WMS_INTEGRATION_ENABLED_KEY)); verify(geoServer).save(same(wmsInfo)); }
/** Test for GEOS-6052 */ @Test public void testVirtualTableMissingEscapeSql() throws Exception { Catalog catalog = new CatalogImpl(); CatalogFactory cFactory = catalog.getFactory(); WorkspaceInfo ws = cFactory.createWorkspace(); ws.setName("foo"); catalog.add(ws); NamespaceInfo ns = cFactory.createNamespace(); ns.setPrefix("acme"); ns.setURI("http://acme.org"); catalog.add(ns); DataStoreInfo ds = cFactory.createDataStore(); ds.setWorkspace(ws); ds.setName("foo"); catalog.add(ds); persister.setCatalog(catalog); FeatureTypeInfo ft = persister.load( getClass() .getResourceAsStream( "/org/geoserver/config/virtualtable_error.xml"), FeatureTypeInfo.class); VirtualTable vt2 = (VirtualTable) ft.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE); assertNotNull(vt2); assertEquals(1, ft.getMetadata().size()); }
@Before public void enableWCSEO() { WCSInfo wcs = getGeoServer().getService(WCSInfo.class); wcs.getMetadata().put(WCSEOMetadata.ENABLED.key, true); wcs.getMetadata().put(WCSEOMetadata.COUNT_DEFAULT.key, String.valueOf(20)); wcs.getSRS().clear(); wcs.getSRS().add("4326"); wcs.getSRS().add("3857"); getGeoServer().save(wcs); wcs = getGeoServer().getService(WCSInfo.class); assertTrue(wcs.getMetadata().get(WCSEOMetadata.ENABLED.key, Boolean.class)); }
/** * CHecks if the EO extension is enabled globally * * @return true if the EO extension is enabled */ public boolean isEOEnabled() { WCSInfo wcs = geoserver.getService(WCSInfo.class); Boolean enabled = wcs.getMetadata().get(WCSEOMetadata.ENABLED.key, Boolean.class); return Boolean.TRUE.equals(enabled); }
meta = catalog.getCoverageByName(request.getSourceCoverage()); if (meta == null) throw new WcsException( meta.getMetadata().get(ResourceInfo.TIME, DimensionInfo.class); if (timeDimension != null && timeDimension.isEnabled() && dimensions.hasTime()) { final List<Object> timeValues = new ArrayList<Object>(); timeValues.add(date); WCSInfo info = geoServer.getService(WCSInfo.class); int maxValues = info.getMaxRequestedDimensionValues(); if (maxValues > 0 && maxValues < timeValues.size()) { throw new ServiceException( "More than " + maxValues meta.getMetadata().get(ResourceInfo.ELEVATION, DimensionInfo.class); if (elevationDimension != null && elevationDimension.isEnabled() Object dimInfo = meta.getMetadata() .entrySet() .stream() .filter(e -> e.getKey().equalsIgnoreCase(key))
@Test public void testVirtualTable() throws Exception { Catalog catalog = new CatalogImpl(); CatalogFactory cFactory = catalog.getFactory(); catalog.add(ws); catalog.add(ns); ft.setSRS("EPSG:4326"); ft.setNativeCRS(CRS.decode("EPSG:4326")); ft.getMetadata().put(FeatureTypeInfo.JDBC_VIRTUAL_TABLE, vt); catalog.add(ft); VirtualTable vt2 = (VirtualTable) ft.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE); assertNotNull(vt2); assertEquals(vt, vt2);
@Before public void setUpInternal() throws Exception { // Creatign models LayerInfo layerInfo = getCatalog().getLayerByName(getLayerId(MockData.TASMANIA_DEM)); layerModel = new Model<LayerInfo>(layerInfo); ResourceInfo resource = layerInfo.getResource(); resourceModel = new Model<CoverageInfo>((CoverageInfo) resource); // Add Element to MetadataMap MetadataMap metadata = resource.getMetadata(); if (!metadata.containsKey(NetCDFSettingsContainer.NETCDFOUT_KEY)) { metadata.put(NetCDFSettingsContainer.NETCDFOUT_KEY, new NetCDFLayerSettingsContainer()); } }