use of com.netflix.metacat.common.server.connectors.model.StorageInfo in project metacat by Netflix.
the class S3ConnectorInfoConverter method toStorageInfo.
/**
* Converts from s3 table info to storage info.
* @param table table info
* @return table info
*/
StorageInfo toStorageInfo(final Table table) {
StorageInfo result = null;
final Location location = table.getLocation();
if (location != null) {
final Map<String, String> infoParameters = Maps.newHashMap();
result = new StorageInfo();
result.setUri(location.getUri());
final Info info = location.getInfo();
if (info != null) {
result.setOwner(info.getOwner());
result.setInputFormat(info.getInputFormat());
result.setOutputFormat(info.getOutputFormat());
result.setSerializationLib(info.getSerializationLib());
if (info.getParameters() != null) {
infoParameters.putAll(info.getParameters());
}
}
result.setSerdeInfoParameters(infoParameters);
result.setParameters(Maps.newHashMap());
}
return result;
}
use of com.netflix.metacat.common.server.connectors.model.StorageInfo in project metacat by Netflix.
the class S3ConnectorInfoConverter method fromStorageInfo.
/**
* Converts from storage info to s3 location.
* @param storageInfo storage info
* @return location
*/
Location fromStorageInfo(final StorageInfo storageInfo) {
final Location result = new Location();
if (storageInfo != null) {
result.setUri(storageInfo.getUri());
final Info info = new Info();
info.setLocation(result);
info.setOwner(storageInfo.getOwner());
info.setInputFormat(storageInfo.getInputFormat());
info.setOutputFormat(storageInfo.getOutputFormat());
info.setSerializationLib(storageInfo.getSerializationLib());
final Map<String, String> parameters = Maps.newHashMap();
if (storageInfo.getParameters() != null) {
parameters.putAll(storageInfo.getParameters());
}
if (storageInfo.getSerdeInfoParameters() != null) {
parameters.putAll(storageInfo.getSerdeInfoParameters());
}
info.setParameters(parameters);
result.setInfo(info);
}
return result;
}
Aggregations