Beispiel #1
0
 public String getValue() {
   if (cum()) {
     return ((JI) cup()).getValue();
   }
   FF localFF = Ga();
   return localFF == null ? null : localFF.getProperty(getName());
 }
Beispiel #2
0
 /**
  * Tries to match the specified MIME type with the default MIME types of the supplied file
  * formats. The supplied fallback format will be returned when no matching format was found. This
  * method does exactly the same as {@link info.aduna.lang.FileFormat#matchMIMEType(String,
  * Iterable, info.aduna.lang.FileFormat)} but only considers the <strong>default</strong>
  * mimeTypes.
  *
  * @param mimeType A MIME type, e.g. "text/plain".
  * @param fileFormats The file formats to match the MIME type against.
  * @param fallback The file format to return if no matching format can be found.
  * @return A FileFormat that matches the MIME type, or the fallback format if the extension was
  *     not recognized.
  * @see info.aduna.lang.FileFormat#matchMIMEType(String, Iterable, info.aduna.lang.FileFormat)
  */
 public static <FF extends FileFormat> FF matchDefaultMIMEType(
     String mimeType, Iterable<FF> fileFormats, FF fallback) {
   // Try to match with the default MIME type
   for (FF fileFormat : fileFormats) {
     if (fileFormat.hasDefaultMIMEType(mimeType)) {
       return fileFormat;
     }
   }
   return fallback;
 }
Beispiel #3
0
 @Override
 public Collection<Property> getValue() {
   final Collection<Property> props = new ArrayList<Property>();
   props.add(FF.createAttribute(id, ATT_ID, null));
   props.add(FF.createAttribute(version, ATT_VERSION, null));
   props.add(FF.createAttribute(changeset, ATT_CHANGESET, null));
   props.add(FF.createAttribute(user, ATT_USER, null));
   props.add(FF.createAttribute(timestamp, ATT_TIMESTAMP, null));
   props.addAll(tags);
   props.addAll(members);
   return props;
 }
    /**
     * Collects features domain to be exposed as metadata
     *
     * @param filePath
     * @param aggregate
     * @param firstFeature
     * @return
     */
    private Map<String, Object> computeGroupMetadata(
        String filePath, boolean aggregate, SimpleFeature firstFeature) {
      Map<String, Object> metadataMap = null;
      List<DimensionDescriptor> dimensionDescriptors = rasterManager.getDimensionDescriptors();
      // extract metadata for the available domains
      if (dimensionDescriptors != null && !dimensionDescriptors.isEmpty()) {
        Filter filter = FF.equals(FF.property("location"), FF.literal(filePath));
        metadataMap = new HashMap<String, Object>();
        try {
          // scan dimensions
          for (DimensionDescriptor descriptor : dimensionDescriptors) {
            String attribute = descriptor.getStartAttribute();
            String name = descriptor.getName();
            Comparable max = null;
            Comparable min = null;
            if (aggregate) {
              Query query = new Query(typeName);
              query.setFilter(filter);
              query.setPropertyNames(Arrays.asList(attribute));
              // Repeat the queries to avoid using a in-Memory
              // featureCollection
              // We may consider caching the features in case
              // the collection size isn't too big

              final MaxVisitor maxVisitor = new MaxVisitor(attribute);
              granuleCatalog.computeAggregateFunction(query, maxVisitor);
              max = maxVisitor.getMax();
              MinVisitor minVisitor = new MinVisitor(attribute);
              granuleCatalog.computeAggregateFunction(query, minVisitor);
              min = minVisitor.getMin();
            } else {
              max = min = (Comparable) firstFeature.getAttribute(attribute);
            }
            addMetadaElement(name, min, max, metadataMap);
          }

          addBBOX(aggregate, filter, firstFeature, metadataMap);
        } catch (IOException e) {
          throw new RuntimeException("Exception occurred while parsing the feature domains", e);
        }
      }
      return metadataMap;
    }