[josm-dev] Add nodes and ways via remoteControl

Sebastian Klein bastikln at googlemail.com
Sat Aug 21 19:48:21 BST 2010


Bodo Meissner wrote:
> When I experimented with remotecontrol and wmsplugin I sometimes got NoSuchMethodException and JOSM suggested to disable the plugin, but sometimes JOSM simply hung.

No console output?

>>> I will also implement a function to request the API version of the
>>> remotecontrol plugin. So in future wmsplugin will not use
>>> remotecontrol if it is too new.
> 
> I should have implemented a getVersion method with my first change, but now it's too late.

You can use reflection to check, if the method getVersion() exists. If 
not, this counts as version 0.

> My intention is that wmsplugin will use reflection to call the getVersion method. This will avoid any ClassNotFoundException when remotecontrol is not installed. Of course wmsplugin will call this method only if remotecontrol is loaded.
> When remotecontrol returns a compatible version, wmsplugin will register its remote request handler, otherwise it will display a message that it cannot use remotecontrol.

Let me try to summarize:
wmsplugin.WMSRemoteHandler includes (compiles against) classes from 
remotecontrol plugin, but does not ship these classes. It relies on 
remotecontrol plugin to provide them.

So each time the source code of remotecontrol.PermissionPref, 
remotecontrol.RequestHandler or 
remotecontrol.RequestHandlerErrorException changes, getVersion must 
return a new version number. This way wmsplugin can abort the 
registration and avoid an instantiation that would lead to ClassNotFound 
error.

This should be working... Anyone has a better idea?


Sebastian



More information about the josm-dev mailing list