geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo Development > How GShell works with Geronimo kernel
Date Thu, 04 Feb 2010 07:05:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=GMOxDEV&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/GMOxDEV/How+GShell+works+with+Geronimo+kernel">How
GShell works with Geronimo kernel</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~wwtvanessa">Wang
Wen Ting</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <p>GShell Commands Structure<br/>
Build-in commands like set, clean, help, quit and so on are defined in gshell-builtin project<br/>
Geronimo commands like start-server,stop-server adn deploy commands like start-module are
defined in geronimo-commands project.<br/>
Jaxws commands&nbsp; are defined in&nbsp; geronimo-jaxws-builder project.<br/>
Remote commands are defined in gshell-remote-client project.<br/>
GShell Startup progress<br/>
1 org.codehaus.plexus.ClassLoader load every jar defined in etc/gsh-classworlds.conf<br/>
2 org.apache.geronimo.gshell.plugin.CommandDiscoverer load the commands.xml in gshell-builtin.jar/META-INF/gshell<br/>
3 All the commands register in org.apache.geronimo.gshell.registry..CommandRegistry.<br/>
4 The same process for geronimo-commands and jaws-commands<br/>
5 org.apache.geronimo.gshell.layout.loader.XMLLayoutLoader load the layout.xml in etc/layout.xml<br/>
6 GShell start up DefaultLayoutManager.<br/>
7 GShell start up org.apache.geronimo.gshell.DefaultCommandLineBuilder and DefaultCommandExecutor<br/>
8 Gshell read argument from console and read history from Document and Setting/[username]/.gshell/gshell.history<br/>
9 Finish initialization and waiting
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<p><font color="#ff0000">Note:</font></p>

<p>Command.xml&nbsp;shows&nbsp;reflection&nbsp;between&nbsp;command&nbsp;id&nbsp;and&nbsp;command&nbsp;implementation</p>

<p>Layout.xml&nbsp;shows&nbsp;reflection&nbsp;between&nbsp;command&nbsp;line&nbsp;string&nbsp;and&nbsp;command&nbsp;id</p>
</div></div>GShell process command line progress<br/>
1 org.apache.geronimo.gshell.console.JLineConsole get a command line from console<br/>
2 org.apache.geronimo.gshell.DefaultCommandLineBuilder parse the command line and check if
it has a syntax error<br/>
3 org.apache.geronimo.gshell.layout.DefaultLayoutManager find corresponding command id and
give to org.apache.geronimo.gshell.DefaultCommandExecutor .<br/>
4org.apache.geronimo.gshell.DefaultCommandExecutor&nbsp; call&nbsp; A certain command
execute the doExecute() method.<br/>
5 org.apache.geronimo.gshell.clp.CommandLineProcessor process the arguements.<br/>
Define your own command<br/>
1 Define command class<br/>
In geronimo/framework/modules/geronimo-commands projects, you can define your own command
class in src folder.<br/>
Note all the command classes&nbsp; are defined in groovy.<br/>
E.g.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"><span class="code-keyword">package</span> org.apache.geronimo.commands
<span class="code-keyword">import</span> org.apache.geronimo.gshell.command.annotation.CommandComponent

/**
  * Test
  */
@CommandComponent(id='geronimo-commands:test', description=<span class="code-quote">"Test"</span>)
class TestCommand <span class="code-keyword">extends</span> ConnectCommand {
    @Option(name='-a', aliases=['--argument'], description='Arguement test')
    <span class="code-object">int</span> argu = 1;   
    <span class="code-keyword">protected</span> <span class="code-object">Object</span> doExecute() <span
class="code-keyword">throws</span> Exception {
        print <span class="code-quote">"Hello World!"</span>   
    }
}
</pre>
</div></div>
<p>Compile source codes and put the target jar file in the same directory in binary
server file.<br/>
2 Modify configuration file<br/>
Modify file layout.xml in [server dir]/etc<br/>
E.g</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">.......&amp;nbsp;

&lt;\!--&amp;nbsp;Geronimo&amp;nbsp;--&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;group&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;name&gt;geronimo&lt;/name&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;nodes&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;command&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;name&gt;stop-server&lt;/name&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;id&gt;geronimo-commands:stop-server&lt;/id&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/command&gt;

{color:#ff0000}&amp;nbsp;&lt;command&gt;{color}

{color:#ff0000}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;name&gt;test&lt;/name&gt;{color}

{color:#ff0000}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;id&gt;geronimo-commands:test&lt;/id&gt;{color}

{color:#ff0000}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/command&gt;{color}

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/nodes&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/group&gt;

.....
</pre>
</div></div>
<p>3 restart gshell<br/>
You can find test command in help list and use test to see print line.<br/>
Details in Geronimo-commands(Client)<br/>
Geronimo command part:<br/>
Jmx-<del>&gt;kenel</del>-&gt;invoke(shutdown/getAttribute)<br/>
Basically, Geronimo stop and wait for server commands connect to remote/local server via jmx
connections and get a MBeanServerConnection.Through MBeanServerConnection command get Kernel
as Mbean and call invoke() method to shutdown or getAttribute.<br/>
Deploy command part<br/>
Geronimo-deploy-tool-<del>&gt;ServerConnection</del>-&gt;GeronimoDeploymentManager<br/>
Details in geronimo-jmx-remoting(Server)<br/>
Build JMX Server progress<br/>
Key codes<br/>
in JMXConnector in geronimo-jmx-remoting project</p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/GMOxDEV/How+GShell+works+with+Geronimo+kernel">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=13271124&revisedVersion=2&originalVersion=1">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/GMOxDEV/How+GShell+works+with+Geronimo+kernel?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message