try {
Path resFile = new Path(descDatabase.getResFile());
FileSystem fs = resFile.getFileSystem(conf);
DataOutput outStream = fs.create(resFile);
Database database = db.getDatabase(descDatabase.getDatabaseName());
if (database != null) {
outStream.writeBytes(database.getName());
outStream.write(separator);
if (database.getDescription() != null) {
outStream.writeBytes(database.getDescription());
}
outStream.write(separator);
if (database.getLocationUri() != null) {
outStream.writeBytes(database.getLocationUri());
}
outStream.write(separator);
if (descDatabase.isExt() && database.getParametersSize() > 0) {
Map<String, String> params = database.getParameters();
outStream.writeBytes(params.toString());
}
} else {
outStream.writeBytes("No such database: " + descDatabase.getDatabaseName());