]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - gis/runtime/org.argeo.gis.geotools/src/main/java/org/argeo/geotools/jcr/GeoJcrIndex.java
Improve GIS
[lgpl/argeo-commons.git] / gis / runtime / org.argeo.gis.geotools / src / main / java / org / argeo / geotools / jcr / GeoJcrIndex.java
index 75c1b81ad745b30e2e9ddc85ee3fc38393e50653..7e4f28702cf726e9ab7ee9a39b11420b9d80d7c0 100644 (file)
@@ -26,7 +26,6 @@ import org.argeo.jcr.JcrUtils;
 import org.argeo.jcr.gis.GisNames;
 import org.argeo.jcr.gis.GisTypes;
 import org.argeo.jts.jcr.JtsJcrUtils;
-import org.argeo.security.SystemExecutionService;
 import org.geotools.data.DataStore;
 import org.geotools.data.DefaultTransaction;
 import org.geotools.data.FeatureStore;
@@ -63,12 +62,16 @@ public class GeoJcrIndex implements EventListener, GisNames, GisTypes {
        // TODO: use common factory finder?
        private FilterFactory2 ff = new FilterFactoryImpl();
 
+       /** Expects to execute with system authentication */
        public void init() {
-               systemExecutionService.execute(new Runnable() {
-                       public void run() {
-                               initGeoJcrIndex();
-                       }
-               });
+               if (systemExecutionService != null)// legacy
+                       systemExecutionService.execute(new Runnable() {
+                               public void run() {
+                                       initGeoJcrIndex();
+                               }
+                       });
+               else
+                       initGeoJcrIndex();
        }
 
        protected void initGeoJcrIndex() {
@@ -201,7 +204,7 @@ public class GeoJcrIndex implements EventListener, GisNames, GisTypes {
                        if (node.isNodeType(GIS_LOCATED)) {
                                locatedNode = node;
                        } else if (node.isNodeType(GIS_INDEXED)) {
-                               locatedNode = findLocatedparent(node);
+                               locatedNode = findLocatedParent(node);
                        } else {
                                throw new ArgeoException("Unsupported node " + node);
                        }
@@ -231,12 +234,12 @@ public class GeoJcrIndex implements EventListener, GisNames, GisTypes {
                }
        }
 
-       protected Node findLocatedparent(Node child) {
+       protected Node findLocatedParent(Node child) {
                try {
                        if (child.getParent().isNodeType(GIS_LOCATED))
                                return child.getParent();
                        else
-                               return findLocatedparent(child.getParent());
+                               return findLocatedParent(child.getParent());
                } catch (Exception e) {
                        // also if child is root node
                        throw new ArgeoException("Cannot find located parent", e);
@@ -292,8 +295,7 @@ public class GeoJcrIndex implements EventListener, GisNames, GisTypes {
                this.session = session;
        }
 
-       public void setSystemExecutionService(
-                       Executor systemExecutionService) {
+       public void setSystemExecutionService(Executor systemExecutionService) {
                this.systemExecutionService = systemExecutionService;
        }