[jbosstools-dev] Design of Runtime dectation/migration: Re: Code re-org in o.j.t.runtime

Max Rydahl Andersen max.andersen at redhat.com
Mon Oct 25 05:39:07 EDT 2010


Hey, 

Moved to jbosstools-dev where this topic is for.

>> Correct.
>> There is a problem when a plugin doesn't export its preferences correctly.
> 
> I think the problem is that you're assuming that each of these items are a workspace preference. They are not. A list of servers is not a workspace preference. A list of filesets belonging to servers (currently stored in a standalone xml file) is *NOT* a workspace preference. 

These are all things happening for JBoss AS, right ?

What does "a list of filesets belonging to servers" mean ?

> They *ARE* metadata, but designing a preference page around the idea that all important metadata is stored in workspace preferences is very very flawed.

Not *really* since they in most cases should be .. at least it makes things much more uniform.

I would like to know what other plugins store their Preferences *outside* of the preferences ?

>> WTP doesn't export server definitions when a user exports preferences. Server definitions are saved in a separate file in the workspace and there is no way to move them to a new workspace unless the user copies the servers.xml file manually. This is a bug (or a missing feature) in WTP. I have added exporting WTP server definitions within the Export/Import action to the runtime plugin.
>> 
> 
> In WTP, the runtimes are stored in workspace preferences, and the servers are not. However, I have had extreme problems trying to trace through the code. When importing servertools preferences, including the runtime objects, *NO* runtime lifecycle events are thrown. It seems simply setting a preference key does not properly work with the WTP framework. Somehow the runtimes are added, but no lifecycle events are thrown. It would *SEEM* that simply setting a preference key is not a proper way to import runtimes.

But what happens when Eclipse startsup ? at this point it i just reading preferences...we should be able to emulate/activate the same.

>> jBPM plugin doesn't export its runtime preferences correctly. There is a workaround in the runtime plugin that probably needs to be moved to the jBPM plugin.

Please open a jira!

>> [sic]
>> JBoss AS also doesn't export its preferences. https://jira.jboss.org/browse/JBIDE-7379 is a bug in JBoss AS. I suppose that this problem is similar to the problem related to the exporting WTP server definitions. Since
> You can go around saying WTP has bugs for not exporting the servers and launch configurations, or for importing runtime objects wrong, and that AS Tools has bugs for not exporting filesets and xpaths and things. I on the other hand will say that the preference page was designed with a very very flawed assumption in mind, an assumption that doesn't seem to work with *MOST* frameworks.

Rob - I'm only seeing AS having the problem right now ? Am I wrong on that ?

btw. would make perfect sense to import/export most of these settings via preferences, would it not ?

> The truth of the matter is that simply setting preference keys does not work with most APIs, it does not update core models, it does not work with lifecycle events, and it is flawed in almost every way from design to implementation. The other assumption, that most or all important metadata is stored in the preferences, is also flawed. Filesets stored in other files, xpaths stored elsewhere, launch configurations for servers, there are tons of other metadata locations and assuming that most plugins can even function at all (let alone function correctly) by just swapping out plugin preferences seems very very dangerous to me.
> 
> But this is just my opinion and what I've noticed.

I understand that AS has this problem - but that doesn't make it *most* frameworks does it ?

> I would suggest moving slowly on this and not rushing into a new extension point until we have an API panned out. And more discussion. Now that I've become more familiar with it, I do like the idea of an extension point, but that individual plugins should be the ones accurately in charge of how they export their preferences and not the runtime plugin.

That is how it is intended - if there are anything done "outside" that (i.e. jbpm bug or AS limitations) that should be ironed out.

>>>>> btw. how is this hooked up to the installers mechanism of setting up servers for new workspaces ? (i.e. the properties file that sits in product root so you don't have to manually import/export)
>>>>> 
>>>>> 
>>>> The installers mechanism uses the application.properties file that is created when installing JBDS. When the runtime plugin creates runtimes, their preferences are created automatically and can be exported/imported either using the standard Eclipse Export/Import action or using our wizard.
>>> 
>>> Yes, but the beauty of the application.properties is that it works across workspaces *without* as users having to worry about it....i know its a "hack" but its a real nice hack now that Eclipse doesn't have a good notion of "cross-workspace" configuration (beyond the manual import/export of hardcoded preferences)
>>> 
>>> Which is why I was kinda hoping we would have a ui on this page where we could add/remove to this application.properties file so it were available even without the installer.
>>> 
>> There are several issues and they are the following:
>> 
>> 1) application.properties within JBDS are placed at a fixed location: the <JBDS_HOME>/studio directory. Where to place this file in JBoss Tools? In the configuration area of the runtime plugin ?

How is it looked up today ? it's looked up relatively to "something". I assume the eclipse instance ? We could do the same in JBoss Tools...or as we do for Usage preferences, in the Eclipse Configuration instance area ?
Or simply as a file in the root of eclipse instance...

>> What if the user doesn't want to have the same runtimes in different workspaces ?

Then he doesn't put the file there or he doesn't setup the server this way.

>> Do we need to add a global preference "Import JBoss Runtimes preferences to a new workspace?"

No, since the existence of the file and elements in there makes up for that preference.

>> 2) application.properties in JBDS is created in a strictly defined time: when installing JBDS
>> It isn't changed when the user changes some runtimes.

Which is why I mentioned in the early time of the o.j.t.runtime that we should find a way to do similar things as we do in the installer from inside JBoss Tools.

>> For example: when the user starts JBDS in a new workspace (workspace A), he will have runtimes defined when installing JBDS. Let's assume the user changes some runtimes (adds new runtimes, changes the preferences of the existing runtimes ...). When staring JBDS in a new workspace (workspace B), he will have the runtimes defined when installing JBDS, not the runtimes defined in the workspace A.

Yup - that is what the installer feature does - produces a *clean* slate based on the directories setup.

>> When to create this file in JBoss Tools? After adding/changing some runtime?

That is what I wanted the preference page to handle.

Changes to the runtime/server config is not what the JBDS installer is meant to handle/automate.
 
>> Would the feature be available in JBDS?

Not sure I understand the question...why wouldn't this be available in JBDS ?

>> 3) It isn't easy to create application.properties based on the preferences in the current workspace. The application.properties file is created on the basis of some default values (JRE, the name of a runtime ...). The user can change some preferences and/or add new preferences. The application.properties file doesn't recognize all the Runtime preferences (JRE or the deploy location of a Server Runtime, for instance).

application.properties does not reference JRE's - it should simply be using the default execution environment (or possibly reference specific execution environments if need to setup for Java5 & Java6).
deploy location of server runtime - why should it care ? The creation of the server is/should be handled mostly by the AS anyway, right ? 

>> In my opinion, it would be better to use Eclipse preferences file (*.epf) than the application.properties file.

But these aren't shared automatically...
if you mean that the format of application.properties should be like an eclipse preference file..i'm find with that.

>> We could create the *.epf file in the configuration area of the runtime plugin and read it as JBDS reads application.properties when the user checks the "Import JBoss Runtimes preferences to a new workspace ?" preference.
>> Finally, yet another issue remains:
>> If the user starts JBT in two workspaces and changes runtimes independently, which preferences would we get? The preferences from the workspace in which the last change has been made?

These preferences are only used on *creation* of a new workspace - not *during* its use.

/max


More information about the jbosstools-dev mailing list