dev@glassfish.java.net

Re: location/module/package for common code ...

From: Jerome Dochez <Jerome.Dochez_at_Sun.COM>
Date: Wed, 13 Jan 2010 11:38:55 -0800

On Jan 13, 2010, at 11:32 AM, kedar wrote:

>
>
> Jerome Dochez wrote:
>> how big is that code ? your notion of reusable seems vague in your description, does it corresponds to requests made by several people or you just think it might be useful ?
>
> The latter. I think multiple places in GlassFish code might be its clients though. Also, this code is pretty small to begin with.
>
>> also is it something only useful with the GF community or it's general enough ?
>
> Can't decide at this point. But it can be general enough without any references
> to GF.
>
> The example, I am working on code available in ListCommandsCommand.java in
> admin/cli. This code accepts the file globbing pattern (that Unix shells have
> made popular [1]) and converts it into equivalent java.util.regex style regex.
> Till now, for such a functionality, there was only one client and hence it was
> a method in this class. But now, to fix another RFE [2], I need to extract this
> functionality and put it at a common place. Hence the question.
I think this is probably too small to be considered as a resuable set of utilities to ship in a standalone jar.

so common-util is the right place for GF, it should contain code useful for all possible processes.
As for the package name (which is a painful mess right now), you should re-use one of the common-util packages. If you want a new one, it needs to be consistent with groupID:moduleID so org.glassfish.common.util.<some-distinguishing-name> would be better assuming it's not already taken by another module.

>
> [1] man glob
> [2] https://glassfish.dev.java.net/issues/show_bug.cgi?id=11255
>
>> On Jan 12, 2010, at 4:11 PM, Kedar Mhaswade wrote:
>>> I need to find a place where I can place some code that I think is of
>>> common interest. What is the most appropriate place for this?
>>> Note that this is purely utility code (dare I say, it's like apache
>>> commons) and not API of any kind. My expectation is that this code
>>> will be useful to both server and other clients (e.g. asadmin, admin
>>> GUI, upgrade tool etc.)
>>>
>>> Does v3/common/common-util sound right?
>>>
>>> Does org.glassfish.util.<some-distinguishing-name> sound like
>>> the correct package name?
>>>
>>> We do have such code, but it is mostly under older package names
>>> (com.sun.*) and the new hierarchy (org.glassfish) does not have a
>>> package-info.java or package.html explaining what should go there.
>>>
>>> Thanks for suggestions.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>