Changes between Version 1 and Version 2 of FDORfc4


Ignore:
Timestamp:
04/19/07 10:04:21 (18 years ago)
Author:
gregboone
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FDORfc4

    v1 v2  
    3434If a client installs both ArcSDE versions, ArcSDEProvider92.dll will be loaded and used. The ArcSDE 9.1 client will not be used.
    3535
    36 == Implementation Details ==
     36== Implementation Overview ==
    3737
    3838To implement the above recommendations, a design has been proposed that would result in the modification of the FDO ArcSDE build process so that it creates two separate provider libraries. Each library in turn will link against separate client SDK versions of ArcSDE 9.1 and 9.2.
     
    5050In case user has only one version of the ArcSDE client installed, the location must be specified using %SDEHOME%
    5151
    52 
     52== The Provider 'Loader Library' ==
     53
     54Here is example code on how the loader dll logic will operate.
     55
     56Windows:
     57
     58{{{
     59
     60typedef FdoIConnection* (*CreateConnectionProc)();
     61
     62#ifdef _WIN32
     63
     64#ifdef ARCSDEPROVIDER_EXPORTS
     65#define FDOSDE_API __declspec(dllexport)
     66#else
     67#define FDOSDE_API __declspec(dllimport)
     68#endif
     69
     70class ArcSDELoaderLibrary
     71{
     72private:
     73    HMODULE m_hArcSDE;
     74
     75public:
     76    ArcSDELoaderLibrary()
     77    {
     78        m_hArcSDE = NULL;
     79        try
     80        {
     81            HMODULE hmod = ::LoadLibraryW(L"sde.dll");
     82            if (hmod != NULL)
     83            {
     84                ::FreeLibrary(hmod);
     85                m_hArcSDE = ::LoadLibraryW(L"ArcSDEProvider92.dll");
     86                // in case load ArcSDEProvider92.dll fails try to load 91
     87                if (m_hArcSDE == NULL)
     88                    m_hArcSDE = ::LoadLibraryW(L"ArcSDEProvider91.dll");
     89            }
     90            else
     91                m_hArcSDE = ::LoadLibraryW(L"ArcSDEProvider91.dll");
     92        }
     93        catch(...){}
     94    }
     95    HMODULE GetLibraryHandle()
     96    {
     97        return m_hArcSDE;
     98    }
     99    ~ArcSDELoaderLibrary()
     100    {
     101        try
     102        {
     103            if (m_hArcSDE != NULL)
     104                ::FreeLibrary(m_hArcSDE);
     105        }
     106        catch(...){}
     107    }
     108};
     109
     110static ArcSDELoaderLibrary arcSDEloader;
     111// external access to connection for client services
     112extern "C" FDOSDE_API FdoIConnection* CreateConnection ()
     113{
     114    CreateConnectionProc procCreateConn;
     115    HMODULE hArc = arcSDEloader.GetLibraryHandle();
     116
     117    if (hArc != NULL)
     118    {
     119        procCreateConn = (CreateConnectionProc)::GetProcAddress (hArc, "CreateConnection");
     120        if (procCreateConn != NULL)
     121            return procCreateConn();
     122    }
     123    return NULL;
     124}
     125
     126
     127}}}
     128
     129Linux:
     130
     131{{{
     132
     133class ArcSDELoaderLibrary
     134{
     135private:
     136    void* m_hArcSDE;
     137
     138public:
     139    ArcSDELoaderLibrary()
     140    {
     141        m_hArcSDE = NULL;
     142        try
     143        {
     144            void* hmod = dlopen("libsde.so", RTLD_NOW);
     145            if (hmod != NULL)
     146            {
     147                dlclose(hmod);
     148                m_hArcSDE = dlopen("libArcSDEProvider92.so", RTLD_NOW);
     149                // in case load libArcSDEProvider92.so fails try to load 91
     150                if (m_hArcSDE == NULL)
     151                    m_hArcSDE = dlopen("libArcSDEProvider91.so", RTLD_NOW);
     152            }
     153            else
     154                m_hArcSDE = dlopen("libArcSDEProvider91.so", RTLD_NOW);
     155        }
     156        catch(...){}
     157    }
     158    void* GetLibraryHandle()
     159    {
     160        return m_hArcSDE;
     161    }
     162    ~ArcSDELoaderLibrary()
     163    {
     164        try
     165        {
     166            if (m_hArcSDE != NULL)
     167                dlclose(m_hArcSDE);
     168        }
     169        catch(...){}
     170    }
     171};
     172
     173static ArcSDELoaderLibrary arcSDEloader;
     174
     175// external access to connection for client services
     176extern "C" FDOSDE_API FdoIConnection* CreateConnection ()
     177{
     178    CreateConnectionProc procCreateConn;
     179    void* hArc = arcSDEloader.GetLibraryHandle();
     180
     181    if (hArc != NULL)
     182    {
     183        procCreateConn = (CreateConnectionProc)dlsym (hArc, "CreateConnection");
     184        if (procCreateConn != NULL)
     185            return procCreateConn();
     186    }
     187    return NULL;
     188}
     189
     190}}}
     191
     192=== Build Script Changes ===
     193
     194In order to support the above proposal, the ArcSDE build scripts must be modified.
     195
     196It is known the open source user can have ArcSDE 9.1 client, ArcSDE 9.2 client or both and the build scripts must handle this.
     197
     198If a user has both clients we must build both versions of provider, but if he has only one version we must detect at run time which one it is and build the right provider.
     199
     200The unit test can be based on ArcSDE 9.1 client or ArcSDE 9.2 client so here the user must decide which one to use.
     201In order to handle this, a new environment variable was created to specify the version used by the unit test, named SDEVER_ARCUNITTEST.
     202
     203Windows side:
     204
     205If a user has only one version of ArcSDE client he must set the environment variable SDEHOME to target the location of ArcSDE client SDK.
     206
     207If the user has both versions of ArcSDE clients he must copy/install ArcSDE 9.1 client to:
     208
     209%FDOTHIRDPARTY%\ESRI\ArcSDEClient91\Windows
     210
     211…and ArcSDE 9.2 client to
     212
     213%FDOTHIRDPARTY%\ESRI\ArcSDEClient92\Windows
     214
     215…to be able to build both versions of provider.
     216
     217Also he must set the environment variable %SDEHOME% to target the location of ArcSDE client version used in the unit test.
     218
     219The valid values for SDEVER_ARCUNITTEST will be 91 and 92.
     220
     221The ArcSDE Provider solution file, ArcSDE.sln, will be modified to include multiple configurations to allow user to build the provider depending of the ArcSDE clients installed. The configurations that will be supported are as follows:
     222
     223Debug
     224Debug91Only
     225Debug92Only
     226Release
     227Release91Only
     228Release92Only
     229
     230The following lines will be added to the Windows build scripts to detect the correct build configuration:
     231
     232{{{
     233
     234SET ARCSDEVERSIONACTIVE=9
     235
     236:start_exbuild
     237
     238if not ("%SDEVER_ARCUNITTEST%")==("") goto start_setbuild
     239if exist "%SDEHOME%\bin\sde.dll" SET SDEVER_ARCUNITTEST=92
     240if exist "%SDEHOME%\bin\sde91.dll" SET SDEVER_ARCUNITTEST=91
     241
     242:start_setbuild
     243
     244if exist "%FDOTHIRDPARTY%\ESRI\ArcSDEClient91\Windows\bin\sde91.dll" SET ARCSDEVERSIONACTIVE=%ARCSDEVERSIONACTIVE%1
     245
     246if exist "%FDOTHIRDPARTY%\ESRI\ArcSDEClient92\Windows\bin\sde.dll" SET ARCSDEVERSIONACTIVE=%ARCSDEVERSIONACTIVE%2
     247
     248if "%ARCSDEVERSIONACTIVE%"=="912" SET ARCSDEVERSIONACTIVE=%TYPEBUILDARCSDE%
     249if "%ARCSDEVERSIONACTIVE%"=="91" SET ARCSDEVERSIONACTIVE=%TYPEBUILDARCSDE%91Only
     250if "%ARCSDEVERSIONACTIVE%"=="92" SET ARCSDEVERSIONACTIVE=%TYPEBUILDARCSDE%92Only
     251
     252if "%TYPEACTIONARCSDE%"=="clean" SET MSACTIONARCSDE=Clean
     253if "%TYPEACTIONARCSDE%"=="install" goto install_files_ArcSDE
     254
     255echo %MSACTIONARCSDE% %TYPEBUILDARCSDE% ArcSDE provider dlls
     256SET FDOACTIVEBUILD=%cd%\Src\ArcSDE
     257cscript //Nologo //job:prepare preparebuilds.wsf
     258pushd Src
     259
     260msbuild ArcSDE_temp.sln /t:%MSACTIONARCSDE% /p:Configuration=%ARCSDEVERSIONACTIVE% /p:Platform="Win32" /nologo /consoleloggerparameters:NoSummary
     261
     262
     263}}}
     264
     265Linux side:
     266
     267The valid values for SDEVER_ARCUNITTEST will be 91 and empty.
     268
     269Building different versions of the provider will be done using an environment variable and an optional parameter in the configure script.
     270
     271If the user has only one version of ArcSDE client he must set the environment variable SDEHOME to target the location of ArcSDE client SDK.
     272
     273If the user has both versions of ArcSDE clients he must copy/install ArcSDE 9.1 client to
     274
     275$FDOTHIRDPARTY/ESRI/ArcSDEClient91/Linux
     276
     277… and ArcSDE 9.2 client to
     278
     279$FDOTHIRDPARTY/ESRI/ArcSDEClient92/Linux
     280
     281…to be able to build both versions of provider.
     282
     283Also, he must set the environment variable $SDEHOME to target the location of the ArcSDE client version used in the unit tests.
     284
     285=== Issues ===
     286
     287We are still working on finalizing the changes required to the Linux build scripts.