import org.argeo.jcr.gis.GisNames;
import org.argeo.jcr.gis.GisTypes;
import org.argeo.jts.jcr.JtsJcrUtils;
import org.argeo.jcr.gis.GisNames;
import org.argeo.jcr.gis.GisTypes;
import org.argeo.jts.jcr.JtsJcrUtils;
import org.geotools.data.DataStore;
import org.geotools.data.DefaultTransaction;
import org.geotools.data.FeatureStore;
import org.geotools.data.DataStore;
import org.geotools.data.DefaultTransaction;
import org.geotools.data.FeatureStore;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.filter.FilterFactoryImpl;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.filter.FilterFactoryImpl;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.filter.FilterFactory2;
import org.opengis.filter.identity.FeatureId;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.filter.FilterFactory2;
import org.opengis.filter.identity.FeatureId;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
public class GeoJcrIndex implements EventListener, GisNames, GisTypes {
// PostGIS convention
final static String DEFAULT_GEOM_NAME = "the_geom";
public class GeoJcrIndex implements EventListener, GisNames, GisTypes {
// PostGIS convention
final static String DEFAULT_GEOM_NAME = "the_geom";
/** The key is the workspace */
private Map<String, FeatureStore<SimpleFeatureType, SimpleFeature>> geoJcrIndexes = Collections
/** The key is the workspace */
private Map<String, FeatureStore<SimpleFeatureType, SimpleFeature>> geoJcrIndexes = Collections
final Set<FeatureId> toRemove = new HashSet<FeatureId>();
// execute with system authentication so that JCR can be read
final Set<FeatureId> toRemove = new HashSet<FeatureId>();
// execute with system authentication so that JCR can be read
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setNamespaceURI(GIS_NAMESPACE);
builder.setName(workspaceName + "_geojcr_index");
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.setDefaultGeometry(JcrUtils.normalize(GIS_BBOX));
builder.add(JcrUtils.normalize(GIS_BBOX), Polygon.class);
} catch (Exception e) {
// also if child is root node
throw new ArgeoException("Cannot find located parent", e);
} catch (Exception e) {
// also if child is root node
throw new ArgeoException("Cannot find located parent", e);