Skip to content

Commit

Permalink
Set properties for a given ICAT3Proxy. Refs #8607.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Dec 12, 2013
1 parent 9cc0574 commit 1db0923
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/ICat/inc/MantidICat/ICat3/ICat3Helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ namespace Mantid
// Defines the SSL authentication scheme.
void setSSLContext(ICat3::ICATPortBindingProxy& icat);

// Sets the soap-endpoint & SSL context for the proxy being returned.
ICat3::ICATPortBindingProxy getICATProxy();
// Sets the soap-endpoint & SSL context for the given ICAT proxy.
void setICATProxySettings(ICat3::ICATPortBindingProxy& icat);

/** This is a template method to save data to table workspace
* @param input :: pointer to input value
Expand Down
55 changes: 32 additions & 23 deletions Code/Mantid/Framework/ICat/src/ICat3/ICat3Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ namespace Mantid
*/
int CICatHelper::doSearch(ICATPortBindingProxy& icat,boost::shared_ptr<ns1__searchByAdvanced>& request,ns1__searchByAdvancedResponse& response)
{
icat = getICATProxy();
setICATProxySettings(icat);

clock_t start=clock();
int ret_advsearch=icat.searchByAdvanced(request.get(),&response);
if(ret_advsearch!=0)
Expand Down Expand Up @@ -275,7 +276,8 @@ namespace Mantid
API::ITableWorkspace_sptr& responsews_sptr)
{
//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__getInvestigationIncludes request;
//get the sessionid which is cached in session class during login
Expand Down Expand Up @@ -411,7 +413,8 @@ namespace Mantid
API::ITableWorkspace_sptr& responsews_sptr)
{
//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

// request object
ns1__getInvestigationIncludes request;
Expand Down Expand Up @@ -507,7 +510,8 @@ namespace Mantid
void CICatHelper::listInstruments(std::vector<std::string>& instruments)
{
//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__listInstruments request;
//get the sessionid which is cached in session class during login
Expand Down Expand Up @@ -558,7 +562,8 @@ namespace Mantid
void CICatHelper::listInvestigationTypes(std::vector<std::string>& investTypes)
{
//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__listInvestigationTypes request;
//get the sessionid which is cached in session class during login
Expand Down Expand Up @@ -620,7 +625,8 @@ namespace Mantid
*/
int CICatHelper::doLogout()
{
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__logout request;
ns1__logoutResponse response;
Expand All @@ -642,7 +648,8 @@ namespace Mantid
*/
void CICatHelper::doMyDataSearch(API::ITableWorkspace_sptr& ws_sptr)
{
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__getMyInvestigationsIncludes request;
ns1__getMyInvestigationsIncludesResponse response;
Expand Down Expand Up @@ -723,8 +730,8 @@ namespace Mantid
request.startIndex = offset;
request.advancedSearchDetails = buildSearchQuery(inputs);

//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

int result = icat.searchByAdvancedPagination(&request, &response);

Expand Down Expand Up @@ -843,7 +850,8 @@ namespace Mantid
*/
int64_t CICatHelper::getNumberOfSearchResults(const CatalogSearchParam& inputs)
{
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__searchByAdvanced request;
ns1__searchByAdvancedResponse response;
Expand Down Expand Up @@ -875,8 +883,8 @@ namespace Mantid
*/
bool CICatHelper::isvalidSession()
{

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

ns1__isSessionValid request;
ns1__isSessionValidResponse response;
Expand All @@ -897,8 +905,11 @@ 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.
ICATPortBindingProxy icat = getICATProxy();
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 @@ -931,8 +942,8 @@ namespace Mantid

void CICatHelper::getdownloadURL(const long long& fileId,std::string& url)
{

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

ns1__downloadDatafile request;

Expand Down Expand Up @@ -963,9 +974,9 @@ namespace Mantid

void CICatHelper::getlocationString(const long long& fileid,std::string& filelocation)
{

ICATPortBindingProxy icat = getICATProxy();

ICATPortBindingProxy icat;
setICATProxySettings(icat);
ns1__getDatafile request;

boost::shared_ptr<std::string >sessionId_sptr(new std::string);
Expand All @@ -988,18 +999,16 @@ 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.
*/
ICat3::ICATPortBindingProxy CICatHelper::getICATProxy()
void CICatHelper::setICATProxySettings(ICat3::ICATPortBindingProxy& icat)
{
ICat3::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;
}

/**
* Defines the SSL authentication scheme.
* @param icat :: ICATPortBindingProxy object.
Expand Down

0 comments on commit 1db0923

Please sign in to comment.