Thread: [Ejtools-cvs] applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model JNDILinkR
Brought to you by:
letiemble
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model In directory usw-pr-cvs1:/tmp/cvs-serv17918/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model Modified Files: JNDIContext.java JNDIEntry.java Server.java Added Files: JNDILinkRef.java Proxy.java Log Message: Add support for BeanInfo generation bby XDoclet --- NEW FILE: JNDILinkRef.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.jndibrowser.model; import javax.naming.Context; import javax.naming.LinkRef; /** * Describe a simple JNDI Link Reference. * * @author letiemble * @created 13 décembre 2001 * @version $Revision: 1.3 $ * @todo Javadoc to complete * @javabean:class displayName="JNDI LinkRef" shortDescription="JNDI Link Reference" * @javabean:icons color16="/toolbarButtonGraphics/general/File16.gif" * @javabean:property name="name" class="java.lang.String" displayName="Name" shortDescription="Name of the entry" * @javabean:property name="className" class="java.lang.String" displayName="Class" shortDescription="Class of the entry" * @javabean:property name="path" class="java.lang.String" displayName="Full Path" shortDescription="Absolute path of the context" * @javabean:property name="linkName" class="java.lang.String" displayName="Link Reference" shortDescription="Link Reference" */ public class JNDILinkRef extends JNDIEntry { /** Class name of the context */ protected String linkName = ""; /** Description of the Field */ protected LinkRef ref; /** * Constructor for the JNDILinkRef object * * @param context Description of the Parameter * @param jndiName Description of the Parameter * @exception Exception Description of the Exception */ public JNDILinkRef(Context context, String jndiName) throws Exception { setName(jndiName); Object o = context.lookupLink(jndiName); setClassName(o.getClass().getName()); ref = (LinkRef) o; setLinkName(ref.getLinkName()); } /** * Gets the linkName attribute of the JNDILinkRef object * * @return The linkName value */ public String getLinkName() { return this.linkName; } /** * Sets the linkName attribute of the JNDILinkRef object * * @param linkName The new linkName value */ protected void setLinkName(String linkName) { this.linkName = linkName; } } --- NEW FILE: Proxy.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.jndibrowser.model; import javax.naming.Context; /** * Describe a Proyx entry. * * @author letiemble * @created 13 décembre 2001 * @version $Revision: 1.3 $ * @todo Javadoc to complete * @javabean:class displayName="Proxy Class" shortDescription="Proxy Class" * @javabean:icons color16="/toolbarButtonGraphics/general/File16.gif" * @javabean:property name="name" class="java.lang.String" displayName="Name" shortDescription="Name of the entry" * @javabean:property name="className" class="java.lang.String" displayName="Class" shortDescription="Class of the entry" * @javabean:property name="path" class="java.lang.String" displayName="Full Path" shortDescription="Absolute path of the context" * @javabean:property name="interfaces" class="java.lang.Class" displayName="Interfaces" shortDescription="Interfaces implemented by this proxy" */ public class Proxy extends JNDIEntry { /** Description of the Field */ protected Object proxy = null; /** * Constructor for the JNDILinkRef object * * @param context Description of the Parameter * @param jndiName Description of the Parameter * @exception Exception Description of the Exception */ public Proxy(Context context, String jndiName) throws Exception { Object o = context.lookup(jndiName); if (java.lang.reflect.Proxy.isProxyClass(o.getClass())) { proxy = o; } else { if (o.getClass().getName().startsWith("$Proxy")) { proxy = o; } } if (proxy == null) { throw new Exception("This object is not a proxy"); } } /** * Gets the linkName attribute of the JNDILinkRef object * * @return The linkName value */ public Class[] getInterfaces() { return proxy.getClass().getInterfaces(); } } Index: JNDIContext.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/JNDIContext.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JNDIContext.java 25 May 2002 20:54:47 -0000 1.6 --- JNDIContext.java 30 May 2002 22:37:26 -0000 1.7 *************** *** 1,212 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model; ! ! import java.awt.Component; ! import java.beans.Customizer; ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextChild; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.beans.beancontext.BeanContextServiceRevokedListener; ! import java.beans.beancontext.BeanContextServices; ! import java.beans.beancontext.BeanContextServicesSupport; ! import java.util.Iterator; ! import java.util.TooManyListenersException; ! ! import net.sourceforge.ejtools.awt.GenericCustomizer; ! import net.sourceforge.ejtools.util.Sort; ! ! import org.apache.log4j.Category; ! ! /** ! * Ancestor of all element in the JNDI tree. Represents a JNDI Context and can contains other context. ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @beaninfo:class displayName="JNDI Context" shortDescription="JNDI Context" ! * @beaninfo:icons color16="/toolbarButtonGraphics/general/Folder16.gif" ! * @beaninfo:property name="name" class="java.lang.String" displayName="Name" shortDescription="Name of the context" ! * @beaninfo:property name="path" class="java.lang.String" displayName="Full Path" shortDescription="Absolute path of the context" ! */ ! public class JNDIContext extends BeanContextServicesSupport implements BeanContextChildComponentProxy ! { ! /** Customizer of the JavaBean */ ! protected transient Customizer c = null; ! /** Class name of the context */ ! protected String className = ""; ! /** Name of the context */ ! protected String name = ""; ! /** Description of the Field */ ! private static Category logger = Category.getInstance(JNDIContext.class); ! ! ! /** Constructor for the JndiServer object */ ! public JNDIContext() ! { ! super(); ! } ! ! ! /** ! * Gets the class name of the context ! * ! * @return The class name string ! */ ! public String getClassName() ! { ! return this.className; ! } ! ! ! /** ! * Gets the JavaBean customizer of the context ! * ! * @return The customizer ! */ ! public Component getComponent() ! { ! // Lazy creation ! if (c == null) ! { ! c = new GenericCustomizer(true, this); ! } ! return (Component) c; ! } ! ! ! /** ! * Gets the name of the context ! * ! * @return The name string ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Get the absolute JNDI path of the context ! * ! * @return The path value ! */ ! public String getPath() ! { ! try ! { ! BeanContext parent = getBeanContext(); ! if (parent != null) ! { ! JNDIContext context = (JNDIContext) parent; ! String path = context.getPath(); ! if ((path == null) || ("".equals(path))) ! { ! return (getName()); ! } ! else ! { ! return (path + "/" + getName()); ! } ! } ! else ! { ! return ""; ! } ! } ! catch (Exception e) ! { ! logger.warn("Oops, not in a JNDIContext"); ! } ! return null; ! } ! ! ! /** ! * Override of BeanContextServicesSupport to allow recursive access to BeanContext services ! * ! * @param child Child which requested the service ! * @param requestor Requester of the service ! * @param serviceClass Class of the service ! * @param serviceSelector Selector for the service ! * @param bcsrl Listener for the revocation ! * @return The requested service ! * @exception TooManyListenersException Exception in case of error ! */ ! public Object getService(BeanContextChild child, ! Object requestor, ! Class serviceClass, ! Object serviceSelector, ! BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException ! { ! Object service = super.getService(child, requestor, serviceClass, serviceSelector, bcsrl); ! ! // If the service requested is not provided by this BeanContext, try the parent ! if (service == null) ! { ! BeanContextServices bcs = null; ! ! try ! { ! bcs = (BeanContextServices) getBeanContext(); ! } ! catch (ClassCastException cce) ! { ! // Ignore it ! return null; ! } ! ! return bcs.getService(this, requestor, serviceClass, serviceSelector, bcsrl); ! } ! ! return service; ! } ! ! ! /** ! * Return the children of this context as an iterator ! * ! * @return The sorted iterator by class and by name ! */ ! public Iterator iterator() ! { ! return Sort.sortByClassAndName(super.iterator()); ! } ! ! ! /** ! * Implementation of toString() method ! * ! * @return The name of the context ! */ ! public String toString() ! { ! return name == null ? "Undefined" : name; ! } ! ! ! /** ! * Sets the class name of this context ! * ! * @param className The class name ! */ ! protected void setClassName(String className) ! { ! this.className = className; ! } ! ! ! /** ! * Sets the name of this context ! * ! * @param name The name ! */ ! protected void setName(String name) ! { ! this.name = name; ! } ! } --- 1,213 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model; ! ! import java.awt.Component; ! import java.beans.Customizer; ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextChild; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.beans.beancontext.BeanContextServiceRevokedListener; ! import java.beans.beancontext.BeanContextServices; ! import java.beans.beancontext.BeanContextServicesSupport; ! import java.util.Iterator; ! import java.util.TooManyListenersException; ! ! import net.sourceforge.ejtools.awt.GenericCustomizer; ! import net.sourceforge.ejtools.util.Sort; ! ! import org.apache.log4j.Category; ! ! /** ! * Ancestor of all element in the JNDI tree. Represents a JNDI Context and can contains other context. ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @javabean:class displayName="JNDI Context" shortDescription="JNDI Context" ! * @javabean:icons color16="/toolbarButtonGraphics/general/Folder16.gif" ! * @javabean:property name="name" class="java.lang.String" displayName="Name" shortDescription="Name of the context" ! * @javabean:property name="path" class="java.lang.String" displayName="Full Path" shortDescription="Absolute path of the context" ! */ ! public class JNDIContext extends BeanContextServicesSupport implements BeanContextChildComponentProxy ! { ! /** Customizer of the JavaBean */ ! protected transient Customizer c = null; ! /** Class name of the context */ ! protected String className = ""; ! /** Name of the context */ ! protected String name = ""; ! /** Description of the Field */ ! private static Category logger = Category.getInstance(JNDIContext.class); ! ! ! /** Constructor for the JndiServer object */ ! public JNDIContext() ! { ! super(); ! } ! ! ! /** ! * Gets the class name of the context ! * ! * @return The class name string ! */ ! public String getClassName() ! { ! return this.className; ! } ! ! ! /** ! * Gets the JavaBean customizer of the context ! * ! * @return The customizer ! */ ! public Component getComponent() ! { ! // Lazy creation ! if (c == null) ! { ! c = new GenericCustomizer(true, this); ! } ! return (Component) c; ! } ! ! ! /** ! * Gets the name of the context ! * ! * @return The name string ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Get the absolute JNDI path of the context ! * ! * @return The path value ! */ ! public String getPath() ! { ! try ! { ! BeanContext parent = getBeanContext(); ! if (parent != null) ! { ! JNDIContext context = (JNDIContext) parent; ! String path = context.getPath(); ! if ((path == null) || ("".equals(path))) ! { ! return (getName()); ! } ! else ! { ! return (path + "/" + getName()); ! } ! } ! else ! { ! return ""; ! } ! } ! catch (Exception e) ! { ! logger.warn("Oops, not in a JNDIContext"); ! } ! return null; ! } ! ! ! /** ! * Override of BeanContextServicesSupport to allow recursive access to BeanContext services ! * ! * @param child Child which requested the service ! * @param requestor Requester of the service ! * @param serviceClass Class of the service ! * @param serviceSelector Selector for the service ! * @param bcsrl Listener for the revocation ! * @return The requested service ! * @exception TooManyListenersException Exception in case of error ! */ ! public Object getService(BeanContextChild child, ! Object requestor, ! Class serviceClass, ! Object serviceSelector, ! BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException ! { ! Object service = super.getService(child, requestor, serviceClass, serviceSelector, bcsrl); ! ! // If the service requested is not provided by this BeanContext, try the parent ! if (service == null) ! { ! BeanContextServices bcs = null; ! ! try ! { ! bcs = (BeanContextServices) getBeanContext(); ! } ! catch (ClassCastException cce) ! { ! // Ignore it ! return null; ! } ! ! return bcs.getService(this, requestor, serviceClass, serviceSelector, bcsrl); ! } ! ! return service; ! } ! ! ! /** ! * Return the children of this context as an iterator ! * ! * @return The sorted iterator by class and by name ! */ ! public Iterator iterator() ! { ! return Sort.sortByName(super.iterator()); ! // return Sort.sortByClassAndName(super.iterator()); ! } ! ! ! /** ! * Implementation of toString() method ! * ! * @return The name of the context ! */ ! public String toString() ! { ! return name == null ? "Undefined" : name; ! } ! ! ! /** ! * Sets the class name of this context ! * ! * @param className The class name ! */ ! protected void setClassName(String className) ! { ! this.className = className; ! } ! ! ! /** ! * Sets the name of this context ! * ! * @param name The name ! */ ! protected void setName(String name) ! { ! this.name = name; ! } ! } Index: JNDIEntry.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/JNDIEntry.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JNDIEntry.java 25 May 2002 20:54:47 -0000 1.6 --- JNDIEntry.java 30 May 2002 22:37:26 -0000 1.7 *************** *** 14,22 **** * @created 13 décembre 2001 * @version $Revision$ ! * @beaninfo:class displayName="JNDI Entry" shortDescription="JNDI Entry" ! * @beaninfo:icons color16="/toolbarButtonGraphics/general/File16.gif" ! * @beaninfo:property name="name" class="java.lang.String" displayName="Name" shortDescription="Name of the entry" ! * @beaninfo:property name="className" class="java.lang.String" displayName="Class" shortDescription="Class of the entry" ! * @beaninfo:property name="path" class="java.lang.String" displayName="Full Path" shortDescription="Absolute path of the context" */ public class JNDIEntry extends JNDIContext --- 14,22 ---- * @created 13 décembre 2001 * @version $Revision$ ! * @javabean:class displayName="JNDI Entry" shortDescription="JNDI Entry" ! * @javabean:icons color16="/toolbarButtonGraphics/general/File16.gif" ! * @javabean:property name="name" class="java.lang.String" displayName="Name" shortDescription="Name of the entry" ! * @javabean:property name="className" class="java.lang.String" displayName="Class" shortDescription="Class of the entry" ! * @javabean:property name="path" class="java.lang.String" displayName="Full Path" shortDescription="Absolute path of the context" */ public class JNDIEntry extends JNDIContext Index: Server.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/Server.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Server.java 25 May 2002 20:54:47 -0000 1.7 --- Server.java 30 May 2002 22:37:26 -0000 1.8 *************** *** 7,13 **** package net.sourceforge.ejtools.jndibrowser.model; import java.lang.reflect.Proxy; import java.util.Collection; - import java.util.Hashtable; import java.util.Iterator; import java.util.Properties; --- 7,13 ---- package net.sourceforge.ejtools.jndibrowser.model; + import java.lang.reflect.Constructor; import java.lang.reflect.Proxy; import java.util.Collection; import java.util.Iterator; import java.util.Properties; *************** *** 21,25 **** import javax.naming.NamingEnumeration; import javax.naming.NamingException; - import javax.naming.NotContextException; import net.sourceforge.ejtools.jndibrowser.model.ejb.EJBHomeProxy; --- 21,24 ---- *************** *** 27,30 **** --- 26,30 ---- import net.sourceforge.ejtools.jndibrowser.model.jms.QueueProxy; import net.sourceforge.ejtools.jndibrowser.model.jms.TopicProxy; + import net.sourceforge.ejtools.jndibrowser.model.mail.SessionProxy; import org.apache.log4j.Category; *************** *** 38,48 **** * @todo Javadoc to complete * @todo Add log4j logs ! * @beaninfo:class displayName="JNDI Server" shortDescription="JNDI Server" ! * @beaninfo:icons color16="/toolbarButtonGraphics/development/Server16.gif" ! * @beaninfo:property name="factory" class="java.lang.String" displayName="Factory" shortDescription="JNDI context factory" ! * @beaninfo:property name="context" class="java.lang.String" displayName="Context" shortDescription="Initial JNDI context" ! * @beaninfo:property name="packages" class="java.lang.String" displayName="Packages" shortDescription="Packages for context" ! * @beaninfo:property name="url" class="java.lang.String" displayName="URL" shortDescription="JNDI Server URL" ! * @beaninfo:property name="searchType" class="int" displayName="Browsing" shortDescription="JNDI context factory" propertyeditor="net.sourceforge.ejtools.jndibrowser.model.SearchTypeEditor" */ public class Server extends JNDIContext --- 38,48 ---- * @todo Javadoc to complete * @todo Add log4j logs ! * @javabean:class displayName="JNDI Server" shortDescription="JNDI Server" ! * @javabean:icons color16="/toolbarButtonGraphics/development/Server16.gif" ! * @javabean:property name="factory" class="java.lang.String" displayName="Factory" shortDescription="JNDI context factory" ! * @javabean:property name="packages" class="java.lang.String" displayName="Packages" shortDescription="Packages for context" ! * @javabean:property name="url" class="java.lang.String" displayName="URL" shortDescription="JNDI Server URL" ! * @javabean:property name="context" class="java.lang.String" displayName="Context" shortDescription="Initial JNDI context" ! * @javabean:property name="searchType" class="int" displayName="Browsing" shortDescription="JNDI context factory" propertyeditor="net.sourceforge.ejtools.jndibrowser.model.SearchTypeEditor" */ public class Server extends JNDIContext *************** *** 61,65 **** private static Category logger = Category.getInstance(Server.class); /** Description of the Field */ ! private static Hashtable proxies = new Hashtable(); /** Description of the Field */ public final static int DEEP_SEARCH = 0; --- 61,65 ---- private static Category logger = Category.getInstance(Server.class); /** Description of the Field */ ! private static Vector proxies = new Vector(); /** Description of the Field */ public final static int DEEP_SEARCH = 0; *************** *** 95,130 **** - /** Description of the Method */ - public void connect() - { - logger.debug("Cleaning JNDI tree..."); - Iterator iterator = iterator(); - while (iterator.hasNext()) - { - remove(iterator.next()); - } - - try - { - Context context = new InitialContext(); - context = (Context) context.lookup(getContext()); - - Vector content = new Vector(); - list(context, content); - - logger.debug("Populating JNDI tree..."); - Iterator it = content.iterator(); - while (it.hasNext()) - { - add(it.next()); - } - } - catch (Exception e) - { - logger.error("Exception " + e.getMessage()); - } - } - - /** * Gets the context attribute of the JNDIServer object --- 95,98 ---- *************** *** 196,200 **** * Description of the Method * ! * @beaninfo:method name="refresh" displayName="Refresh" shortDescription="Refresh the JNDI tree" */ public void refresh() --- 164,168 ---- * Description of the Method * ! * @javabean:method name="refresh" displayName="Refresh" shortDescription="Refresh the JNDI tree" */ public void refresh() *************** *** 217,226 **** logger.debug("Initial context with " + props); ! // context = (Context) context.lookup(this.getContext()); - logger.debug("Parsing context " + props); Vector content = new Vector(); ! this.iterateContext(context, this.getContext(), content); ! // this.iterateContext(context, "", content); logger.debug("Populating JNDI tree..."); --- 185,193 ---- logger.debug("Initial context with " + props); ! // Context context = new InitialContext(); ! context = (Context) context.lookup(getContext()); Vector content = new Vector(); ! list(context, content); logger.debug("Populating JNDI tree..."); *************** *** 233,237 **** catch (Exception e) { ! System.err.println("Exception " + e.getMessage()); } } --- 200,204 ---- catch (Exception e) { ! logger.error("Exception " + e.getMessage()); } } *************** *** 296,299 **** --- 263,297 ---- * Description of the Method * + * @param context Description of the Parameter + * @param jndiName Description of the Parameter + * @return Description of the Return Value + */ + protected JNDIContext createNode(Context context, String jndiName) + { + for (int i = 0; i < proxies.size(); i++) + { + Class clazz = (Class) proxies.elementAt(i); + + try + { + Constructor c = clazz.getConstructor(new Class[]{javax.naming.Context.class, java.lang.String.class}); + JNDIContext node = (JNDIContext) c.newInstance(new Object[]{context, jndiName}); + if (node != null) + { + return node; + } + } + catch (Exception e) + { + } + } + + return null; + } + + + /** + * Description of the Method + * * @param ctx Description of the Parameter * @param node Description of the Parameter *************** *** 307,312 **** while (ne.hasMore()) { NameClassPair pair = (NameClassPair) ne.next(); ! // logger.warn(">>> Pair: " + pair); String name = pair.getName(); --- 305,312 ---- while (ne.hasMore()) { + JNDIContext newNode = null; + NameClassPair pair = (NameClassPair) ne.next(); ! // logger.warn(">>> Pair: " + pair); String name = pair.getName(); *************** *** 314,321 **** boolean recursive = false; boolean isLinkRef = false; - boolean isProxy = false; ! // logger.warn("Name=" + name); ! // logger.warn("Class=" + className); Class c = null; --- 314,320 ---- boolean recursive = false; boolean isLinkRef = false; ! // logger.warn("Name=" + name); ! // logger.warn("Class=" + className); Class c = null; *************** *** 323,327 **** { c = loader.loadClass(className); ! // logger.warn("Class: " + c); if (Context.class.isAssignableFrom(c)) --- 322,326 ---- { c = loader.loadClass(className); ! // logger.warn("Class: " + c); if (Context.class.isAssignableFrom(c)) *************** *** 333,342 **** isLinkRef = true; } - - isProxy = Proxy.isProxyClass(c); } catch (ClassNotFoundException cnfe) { ! logger.warn("Exception " + cnfe.getMessage()); } catch (Exception e) --- 332,339 ---- isLinkRef = true; } } catch (ClassNotFoundException cnfe) { ! logger.warn("ClassNotFoundException " + cnfe.getMessage()); } catch (Exception e) *************** *** 345,358 **** } if (recursive) { ! JNDIContext newNode = new JNDIContext(); newNode.setName(name); newNode.setClassName(className); - node.add(newNode); try { Object value = ctx.lookup(name); if (value instanceof Context) { --- 342,367 ---- } + if (isLinkRef) + { + try + { + newNode = new JNDILinkRef(ctx, name); + node.add(newNode); + } + catch (Exception e) + { + } + } + if (recursive) { ! newNode = new JNDIContext(); newNode.setName(name); newNode.setClassName(className); try { Object value = ctx.lookup(name); + if (value instanceof Context) { *************** *** 360,366 **** list(subctx, newNode); } - else - { - } } catch (Throwable t) --- 369,372 ---- *************** *** 369,382 **** } } ! else { ! JNDIContext newNode; newNode = new JNDIEntry(); newNode.setName(name); newNode.setClassName(className); - - node.add(newNode); } } ne.close(); --- 375,394 ---- } } ! ! // Try to cast to a predefined object ! if ((newNode == null) && (searchType == Server.DEEP_SEARCH)) { ! newNode = createNode(ctx, name); ! } + // If no match, create a JNDIEntry + if (newNode == null) + { newNode = new JNDIEntry(); newNode.setName(name); newNode.setClassName(className); } + + node.add(newNode); } ne.close(); *************** *** 388,540 **** } ! ! /** ! * Gets the context attribute of the JndiServer object ! * ! * @param context Description of Parameter ! * @param s Description of Parameter ! * @return The context value ! * @exception NamingException Description of Exception ! */ ! private boolean isContext(Context context, String s) throws NamingException ! { ! try ! { ! context.list(s); ! } ! catch (NotContextException notcontextexception) ! { ! return false; ! } ! return true; ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of Parameter ! * @param s Description of Parameter ! * @param node Description of Parameter ! * @return Description of the Returned Value ! */ ! private boolean iterateContext(Context context, String s, Collection node) { ! try ! { ! for (NamingEnumeration namingenumeration = context.list(s); namingenumeration.hasMore(); ) ! { ! NameClassPair nc = (NameClassPair) namingenumeration.next(); ! ! if (isContext(context, nc.getName())) ! { ! Context context1 = (Context) context.lookup(nc.getName()); ! String s1 = context1.composeName(nc.getName(), s); ! ! JNDIContext newNode = new JNDIContext(); ! newNode.name = nc.getName(); ! newNode.className = nc.getClassName(); ! node.add(newNode); ! ! iterateContext(context1, s1, newNode); ! // iterateContext(context1, "", newNode); ! } ! else ! { ! JNDIContext newNode; ! ! logger.debug("NC=" + nc.getName()); ! logger.debug("NC=" + nc.getClassName()); ! ! newNode = new JNDIEntry(); ! newNode.name = nc.getName(); ! newNode.className = nc.getClassName(); ! ! if (this.searchType == Server.DEEP_SEARCH) ! { ! try ! { ! logger.debug("Name :" + nc.getName()); ! logger.debug("ClassName :" + nc.getClassName()); ! ! Object o = null; ! ! try ! { ! o = context.lookup(nc.getName()); ! ! try ! { ! newNode = new EJBHomeProxy(o); ! newNode.name = nc.getName(); ! } ! catch (Exception e1) ! { ! ! try ! { ! newNode = new QueueProxy(o); ! newNode.name = nc.getName(); ! newNode.className = nc.getClassName(); ! } ! catch (Exception e2) ! { ! ! try ! { ! newNode = new TopicProxy(o); ! newNode.name = nc.getName(); ! newNode.className = nc.getClassName(); ! } ! catch (Exception e3) ! { ! ! try ! { ! newNode = new ConnectionFactoryProxy(o); ! newNode.name = nc.getName(); ! newNode.className = nc.getClassName(); ! } ! catch (Exception e4) ! { ! } ! } ! } ! } ! } ! catch (Exception e1) ! { ! } ! } ! catch (Exception e1) ! { ! } ! } ! ! node.add(newNode); ! } ! } ! } ! catch (Exception namingexception) ! { ! logger.warn("iterateContext Exception " + namingexception.getMessage()); ! return false; ! } ! return true; } - - /** Load the list of proxies to create */ - /* - * static - * { - * proxies.put(javax.ejb.EJBHome.class, EJBHomeProxy.class); - * proxies.put(javax.ejb.EJBLocalHome.class, EJBLocalHomeProxy.class); - * proxies.put(javax.jms.ConnectionFactory.class, ConnectionFactoryProxy.class); - * proxies.put(javax.jms.Queue.class, QueueProxy.class); - * proxies.put(javax.jms.Topic.class, TopicProxy.class); - * proxies.put(javax.mail.Session.class, TopicProxy.class); - * proxies.put(javax.sql.DataSource.class, DataSourceProxy.class); - * proxies.put(javax.sql.XADataSource.class, XADataSourceProxy.class); - * } - */ } --- 400,412 ---- } ! /** Proxies to load */ ! static { ! proxies.add(net.sourceforge.ejtools.jndibrowser.model.ejb.EJBHomeProxy.class); ! proxies.add(net.sourceforge.ejtools.jndibrowser.model.jms.QueueProxy.class); ! proxies.add(net.sourceforge.ejtools.jndibrowser.model.jms.TopicProxy.class); ! proxies.add(net.sourceforge.ejtools.jndibrowser.model.jms.ConnectionFactoryProxy.class); ! proxies.add(net.sourceforge.ejtools.jndibrowser.model.mail.SessionProxy.class); ! proxies.add(net.sourceforge.ejtools.jndibrowser.model.Proxy.class); } } |