Bug 215820 - [api][breaking] Move SystemRegistry implementation into non-UI in order to make SystemStartHere.getSystemRegistry() work even if RSE UI has not been started
Summary: [api][breaking] Move SystemRegistry implementation into non-UI in order to ma...
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0.2   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Martin Oberhuber CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api
Depends on: 218524 218655
Blocks: 181460
  Show dependency tree
 
Reported: 2008-01-18 10:30 EST by Anna Dushistova CLA
Modified: 2008-02-12 14:57 EST (History)
1 user (show)

See Also:


Attachments
Sample plugin made from Sample View template that prints system registry value on startup (14.28 KB, application/zip)
2008-01-18 10:30 EST, Anna Dushistova CLA
no flags Details
Patch making the change (299.42 KB, patch)
2008-02-12 13:53 EST, Martin Oberhuber CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anna Dushistova CLA 2008-01-18 10:30:34 EST
Created attachment 87270 [details]
Sample plugin made from Sample View template that prints system registry value on startup

Build ID: Build ID: M20071023-1652

Steps To Reproduce:
If SystemStartHere.getSystemRegistry() is called when RSEUIPlugin has not been started, then it returns null since the only place where registry is initialized is start() method of RSEUIPlugin.
Comment 1 Martin Oberhuber CLA 2008-01-21 08:50:17 EST
Essentially, this issue arises because in the RSE 2.x timeframe, only the ISystemRegistry APIs were split between UI and non-UI while the implementation had to be kept in the UI space due to lack of time.

In the RSE 3.x time frame, we will move the SystemRegistry implementation into non-UI as well, so by then you should be safe doing SystemStartHere.getSystemRegistry() and everything you can do from the interface you get should work safely -- without any unnecessary plugin activations.

Until these refactorings are complete, the correct way of initializing RSE in the 2.x stream is documented in bug 202040 comment 1.

Since this 
  * is only an implementation issue and not a user-visible issue,
  * there is a workaround available,
  * and the workaround is no worse than what we had in RSE 1.x

This can be considered an enhancement rather than critical bug. Admittedly, it is an API breakage and thus regression compared to RSE 1.x but this is documented by doing a major version rev up.
Comment 2 Martin Oberhuber CLA 2008-02-12 13:53:56 EST
Created attachment 89532 [details]
Patch making the change

Attached patch makes the change.

Following Breaking API and User Interface changes were required:
----------------------------------------------------------------

* Moved methods from ISystemRegistry into ISystemRegistryUI:
   public boolean getQualifiedHostNames();
   public void setQualifiedHostNames(boolean set);
   public void setShowFilterPools(boolean show);
   public void setShowNewHostPrompt(boolean show);

* ISystemRegistry.setSystemProfileActive() no longer shows a dialog warning
  about potential problems, but just logs to the error log
  -- Returning a MultiStatus from the call should be considered to give
  better access to the warnings

* SystemRegistry logfile is now in RSECorePlugin and no longer RSEUIPlugin

* Removed RSECorePlugin.setSystemRegistry(ISystemRegistry);


Following backward compatible changes were also made:
-----------------------------------------------------

* Messages from systemmessages.xml now duplicated in RSECoreMessages:
  RSEG1069, RSEG1073, RSEG1075, RSEG1081
  -- Removing these from systemmessages.xml should be considered.

* Added new public methods in RSECorePlugin:
  + static ISystemProfileManager getTheSystemProfileManager()
  + static boolean isTheSystemRegistryActive()

* Deprecated methods in RSEUIPlugin:
  - getPersistenceManager();
  - getTheSystemProfileManager();
  - isSystemRegistryActive();
  - isTheSystemRegistryActive();


Other notes:
------------
* For SystemRegistry.getRemoteObjectIdentifier() we should consider creating
  adapter factories that provide the IRemoteObjectIdentifier adapters without
  loading the UI factories -- either by having objects like RemoteFile
  implement IRemoteObjectIdentifier directly, or by providing non-UI adapter
  factories for it.
  Currently, this code only works when UI plugins are loaded, which is not 
  optimal.

* The InitRSEJob should be moved from RSEUIPlugin into RSECorePlugin in order
  to ensure proper system setup even in the non-UI case.
Comment 3 Martin Oberhuber CLA 2008-02-12 13:58:06 EST
Patch committed:
[215820] Move SystemRegistry implementation to Core
Comment 4 Martin Oberhuber CLA 2008-02-12 14:37:21 EST
(In reply to comment #2)
Here is one more breaking change:

* org.eclipse.rse.core plugin now has a dependency on org.eclipse.swt
  (in its MANIFEST.MF)
  - This is not really a breaking change since org.eclipse.rse.core wouldn't 
    have been of much use without SWT anyways. The denpendency is due to 
    requeiring Display.asyncExec() for event notifications in 
       SystemRegistry
       SystemPostableEventNotifier
    we should consider alternative ways for event notifications in a plain
    UI-less environment.