MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0024925Community[OCCT] OCCT:Application Frameworkpublic2014-05-14 20:052016-06-23 09:30
ReporterRoman Lygin 
Assigned Toapn 
PrioritynormalSeverityintegration request 
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version[OCCT] 6.7.1 
Target Version[OCCT] 6.8.0Fixed in Version[OCCT] 6.8.0 
Summary0024925: Enabling OCAF persistence without setting environment variables
DescriptionCurrently in order to enable OCAF persistence there must be a few variables defined and resource files supplied. These includes:
- the Plugin file and the CSF_PluginDefaults variable.
- the <AppFormat> file and the CSF_<AppFormat>Defaults variable, where <AppFormat> is the value returned by Resources() method (re-)defined in the subclass of TDocStd_Application.
  
This creates inconvenience and fragility when redistributing the
OCC-based solutions: end-user applications and especially libraries.

The modifications below allow to remove this need by providing respective API. Current behavior is preserved. Moreover environment variables and external files will override API-based values.

Details are below:
1. Eliminated need in FWOSPlugin library and respective entrance in the Plugin file.
   If the entry for plugin a148e300-5740-11d1-a904-080036aaa103 is not provided the driver will be defaulted to CDF_FWOSDriver (which has been moved from FWOSDriver package). FWOSPlugin is retained but is reduced in size (moving FWOSDriver_Driver into CDF). Possible next step is to remove FWOSPlugin altogether.
2. TDocStd_Application subclasses may define Resources() method to return an empty string, and instead directly set up the myResources resource manager which is now made protected in TDocStd_Application.
3. The Plugin::Load() method can now consult Plugin::AdditionalPluginMap() if it cannot find the plugin using the Plugin file. This global map can be populated from inside user's code.
   Plugin::Load() now accepts an additional boolean parameter theVerbose to suppress errors sent to std::cout. The default value is true to preserve current behavior.
   CDF_Session::LoadDriver() specifies false when trying to load the metadata driver.
Steps To ReproduceThe test sample demonstrates how to enable XML persistence using the API-only approach.
TagsNo tags attached.
Test case numberbugs caf(015) bug24925
Attached Filescxx file icon OCCXDETestLib_OCC_excerpt.cxx (3,965 bytes) 2014-05-14 20:09

- Relationships
related to 0009457closedski Community Avoid usage of environment variables 
parent of 0025173closedbugmaster Community VS 2012: linker errors 
related to 0024895closedbugmaster Community 'PLUGINFACTORY' has C-linkage specified, but returns user-defined type 'Handle_Standard_Transient' which is incompatible with C 
related to 0025812closedabv Open CASCADE Replace dynamic loading mechanism of OCAF persistence with dynamic-link one 

-  Notes
(0029338)
Roman Lygin (developer)
2014-05-14 20:19

The fix has been pushed to git.
Integration requested for 6.8.0. The target version is set respectively.
(0029753)
szy (administrator)
2014-06-09 17:55

Reviewed.
To be tested.
(0029755)
apn (administrator)
2014-06-09 18:38

Could you please rebase CR24925 to current state of master.
(0029810)
Roman Lygin (developer)
2014-06-18 12:27

Rebased to the master of 06/17/14.
The remote branch renamed with CR24925_1.
(0029878)
kgv (developer)
2014-06-25 12:36

Dear apv,

test case bugs/caf/bug24925 using new command OCC24925 has been pushed to branch CR24925_1.
The test is based on attached file OCCXDETestLib_OCC_excerpt.cxx with following changes:
- Standard TKXml plugin is used instead of custom plugin.
- Test case corrupt CSF_PluginDefaults environment variable to prevent default Plugin file loading (containing TKXml definition).
(0029884)
mkv (tester)
2014-06-25 19:53

Dear BugMaster,

Branch CR24925_1 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 1581699154adcd080d39d451c41a093b022ab66d

Number of compiler warnings:

occt component :
Linux: 16 (16 on master)
Windows: 0 (0 on master)
MacOS: 200 (203 on master)

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
http://occt-tests/CR24925-1-master-occt/Debian60-64/bugs/caf/bug24925.html [^]
http://occt-tests/CR24925-1-master-occt/Windows-32-VC9/bugs/caf/bug24925.html [^]
bugs caf(015) bug24925: OK

Testing on Linux:
Total MEMORY difference: 348470736 / 348657500
Total CPU difference: 50404.65000000001 / 51365.58000000003

Testing on Windows:
Total MEMORY difference: 376318216 / 376769996
Total CPU difference: 43594.78125 / 38728.28125

There are no differences in images found by testdiff.
(0029885)
mkv (tester)
2014-06-25 19:54

Dear abv,
could you please review new OCC24925 draw command.
(0029975)
abv (manager)
2014-07-07 09:49

The DRAW command looks OK to me.

@Roman: I have a few general comments / questions to the issue (sorry for being late):

a) The whole approach with plugins loaded via resource files is redundant: it should be easier to link directly to required libs. The overall refactoring is planned.

b) Instead of playing with your own resource managers, why not just set environment variables expected by OCAF programmatically?
(0029992)
mkv (tester)
2014-07-08 08:53

Dear BugMaster,

Branch CR24925_1 from occt git-repository (and master from products git-repository) was rebased on current master, recompiled and retested.
SHA-1: 71108305a89b314feb6575c574d9aa1178ede439
(0029994)
Roman Lygin (developer)
2014-07-08 10:08

Hi Andrey,

Thanks for your comments.

a). Certainly, feel free to refactor the overall mechanism per your plan. The current modification is just a minor relief within the current paradigm. The plugin-based approach is flexible and has multiple advantages over direct linking, e.g. reduced list of required libraries, smaller memory footprint, etc.
For instance, for persistence-less OCAF-based applications direct linking with all persistence flavors would just be an overkill. Also without plugin-based approach enabling user-defined persistence becomes awkward to implement.
So unless I am missing something, the plugin-based architecture is rather to stay. I am open to discussion, of course.

b). The whole idea of this modification is to enable fully API based approach to overcome the need of having environment variable and resource files (although compatibility and prevailing of the current mechanism is preserved). For the library vendors (like CAD Exchanger) it is virtually impossible to reliably set environment variables - there is no control over the application vendor or end-user environment, it is impossible to even compute relative path of the resource file (e.g. Plugin) from the library the call is made from, using some temporary directory to generate temporary Plugin file is fragile, etc.

IMHO the long-term objective should be to enable all settings via API and optionally have environment variables as an extra option to redefine API-set values. For instance, the OpenMP library is a good example of this two-fold approach - the number of threads will be automatically computed upon library initialization, optionally using omp_set_num_threads() you can explicitly specify that value, the optional OMP_NUM_THREADS environment variable will redefine that.

Thus, it would be very convenient to have OCC-based libraries/applications running out of the box without a need to have any single env var set. Whatever is required must be precomputed on the fly, or set via optional API, or redefined via optional env vars.


Roman
(0030338)
git (administrator)
2014-07-22 16:18

Branch CR24925 has been deleted by inv.

SHA-1: fb9510735031a1ea8ac41409e700762951126335
(0030339)
git (administrator)
2014-07-22 16:18

Branch CR24925_1 has been deleted by inv.

SHA-1: 71108305a89b314feb6575c574d9aa1178ede439
(0033142)
Roman Lygin (developer)
2014-10-15 15:39

Verified in 6.8.0 beta.

- Related Changesets
occt: master b6c0b841
Timestamp: 2014-07-10 10:47:20
Author: Roman Lygin
Committer: apn
Details ] Diff ]
0024925: Enabling OCAF persistence without setting environment variables

Add test case bugs/caf/bug24925
Merging with current master IR-2014-07-03
mod - src/CDF/CDF.cdl Diff ] File ]
mod - src/CDF/CDF_Session.cxx Diff ] File ]
mod - src/FWOSDriver/FWOSDriver.cdl Diff ] File ]
mod - src/FWOSDriver/FWOSDriver_DriverFactory.cxx Diff ] File ]
mod - src/Plugin/Plugin.cdl Diff ] File ]
mod - src/Plugin/Plugin.cxx Diff ] File ]
mod - src/QABugs/QABugs_19.cxx Diff ] File ]
mod - src/TDocStd/TDocStd_Application.cdl Diff ] File ]
mod - src/TDocStd/TDocStd_Application.cxx Diff ] File ]
add - tests/bugs/caf/bug24925 Diff ] File ]

- Issue History
Date Modified Username Field Change
2014-05-14 20:05 Roman Lygin New Issue
2014-05-14 20:05 Roman Lygin Assigned To => szy
2014-05-14 20:09 Roman Lygin File Added: OCCXDETestLib_OCC_excerpt.cxx
2014-05-14 20:19 Roman Lygin Note Added: 0029338
2014-05-14 20:19 Roman Lygin Status new => resolved
2014-05-14 23:49 Roman Lygin Relationship added related to 0009457
2014-06-09 17:55 szy Note Added: 0029753
2014-06-09 17:55 szy Assigned To szy => mkv
2014-06-09 17:55 szy Status resolved => reviewed
2014-06-09 18:38 apn Note Added: 0029755
2014-06-09 18:39 apn Assigned To mkv => Roman Lygin
2014-06-09 18:39 apn Status reviewed => assigned
2014-06-18 12:27 Roman Lygin Note Added: 0029810
2014-06-18 12:27 Roman Lygin Assigned To Roman Lygin => apn
2014-06-18 12:27 Roman Lygin Status assigned => resolved
2014-06-18 12:31 apn Status resolved => reviewed
2014-06-18 14:00 mkv Assigned To apn => mkv
2014-06-23 11:14 mkv Assigned To mkv => apv
2014-06-25 12:36 kgv Note Added: 0029878
2014-06-25 19:53 mkv Note Added: 0029884
2014-06-25 19:54 mkv Note Added: 0029885
2014-06-25 19:55 mkv Test case number => bugs caf(015) bug24925
2014-06-25 19:55 mkv Assigned To apv => abv
2014-06-25 19:55 mkv Status reviewed => feedback
2014-07-07 09:49 abv Note Added: 0029975
2014-07-07 09:49 abv Assigned To abv => mkv
2014-07-08 08:53 mkv Note Added: 0029992
2014-07-08 08:53 mkv Assigned To mkv => bugmaster
2014-07-08 08:53 mkv Status feedback => tested
2014-07-08 10:08 Roman Lygin Note Added: 0029994
2014-07-11 14:22 apn Changeset attached => occt master b6c0b841
2014-07-11 14:22 apn Assigned To bugmaster => apn
2014-07-11 14:22 apn Status tested => verified
2014-07-11 14:22 apn Resolution open => fixed
2014-07-12 12:17 kgv Relationship added related to 0024895
2014-07-22 16:18 git Note Added: 0030338
2014-07-22 16:18 git Note Added: 0030339
2014-08-20 17:25 Pawel Relationship added parent of 0025173
2014-10-15 15:39 Roman Lygin Note Added: 0033142
2014-11-11 12:44 user533 Fixed in Version => 6.8.0
2014-11-11 12:59 user533 Status verified => closed
2016-04-25 21:59 abv Relationship added related to 0027401
2016-06-23 09:30 abv Relationship added related to 0025812


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker