[
https://issues.apache.org/jira/browse/CAMEL-7023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13836007#comment-13836007
]
Babak Vahdat commented on CAMEL-7023:
-------------------------------------
Still another 3 concerns I have about [the newly introduced
Mojo|https://github.com/apache/camel/blob/master/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/HawtioMojo.java]
for this goal:
1) The *static* main method of {{io.hawt.app.App}} is and should be {{public}}
as otherwise people using it standalone would not be able to invoke it anyway.
So there is *no* need for the logic below to make it "accessible" (even if
{{hawtioMain.isAccessible()}} returns {{false}}, note that the method is
*static*), that is we could completely get rid of the following obsolete logic:
{code}
if (!hawtioMain.isAccessible()) {
getLog().debug("Setting accessibility to true in order to invoke main().");
hawtioMain.setAccessible(true);
}
{code}
2) The {{java.lang.Class#getMethod()}} API has the following signature (note
the varargs signature for any *potential* parameter(s)):
{code}
public Method getMethod(String name, Class<?>... parameterTypes) throws
NoSuchMethodException, SecurityException
{code}
SO that instead of:
{code}
.getMethod("main", new Class[] {String[].class});
{code}
We can simply do:
{code}
.getMethod("main", String[].class);
{code}
As under the cover the compiler already creates an object array for free.
3) Last but not least instead of the following:
{code}
hawtioMain.invoke(hawtioMain, new Object[]{args});
{code}
We should better do:
{code}
hawtioMain.invoke(null, new Object[]{args});
{code}
As the method is *static*!
Please note that my intention is *NOT* to criticize or what not but I only
believe in the passion of all of us to maintain a clean, precise and easy to
read code while riding Camel! :)
> Add hawtio goal to camel plugin
> -------------------------------
>
> Key: CAMEL-7023
> URL: https://issues.apache.org/jira/browse/CAMEL-7023
> Project: Camel
> Issue Type: New Feature
> Components: tooling
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Fix For: 2.12.3, 2.13.0
>
> Attachments: Screen Shot 2013-11-30 at 11.10.54.png,
> camel-routes.png, camel-tree.png
>
>
> This allows end users to start Camel applications and examples as they would
> do with mvn camel:run, but using mvn camel:hawtio instead, it also bootup the
> hawtio web console.
> This allows end users to use the console to see what happens, visualize the
> Camel routes, debug the routes, profile the routes, and whatnot.
--
This message was sent by Atlassian JIRA
(v6.1#6144)