Search in sources :

Example 46 with PathName

use of com.revolsys.io.PathName in project com.revolsys.open by revolsys.

the class MapGuideWebServerRecordLayer method setWebServiceLayer.

public void setWebServiceLayer(final FeatureLayer layerDescription) {
    this.webServiceLayer = layerDescription;
    if (this.webServiceLayer != null) {
        final String name = this.webServiceLayer.getName();
        setName(name);
        final UrlResource serviceUrl = this.webServiceLayer.getWebService().getServiceUrl();
        setUrl(serviceUrl);
        final PathName pathName = this.webServiceLayer.getPathName();
        setLayerPath(pathName);
    }
}
Also used : UrlResource(com.revolsys.spring.resource.UrlResource) PathName(com.revolsys.io.PathName)

Example 47 with PathName

use of com.revolsys.io.PathName in project com.revolsys.open by revolsys.

the class ArcGisRestServerRecordLayer method initializeDo.

@Override
protected boolean initializeDo() {
    FeatureLayer layerDescription = getLayerDescription();
    if (layerDescription == null) {
        final String url = getUrl();
        final PathName layerPath = getLayerPath();
        if (url == null) {
            Logs.error(this, "An ArcGIS Rest server requires a url: " + getPath());
            return false;
        }
        if (layerPath == null) {
            Logs.error(this, "An ArcGIS Rest server requires a layerPath: " + getPath());
            return false;
        }
        ArcGisRestCatalog server;
        try {
            server = ArcGisRestCatalog.newArcGisRestCatalog(url);
        } catch (final Throwable e) {
            Logs.error(this, "Unable to connect to server: " + url + " for " + getPath(), e);
            return false;
        }
        try {
            layerDescription = server.getWebServiceResource(layerPath, FeatureLayer.class);
        } catch (final IllegalArgumentException e) {
            Logs.error(this, "ArcGIS Rest service is not a layer " + getPath(), e);
            return false;
        }
        if (layerDescription == null) {
            Logs.error(this, "No ArcGIS Rest layer with name: " + layerPath + " for " + getPath());
            return false;
        } else {
            setLayerDescription(layerDescription);
        }
    }
    if (layerDescription != null) {
        final RecordDefinition recordDefinition = layerDescription.getRecordDefinition();
        if (recordDefinition != null) {
            setRecordDefinition(recordDefinition);
            setBoundingBox(layerDescription.getBoundingBox());
            initRenderer();
            return super.initializeDo();
        }
    }
    return false;
}
Also used : FeatureLayer(com.revolsys.record.io.format.esri.rest.map.FeatureLayer) ArcGisRestCatalog(com.revolsys.record.io.format.esri.rest.ArcGisRestCatalog) PathName(com.revolsys.io.PathName) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 48 with PathName

use of com.revolsys.io.PathName in project com.revolsys.open by revolsys.

the class MultiCopyRecords method newProcess.

@SuppressWarnings("unchecked")
protected Process newProcess(final Map<String, Object> processDefinition) {
    if (processDefinition == null) {
        return null;
    } else {
        final String type = MapObjectFactory.getType(processDefinition);
        if ("copyRecords".equals(type)) {
            final PathName typePath = PathName.newPathName(processDefinition.get("typePath"));
            if (Property.hasValue(typePath)) {
                final boolean hasSequence = Maps.getBool(processDefinition, "hasSequence");
                final Map<String, Boolean> orderBy = Maps.get(processDefinition, "orderBy", Collections.<String, Boolean>emptyMap());
                final CopyRecords copy = new CopyRecords(this.sourceRecordStore, typePath, orderBy, this.targetRecordStore, hasSequence);
                return copy;
            } else {
                Logs.error(this, "Parameter 'typePath' required for type='copyRecords'");
            }
        } else if ("sequential".equals(type)) {
            final List<Map<String, Object>> processList = (List<Map<String, Object>>) processDefinition.get("processes");
            if (processList == null) {
                Logs.error(this, "Parameter 'processes' required for type='sequential'");
            } else {
                final Sequential processes = new Sequential();
                newProcesses(processes, processList);
                return processes;
            }
        } else if ("parallel".equals(type)) {
            final List<Map<String, Object>> processList = (List<Map<String, Object>>) processDefinition.get("processes");
            if (processList == null) {
                Logs.error(this, "Parameter 'processes' required for type='parallel'");
            } else {
                final Parallel processes = new Parallel();
                newProcesses(processes, processList);
                return processes;
            }
        } else {
            Logs.error(this, "Parameter type=" + type + " not in 'copyRecords', 'sequential', 'copyRecords'");
        }
        return null;
    }
}
Also used : Sequential(com.revolsys.parallel.process.Sequential) List(java.util.List) PathName(com.revolsys.io.PathName) Parallel(com.revolsys.parallel.process.Parallel) CopyRecords(com.revolsys.process.CopyRecords) Map(java.util.Map)

Example 49 with PathName

use of com.revolsys.io.PathName in project com.revolsys.open by revolsys.

the class RecordStore method getRecordDefinition.

default <RD extends RecordDefinition> RD getRecordDefinition(final PathName path) {
    if (path == null) {
        return null;
    } else {
        final PathName schemaPath = path.getParent();
        final RecordStoreSchema schema = getSchema(schemaPath);
        if (schema == null) {
            return null;
        } else {
            return schema.getRecordDefinition(path);
        }
    }
}
Also used : PathName(com.revolsys.io.PathName)

Example 50 with PathName

use of com.revolsys.io.PathName in project com.revolsys.open by revolsys.

the class RecordStore method findRecordDefinition.

default RecordDefinition findRecordDefinition(final PathName typePath) {
    final PathName schemaName = typePath.getParent();
    final RecordStoreSchema schema = getSchema(schemaName);
    if (schema == null) {
        return null;
    } else {
        return schema.findRecordDefinition(typePath);
    }
}
Also used : PathName(com.revolsys.io.PathName)

Aggregations

PathName (com.revolsys.io.PathName)64 FieldDefinition (com.revolsys.record.schema.FieldDefinition)15 RecordDefinitionImpl (com.revolsys.record.schema.RecordDefinitionImpl)14 DataType (com.revolsys.datatype.DataType)13 RecordDefinition (com.revolsys.record.schema.RecordDefinition)13 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)12 RecordStoreSchema (com.revolsys.record.schema.RecordStoreSchema)11 VectorOfWString (com.revolsys.gis.esri.gdb.file.capi.swig.VectorOfWString)9 RecordStoreSchemaElement (com.revolsys.record.schema.RecordStoreSchemaElement)7 ArrayList (java.util.ArrayList)7 TreeMap (java.util.TreeMap)7 MapEx (com.revolsys.collection.map.MapEx)5 ResultSet (java.sql.ResultSet)5 Geodatabase (com.revolsys.gis.esri.gdb.file.capi.swig.Geodatabase)4 Identifier (com.revolsys.identifier.Identifier)4 JdbcConnection (com.revolsys.jdbc.JdbcConnection)4 Record (com.revolsys.record.Record)4 File (java.io.File)4 PreparedStatement (java.sql.PreparedStatement)4 Geometry (com.revolsys.geometry.model.Geometry)3