Cool... tkx! I will try that. []s, Thiago.
On Tue, Dec 18, 2012 at 2:01 PM, Romain Manni-Bucau <rmannibu...@gmail.com> wrote: > hmm they are in > SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext() > context > > don't think you can get they without reproducing the logic used for > the log (and that's not a solution ;) > > BTW listing > SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup(java:global) > should be fine as a first step > > > Romain Manni-Bucau > Twitter: @rmannibucau > Blog: http://rmannibucau.wordpress.com/ > LinkedIn: http://fr.linkedin.com/in/rmannibucau > Github: https://github.com/rmannibucau > > > > 2012/12/18 Thiago Veronezi <thi...@veronezi.org>: >> Hi Romain, >> >> It is still wrong... working on that. >> btw, do you know a good way to get the JNDI names? I just want to list >> the same jndi strings shown in the log file. >> >> []s, >> Thiago. >> >> >> >> On Tue, Dec 18, 2012 at 12:54 PM, Romain Manni-Bucau >> <rmannibu...@gmail.com> wrote: >>> Hi Thiago, >>> >>> if i understand here jndi = ejbs? >>> >>> it doesn't really match, there is not the resources and all the user >>> could have bound. >>> >>> Romain Manni-Bucau >>> Twitter: @rmannibucau >>> Blog: http://rmannibucau.wordpress.com/ >>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>> Github: https://github.com/rmannibucau >>> >>> >>> >>> >>> ---------- Forwarded message ---------- >>> From: <tveron...@apache.org> >>> Date: 2012/12/18 >>> Subject: svn commit: r1423544 - >>> /openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/command/impl/GetJndi.java >>> To: comm...@openejb.apache.org >>> >>> >>> Author: tveronezi >>> Date: Tue Dec 18 17:32:42 2012 >>> New Revision: 1423544 >>> >>> URL: http://svn.apache.org/viewvc?rev=1423544&view=rev >>> Log: >>> Better way to list the JNDI values. >>> >>> Modified: >>> >>> openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/command/impl/GetJndi.java >>> >>> Modified: >>> openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/command/impl/GetJndi.java >>> URL: >>> http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/command/impl/GetJndi.java?rev=1423544&r1=1423543&r2=1423544&view=diff >>> ============================================================================== >>> --- >>> openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/command/impl/GetJndi.java >>> (original) >>> +++ >>> openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/command/impl/GetJndi.java >>> Tue Dec 18 17:32:42 2012 >>> @@ -17,14 +17,12 @@ >>> >>> package org.apache.tomee.webapp.command.impl; >>> >>> -import org.apache.tomee.webapp.Application; >>> +import org.apache.openejb.BeanContext; >>> +import org.apache.openejb.loader.SystemInstance; >>> +import org.apache.openejb.spi.ContainerSystem; >>> import org.apache.tomee.webapp.command.Command; >>> import org.apache.tomee.webapp.command.IsProtected; >>> >>> -import javax.naming.Context; >>> -import javax.naming.NameClassPair; >>> -import javax.naming.NamingEnumeration; >>> -import javax.naming.NamingException; >>> import java.util.ArrayList; >>> import java.util.HashMap; >>> import java.util.List; >>> @@ -36,32 +34,18 @@ public class GetJndi implements Command >>> @Override >>> public Object execute(final Map<String, Object> params) throws >>> Exception { >>> final String sessionId = (String) params.get("sessionId"); >>> - final Application.Session session = >>> Application.getInstance().getSession(sessionId); >>> final List<String> jndi = new ArrayList<String>(); >>> >>> - list(session.getContext(), jndi, ""); >>> + ContainerSystem container = >>> SystemInstance.get().getComponent(ContainerSystem.class); >>> + BeanContext[] deployments = container.deployments(); >>> + if (deployments != null) { >>> + for (BeanContext beanContext : deployments) { >>> + jndi.add(String.valueOf(beanContext.getDeploymentID())); >>> + } >>> + } >>> + >>> final Map<String, Object> json = new HashMap<String, Object>(); >>> json.put("jndi", jndi); >>> - >>> return json; >>> } >>> - >>> - private void list(final Context context, final List<String> jndi, >>> String path) throws NamingException { >>> - final NamingEnumeration<NameClassPair> namingEnum = >>> context.list(""); >>> - while (namingEnum.hasMore()) { >>> - final NameClassPair pair = namingEnum.next(); >>> - >>> - String namePath = (path + "/" + pair.getName()).trim(); >>> - if (namePath.startsWith("/")) { >>> - namePath = namePath.substring(1); >>> - } >>> - jndi.add(namePath); >>> - >>> - final Object obj = context.lookup(pair.getName()); >>> - if (Context.class.isInstance(obj)) { >>> - list((Context) obj, jndi, namePath); >>> - } >>> - } >>> - } >>> - >>> }