Package org.geoserver.catalog

Examples of org.geoserver.catalog.MetadataMap


       WorkspaceInfo wsInfo = catalog.getWorkspaceByName(workspaceName);
       // If the WorkSpace is present, then the associated MetadataMap is selected
       if(wsInfo != null){
           GeoServer gs = GeoServerExtensions.bean(GeoServer.class);
           SettingsInfo info = gs.getSettings(wsInfo);
           MetadataMap map = info != null ? info.getMetadata() : null;
           return map;
       }
       return null;
    }
View Full Code Here


    public static MetadataMap loadMapFromGlobal() {
       GeoServerInfo gsInfo = GeoServerExtensions.bean(GeoServer.class).getGlobal();
       // Global info should be always not null
       if(gsInfo != null){
           SettingsInfo info = gsInfo.getSettings();
           MetadataMap map = info != null ? info.getMetadata() : null;
           return map;
       }
       return null;
    }
View Full Code Here

        return valid;
    }
   
    private boolean checkDimensions(EoLayerGroupEntry entry) {
        LayerInfo layer = (LayerInfo) entry.getLayer();
        MetadataMap metadata = layer.getResource().getMetadata();
        DimensionInfo timeDimension = metadata.get(ResourceInfo.TIME, DimensionInfo.class);
        boolean timeAvaiable = timeDimension != null && timeDimension.isEnabled();
        if(!timeAvaiable) {
            error(new ParamResourceModel("EoLayerGroupError.invalidLayer", null, layer.getName()).getString());
            return false;
        } else if(entry.getLayerType() != EoLayerType.BAND_COVERAGE) {
            return true;
        }
       
        // ok, has time, and it's a band layer. Does it have any extra dimension that can be
        // imagined to be used as a band selector?
        DimensionInfo elevationDimension = metadata.get(ResourceInfo.ELEVATION, DimensionInfo.class);
        if(elevationDimension != null && elevationDimension.isEnabled()) {
            return true;
        }
       
        // look for custom dimensions
        for (String key : metadata.keySet()) {
            if(key != null && key.startsWith(ResourceInfo.CUSTOM_DIMENSION_PREFIX)) {
                DimensionInfo di = metadata.get(key, DimensionInfo.class);
                if(di != null && di.isEnabled()) {
                    return true;
                }
            }
        }
View Full Code Here

            OwsUtils.resolveCollections(info);
            if (info instanceof GeoServerInfo) {

                GeoServerInfoImpl global = (GeoServerInfoImpl) info;
                if (global.getMetadata() == null) {
                    global.setMetadata(new MetadataMap());
                }
                if (global.getClientProperties() == null) {
                    global.setClientProperties(new HashMap<Object, Object>());
                }
                if (global.getCoverageAccess() == null) {
View Full Code Here

        // Setting of the global configuration
        GeoServerInfo global = getGeoServer().getGlobal();
        SettingsInfoImpl info = (SettingsInfoImpl) ModificationProxy.unwrap(global.getSettings());
        // Setting of the metadata map if not present
        if (info.getMetadata() == null) {
            info.setMetadata(new MetadataMap());
        }
        // Selection of the metadata map
        MetadataMap map = info.getMetadata();
        // Insertion of the Root directory and the ecql expression
        map.put(RESTUtils.ROOT_KEY, root);
        map.put(RESTUploadECQLPathMapper.EXPRESSION_KEY, expression);
        // Save the global settings
        getGeoServer().save(global);
    }
View Full Code Here

                    CoverageInfo ci = (CoverageInfo) getResourceInfo();
                    String nativeName = ci.getNativeCoverageName();
                    Catalog catalog = app.getCatalog();
                    CatalogBuilder cb = new CatalogBuilder(catalog);
                    cb.setStore(ci.getStore());
                    MetadataMap metadata = ci.getMetadata();
                    CoverageInfo rebuilt = null;
                    if (metadata != null && metadata.containsKey(CoverageView.COVERAGE_VIEW)) {
                        GridCoverage2DReader reader = (GridCoverage2DReader) catalog.getResourcePool().getGridCoverageReader(ci, nativeName, GeoTools.getDefaultHints());
                        rebuilt = cb.buildCoverage(reader, nativeName, null);   
                    } else {
                        rebuilt = cb.buildCoverage(nativeName);
                    }
View Full Code Here

        // check if layers have time/elevation support
        boolean hasTime = false;
        boolean hasElevation = false;
        for (MapLayerInfo layer : getMap.getLayers()) {
            if (layer.getType() == MapLayerInfo.TYPE_VECTOR) {
                MetadataMap metadata = layer.getResource().getMetadata();
                DimensionInfo elevationInfo = metadata.get(ResourceInfo.ELEVATION, DimensionInfo.class);
                hasElevation |= elevationInfo != null && elevationInfo.isEnabled();
                DimensionInfo timeInfo = metadata.get(ResourceInfo.TIME, DimensionInfo.class);
                hasTime |= timeInfo != null && timeInfo.isEnabled();
            } else if (layer.getType() == MapLayerInfo.TYPE_RASTER) {
                MetadataMap metadata = layer.getResource().getMetadata();
                //
                // Adding a coverage layer
                //
                GridCoverage2DReader reader;
                try {
                    reader = (GridCoverage2DReader) layer.getCoverageReader();
                } catch (IOException e) {
                    throw new ServiceException(e);
                }
                if (reader != null) {
                    ReaderDimensionsAccessor dimensions = new ReaderDimensionsAccessor(reader);
                    DimensionInfo elevationInfo = metadata.get(ResourceInfo.ELEVATION, DimensionInfo.class);
                    hasElevation |= elevationInfo != null && elevationInfo.isEnabled() && dimensions.hasElevation();
                    DimensionInfo timeInfo = metadata.get(ResourceInfo.TIME, DimensionInfo.class);
                    hasTime |= timeInfo != null && timeInfo.isEnabled() && dimensions.hasTime();
                }
            }
        }
       
View Full Code Here

    <T> T getMetadataValue(String key, T defaultValue, Class<T> clazz) {
        if (getServiceInfo() == null) {
            return defaultValue;
        }

        MetadataMap metadata = getServiceInfo().getMetadata();

      T parsedValue =  Converters.convert(metadata.get(key), clazz);
      if (parsedValue == null)
            return defaultValue;
     
      return parsedValue;
    }
View Full Code Here

            final List<Object> elevations, final GridCoverage2DReader reader,
            boolean readGeom) throws IOException {
        // setup the scene
        final ParameterValueGroup readParametersDescriptor = reader.getFormat().getReadParameters();
        CoverageInfo coverage = mapLayerInfo.getCoverage();
        MetadataMap metadata = coverage.getMetadata();
        GeneralParameterValue[] readParameters = CoverageUtils.getParameters(
                readParametersDescriptor, coverage.getParameters(), readGeom);
        ReaderDimensionsAccessor dimensions = new ReaderDimensionsAccessor(reader);
        // pass down time
        final DimensionInfo timeInfo = metadata.get(ResourceInfo.TIME, DimensionInfo.class);
        // add the descriptors for custom dimensions
        final List<GeneralParameterDescriptor> parameterDescriptors =
                new ArrayList<GeneralParameterDescriptor>(readParametersDescriptor.getDescriptor().descriptors());
        Set<ParameterDescriptor<List>> dynamicParameters = reader.getDynamicParameters();
        parameterDescriptors.addAll(dynamicParameters);
        if (timeInfo != null && timeInfo.isEnabled()) {
            // handle "default"
            List<Object> fixedTimes = new ArrayList<Object>(times);
            for (int i = 0; i < fixedTimes.size(); i++) {
                if (fixedTimes.get(i) == null) {
                    fixedTimes.set(i, getDefaultTime(coverage));
                }
            }
            // pass down the parameters
            readParameters = CoverageUtils.mergeParameter(parameterDescriptors, readParameters,
                    fixedTimes, "TIME", "Time");
        }

        // pass down elevation
        final DimensionInfo elevationInfo = metadata.get(ResourceInfo.ELEVATION,
                DimensionInfo.class);
        if (elevationInfo != null && elevationInfo.isEnabled()) {
            // handle "default"
            List<Object> fixedElevations = new ArrayList<Object>(elevations);
            for (int i = 0; i < fixedElevations.size(); i++) {
                if (fixedElevations.get(i) == null) {
                    fixedElevations.set(i, getDefaultElevation(coverage));
                }
            }
            readParameters = CoverageUtils.mergeParameter(parameterDescriptors, readParameters,
                    fixedElevations, "ELEVATION", "Elevation");
        }

        if (layerFilter != null && readParameters != null) {
            // test for default [empty is replaced with INCLUDE filter] ]filter
            for (int i = 0; i < readParameters.length; i++) {

                GeneralParameterValue param = readParameters[i];
                GeneralParameterDescriptor pd = param.getDescriptor();

                if (pd.getName().getCode().equalsIgnoreCase("FILTER")) {
                    final ParameterValue pv = (ParameterValue) pd.createValue();
                    // if something different from the default INCLUDE filter is specified
                    if (layerFilter != Filter.INCLUDE) {
                        // override the default filter
                        pv.setValue(layerFilter);
                        readParameters[i] = pv;
                    }
                    break;
                }
            }
        }
       
        // custom dimensions

        List<String> customDomains = new ArrayList(dimensions.getCustomDomains());
        for (String domain : new ArrayList<String>(customDomains)) {
            List<String> values = request.getCustomDimension(domain);
            if (values != null) {
                readParameters = CoverageUtils.mergeParameter(parameterDescriptors, readParameters,
                        values, domain);
                customDomains.remove(domain);
            }
        }
       
        // see if we have any custom domain for which we have to set the default value
        if(!customDomains.isEmpty()) {
            for (String name : customDomains) {
                final DimensionInfo customInfo = metadata.get(ResourceInfo.CUSTOM_DIMENSION_PREFIX + name,
                        DimensionInfo.class);
                if (customInfo != null && customInfo.isEnabled()) {
                    final ArrayList<String> val = new ArrayList<String>(1);
                    val.add(getDefaultCustomDimensionValue(name, coverage, String.class));
                    readParameters = CoverageUtils.mergeParameter(
View Full Code Here

       
        public Object doUnmarshal(Object result,
                HierarchicalStreamReader reader, UnmarshallingContext context) {
            SettingsInfoImpl obj = (SettingsInfoImpl) super.doUnmarshal(result, reader, context);
            if(obj.getMetadata() == null){
                obj.setMetadata(new MetadataMap());
            }
            if(obj.getContact() == null){
                obj.setContact(new ContactInfoImpl());
            }
            if(obj.getClientProperties() == 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.