Package org.geoserver.catalog

Examples of org.geoserver.catalog.MetadataMap


                    }
                } else if(value instanceof Collection) {
                    Collection clone = cloneCollection((Collection) value);
                    property.setValue(clone);
                } else if(value instanceof MetadataMap) {
                    MetadataMap clone = cloneMetadataMap((MetadataMap) value);
                    property.setValue(clone);
                }
            }
        }
       
        // and eventually also contents of old collections, they might also be
        if(oldCollectionValues != null) {
            for (Entry<String, Object> oce : oldCollectionValues.entrySet()) {
                Object value = oce.getValue();
                if(value instanceof Collection) {
                    Collection oldCollection = (Collection) value;
                    Collection clone = cloneCollection(oldCollection);
                    oce.setValue(clone);
                } else if(value instanceof MetadataMap) {
                    MetadataMap clone = cloneMetadataMap((MetadataMap) value);
                    oce.setValue(clone);
                }
            }
        }
       
View Full Code Here


       
        return this;
    }

    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;
    }
View Full Code Here

    public static final String[] _ALL_KEYS = { CONFIG_KEY_ENABLED, CONFIG_KEY_GUTTER,
            CONFIG_KEY_GRIDSETS, CONFIG_KEY_METATILING_X, CONFIG_KEY_METATILING_Y,
            CONFIG_KEY_FORMATS, CONFIG_KEY_AUTO_CACHE_STYLES, CONFIG_KEY_CACHED_STYLES };

    public static GeoServerTileLayerInfoImpl load(final LayerInfo layer) {
        MetadataMap metadataMap = layer.getMetadata();

        if (!hasTileLayerDef(metadataMap)) {
            return null;
        }
        GeoServerTileLayerInfoImpl tileLayerInfo = load(metadataMap);

        if (metadataMap.containsKey(CONFIG_KEY_CACHED_STYLES)) {
            final String defaultStyle = layer.getDefaultStyle() == null ? "" : layer
                    .getDefaultStyle().getName();
            String cachedStylesStr = metadataMap.get(CONFIG_KEY_CACHED_STYLES, String.class);
            Set<String> cachedStyles = unmarshalSet(cachedStylesStr);
            TileLayerInfoUtil.setCachedStyles(tileLayerInfo, defaultStyle, cachedStyles);

        }
       
View Full Code Here

    public static boolean hasTileLayerDef(MetadataMap metadataMap) {
        return metadataMap.containsKey(CONFIG_KEY_ENABLED);
    }

    public static GeoServerTileLayerInfoImpl load(final LayerGroupInfo layerGroup) {
        MetadataMap metadataMap = layerGroup.getMetadata();
        if (!hasTileLayerDef(metadataMap)) {
            return null;
        }
        GeoServerTileLayerInfoImpl tileLayerInfo = load(metadataMap);
        if (tileLayerInfo != null) {
View Full Code Here

    /**
     * Returns the max age for the specified layer
     * @return
     */
    private int getLayerMaxAge(LayerInfo li) {
        MetadataMap metadata = li.getResource().getMetadata();
        Object enabled = metadata.get(ResourceInfo.CACHING_ENABLED);
        if (enabled != null && enabled.toString().equalsIgnoreCase("true")) {
            Integer maxAge = metadata.get(ResourceInfo.CACHE_AGE_MAX, Integer.class);
            if(maxAge != null) {
                return maxAge;
            } else {
                return 0;
            }
View Full Code Here

        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 ));
    }
View Full Code Here

        FeatureTypeInfo resource = mock(FeatureTypeInfo.class);
        when(resource.getPrefixedName()).thenReturn("topp:states");

        layer = mock(LayerInfo.class);
        when(layer.getResource()).thenReturn(resource);
        MetadataMap mdm = new MetadataMap();
        when(layer.getMetadata()).thenReturn(mdm);
        resourceModel = new Model<ResourceInfo>(resource);
        layerModel = new Model<LayerInfo>(layer);
    }
View Full Code Here

        @Override
        public Object doUnmarshal(Object result, HierarchicalStreamReader reader,
                UnmarshallingContext context) {

            WMSInfoImpl service = (WMSInfoImpl) super.doUnmarshal(result, reader, context);
            MetadataMap metadata = service.getMetadata();
            // for backwards compatibility with 2.1.3+ data directories, check if the auth urls and
            // identifiers are stored in the metadata map
            if (service.getAuthorityURLs() == null && metadata != null) {
                String serialized = metadata.get("authorityURLs", String.class);
                List<AuthorityURLInfo> authorities;
                if (serialized == null) {
                    authorities = new ArrayList<AuthorityURLInfo>(1);
                } else {
                    authorities = AuthorityURLInfoInfoListConverter.fromString(serialized);
                }
                service.setAuthorityURLs(authorities);
            }
            if (service.getIdentifiers() == null && metadata != null) {
                String serialized = metadata.get("identifiers", String.class);
                List<LayerIdentifierInfo> identifiers;
                if (serialized == null) {
                    identifiers = new ArrayList<LayerIdentifierInfo>(1);
                } else {
                    identifiers = LayerIdentifierInfoListConverter.fromString(serialized);
View Full Code Here

            if (id != null) {
                OwsUtils.set(entity, "id", null);
            }
        }
        try {
            MetadataMap md = (MetadataMap) OwsUtils.get(entity, "metadata");
            if (md != null) {
                md.setId(null);
            }
        }
        catch(IllegalArgumentException e1) {}
        catch(ClassCastException e2) {}
       
View Full Code Here

        if(storeInfo == null){
            storeInfo = catalog.getStoreByName(storeName, DataStoreInfo.class);
        }
        // If the Store is present, then the associated MetadataMap is selected
        if(storeInfo != null){
            MetadataMap map = storeInfo.getMetadata();
            return map;
        }
       return null;
    }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.MetadataMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.