hg: penrose/penrose: 1. Update Penrose demos to support JSON format module info.
David Bosschaert
david.bosschaert at gmail.com
Thu Jul 5 01:38:18 PDT 2012
On 5 July 2012 06:50, Shi Jun Zhang <zhangshj at linux.vnet.ibm.com> wrote:
> On 7/4/2012 10:04 PM, David Bosschaert wrote:
>>
>> On 4 July 2012 12:04, David Bosschaert<david.bosschaert at gmail.com> wrote:
>>>
>>> On 4 July 2012 07:36, Shi Jun Zhang<zhangshj at linux.vnet.ibm.com> wrote:
>>>>
>>>> 1. We need to add some document on how to write JSON format module info.
>>>> I
>>>> have to look into source code to learn how module-info.json structures
>>>> and
>>>> how to add modifiers.
>>>
>>> Yes, this is correct. It would be great if we had a wiki to host this
>>> information. But in the absence of that I'll create a document and
>>> will share it some other way.
>>> Currently there are 2 system tests that can be used as example:
>>> *
>>> http://hg.openjdk.java.net/penrose/jigsaw/jdk/file/507fae0a1d80/test/org/openjdk/jigsaw/hello-json.sh
>>> *
>>> http://hg.openjdk.java.net/penrose/jigsaw/jdk/file/1d2576346081/test/org/openjdk/jigsaw/hello-json-custom.sh
>>
>> I have checked some documentation in to the penrose code base in the
>> absence of a wiki. You can find it here:
>>
>> http://hg.openjdk.java.net/penrose/penrose/raw-file/9b7beb1f525b/doc/PenroseModuleInfoJSON.html
>>
>> Hope this helps, let me know if you're missing anything.
>>
>> Cheers,
>>
>> David
>>
>
> That's great. As exports and permits are just set of strings in ModuleInfo
> java object, can we simplify the representation in module-info.json?
> Such as: "exports" : [ "x.y.z" ], "permits" : [ "x", "y" ]
I actually made exports and permits JSON objects on purpose, because
that way the value becomes extensible.
In the case of exports, OSGi needs to be able to add version
information (and possibly other attributes) to the export information.
See the 'extensibility' section of [1] for an example.
WRT to permits it's more a guess. I have a hunch that 'permits' may
get more attributes in the future, that's why I turned it into an
object.
I think as a general rule its probably good to use JSON objects for
anything that not purely a value. I.e. if the key is 'name' or
'version' then you're pretty sure you have a value but in other cases
I using an object makes it possible to extend in the future without
breaking bw compatibility. By that rule it would probably be better to
rename the "class" entry into "main-class-name" as we're really
talking about just a class name here.
Cheers,
David
[1] http://hg.openjdk.java.net/penrose/penrose/raw-file/9b7beb1f525b/doc/PenroseModuleInfoJSON.html
More information about the penrose-dev
mailing list