Skip to content

Commit

Permalink
Set properties for a given ICATProxy. Refs #8607.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Dec 12, 2013
1 parent b370a24 commit 9cc0574
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ namespace Mantid
std::string bytesToString(int64_t &fileSize);
// Helper method that formats a given timestamp.
std::string formatDateTime(const time_t &timestamp, const std::string &format);
// Sets the soap-endpoint & SSL context for the proxy being returned.
ICat4::ICATPortBindingProxy getICATProxy();
// Sets the soap-endpoint & SSL context for the given ICAT proxy.
void setICATProxySettings(ICat4::ICATPortBindingProxy& icat);

// Reference to the logger class.
Kernel::Logger& g_log;
Expand Down
40 changes: 24 additions & 16 deletions Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ namespace Mantid
{
// Store the soap end-point in the session for use later.
ICat::Session::Instance().setSoapEndPoint(url);
// Obtain the ICAT proxy that has been securely set, including soap-endpoint.
ICat4::ICATPortBindingProxy icat = getICATProxy();
// Securely set, including soap-endpoint.
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

// Output the soap end-point in use for debugging purposes.
g_log.debug() << "The ICAT soap end-point is: " << icat.soap_endpoint << "\n";

Expand Down Expand Up @@ -87,7 +89,8 @@ namespace Mantid
*/
void ICat4Catalog::logout()
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__logout request;
ns1__logoutResponse response;
Expand Down Expand Up @@ -257,7 +260,8 @@ namespace Mantid

g_log.debug() << "ICat4Catalog::search -> Query is: { " << query << " }" << std::endl;

ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand All @@ -284,7 +288,8 @@ namespace Mantid
*/
int64_t ICat4Catalog::getNumberOfSearchResults(const CatalogSearchParam& inputs)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -326,7 +331,8 @@ namespace Mantid
*/
void ICat4Catalog::myData(Mantid::API::ITableWorkspace_sptr& outputws)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -431,7 +437,8 @@ namespace Mantid
*/
void ICat4Catalog::getDataSets(const long long& investigationId, Mantid::API::ITableWorkspace_sptr& outputws)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -499,7 +506,8 @@ namespace Mantid
*/
void ICat4Catalog::getDataFiles(const long long& investigationId, Mantid::API::ITableWorkspace_sptr& outputws)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -576,7 +584,8 @@ namespace Mantid
*/
void ICat4Catalog::listInstruments(std::vector<std::string>& instruments)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -616,7 +625,8 @@ namespace Mantid
*/
void ICat4Catalog::listInvestigationTypes(std::vector<std::string>& invstTypes)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -657,7 +667,8 @@ namespace Mantid
*/
void ICat4Catalog::getFileLocation(const long long & fileID, std::string & fileLocation)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__get request;
ns1__getResponse response;
Expand Down Expand Up @@ -810,17 +821,14 @@ namespace Mantid
}

/**
* Sets the soap-endpoint & SSL context for the proxy being returned.
* @return ICATPortBindingProxy :: The proxy with set endpoint & SSL context.
* Sets the soap-endpoint & SSL context for the given ICAT proxy.
*/
ICat4::ICATPortBindingProxy ICat4Catalog::getICATProxy()
void ICat4Catalog::setICATProxySettings(ICat4::ICATPortBindingProxy& icat)
{
ICat4::ICATPortBindingProxy icat;
// Set the soap-endpoint of the catalog we want to use.
icat.soap_endpoint = ICat::Session::Instance().getSoapEndPoint().c_str();
// Sets SSL authentication scheme
setSSLContext(icat);
return icat;
}
}
}

0 comments on commit 9cc0574

Please sign in to comment.