Version 3

    Here we will list of ideas that would be nice to have in JBoss Fresh

     

    • autodiscovery of executables
    • fixup code to reduce jndi/registry lookups
    • add support of @Executable
    • MC should handle executable lifecycle
    • add executables to interact with jopr/jon/RHQ
    • migrate to better ssh server library
    • add executables to manage jms queues/topics

     

     

     

     

    @Executable impl details

     

    Let's say we have an existing Stateless session bean ...

     

    @Executable("test")

    @Stateless

    public class UsersLogicImpl implements UsersLogic {

     

          public void List<User> getMostPopular(int max) {

              ...

          }

     

    }

     

     

     

    By annotating it with @Executable the command is automatically registered as an alias

     

    alias test EJB3SessionAdapterExe UsersLogicImpl

     

     

     

    Command can be invoked as:

     

    test

     

     

     

    Help is automatically generated for the command:

     

    Usage: test --mostPopular <intValue>

     

     

    To perform an invocation you then write:

     

    test --mostPopular 5

     

    Which causes EJB3SessionAdapterExe to be instanciated with parameters:

     

    "UsersLogicImpl" "--mostPopular" "5"

     

    It looksup "UsersLogicImpl", then uses reflection looking for method named "mostPopular" that takes one parameter.

     

    It finds it, and then tries to coerce "5" into an int. If successful it performs invocation equivalent to:

     

    Object result = usersLogicImpl.getMostPopular(5);

     

    But reflection style. It then writes the resulting object to stdout buffer.

     

     

     

     

    We could be extremely generic here - we can have a general purpuse executable that takes object to operate on through stdin. We can tell it to inquire about operations that can be invoked - get back generated invocation help.

     

    We can use it to perform the invocation.

     

    How you get the object is irrelevant. Shell has its own context - session state. In there you can put many things. You can perform lookup on JNDI and get back an object ...

     

    Some generic executables that can be of help:

     

    objex

      Takes a Collection from stdin buffer and writes its elements to stdout as individual objects. If a Map it calls entrySet() on it ...

     

    debean

      Takes any java bean object and converts it into a map containing property name for a key and property value as value.