Bug 220547 - [api] SimpleSystemMessage needs to specify a message id and some messages should be shared
Summary: [api] SimpleSystemMessage needs to specify a message id and some messages sho...
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.0 M6   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api
Depends on: 216252
Blocks: 226773
  Show dependency tree
 
Reported: 2008-02-27 08:56 EST by David McKnight CLA
Modified: 2008-04-11 18:30 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 David McKnight CLA 2008-02-27 08:56:15 EST
Apparently, there's an IBM guideline that messages should have message ids.  Furthermore, IBM product teams also require that message ids exist (and are the same as in previous releases) because they provide customers with a list/database of id's to help.
Comment 1 David McKnight CLA 2008-02-28 12:50:57 EST
I'm also going to use this defect to share common messages in a central location so that duplication can be avoided.
Comment 2 David McKnight CLA 2008-02-28 16:31:01 EST
marking this as api breaking since the SimpleSystemMessage constructor will now take a message id.
Comment 3 Martin Oberhuber CLA 2008-02-28 17:07:13 EST
But I thought that the ID is not mandatory? 
There could be messages without an ID, no?

Because then you could have two constructors (one with ID and one without), and it would not be API breaking.
Comment 4 Martin Oberhuber CLA 2008-02-28 17:08:17 EST
Remember that at places, RSE API requires extenders to use the SystemMessage interface, e.g. when throwing a SystemMessageException. 

There are also non-IBM extenders, who don't understand message id's and don't want to be forced to add a dummy id like "9999".
Comment 5 David McKnight CLA 2008-02-28 18:45:15 EST
I've committed the changes to cvs.

The SimpleSystemMessage constructors now take as their second argument the
message id.  Message ids for the current RSE messages are as they have been in
the past (i.e "RSEG1001", etc.).  I'm using constants for these id's in most
places.  I've created CommonMessages.java, CommonMessages.properties and
ICommonMessageIds.java to store the reused items.
Comment 6 Martin Oberhuber CLA 2008-02-29 05:47:48 EST
Actually this is not a breaking API change, because SimpleSystemMessage was only introduced in 3.0M5 - we're counting a "breaking" only if it was in a released version like 2.0, we're not counting breakage against milestones.

I'd suggest that message IDs should be grouped in few interfaces only, i.e. the directly embedded Strings like "RSEF1003" in RemoteFolderNotEmptyException should probably go into IRSEServicesMessageIds.java
--> Use a common naming scheme for all interfaces that hold Message ID's, in order to make it easy for automated tooling to find out all message ID's in use such that duplication can be avoided etc

New API added with this bug:

* org.eclipse.rse.services/clientserver
   CommonMessages
   ICommonMessageIds
Comment 7 Martin Oberhuber CLA 2008-02-29 12:27:47 EST
Dave - what do you think about providing a constructor without message ID,
which would automatically provide a default/dummy id?
Comment 8 David McKnight CLA 2008-02-29 12:38:47 EST
(In reply to comment #7)
> Dave - what do you think about providing a constructor without message ID,
> which would automatically provide a default/dummy id?

The thing I'd worry about with a non-id constructor is that developers would be inclined to avoid using ids when using either common or uncommon messages.  Aside from identifying a message as unique and being able to cross reference a message id with documentation, the id is also being used as the title for SystemMessageDialog.
Comment 9 Martin Oberhuber CLA 2008-02-29 12:43:49 EST
Fair enough, but you can't force IDs on non-IBM products.
We know that we'll use IDs properly inside RSE. So why force IDs on extenders?
Comment 10 David McKnight CLA 2008-02-29 13:06:21 EST
I'd at least want to discourage developers from not using ids.  I'm not sure how to do that effectively other than via the constructor.  Would you suggest just using javadoc for this purpose?
Comment 11 Martin Oberhuber CLA 2008-02-29 13:20:37 EST
Yes Javadoc should be sufficient.

For your IBM products, you can also Trace every use of the constructor without ID, and since you have the plugin id available, you can even know the culprit.

Note that in an Open Source World, where we have no idea who extends us and in what respect, we have no chance to come up with any useful global message ID's. That's why Ecipse IStatus uses an (int) as "plug-in specific status code" and gives the plugin every freedom they want for using that status code.

What we could do is mimic Eclipse Status and update Javadoc of the SimpleSystemMessage saying that the message ID is plug-in specific. But then, that would not be true for the IBM products where the message ID is supposed to be globally unique.

In the end, that's something you'll need to discuss at IBM... I just want to avoid confusion among Open Source Extenders who would not know what format, type or range of IDs they are allowed to use for SimpleSystemMessage.
Comment 12 David McKnight CLA 2008-02-29 13:46:43 EST
(In reply to comment #11)
> Yes Javadoc should be sufficient.
> For your IBM products, you can also Trace every use of the constructor without
> ID, and since you have the plugin id available, you can even know the culprit.
> Note that in an Open Source World, where we have no idea who extends us and in
> what respect, we have no chance to come up with any useful global message ID's.
> That's why Ecipse IStatus uses an (int) as "plug-in specific status code" and
> gives the plugin every freedom they want for using that status code.
> What we could do is mimic Eclipse Status and update Javadoc of the
> SimpleSystemMessage saying that the message ID is plug-in specific. But then,
> that would not be true for the IBM products where the message ID is supposed to
> be globally unique.
> In the end, that's something you'll need to discuss at IBM... I just want to
> avoid confusion among Open Source Extenders who would not know what format,
> type or range of IDs they are allowed to use for SimpleSystemMessage.

I've added the new constructors, some javadoc and trace statements where the message id is not specified.
Comment 13 Martin Oberhuber CLA 2008-03-03 09:12:48 EST
The tracing doesn't work as currently implemented because clientserver.jar must also run stand-alone in the dstore server, without any Eclipse Tracing Infrastructure.

After thinking about this again, I guess I'd be OK with requiring a message-id in the constructors. Question is how to properly write the Javadocs, because it must be clear for non-IBM extenders that 

 1.) this message-id is something that the plugin can freely choose
 2.) Yet there must not be any namespace collision with message id's owned by
     IBM

Eclipse "IStatus" solves this by binding the message id (aka status code) to the plugin id, and make the namespace "local" to the plugin. Please think about possible solutions for this in RSE.
Comment 14 Martin Oberhuber CLA 2008-03-04 17:40:33 EST
What do you think about this approach for SimpleSystemMessage:

if (pluginID==null) {
   messageID must be a globally unique id
} else {
   messageID may be "local" relative to plugin id
}

Title of dialogs and text in logs only shows messageID if globally unique, or it shows "pluginID:messageID" if not globally unique.

That way, IBM could use globally unique message ID's with a "null" pluginID and other contributors / extenders could use their plugin-local ID's without polluting the global namespace or risking collisions.
Comment 15 David McKnight CLA 2008-04-02 17:24:37 EDT
(In reply to comment #14)
> What do you think about this approach for SimpleSystemMessage:
> if (pluginID==null) {
>    messageID must be a globally unique id
> } else {
>    messageID may be "local" relative to plugin id
> }
> Title of dialogs and text in logs only shows messageID if globally unique, or
> it shows "pluginID:messageID" if not globally unique.
> That way, IBM could use globally unique message ID's with a "null" pluginID and
> other contributors / extenders could use their plugin-local ID's without
> polluting the global namespace or risking collisions.

As discussed in committer meetings, I'm not so sure about this approach.  I find it useful to have both a pluginID as well as a global message ID.  A number of our messages are used in several plugins so that the information provided by the pluginID is helpful.  Almost all of the current RSE messages have a global id and a plugin ID right now.  If we were to change this so that you could either have a global id (without a plugin id) or a plugin Id and a relative message ID, then we would have to set all the pluginIDs that are passed in now to null.
Comment 16 Martin Oberhuber CLA 2008-04-02 17:28:22 EDT
Then we need a different kind of convention, e.g. all global message ids need to start with "RSE" whereas anything else is considered non-global. Would that work?
Comment 17 David McKnight CLA 2008-04-02 17:44:01 EDT
(In reply to comment #16)
> Then we need a different kind of convention, e.g. all global message ids need
> to start with "RSE" whereas anything else is considered non-global. Would that
> work?

I think I'd be okay with that.
Comment 18 Martin Oberhuber CLA 2008-04-02 17:51:13 EDT
Ok so I propose capturing this information in the Javadocs.
Comment 19 Martin Oberhuber CLA 2008-04-11 18:30:59 EDT
I filed bug 226773 to handle the remaining task of writing Javadoc to specify what message ID's are allowed. Since that one is now tracked separately, I'm closing this.