[josm-dev] Add nodes and ways via remoteControl

Bodo Meissner bodo at bodo-m.de
Sat Aug 21 20:53:40 BST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 21.08.2010 20:48, schrieb Sebastian Klein:
> 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.

No need to do this. The next version of wmsplugin will register its handler only with a version of remotecontrol that has getVersion.
The problem is that I cannot change the existing wmsplugin.jar and this will not care about incompatible changes in remotecontrol.

(Maybe remotecontrol could use reflection on the RequestHandler subclass supplied at the registration call to find out the version of wmsplugin...
First: I'm not sure this will work. Maybe trying the registration will throw some exception. Second: This would get really complicated.)

> 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.

... or NoSuchMethod error.

Exactly.

I'm not sure about adding interfaces or internal changes. Will wmsplugin compiled with a certain version of remotecontrol still work when I add a public method or change some private method?


Bodo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkxwLsQACgkQnMz9fgzDSqdybgCfWBbgwQPWNJY7WPsxbs7Ql2fw
QVoAoJ/7d/1MOrlSNvWRqnrjVpyEm4+Q
=eaJ4
-----END PGP SIGNATURE-----



More information about the josm-dev mailing list