You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Thiago Veronezi <th...@veronezi.org> on 2012/03/23 20:23:21 UTC

TomEE UI - server side code help

Guys,
I am still struggling to get the UI as I would like to, so I didn’t have
time to invest at the server side of the new TomEE UI. I would appreciate a
little help on that. :O)
I have to have servlets returning JSON strings. Basically I need servlets
for each of the current TomEE panels: “JNDI Namespace Browser”, “Enterprise
JavaBeans Viewer”, “Object Invoker” and “Class Viewer”.

“JNDI Namespace Browser”
This servlet receives one parameter: “path”.  For example:

   - “http://localhost:8080/tomee/ws/viewjndi?path=” would return (1).
   - “http://localhost:8080/tomee/ws/viewjndi?path=openejb” would return
   (2).


“Enterprise JavaBeans Viewer”
This servlet receives one parameter: “path”.  For example:

   - “http://localhost:8080/tomee/ws/viewbean?path=openejb/DeployerBusinessRemote”
would return “{items:[
   *<list of key-value pairs of what we should show for it… check the file
   viewejb.jsp, line 166, to see what we should show>*]}”.


“Class Viewer”
This servlet receives one parameter: “class”.  For example:

   - “http://localhost:8080/tomee/ws/viewclass?class=org.apache.openejb.assembler.DeployerEjb”
would return (3).


“Object Invoker”
This servlet has tow versions: "GET" and "POST".  For example:

   - GET - “
   http://localhost:8080/tomee/ws/beaninvoker?path=openejb/DeployerBusinessRemote”
   would return an element with the same structure as (3).
   - POST - “
   http://localhost:8080/tomee/ws/beaninvoker?path=openejb/DeployerBusinessRemote”
   with extra "post" parameters -> method name and method parameters values
   list. It would return the something like (4). If the execution of the
   method throws and exception, just let the exception reach the JS side
   (normal servlet flow). I will manage the exceptions at the client side.


// (1)*******************************************************************

{
    items: [{
        name: ‘.’,
        type: ‘class’,
        path: ‘java.lang.String’
    }, {
        name: ‘openejb’,
        type: ‘context’,
        path: ‘openejb’
    }, {
        name: ‘MEJB’,
        type: ‘bean’,
        path: ‘MEJB’
    }]
}

// (2)*******************************************************************

{
    items: [{
        name: ‘ConfigurationInfoBusinessRemote’,
        type: ‘bean’,
        path: ‘openejb / ConfigurationInfoBusinessRemote’
    }, {
        name: ‘DeployerBusinessRemote’,
        type: ‘bean’,
        path: ‘openejb / DeployerBusinessRemote’
    }]
}

// (3)*******************************************************************

{
    'items': [
        {
            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
            'methodName': 'deploy',
            'parameterTypes': ['java.lang.String'],
            'throws': ['org.apache.openejb.OpenEJBException']
        },
        {
            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
            'methodName': 'deploy',
            'parameterTypes': ['java.util.Properties'],
            'throws': ['org.apache.openejb.OpenEJBException']
        },
        {
            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
            'methodName': 'deploy',
            'parameterTypes': ['java.lang.String', 'java.util.Properties'],
            'throws': ['org.apache.openejb.OpenEJBException']
        },
        {
            'returnType': null,
            'methodName': 'undeploy',
            'parameterTypes': ['java.lang.String'],
            'throws': ['org.apache.openejb.UndeployException',
'org.apache.openejb.NoSuchApplicationException']
        }
.
.
.
    ]
}

// (4)*******************************************************************

{
    'id': 'java.lang.String@1517688671',
    'class': 'java.lang.String',
    'toString':
'proxy=org.apache.openejb.assembler.Deployer;deployment=openejb/Deployer;...'
}

******************************************************************************************

There is something already implemented, so you can use it as example of how
return json strings from regular java Map objects. Check the
"JndiServlet.java" class.

Is anyone available for a little help? :O)

[]s,
Thiago.

Re: TomEE UI - server side code help

Posted by Thiago Veronezi <th...@veronezi.org>.
Nice!!!
Tkx, Romain!


On Sun, Mar 25, 2012 at 1:18 PM, Romain Manni-Bucau
<rm...@gmail.com>wrote:

> Hi Thiago,
>
> maybe you can use this helpers:
>
> http://code.google.com/p/rmannibucau/source/browse/#hg%2Fopenejb%2Ftomee-webapp-ng%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Ftomee%2Fwebapp%2Fjsf
>
> was intially for JSF but it shouldn't be hard to make it work with any
> other view.
>
> - Romain
>
>
> 2012/3/23 Romain Manni-Bucau <rm...@gmail.com>
>
> > Ping me next week ;)
> >
> > - Romain
> >
> > Le 23 mars 2012 20:23, "Thiago Veronezi" <th...@veronezi.org> a écrit :
> >
> > Guys,
> >> I am still struggling to get the UI as I would like to, so I didn’t have
> >> time to invest at the server side of the new TomEE UI. I would
> appreciate
> >> a
> >> little help on that. :O)
> >> I have to have servlets returning JSON strings. Basically I need
> servlets
> >> for each of the current TomEE panels: “JNDI Namespace Browser”,
> >> “Enterprise
> >> JavaBeans Viewer”, “Object Invoker” and “Class Viewer”.
> >>
> >> “JNDI Namespace Browser”
> >> This servlet receives one parameter: “path”.  For example:
> >>
> >>   - “http://localhost:8080/tomee/ws/viewjndi?path=” would return (1).
> >>   - “http://localhost:8080/tomee/ws/viewjndi?path=openejb” would return
> >>   (2).
> >>
> >>
> >> “Enterprise JavaBeans Viewer”
> >> This servlet receives one parameter: “path”.  For example:
> >>
> >>   - “
> >>
> http://localhost:8080/tomee/ws/viewbean?path=openejb/DeployerBusinessRemote
> >> ”
> >> would return “{items:[
> >>   *<list of key-value pairs of what we should show for it… check the
> file
> >>   viewejb.jsp, line 166, to see what we should show>*]}”.
> >>
> >>
> >> “Class Viewer”
> >> This servlet receives one parameter: “class”.  For example:
> >>
> >>   - “
> >>
> http://localhost:8080/tomee/ws/viewclass?class=org.apache.openejb.assembler.DeployerEjb
> >> ”
> >> would return (3).
> >>
> >>
> >> “Object Invoker”
> >> This servlet has tow versions: "GET" and "POST".  For example:
> >>
> >>   - GET - “
> >>
> >>
> http://localhost:8080/tomee/ws/beaninvoker?path=openejb/DeployerBusinessRemote
> >> ”
> >>   would return an element with the same structure as (3).
> >>   - POST - “
> >>
> >>
> http://localhost:8080/tomee/ws/beaninvoker?path=openejb/DeployerBusinessRemote
> >> ”
> >>   with extra "post" parameters -> method name and method parameters
> values
> >>   list. It would return the something like (4). If the execution of the
> >>   method throws and exception, just let the exception reach the JS side
> >>   (normal servlet flow). I will manage the exceptions at the client
> side.
> >>
> >>
> >> //
> (1)*******************************************************************
> >>
> >> {
> >>    items: [{
> >>        name: ‘.’,
> >>        type: ‘class’,
> >>        path: ‘java.lang.String’
> >>    }, {
> >>        name: ‘openejb’,
> >>        type: ‘context’,
> >>        path: ‘openejb’
> >>    }, {
> >>        name: ‘MEJB’,
> >>        type: ‘bean’,
> >>        path: ‘MEJB’
> >>    }]
> >> }
> >>
> >> //
> (2)*******************************************************************
> >>
> >> {
> >>    items: [{
> >>        name: ‘ConfigurationInfoBusinessRemote’,
> >>        type: ‘bean’,
> >>        path: ‘openejb / ConfigurationInfoBusinessRemote’
> >>    }, {
> >>        name: ‘DeployerBusinessRemote’,
> >>        type: ‘bean’,
> >>        path: ‘openejb / DeployerBusinessRemote’
> >>    }]
> >> }
> >>
> >> //
> (3)*******************************************************************
> >>
> >> {
> >>    'items': [
> >>        {
> >>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
> >>            'methodName': 'deploy',
> >>            'parameterTypes': ['java.lang.String'],
> >>            'throws': ['org.apache.openejb.OpenEJBException']
> >>        },
> >>        {
> >>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
> >>            'methodName': 'deploy',
> >>            'parameterTypes': ['java.util.Properties'],
> >>            'throws': ['org.apache.openejb.OpenEJBException']
> >>        },
> >>        {
> >>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
> >>            'methodName': 'deploy',
> >>            'parameterTypes': ['java.lang.String',
> 'java.util.Properties'],
> >>            'throws': ['org.apache.openejb.OpenEJBException']
> >>        },
> >>        {
> >>            'returnType': null,
> >>            'methodName': 'undeploy',
> >>            'parameterTypes': ['java.lang.String'],
> >>            'throws': ['org.apache.openejb.UndeployException',
> >> 'org.apache.openejb.NoSuchApplicationException']
> >>        }
> >> .
> >> .
> >> .
> >>    ]
> >> }
> >>
> >> //
> (4)*******************************************************************
> >>
> >> {
> >>    'id': 'java.lang.String@1517688671',
> >>    'class': 'java.lang.String',
> >>    'toString':
> >>
> >>
> 'proxy=org.apache.openejb.assembler.Deployer;deployment=openejb/Deployer;...'
> >> }
> >>
> >>
> >>
> ******************************************************************************************
> >>
> >> There is something already implemented, so you can use it as example of
> >> how
> >> return json strings from regular java Map objects. Check the
> >> "JndiServlet.java" class.
> >>
> >> Is anyone available for a little help? :O)
> >>
> >> []s,
> >> Thiago.
> >>
> >
>

Re: TomEE UI - server side code help

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Thiago,

maybe you can use this helpers:
http://code.google.com/p/rmannibucau/source/browse/#hg%2Fopenejb%2Ftomee-webapp-ng%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Ftomee%2Fwebapp%2Fjsf

was intially for JSF but it shouldn't be hard to make it work with any
other view.

- Romain


2012/3/23 Romain Manni-Bucau <rm...@gmail.com>

> Ping me next week ;)
>
> - Romain
>
> Le 23 mars 2012 20:23, "Thiago Veronezi" <th...@veronezi.org> a écrit :
>
> Guys,
>> I am still struggling to get the UI as I would like to, so I didn’t have
>> time to invest at the server side of the new TomEE UI. I would appreciate
>> a
>> little help on that. :O)
>> I have to have servlets returning JSON strings. Basically I need servlets
>> for each of the current TomEE panels: “JNDI Namespace Browser”,
>> “Enterprise
>> JavaBeans Viewer”, “Object Invoker” and “Class Viewer”.
>>
>> “JNDI Namespace Browser”
>> This servlet receives one parameter: “path”.  For example:
>>
>>   - “http://localhost:8080/tomee/ws/viewjndi?path=” would return (1).
>>   - “http://localhost:8080/tomee/ws/viewjndi?path=openejb” would return
>>   (2).
>>
>>
>> “Enterprise JavaBeans Viewer”
>> This servlet receives one parameter: “path”.  For example:
>>
>>   - “
>> http://localhost:8080/tomee/ws/viewbean?path=openejb/DeployerBusinessRemote
>> ”
>> would return “{items:[
>>   *<list of key-value pairs of what we should show for it… check the file
>>   viewejb.jsp, line 166, to see what we should show>*]}”.
>>
>>
>> “Class Viewer”
>> This servlet receives one parameter: “class”.  For example:
>>
>>   - “
>> http://localhost:8080/tomee/ws/viewclass?class=org.apache.openejb.assembler.DeployerEjb
>> ”
>> would return (3).
>>
>>
>> “Object Invoker”
>> This servlet has tow versions: "GET" and "POST".  For example:
>>
>>   - GET - “
>>
>> http://localhost:8080/tomee/ws/beaninvoker?path=openejb/DeployerBusinessRemote
>> ”
>>   would return an element with the same structure as (3).
>>   - POST - “
>>
>> http://localhost:8080/tomee/ws/beaninvoker?path=openejb/DeployerBusinessRemote
>> ”
>>   with extra "post" parameters -> method name and method parameters values
>>   list. It would return the something like (4). If the execution of the
>>   method throws and exception, just let the exception reach the JS side
>>   (normal servlet flow). I will manage the exceptions at the client side.
>>
>>
>> // (1)*******************************************************************
>>
>> {
>>    items: [{
>>        name: ‘.’,
>>        type: ‘class’,
>>        path: ‘java.lang.String’
>>    }, {
>>        name: ‘openejb’,
>>        type: ‘context’,
>>        path: ‘openejb’
>>    }, {
>>        name: ‘MEJB’,
>>        type: ‘bean’,
>>        path: ‘MEJB’
>>    }]
>> }
>>
>> // (2)*******************************************************************
>>
>> {
>>    items: [{
>>        name: ‘ConfigurationInfoBusinessRemote’,
>>        type: ‘bean’,
>>        path: ‘openejb / ConfigurationInfoBusinessRemote’
>>    }, {
>>        name: ‘DeployerBusinessRemote’,
>>        type: ‘bean’,
>>        path: ‘openejb / DeployerBusinessRemote’
>>    }]
>> }
>>
>> // (3)*******************************************************************
>>
>> {
>>    'items': [
>>        {
>>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
>>            'methodName': 'deploy',
>>            'parameterTypes': ['java.lang.String'],
>>            'throws': ['org.apache.openejb.OpenEJBException']
>>        },
>>        {
>>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
>>            'methodName': 'deploy',
>>            'parameterTypes': ['java.util.Properties'],
>>            'throws': ['org.apache.openejb.OpenEJBException']
>>        },
>>        {
>>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
>>            'methodName': 'deploy',
>>            'parameterTypes': ['java.lang.String', 'java.util.Properties'],
>>            'throws': ['org.apache.openejb.OpenEJBException']
>>        },
>>        {
>>            'returnType': null,
>>            'methodName': 'undeploy',
>>            'parameterTypes': ['java.lang.String'],
>>            'throws': ['org.apache.openejb.UndeployException',
>> 'org.apache.openejb.NoSuchApplicationException']
>>        }
>> .
>> .
>> .
>>    ]
>> }
>>
>> // (4)*******************************************************************
>>
>> {
>>    'id': 'java.lang.String@1517688671',
>>    'class': 'java.lang.String',
>>    'toString':
>>
>> 'proxy=org.apache.openejb.assembler.Deployer;deployment=openejb/Deployer;...'
>> }
>>
>>
>> ******************************************************************************************
>>
>> There is something already implemented, so you can use it as example of
>> how
>> return json strings from regular java Map objects. Check the
>> "JndiServlet.java" class.
>>
>> Is anyone available for a little help? :O)
>>
>> []s,
>> Thiago.
>>
>

Re: TomEE UI - server side code help

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Ping me next week ;)

- Romain

Le 23 mars 2012 20:23, "Thiago Veronezi" <th...@veronezi.org> a écrit :

> Guys,
> I am still struggling to get the UI as I would like to, so I didn’t have
> time to invest at the server side of the new TomEE UI. I would appreciate a
> little help on that. :O)
> I have to have servlets returning JSON strings. Basically I need servlets
> for each of the current TomEE panels: “JNDI Namespace Browser”, “Enterprise
> JavaBeans Viewer”, “Object Invoker” and “Class Viewer”.
>
> “JNDI Namespace Browser”
> This servlet receives one parameter: “path”.  For example:
>
>   - “http://localhost:8080/tomee/ws/viewjndi?path=” would return (1).
>   - “http://localhost:8080/tomee/ws/viewjndi?path=openejb” would return
>   (2).
>
>
> “Enterprise JavaBeans Viewer”
> This servlet receives one parameter: “path”.  For example:
>
>   - “
> http://localhost:8080/tomee/ws/viewbean?path=openejb/DeployerBusinessRemote
> ”
> would return “{items:[
>   *<list of key-value pairs of what we should show for it… check the file
>   viewejb.jsp, line 166, to see what we should show>*]}”.
>
>
> “Class Viewer”
> This servlet receives one parameter: “class”.  For example:
>
>   - “
> http://localhost:8080/tomee/ws/viewclass?class=org.apache.openejb.assembler.DeployerEjb
> ”
> would return (3).
>
>
> “Object Invoker”
> This servlet has tow versions: "GET" and "POST".  For example:
>
>   - GET - “
>
> http://localhost:8080/tomee/ws/beaninvoker?path=openejb/DeployerBusinessRemote
> ”
>   would return an element with the same structure as (3).
>   - POST - “
>
> http://localhost:8080/tomee/ws/beaninvoker?path=openejb/DeployerBusinessRemote
> ”
>   with extra "post" parameters -> method name and method parameters values
>   list. It would return the something like (4). If the execution of the
>   method throws and exception, just let the exception reach the JS side
>   (normal servlet flow). I will manage the exceptions at the client side.
>
>
> // (1)*******************************************************************
>
> {
>    items: [{
>        name: ‘.’,
>        type: ‘class’,
>        path: ‘java.lang.String’
>    }, {
>        name: ‘openejb’,
>        type: ‘context’,
>        path: ‘openejb’
>    }, {
>        name: ‘MEJB’,
>        type: ‘bean’,
>        path: ‘MEJB’
>    }]
> }
>
> // (2)*******************************************************************
>
> {
>    items: [{
>        name: ‘ConfigurationInfoBusinessRemote’,
>        type: ‘bean’,
>        path: ‘openejb / ConfigurationInfoBusinessRemote’
>    }, {
>        name: ‘DeployerBusinessRemote’,
>        type: ‘bean’,
>        path: ‘openejb / DeployerBusinessRemote’
>    }]
> }
>
> // (3)*******************************************************************
>
> {
>    'items': [
>        {
>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
>            'methodName': 'deploy',
>            'parameterTypes': ['java.lang.String'],
>            'throws': ['org.apache.openejb.OpenEJBException']
>        },
>        {
>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
>            'methodName': 'deploy',
>            'parameterTypes': ['java.util.Properties'],
>            'throws': ['org.apache.openejb.OpenEJBException']
>        },
>        {
>            'returnType': 'org.apache.openejb.assembler.classic.AppInfo',
>            'methodName': 'deploy',
>            'parameterTypes': ['java.lang.String', 'java.util.Properties'],
>            'throws': ['org.apache.openejb.OpenEJBException']
>        },
>        {
>            'returnType': null,
>            'methodName': 'undeploy',
>            'parameterTypes': ['java.lang.String'],
>            'throws': ['org.apache.openejb.UndeployException',
> 'org.apache.openejb.NoSuchApplicationException']
>        }
> .
> .
> .
>    ]
> }
>
> // (4)*******************************************************************
>
> {
>    'id': 'java.lang.String@1517688671',
>    'class': 'java.lang.String',
>    'toString':
>
> 'proxy=org.apache.openejb.assembler.Deployer;deployment=openejb/Deployer;...'
> }
>
>
> ******************************************************************************************
>
> There is something already implemented, so you can use it as example of how
> return json strings from regular java Map objects. Check the
> "JndiServlet.java" class.
>
> Is anyone available for a little help? :O)
>
> []s,
> Thiago.
>