mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve error handling when trying to access OSDU data
Show more details when support for SSL is missing. Move connection of signal/slot away from constructor. This makes it possible to use ResInsight even if SSL is not available.
This commit is contained in:
@@ -1711,6 +1711,18 @@ RiaOsduConnector* RiaApplication::makeOsduConnector()
|
|||||||
{
|
{
|
||||||
if ( m_osduConnector ) return m_osduConnector;
|
if ( m_osduConnector ) return m_osduConnector;
|
||||||
|
|
||||||
|
if ( !QSslSocket::supportsSsl() )
|
||||||
|
{
|
||||||
|
QString errMsg = "SSL support is not available. ";
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
errMsg +=
|
||||||
|
"Make sure that the SSL libraries are available (on Windows platform, they are called 'libcrypto*.dll' and 'libssl*.dll').";
|
||||||
|
#endif
|
||||||
|
RiaLogging::errorInMessageBox( nullptr, "OSDU Service Connection", errMsg );
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
RiaPreferencesOsdu* osduPreferences = preferences()->osduPreferences();
|
RiaPreferencesOsdu* osduPreferences = preferences()->osduPreferences();
|
||||||
const QString server = osduPreferences->server();
|
const QString server = osduPreferences->server();
|
||||||
const QString dataPartitionId = osduPreferences->dataPartitionId();
|
const QString dataPartitionId = osduPreferences->dataPartitionId();
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ void RicWellPathsImportOsduFeature::onActionTriggered( bool isChecked )
|
|||||||
if ( !oilField ) return;
|
if ( !oilField ) return;
|
||||||
|
|
||||||
RiaOsduConnector* osduConnector = app->makeOsduConnector();
|
RiaOsduConnector* osduConnector = app->makeOsduConnector();
|
||||||
|
if ( !osduConnector )
|
||||||
|
{
|
||||||
|
RiaLogging::error( "Failed to create OSDU connector" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RiuWellImportWizard wellImportwizard( osduConnector, RiuMainWindow::instance() );
|
RiuWellImportWizard wellImportwizard( osduConnector, RiuMainWindow::instance() );
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ void RicImportWellLogOsduFeature::onActionTriggered( bool isChecked )
|
|||||||
if ( !oilField->wellPathCollection ) oilField->wellPathCollection = std::make_unique<RimWellPathCollection>();
|
if ( !oilField->wellPathCollection ) oilField->wellPathCollection = std::make_unique<RimWellPathCollection>();
|
||||||
|
|
||||||
auto osduConnector = app->makeOsduConnector();
|
auto osduConnector = app->makeOsduConnector();
|
||||||
|
if ( !osduConnector )
|
||||||
|
{
|
||||||
|
RiaLogging::error( "Failed to create OSDU connector" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RiuWellLogImportWizard wellLogImportWizard( osduConnector, wellPath->wellboreId(), RiuMainWindow::instance() );
|
RiuWellLogImportWizard wellLogImportWizard( osduConnector, wellPath->wellboreId(), RiuMainWindow::instance() );
|
||||||
|
|
||||||
|
|||||||
@@ -39,14 +39,6 @@
|
|||||||
RimOsduWellLogDataLoader::RimOsduWellLogDataLoader()
|
RimOsduWellLogDataLoader::RimOsduWellLogDataLoader()
|
||||||
: caf::DataLoader()
|
: caf::DataLoader()
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
|
||||||
RiaOsduConnector* osduConnector = app->makeOsduConnector();
|
|
||||||
|
|
||||||
connect( osduConnector,
|
|
||||||
SIGNAL( parquetDownloadFinished( const QByteArray&, const QString&, const QString& ) ),
|
|
||||||
this,
|
|
||||||
SLOT( parquetDownloadComplete( const QByteArray&, const QString&, const QString& ) ),
|
|
||||||
Qt::QueuedConnection );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -56,12 +48,23 @@ void RimOsduWellLogDataLoader::loadData( caf::PdmObject& pdmObject, const QStrin
|
|||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
RiaOsduConnector* osduConnector = app->makeOsduConnector();
|
RiaOsduConnector* osduConnector = app->makeOsduConnector();
|
||||||
|
if ( !osduConnector )
|
||||||
|
{
|
||||||
|
RiaLogging::error( "Failed to create OSDU connector" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: this is weird?
|
// TODO: this is weird?
|
||||||
m_dataType = dataType;
|
m_dataType = dataType;
|
||||||
|
|
||||||
if ( RimOsduWellLog* osduWellLog = dynamic_cast<RimOsduWellLog*>( &pdmObject ) )
|
if ( RimOsduWellLog* osduWellLog = dynamic_cast<RimOsduWellLog*>( &pdmObject ) )
|
||||||
{
|
{
|
||||||
|
connect( osduConnector,
|
||||||
|
SIGNAL( parquetDownloadFinished( const QByteArray&, const QString&, const QString& ) ),
|
||||||
|
this,
|
||||||
|
SLOT( parquetDownloadComplete( const QByteArray&, const QString&, const QString& ) ),
|
||||||
|
Qt::ConnectionType( Qt::QueuedConnection | Qt::UniqueConnection ) );
|
||||||
|
|
||||||
QString wellLogId = osduWellLog->wellLogId();
|
QString wellLogId = osduWellLog->wellLogId();
|
||||||
osduConnector->requestWellLogParquetDataById( wellLogId );
|
osduConnector->requestWellLogParquetDataById( wellLogId );
|
||||||
m_wellLogs[wellLogId] = osduWellLog;
|
m_wellLogs[wellLogId] = osduWellLog;
|
||||||
|
|||||||
@@ -39,14 +39,6 @@
|
|||||||
RimOsduWellPathDataLoader::RimOsduWellPathDataLoader()
|
RimOsduWellPathDataLoader::RimOsduWellPathDataLoader()
|
||||||
: caf::DataLoader()
|
: caf::DataLoader()
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
|
||||||
RiaOsduConnector* osduConnector = app->makeOsduConnector();
|
|
||||||
|
|
||||||
connect( osduConnector,
|
|
||||||
SIGNAL( parquetDownloadFinished( const QByteArray&, const QString&, const QString& ) ),
|
|
||||||
this,
|
|
||||||
SLOT( parquetDownloadComplete( const QByteArray&, const QString&, const QString& ) ),
|
|
||||||
Qt::QueuedConnection );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -56,6 +48,11 @@ void RimOsduWellPathDataLoader::loadData( caf::PdmObject& pdmObject, const QStri
|
|||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
RiaOsduConnector* osduConnector = app->makeOsduConnector();
|
RiaOsduConnector* osduConnector = app->makeOsduConnector();
|
||||||
|
if ( !osduConnector )
|
||||||
|
{
|
||||||
|
RiaLogging::error( "Failed to create OSDU connector" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: this is weird?
|
// TODO: this is weird?
|
||||||
m_dataType = dataType;
|
m_dataType = dataType;
|
||||||
@@ -63,6 +60,12 @@ void RimOsduWellPathDataLoader::loadData( caf::PdmObject& pdmObject, const QStri
|
|||||||
auto oWPath = dynamic_cast<RimOsduWellPath*>( &pdmObject );
|
auto oWPath = dynamic_cast<RimOsduWellPath*>( &pdmObject );
|
||||||
if ( oWPath )
|
if ( oWPath )
|
||||||
{
|
{
|
||||||
|
connect( osduConnector,
|
||||||
|
SIGNAL( parquetDownloadFinished( const QByteArray&, const QString&, const QString& ) ),
|
||||||
|
this,
|
||||||
|
SLOT( parquetDownloadComplete( const QByteArray&, const QString&, const QString& ) ),
|
||||||
|
Qt::ConnectionType( Qt::QueuedConnection | Qt::UniqueConnection ) );
|
||||||
|
|
||||||
QString trajectoryId = oWPath->wellboreTrajectoryId();
|
QString trajectoryId = oWPath->wellboreTrajectoryId();
|
||||||
m_wellPaths[trajectoryId] = oWPath;
|
m_wellPaths[trajectoryId] = oWPath;
|
||||||
m_taskIds[trajectoryId] = taskId;
|
m_taskIds[trajectoryId] = taskId;
|
||||||
|
|||||||
@@ -182,8 +182,10 @@ bool RimWellPathCollection::loadDataAndUpdate()
|
|||||||
|
|
||||||
if ( hasOsduData( allWellPaths() ) )
|
if ( hasOsduData( allWellPaths() ) )
|
||||||
{
|
{
|
||||||
auto osduConnector = RiaApplication::instance()->makeOsduConnector();
|
if ( auto osduConnector = RiaApplication::instance()->makeOsduConnector() )
|
||||||
osduConnector->requestTokenBlocking();
|
{
|
||||||
|
osduConnector->requestTokenBlocking();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
caf::DataLoadController* dataLoadController = caf::DataLoadController::instance();
|
caf::DataLoadController* dataLoadController = caf::DataLoadController::instance();
|
||||||
|
|||||||
Reference in New Issue
Block a user