Package org.geomajas.layer

Examples of org.geomajas.layer.LayerException


  protected SimpleFeature asFeature(Object possibleFeature) throws LayerException {
    if (possibleFeature instanceof SimpleFeature) {
      return (SimpleFeature) possibleFeature;
    } else {
      throw new LayerException(ExceptionCode.INVALID_FEATURE_OBJECT, possibleFeature.getClass().getName());
    }
  }
View Full Code Here


              }
            }
          }
        }
      } catch (Exception e) {
        throw new LayerException(e, ExceptionCode.INVALID_SLD, location, layer.getId());
      }
      styleMap.put(location, styles);
    }
    Style style = null;
    for (Style s : styles) {
      if (s.getName().equals(vectorLayerRasterizingInfo.getStyle().getSldStyleName())) {
        style = s;
        break;
      }
    }
    if (style == null) {
      if (styles.length > 0) {
        style = styles[0];
      } else {
        throw new LayerException(ExceptionCode.INVALID_SLD, location, layer.getId());
      }
    }
    // visit to draw/omit labels/geometries
    RasterizingStyleVisitor visitor = new RasterizingStyleVisitor(vectorLayerRasterizingInfo);
    visitor.visit(style);
View Full Code Here

  // FeatureModel implementation:

  public Attribute getAttribute(Object feature, String name) throws LayerException {
    AttributeInfo attributeInfo = attributeInfoMap.get(name);
    if (null == attributeInfo) {
      throw new LayerException(ExceptionCode.ATTRIBUTE_UNKNOWN, name, attributeInfoMap.keySet());
    }
    try {
      return converterService.toDto(asFeature(feature).getAttribute(name), attributeInfo);
    } catch (GeomajasException e) {
      throw new LayerException(e);
    }
  }
View Full Code Here

    for (Map.Entry<String, AttributeInfo> entry : attributeInfoMap.entrySet()) {
      String name = entry.getKey();
      try {
        attribs.put(name, converterService.toDto(f.getAttribute(name), entry.getValue()));
      } catch (GeomajasException e) {
        throw new LayerException(e);
      }
    }
    return attribs;
  }
View Full Code Here

          converterService);
      featureModel.setLayerInfo(layerInfo);
      featureModelUsable = true;
    } catch (IOException ioe) {
      if (MAGIC_STRING_LIBRARY_MISSING.equals(ioe.getMessage())) {
        throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION, url);
      } else {
        featureModelUsable = false;
        log.warn("The layer could not be correctly initialized: " + getId(), ioe);
      }
    }
View Full Code Here

      }
      try {
        store.addFeatures(col);
      } catch (IOException ioe) {
        featureModelUsable = false;
        throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION);
      }
      return feature;
    } else {
      log.error("Don't know how to create or update " + getFeatureSourceName() + ", class "
          + source.getClass().getName() + " does not implement FeatureStore");
      throw new LayerException(ExceptionCode.CREATE_OR_UPDATE_NOT_IMPLEMENTED, getFeatureSourceName(), source
          .getClass().getName());
    }
  }
View Full Code Here

        store.modifyFeatures(store.getSchema().getGeometryDescriptor().getName(), getFeatureModel()
            .getGeometry(feature), filter);
        log.debug("Updated feature {} in {}", featureId, getFeatureSourceName());
      } catch (IOException ioe) {
        featureModelUsable = false;
        throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION);
      }
    } else {
      log.error("Don't know how to create or update " + getFeatureSourceName() + ", class "
          + source.getClass().getName() + " does not implement FeatureStore");
      throw new LayerException(ExceptionCode.CREATE_OR_UPDATE_NOT_IMPLEMENTED, getFeatureSourceName(), source
          .getClass().getName());
    }
  }
View Full Code Here

        if (log.isDebugEnabled()) {
          log.debug("Deleted feature {} in {}", featureId, getFeatureSourceName());
        }
      } catch (IOException ioe) {
        featureModelUsable = false;
        throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION);
      }
    } else {
      log.error("Don't know how to delete from " + getFeatureSourceName() + ", class "
          + source.getClass().getName() + " does not implement FeatureStore");
      throw new LayerException(ExceptionCode.DELETE_NOT_IMPLEMENTED, getFeatureSourceName(), source.getClass()
          .getName());
    }
  }
View Full Code Here

    Filter filter = filterService.createFidFilter(new String[] {featureId});
    Iterator<?> iterator = getElements(filter, 0, 0);
    if (iterator.hasNext()) {
      return iterator.next();
    } else {
      throw new LayerException(ExceptionCode.LAYER_MODEL_FEATURE_NOT_FOUND, featureId);
    }
  }
View Full Code Here

      if (transactionManager != null) {
        transactionManager.addIterator(it);
      }
      return fc.getBounds();
    } catch (Throwable t) {
      throw new LayerException(t, ExceptionCode.UNEXPECTED_PROBLEM);
    }
  }
View Full Code Here

TOP

Related Classes of org.geomajas.layer.LayerException

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.