+ protected FeatureStore<SimpleFeatureType, SimpleFeature> getGeoJcrIndex() {
+ String workspaceName = session.getWorkspace().getName();
+ if (!geoJcrIndexes.containsKey(workspaceName)) {
+ SimpleFeatureType indexType = getWorkspaceGeoJcrIndexType(workspaceName);
+ FeatureStore<SimpleFeatureType, SimpleFeature> geoIndex = GeoToolsUtils
+ .getFeatureStore(dataStore, indexType.getName());
+ geoJcrIndexes.put(workspaceName, geoIndex);
+ }
+ return geoJcrIndexes.get(workspaceName);
+ }
+
+ protected SimpleFeatureType getWorkspaceGeoJcrIndexType(String workspaceName) {
+ SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
+ builder.setNamespaceURI(GIS_NAMESPACE);
+ builder.setName(workspaceName + "_geojcr_index");
+
+ builder.setDefaultGeometry(JcrUtils.normalize(GIS_BBOX));
+ builder.add(JcrUtils.normalize(GIS_BBOX), Polygon.class);
+ builder.add(JcrUtils.normalize(GIS_CENTROID), Point.class);
+
+ builder.add(JcrUtils.normalize("jcr:uuid"), String.class);
+ builder.add(JcrUtils.normalize("jcr:path"), String.class);
+ builder.add(JcrUtils.normalize("jcr:primaryType"), String.class);
+ // mix:lastModified
+ builder.add(JcrUtils.normalize("jcr:lastModified"), Date.class);
+ builder.add(JcrUtils.normalize("jcr:lastModifiedBy"), String.class);
+
+ return builder.buildFeatureType();
+ }
+