use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class MavenRepository method getPom.
public MavenPom getPom(final String groupId, final String artifactId, final String version) {
final String groupArtifactVersion = groupId + ":" + artifactId + ":" + version;
MavenPom pom = this.pomCache.get(groupArtifactVersion);
if (pom == null) {
final Resource resource = getResource(groupId, artifactId, "pom", version);
if (resource.exists()) {
final MapEx map = Xml.toMap(resource);
pom = new MavenPom(this, map);
this.pomCache.put(groupArtifactVersion, pom);
} else {
return null;
}
}
return pom;
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class RecordStoreConnection method toMapInternal.
protected MapEx toMapInternal() {
final MapEx map = newTypeMap("recordStore");
addAllToMap(map, getProperties());
final String name = getName();
map.put("name", name);
final boolean savePassword = isSavePassword();
map.put("savePassword", savePassword);
return map;
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class CsvMapIterator method parseMap.
private MapEx parseMap(final List<String> record) {
final MapEx map = new LinkedHashMapEx();
for (int i = 0; i < this.fieldNames.size() && i < record.size(); i++) {
final String fieldName = this.fieldNames.get(i);
final String value = record.get(i);
if (value != null) {
map.put(fieldName, value);
}
}
return map;
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class MapReaderRecordReader method next.
@Override
public Record next() {
if (hasNext()) {
final MapEx source = this.mapIterator.next();
final Record target = new ArrayRecord(this.recordDefinition);
for (final FieldDefinition field : this.recordDefinition.getFields()) {
final String name = field.getName();
final Object value = source.get(name);
if (value != null) {
final DataType dataType = this.recordDefinition.getFieldType(name);
final Object convertedValue;
try {
convertedValue = dataType.toObject(value);
} catch (final Throwable e) {
throw new FieldValueInvalidException(name, value, e);
}
target.setValue(name, convertedValue);
}
}
return target;
} else {
throw new NoSuchElementException();
}
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class RecordStoreConnectionRegistry method loadConnection.
@Override
protected RecordStoreConnection loadConnection(final Path connectionFile, final boolean importConnection) {
final MapEx config = Json.toMap(connectionFile);
final String name = getConnectionName(config, connectionFile, importConnection);
try {
@SuppressWarnings({ "unchecked", "rawtypes" }) final Map<String, Object> connectionProperties = Maps.get((Map) config, "connection", Collections.<String, Object>emptyMap());
if (connectionProperties.isEmpty()) {
Logs.error(this, "Record store must include a 'connection' map property: " + connectionFile);
return null;
} else {
final RecordStoreConnection connection = new RecordStoreConnection(this, connectionFile.toString(), config);
if (!importConnection) {
connection.setConnectionFile(connectionFile);
}
addConnection(name, connection);
return connection;
}
} catch (final Throwable e) {
Logs.error(this, "Error creating record store from: " + connectionFile, e);
return null;
}
}
Aggregations