Bug 290221 - "Enable/Disable Weaving" option only tries to change global config.ini
Summary: "Enable/Disable Weaving" option only tries to change global config.ini
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-23 04:38 EDT by Michael Woski CLA
Modified: 2009-09-24 14:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Woski CLA 2009-09-23 04:38:55 EDT
Hi,

I have the situation where I have shared eclipse installations, which means users don't have write-access to the profile/installation. The profiles are setup for cascaded config.ini files.
The problem with weaving is that the enable/disable option in the preference page does not honour that case. It only tries to set the parameters in the global config.ini which is bound to fail. So basically weaving can't be switched from the preference page in a shared installation scenario.

thx M;chi
Comment 1 Martin Lippert CLA 2009-09-23 04:55:53 EDT
Are you talking about the "JDT Weaving" preference page?
Comment 2 Michael Woski CLA 2009-09-23 05:19:58 EDT
(In reply to comment #1)
> Are you talking about the "JDT Weaving" preference page?
yep
Comment 3 Martin Lippert CLA 2009-09-23 05:32:50 EDT
This is part of the AJDT development, I move this bug over to them.
Comment 4 Martin Lippert CLA 2009-09-23 05:34:21 EDT
Hi Andrew! As far as I remember our discussions and ideas on how to control the enabling/disabling of the weaving, I thought we moved to starting and stopping the service without modifying the config.ini. Am I wrong here?
Comment 5 Andrew Eisenberg CLA 2009-09-23 11:34:02 EDT
So, the main way of enabling/disabling weaving is through starting and stopping the equinox weaving bundle.  However, when enabling weaving, I also ensure that the weaving hook line is in the config.ini.  This is where it is failing for Michael.  I can change things such that the check is done, and if the weaving hook line does not exist and the file is read-only, a warning is displayed, rather than a failure.
Comment 6 Andrew Eisenberg CLA 2009-09-23 11:46:09 EDT
Michael,

Does the global config.ini contain the line:
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
(or something like it)?

Does your local config.ini contain it?

If this is a shared installation, then are users able to install their own plugins?
Comment 7 Andrew Eisenberg CLA 2009-09-23 12:05:09 EDT
OK.  Just made a small change to the way that weaving enablement occurs.

1. Set the weaving.aspectj bundle to autostart.
2. Check the global config.ini for the hook line
3. Add if necessary and not read-only
4. If should add, but read only issue a warning to the user, and restart anyway.

I can make further changes to check for the hook line in the local config.ini, but I'd like to first see if this works.
Comment 8 Andrew Eisenberg CLA 2009-09-23 12:05:34 EDT
And new dev build will be available in a few hours.
Comment 9 Michael Woski CLA 2009-09-23 13:01:04 EDT
(In reply to comment #6)
> Michael,
> 
> Does the global config.ini contain the line:
> osgi.framework.extensions=org.eclipse.equinox.weaving.hook
> (or something like it)?
> 
> Does your local config.ini contain it?
When I add it manually as root, yes
> If this is a shared installation, then are users able to install their own
> plugins?
No
Comment 10 Andrew Eisenberg CLA 2009-09-23 23:01:35 EDT
OK.  The build is available.  The way it is with this new build, you will receive a warning if the hook line is not in the config file, but the weaving bundle will still be activated.  Note that both are required in order for the weaving service to be enabled.

When Equinox Aspects is installed through p2, the hook line will be added to the config.ini in the proper way.  However, I don't know how you installed AJDT, so I don't know what the proper behavior in your situation should have been.
Comment 11 Michael Woski CLA 2009-09-24 04:30:35 EDT
(In reply to comment #10)
> OK.  The build is available.  The way it is with this new build, you will
> receive a warning if the hook line is not in the config file, but the weaving
> bundle will still be activated.  Note that both are required in order for the
> weaving service to be enabled.
and it works like a charm now. Thanks a lot for such a quick solution.
> When Equinox Aspects is installed through p2, the hook line will be added to
> the config.ini in the proper way.  However, I don't know how you installed
> AJDT, so I don't know what the proper behavior in your situation should have
> been.
I use the p2 Agent to install/update bundles into different profiles. That's all done as a privileged user, so the agent will have full access to the shared locations.At runtime users only have read-access to the profile locations and the bundle pool.
Comment 12 Andrew Eisenberg CLA 2009-09-24 14:08:58 EDT
Great.  So, this seems like a reasonable solution for you.  The problem was that JDT Weaving was forcing the re-write of the config.ini when it should not have.  We are now more careful not to do that.

In the future, I can consider also looking at local config.ini files to see if the hook line exists, but since the hook line will exist whenever p2 is used (and almost everyone uses p2 now), I'd consider this a very low priority.