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);
}
}
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;
}
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;
}
}
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);
}
}
}
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);
}
}
Aggregations