Guillaume,
I think it makes sense to upgrade to the latest GShell now. Right now,
there aren't that many people using ServiceMix so the impact from the
syntax change isn't a problem yet. For new users, the command
completion feature is a big plus.
And from a development perspective, we are better off staying current
with GShell instead of having to hack GShell all the time to add
features we want.
Regards,
Gert
Guillaume Nodet schreef:
I'm currently working on upgrading ServiceMix Kernel to the latest gshell trunk.
GShell has undergone some major refactoring and now uses spring
instead of plexus for its configuration.
This means that all the crapy code from our gshell-core module goes
away, but there are a few things I'd like to discuss.
The first thing is that there is some incompatibility between the
version we use and the trunk for defining commands.
I've recreated locally OsgiCommandSupport class which does most of the
work, so mostly the code is easy to migrate:
* remove the annotation on the command
* replace the @Requirement annotation by spring @Autowired annotation
* change a few packages when they have been moved in gshell
* the return value SUCCESS / FAILED are now enums and thus need to
be changed to Result.SUCCESS / Result.FAILED
So this is quite easy.
The configuration is now really different, but much easier too.
Instead of having the following definitions for each command:
<bean id="bundle-level"
class="org.apache.geronimo.gshell.osgi.BundleLevel" />
<osgi:service ref="bundle-level"
interface="org.apache.geronimo.gshell.command.Command">
<osgi:service-properties>
<entry key="shell" value="osgi"/>
<entry key="name" value="bundle-level"/>
</osgi:service-properties>
</osgi:service>
You can now write:
<import
resource="classpath:org/apache/servicemix/kernel/gshell/core/commands.xml"
/>
<gshell:command-bundle>
<gshell:command name="osgi/bundle-level">
<gshell:action
class="org.apache.servicemix.kernel.gshell.osgi.BundleLevel" />
</gshell:command>
... other commands here ...
</gshell:command-bundle>
The second point is that gshell is natively written to organize the
commands and access them as if they were on a file system.
So instead of:
osgi install xxx
you would write:
osgi/install xxx
The nice thing is that the completion now works which helps a lot when
writing commands.
So the question is: should be try to keep the previous command syntax
and hack gshell to follow what we want, or should we just switch to
the new syntax ?
I'm currently working locally and I have not updated the branch I
created some time ago, but if someone wants to have a look at the
code, I can commit / upload it somewhere.