Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/8126_icat4_external_down…
Browse files Browse the repository at this point in the history
…load'

Conflicts:
	Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
refs #8126
  • Loading branch information
OwenArnold committed Oct 28, 2013
2 parents 4e818c7 + 9f47d0c commit 99bc13c
Show file tree
Hide file tree
Showing 14 changed files with 20,201 additions and 10,310 deletions.
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
*.xml hooks.MaxObjectKiB130902=2048

# Allowing gSoap generated files to be committed.
/Code/Mantid/Framework/ICat/inc/MantidICat/ICat3/GSoapGenerated/ICat3H.h hooks.MaxObjectKiB130819=2048
/Code/Mantid/Framework/ICat/src/ICat3/GSoapGenerated/ICat3C.cpp hooks.MaxObjectKiB130819=5120
/Code/Mantid/Framework/ICat/src/ICat4/GSoapGenerated/ICat4C.cpp hooks.MaxObjectKiB130819=2048
/Code/Mantid/Framework/ICat/inc/MantidICat/ICat3/GSoapGenerated/ICat3H.h hooks.MaxObjectKiB131025=2048
/Code/Mantid/Framework/ICat/src/ICat3/GSoapGenerated/ICat3C.cpp hooks.MaxObjectKiB131025=5120
/Code/Mantid/Framework/ICat/src/ICat4/GSoapGenerated/ICat4C.cpp hooks.MaxObjectKiB131025=2048
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ namespace Mantid
void exec();
/// get location of data file or download method
int doDownload( ICATPortBindingProxy & icat);
/// True if the stream is considered binary, false otherwise
bool isBinary(std::istream& stream);
/// True if the extension of the file is a datafile.
bool isDataFile(const std::string& fileName);
/// Saves the downloaded file to disc
std::string saveFiletoDisk(std::istream& rs,const std::string &fileName);
/// Saves downloaded file to local disk
Expand Down
4,672 changes: 3,086 additions & 1,586 deletions Code/Mantid/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4H.h

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3,323 changes: 1,966 additions & 1,357 deletions Code/Mantid/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4Stub.h

Large diffs are not rendered by default.

27 changes: 19 additions & 8 deletions Code/Mantid/Framework/ICat/src/CatalogDownloadDataFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ if the data archive is not accessible, it downloads the files from the data serv
#include "MantidAPI/ICatalog.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/FacilityInfo.h"
#include "MantidKernel/FileDescriptor.h"

#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPRequest.h>
Expand Down Expand Up @@ -157,13 +156,25 @@ namespace Mantid
}

/**
* Checks to see if the file to be downloaded is a datafile.
* @param stream :: input stream
* @returns True if the stream is not considered ASCII (e.g. binary), false otherwise
*/
bool CatalogDownloadDataFiles::isBinary(std::istream& stream)
* Checks to see if the file to be downloaded is a datafile.
* @param fileName :: Name of data file to download.
* @returns True if the file is a data file.
*/
bool CatalogDownloadDataFiles::isDataFile(const std::string & fileName)
{
return !FileDescriptor::isAscii(stream);
std::string extension = Poco::Path(fileName).getExtension();
std::transform(extension.begin(),extension.end(),extension.begin(),tolower);

std::cerr << "The extension of this file is: " << extension << "\n";

if (extension.compare("raw") == 0 || extension.compare("nxs") == 0)
{
return true;
}
else
{
return false;
}
}

/**
Expand Down Expand Up @@ -232,7 +243,7 @@ namespace Mantid
Poco::Path path(downloadPath, fileName);
std::string filepath = path.toString();

std::ios_base::openmode mode = isBinary(rs) ? std::ios_base::binary : std::ios_base::out;
std::ios_base::openmode mode = isDataFile(fileName) ? std::ios_base::binary : std::ios_base::out;

std::ofstream ofs(filepath.c_str(), mode);
if ( ofs.rdstate() & std::ios::failbit )
Expand Down
20,048 changes: 13,599 additions & 6,449 deletions Code/Mantid/Framework/ICat/src/ICat4/GSoapGenerated/ICat4C.cpp

Large diffs are not rendered by default.

0 comments on commit 99bc13c

Please sign in to comment.