tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tveron...@apache.org
Subject svn commit: r1291513 - in /openejb/trunk/openejb/tomee: tomee-loader/src/main/java/org/apache/tomee/loader/dto/ tomee-loader/src/main/java/org/apache/tomee/loader/servlet/ tomee-webapp/src/main/webapp/staging/js/tomee/ tomee-webapp/src/main/webapp/stag...
Date Mon, 20 Feb 2012 23:08:15 GMT
Author: tveronezi
Date: Mon Feb 20 23:08:14 2012
New Revision: 1291513

URL: http://svn.apache.org/viewvc?rev=1291513&view=rev
Log:
https://issues.apache.org/jira/browse/TOMEE-130

viewejb.jsp and viewjndi.jsp are done.

Modified:
    openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/dto/JndiDTO.java
    openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/servlet/JndiServlet.java
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/ApplicationI18N.js
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationJndiPanel.js

Modified: openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/dto/JndiDTO.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/dto/JndiDTO.java?rev=1291513&r1=1291512&r2=1291513&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/dto/JndiDTO.java
(original)
+++ openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/dto/JndiDTO.java
Mon Feb 20 23:08:14 2012
@@ -16,10 +16,20 @@
  */
 package org.apache.tomee.loader.dto;
 
+import java.util.List;
+
 public class JndiDTO {
     public String deploymentId;
     public String path;
     public String name;
     public String value;
     public String beanType;
+    
+    public String remoteInterface;
+    public String homeInterface;
+    public String beanCls;
+    public List<String> businessLocal;
+    public List<String> businessRemote;
+
+    public String primaryKeyCls;
 }

Modified: openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/servlet/JndiServlet.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/servlet/JndiServlet.java?rev=1291513&r1=1291512&r2=1291513&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/servlet/JndiServlet.java
(original)
+++ openejb/trunk/openejb/tomee/tomee-loader/src/main/java/org/apache/tomee/loader/servlet/JndiServlet.java
Mon Feb 20 23:08:14 2012
@@ -26,7 +26,6 @@ import org.apache.openejb.util.proxy.Pro
 import org.apache.tomee.loader.dto.JndiDTO;
 
 import javax.naming.Context;
-import javax.naming.InitialContext;
 import javax.naming.NameClassPair;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -40,7 +39,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 
 @WebServlet(name = "jndi", urlPatterns = "/ws/jndi", asyncSupported = false)
 public class JndiServlet extends HttpServlet {
@@ -94,17 +92,38 @@ public class JndiServlet extends HttpSer
 
                 dto.path = key;
                 dto.name = pair.getName();
-                dto.value = String.valueOf(obj);
+                dto.value = getStr(obj);
                 dto.deploymentId = getDeploymentId(obj);
 
                 final BeanContext beanContext = getDeployment(dto.deploymentId);
-                dto.beanType = String.valueOf(beanContext.getComponentType());
-                
+                dto.beanType = getStr(beanContext.getComponentType());
+
+                dto.remoteInterface = getStr(beanContext.getRemoteInterface());
+                dto.homeInterface = getStr(beanContext.getHomeInterface());
+                dto.beanCls = getStr(beanContext.getBeanClass());
+
+                dto.businessLocal = new ArrayList<String>();
+                populateClassList(dto.businessLocal, beanContext.getBusinessLocalInterfaces());
+
+                dto.businessRemote = new ArrayList<String>();
+                populateClassList(dto.businessRemote, beanContext.getBusinessRemoteInterfaces());
+
+                dto.primaryKeyCls = getStr(beanContext.getPrimaryKeyClass());
+
                 jndi.add(dto);
             }
         }
     }
 
+    private void populateClassList(List<String> list, List<Class> classes) {
+        if (classes == null) {
+            return;
+        }
+        for (Class<?> cls : classes) {
+            list.add(getStr(cls));
+        }
+    }
+
     private BeanContext getDeployment(String deploymentID) {
         ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
         BeanContext ejb = containerSystem.getBeanContext(deploymentID);
@@ -113,7 +132,14 @@ public class JndiServlet extends HttpSer
 
     private String getDeploymentId(Object ejbObj) throws NamingException {
         final BaseEjbProxyHandler handler = (BaseEjbProxyHandler) ProxyManager.getInvocationHandler(ejbObj);
-        return String.valueOf(handler.deploymentID);
+        return getStr(handler.deploymentID);
+    }
+
 
+    private String getStr(Object value) {
+        if(value == null) {
+            return null;
+        }
+        return String.valueOf(value);
     }
 }

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/ApplicationI18N.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/ApplicationI18N.js?rev=1291513&r1=1291512&r2=1291513&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/ApplicationI18N.js
(original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/ApplicationI18N.js
Mon Feb 20 23:08:14 2012
@@ -51,6 +51,10 @@ TOMEE.ApplicationI18N = (function () {
         'app.home.menu.tools.jndi.browser.bean': 'Bean',
         'app.home.menu.tools.jndi.browser.bean.details': 'See your bean details',
 
+        'app.home.menu.tools.jndi.browser.back': 'Back',
+        'app.home.menu.tools.jndi.browser.invoke': 'Invoke',
+        'app.home.menu.tools.jndi.browser.class': 'View class',
+
         'dummy': 'dummy'
     };
 

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationJndiPanel.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationJndiPanel.js?rev=1291513&r1=1291512&r2=1291513&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationJndiPanel.js
(original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationJndiPanel.js
Mon Feb 20 23:08:14 2012
@@ -27,6 +27,8 @@ TOMEE.ApplicationJndiPanel = function (c
         var tbodyUid = TOMEE.Sequence.next();
         var tpl = [
             '<div class="well">',
+            '<div class="row-fluid">',
+            '<div class="span12">',
 
             '<div class="carousel slide">',
             '    <div id="' + carouselUid + '" class="carousel-inner">',
@@ -45,6 +47,9 @@ TOMEE.ApplicationJndiPanel = function (c
             '        </div>',
             '    </div>',
             '</div>',
+
+            '</div>',
+            '</div>',
             '</div>'
         ];
 
@@ -92,20 +97,116 @@ TOMEE.ApplicationJndiPanel = function (c
     };
 
     var showBeanPanel = function (bean) {
+        var fieldTpl = [
+            '    <div class="control-group">',
+            '        <label class="control-label" for="{2}">{0}</label>',
+            '         <div class="controls">',
+            '            <input class="input-xlarge" id="{2}" type="text" placeholder="{1}"
style="width:80%;">',
+            '        </div>',
+            '    </div>'
+        ].join('');
+
+        var listFieldTpl = [
+            '    <div class="control-group">',
+            '        <label class="control-label" for="{2}">{0}</label>',
+            '         <div class="controls">',
+            '            <select multiple="multiple" id="{2}" style="width:80%;">',
+            '            {1}',
+            '            </select>',
+            '        </div>',
+            '    </div>'
+        ].join('');
+
+        var mountOptions = function(beanArray) {
+            var myArray = [];
+            $.each(TOMEE.utils.getArray(beanArray), function(index, value) {
+                myArray.push('<option>');
+                myArray.push(value);
+                myArray.push('</option>');
+            });
+            return myArray.join('');
+        };
+
+        var getSafeValue = function(value) {
+            if(value) {
+                return value;
+            }
+            return '';
+        };
+
+        var fields = [
+            TOMEE.utils.stringFormat(fieldTpl,
+                "deploymentId",
+                getSafeValue(bean['deploymentId']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(fieldTpl,
+                "path",
+                getSafeValue(bean['path']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(fieldTpl,
+                "name",
+                getSafeValue(bean['name']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(fieldTpl,
+                "value",
+                getSafeValue(bean['value']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(fieldTpl,
+                "beanType",
+                getSafeValue(bean['beanType']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(fieldTpl,
+                "remoteInterface",
+                getSafeValue(bean['remoteInterface']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(fieldTpl,
+                "homeInterface",
+                getSafeValue(bean['homeInterface']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(fieldTpl,
+                "beanCls",
+                getSafeValue(bean['beanCls']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(fieldTpl,
+                "primaryKeyCls",
+                getSafeValue(bean['primaryKeyCls']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+
+            TOMEE.utils.stringFormat(listFieldTpl,
+                "businessLocal",
+                mountOptions(bean['businessLocal']),
+                TOMEE.Sequence.next('FIELD')
+            ),
+            TOMEE.utils.stringFormat(listFieldTpl,
+                "businessRemote",
+                mountOptions(bean['businessRemote']),
+                TOMEE.Sequence.next('FIELD')
+            )
+        ].join('');
+
         var bodyTpl = [
-            '<p>deploymentId: ' + bean.deploymentId + '</p>',
-            '<p>path: ' + bean['path'] + '</p>',
-            '<p>name: ' + bean['name'] + '</p>',
-            '<p>value: ' + bean['value'] + '</p>',
-            '<p>beanType: ' + bean['beanType'] + '</p>'
+            '<form class="form-horizontal">',
+            '<fieldset>',
+            fields,
+            '</fieldset>',
+            '</form>'
         ].join('');
 
         var backUid = TOMEE.Sequence.next('CAROUSEL-BACK');
         var captionTpl = [
             '<div class="btn-group">',
-            '<a class="btn" id="' + backUid + '" href="#">Back</a>',
-            '<a class="btn" href="#">Invoke</a>',
-            '<a class="btn" href="#">View class</a>',
+            '<a class="btn" id="' + backUid + '" href="#">' + TOMEE.ApplicationI18N.get('app.home.menu.tools.jndi.browser.back')
+ '</a>',
+            '<a class="btn" href="#">' + TOMEE.ApplicationI18N.get('app.home.menu.tools.jndi.browser.invoke')
+ '</a>',
+            '<a class="btn" href="#">' + TOMEE.ApplicationI18N.get('app.home.menu.tools.jndi.browser.class')
+ '</a>',
             '</div>'
         ].join('');
 
@@ -115,11 +216,11 @@ TOMEE.ApplicationJndiPanel = function (c
         });
 
         var backBtn = item.find("#" + backUid);
-        backBtn.on('click', function() {
+        backBtn.on('click', function () {
             elements.carousel.carousel('prev');
 
             var task = TOMEE.DelayedTask({
-                callback:function() {
+                callback: function () {
                     item.remove();
                 }
             });



Mime
View raw message