Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358708 - [pivot] Verify the optionality of UML2 support
Summary: [pivot] Verify the optionality of UML2 support
Status: RESOLVED FIXED
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: M5   Edit
Assignee: OCL Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-23 07:05 EDT by Ed Willink CLA
Modified: 2018-06-12 08:50 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2011-09-23 07:05:33 EDT
The UML depenedencies in OCLinEcore have been changed to optional. Check that the usage is such that only SaveAsUML fails when UML is missing. i.e SaveAsEcore which is in the same file works.
Comment 1 Ed Willink CLA 2012-04-11 15:52:04 EDT
Needs re-classing so that all UML-specific stuff is in sacrificial classes.
Comment 2 Ed Willink CLA 2014-01-23 11:35:57 EST
Not optional at all as discovered when removing the re-exports for UML2 5.0.

UMLResourcesUtil is accessed by PivotStandaloneSetup. A variety of UML constants are also accessed.

TemplateSignature has a subset parameter/owmedParameter that requires UML support; this has been eliminated.

Most of the problems are easily resolved. edw/358708 is nearly done. But

OCL.uml2pivot need moving to 'UML'
PivotStandaloneSetup.init access of UMLASREsourceFactory needs ???
Editor satrtups for UML need ???

need a little more thought than there is currently time for.

Until then clients must provide their own UML depedencies.
Comment 3 Rolf Theunissen CLA 2014-08-01 05:03:21 EDT
Changing the init method of PivotStandaloneSetup, to not only catch an exception if UMLResourceUtil is accessed but also if UMLASResourceFactory is accessed, seems to remove the dependency on UML.

For instance:

try {
  UMLASResourceFactory.INSTANCE.getClass();
  UMLResourcesUtil.init(null);
} catch (Throwable e) {} // UML is optional so may get a ClassNotFoundException
Comment 4 Ed Willink CLA 2015-01-01 10:35:08 EST
The promotion to non-'examples' for Mars isolates UML support in org.eclipse.ocl.pivot.uml that naively solves the problems, but creates new ones.

Simplistically a UMLEnvironmentFactory rather than a PivotEnvironmentFactory must be created whenever UML support is required. If the user has already populated a ResourceSet we can be 'telepathic' by analyzing the ResourceSet for UMLResources. However if all we know is that we have a Complete OCL document, we don't know about UML until after we analyze the import statements.

For standalone applications it's a user problem; user must invoke UMLOCL.newInstance() rather than OCL.newInstance(). For plugin usage such as OCL editors we must assume the worst. If the pivot.uml plugin is installed, the ASResourceFactory extension point provides a UMLASResourceFactory and so that is what we must use to create the default EnvironmentFactory.
Comment 5 Ed Willink CLA 2015-02-09 03:39:36 EST
(In reply to Ed Willink from comment #4)
> Simplistically a UMLEnvironmentFactory rather than a PivotEnvironmentFactory

The correct EnvironmentFactory is now chosen according to the ASResourceFactory registrations.

> For standalone applications it's a user problem; user must invoke
> UMLOCL.newInstance() rather than OCL.newInstance(). For plugin usage such as

UMLOCL is redundant.

User just needs to invoke UMLStandaloneSwetup.init() to install the UMLASResourceFactory  registration.

Pushed to master for M5.