return createContentStoreDump(session, dbKey, includeACL, false);
}
public DataSource createContentStoreDump(RemoteSession session, String dbKey, final boolean includeACL, final boolean includeSystemAreas) throws WGAServiceException {
if (!isAdminServiceEnabled()) {
throw new WGAServiceException("Administrative services are disabled");
}
if (!isAdminSession(session)) {
throw new WGAServiceException("You need an administrative login to access this service.");
}
try {
final WGDatabase db = retrieveAndOpenDB(session, dbKey);
if (db != null && db.isSessionOpen()) {
return new DataSource() {
public OutputStream getOutputStream() throws IOException {
return null;
}
public String getName() {
return "Dump '" + db.getDbReference() + "'";
}
public InputStream getInputStream() throws IOException {
try {
return _core.dumpContentStore(db, "", true, _core.getLog(), includeACL, includeSystemAreas);
}
catch (WGAPIException e) {
IOException ioe = new IOException(e.getMessage());
ioe.setStackTrace(e.getStackTrace());
throw ioe;
}
}
public String getContentType() {
return "application/zip";
}
};
} else {
throw new WGAServiceException("Unable to open database '" + dbKey + "'.");
}
}
catch (Exception e) {
throw new WGAServiceException("Import of content store dump failed for database '" + dbKey + "'.", e);
}
}