admin@glassfish.java.net

Re: text man page integration with v3 commands ...

From: Byron Nevins <Byron.Nevins_at_Sun.COM>
Date: Fri, 20 Mar 2009 13:39:55 -0700

In

public class CommandRunnerImpl implements CommandRunner {


 public InputStream getManPage(String commandName, AdminCommand command) {
        // bnevins -- too bad there is no AdminCommand baseclass. We
could make it
        // do the work but, alas, there is no such thing.
        Class clazz = command.getClass();
        Package pkg = clazz.getPackage();
        String manPage = pkg.getName().replace('.', '/');
        manPage += "/" + commandName + ".1";
        ClassLoader loader = clazz.getClassLoader();
        InputStream in = loader.getResourceAsStream(manPage);
        return in;
    }



Kedar Mhaswade wrote:
> Oops, you are right. But the way we get the resources is not very
> clear to me. Do we do ClassLoader.getResourceAsStream there?
Yes (see code above)
> Is that going to work, always?
Always is a long time!
>
> -Kedar
>
>
> Byron Nevins wrote:
>> But it *is* a resource. Or am I misunderstanding??
>>
>> E.g.
>>
>> Directory of
>> C:\gf\v3\core\kernel\src\main\*resources*\com\sun\enterprise\v3\admin\commands
>>
>>
>> 03/19/2009 11:03 PM 12,013 create-jvm-options.1
>> 03/19/2009 11:03 PM 10,769 delete-jvm-options.1
>> 03/19/2009 11:03 PM 17,351 generate-jvm-report.1
>> 03/19/2009 11:03 PM 7,381 list-jvm-options.1
>> 4 File(s) 47,514 bytes
>>
>>
>>
>> Kedar Mhaswade wrote:
>>> This is a topic that keeps on coming up and I realize
>>> that we never really solved it properly.
>>>
>>> The text help page should reside along with the
>>> command implementation (per module) as a "resource",
>>> which is not the case right now.
>>>
>>> It may also be a good idea to be more agile here and get
>>> the man page from the web, such that the freshness of
>>> content is addressed. Too many times have I observed
>>> that bundled docs are just wrong or incomplete. (This is
>>> not a criticism, just observation.)
>>>
>>> I want two things:
>>> - Scheduling of this on iteam meeting (Sreeni).
>>> - A volunteer who is willing to work on this. Creative
>>> solutions are encouraged. This is NOT a negligible item.
>>>
>>> -Kedar
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>>
>>
>> --
>> Byron Nevins Work 408-276-4089, Home 650-359-1290, Cell 650-784-4123
>> - Sun Microsystems, Inc.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net For
>> additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>

-- 
Byron Nevins Work 408-276-4089, Home 650-359-1290, Cell 650-784-4123 - Sun Microsystems, Inc.