Thread: [Ejtools-cvs] applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/ejb EJBHomeProxy.jav
Brought to you by:
letiemble
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/ejb In directory sc8-pr-cvs1:/tmp/cvs-serv17169/jndi.browser/src/main/org/ejtools/jndi/browser/model/ejb Modified Files: EJBHomeProxy.java EJBLocalHomeProxy.java EJBObjectProxy.java PropertyChanger.java Log Message: Address Todo #755528 Address Todo #800902 Index: EJBHomeProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/ejb/EJBHomeProxy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EJBHomeProxy.java 24 Feb 2003 22:32:10 -0000 1.3 --- EJBHomeProxy.java 27 Nov 2003 01:30:29 -0000 1.4 *************** *** 1,177 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.ejb; ! ! import java.awt.Component; ! import java.beans.BeanInfo; ! import java.beans.Introspector; ! import java.lang.reflect.InvocationHandler; ! import java.lang.reflect.Method; ! import java.lang.reflect.Proxy; ! import java.util.Collection; ! import java.util.Iterator; ! ! import javax.ejb.EJBHome; ! import javax.naming.Context; ! import javax.rmi.PortableRemoteObject; ! ! import org.ejtools.adwt.GenericCustomizer; ! import org.ejtools.jndi.browser.model.JNDIEntry; ! ! /** ! * Proxy that hide the remote aspect of the EJB Home interface. Allows the creation of an EJB or of a collection of EJB remotly and displays them as ! * EJBObjectProxy. ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Reference to Rickard Öberg ! * @javabean:class displayName="Enterprise Java Bean" ! * shortDescription="EJB Home interface" ! * @javabean:icons color16="/toolbarButtonGraphics/development/EnterpriseJavaBeanJar16.gif" ! * @javabean:property name="name" ! * class="java.lang.String" ! * displayName="Name" ! * shortDescription="Name of the EJB Home" ! * @javabean:property name="className" ! * class="java.lang.String" ! * displayName="Home interface" ! * shortDescription="Class of EJB Home" ! */ ! public class EJBHomeProxy extends JNDIEntry implements InvocationHandler ! { ! /** EJB Home */ ! protected EJBHome home; ! /** EJB Home class */ ! protected Class homeClass; ! /** BeanInfo of the EJB Home class */ ! protected BeanInfo info; ! /** Invocation Proxy of the EJB Home class */ ! protected Object proxy; ! ! ! /** ! * Create the proxy by encapsulating the EJB Home interface ! * ! * @param context Description of the Parameter ! * @param jndiName Description of the Parameter ! * @exception Exception Exception in case of errors ! */ ! public EJBHomeProxy(Context context, String jndiName) ! throws Exception ! { ! // Try to narrow to an EJBHome class ! Object o = context.lookup(jndiName); ! home = (EJBHome) PortableRemoteObject.narrow(o, EJBHome.class); ! ! // Search for the Home interface ! Class[] intf = home.getClass().getInterfaces(); ! for (int i = 0; i < intf.length; i++) ! { ! if (EJBHome.class.isAssignableFrom(intf[i])) ! { ! homeClass = intf[i]; ! } ! } ! ! setName(jndiName); ! setClassName(homeClass.getName()); ! ! // Create the BeanInfo of the home class ! this.info = Introspector.getBeanInfo(this.homeClass); ! // Create the invocation proxy ! this.proxy = Proxy.newProxyInstance(homeClass.getClassLoader(), new Class[]{BeanInfo.class, homeClass}, this); ! } ! ! ! /** ! * Gets the JavaBean customizer of the context ! * ! * @return The customizer ! */ ! public Component getComponent() ! { ! // Lazy creation ! if (c == null) ! { ! try ! { ! c = new GenericCustomizer(proxy); ! } ! catch (Exception e) ! { ! e.printStackTrace(); ! } ! } ! return (Component) c; ! } ! ! ! /** ! * Implementation of InvocationHandler. ! * ! * @param proxy The proxy that makes the invocation ! * @param method The method invoked ! * @param args Arguments of the method ! * @return Result of the method ! * @exception Throwable Exception in case of errors ! */ ! public Object invoke(Object proxy, Method method, Object[] args) ! throws Throwable ! { ! // Intercept BeanInfo methods ! if (method.getDeclaringClass().equals(BeanInfo.class)) ! { ! return method.invoke(info, args); ! } ! // Intercept Object methods ! else if (method.getDeclaringClass().equals(Object.class)) ! { ! return method.invoke(this, args); ! } ! else ! { ! // Clear the content ! Iterator iterator = iterator(); ! while (iterator.hasNext()) ! { ! this.remove(iterator.next()); ! } ! ! // Execute EJBHome methods ! Object result = method.invoke(home, args); ! ! // Add an EJB or a collection of EJB ! if (result instanceof Collection) ! { ! Iterator enum = ((Collection) result).iterator(); ! while (enum.hasNext()) ! { ! this.add(new EJBObjectProxy(enum.next(), homeClass.getClassLoader())); ! } ! } ! else ! { ! this.add(new EJBObjectProxy(result, homeClass.getClassLoader())); ! } ! ! return null; ! } ! } ! ! ! /** ! * Implementation of toString() method. ! * ! * @return The name of the ejb home ! */ ! public String toString() ! { ! return homeClass.getName().substring(homeClass.getName().lastIndexOf(".") + 1); ! } ! ! } --- 1,177 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.ejb; ! ! import java.awt.Component; ! import java.beans.BeanInfo; ! import java.beans.Introspector; ! import java.lang.reflect.InvocationHandler; ! import java.lang.reflect.Method; ! import java.lang.reflect.Proxy; ! import java.util.Collection; ! import java.util.Iterator; ! ! import javax.ejb.EJBHome; ! import javax.naming.Context; ! import javax.rmi.PortableRemoteObject; ! ! import org.ejtools.adwt.GenericCustomizer; ! import org.ejtools.jndi.browser.model.JNDIEntry; ! ! /** ! * Proxy that hide the remote aspect of the EJB Home interface. Allows the creation of an EJB or of a collection of EJB remotly and displays them as ! * EJBObjectProxy. ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Reference to Rickard Öberg ! * @javabean:class displayName="Enterprise Java Bean" ! * shortDescription="EJB Home interface" ! * @javabean:icons color16="/toolbarButtonGraphics/development/EnterpriseJavaBeanJar16.gif" ! * @javabean:property name="name" ! * class="java.lang.String" ! * displayName="Name" ! * shortDescription="Name of the EJB Home" ! * @javabean:property name="className" ! * class="java.lang.String" ! * displayName="Home interface" ! * shortDescription="Class of EJB Home" ! */ ! public class EJBHomeProxy extends JNDIEntry implements InvocationHandler ! { ! /** EJB Home */ ! protected EJBHome home; ! /** EJB Home class */ ! protected Class homeClass; ! /** BeanInfo of the EJB Home class */ ! protected BeanInfo info; ! /** Invocation Proxy of the EJB Home class */ ! protected Object proxy; ! ! ! /** ! * Create the proxy by encapsulating the EJB Home interface ! * ! * @param context Description of the Parameter ! * @param jndiName Description of the Parameter ! * @exception Exception Exception in case of errors ! */ ! public EJBHomeProxy(Context context, String jndiName) ! throws Exception ! { ! // Try to narrow to an EJBHome class ! Object o = context.lookup(jndiName); ! home = (EJBHome) PortableRemoteObject.narrow(o, EJBHome.class); ! ! // Search for the Home interface ! Class[] intf = home.getClass().getInterfaces(); ! for (int i = 0; i < intf.length; i++) ! { ! if (EJBHome.class.isAssignableFrom(intf[i])) ! { ! homeClass = intf[i]; ! } ! } ! ! setName(jndiName); ! setClassName(homeClass.getName()); ! ! // Create the BeanInfo of the home class ! this.info = Introspector.getBeanInfo(this.homeClass); ! // Create the invocation proxy ! this.proxy = Proxy.newProxyInstance(homeClass.getClassLoader(), new Class[]{BeanInfo.class, homeClass}, this); ! } ! ! ! /** ! * Gets the JavaBean customizer of the context ! * ! * @return The customizer ! */ ! public Component getComponent() ! { ! // Lazy creation ! if (c == null) ! { ! try ! { ! c = new GenericCustomizer(proxy); ! } ! catch (Exception e) ! { ! e.printStackTrace(); ! } ! } ! return (Component) c; ! } ! ! ! /** ! * Implementation of InvocationHandler. ! * ! * @param proxy The proxy that makes the invocation ! * @param method The method invoked ! * @param args Arguments of the method ! * @return Result of the method ! * @exception Throwable Exception in case of errors ! */ ! public Object invoke(Object proxy, Method method, Object[] args) ! throws Throwable ! { ! // Intercept BeanInfo methods ! if (method.getDeclaringClass().equals(BeanInfo.class)) ! { ! return method.invoke(info, args); ! } ! // Intercept Object methods ! else if (method.getDeclaringClass().equals(Object.class)) ! { ! return method.invoke(this, args); ! } ! else ! { ! // Clear the content ! Iterator iterator = iterator(); ! while (iterator.hasNext()) ! { ! this.remove(iterator.next()); ! } ! ! // Execute EJBHome methods ! Object result = method.invoke(home, args); ! ! // Add an EJB or a collection of EJB ! if (result instanceof Collection) ! { ! Iterator enum = ((Collection) result).iterator(); ! while (enum.hasNext()) ! { ! this.add(new EJBObjectProxy(enum.next(), homeClass.getClassLoader())); ! } ! } ! else ! { ! this.add(new EJBObjectProxy(result, homeClass.getClassLoader())); ! } ! ! return null; ! } ! } ! ! ! /** ! * Implementation of toString() method. ! * ! * @return The name of the ejb home ! */ ! public String toString() ! { ! return homeClass.getName().substring(homeClass.getName().lastIndexOf(".") + 1); ! } ! ! } Index: EJBLocalHomeProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/ejb/EJBLocalHomeProxy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EJBLocalHomeProxy.java 24 Feb 2003 22:32:10 -0000 1.2 --- EJBLocalHomeProxy.java 27 Nov 2003 01:30:29 -0000 1.3 *************** *** 1,81 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.ejb; ! ! import javax.ejb.EJBLocalHome; ! import javax.naming.Context; ! import javax.rmi.PortableRemoteObject; ! ! import org.ejtools.jndi.browser.model.JNDIEntry; ! ! /** ! * Proxy that hide the remote aspect of the EJB Local Home interface. ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Reference to Rickard Öberg ! * @javabean:class displayName="Enterprise Java Bean" ! * shortDescription="EJB Local Home interface" ! * @javabean:icons color16="/toolbarButtonGraphics/development/EnterpriseJavaBeanJar16.gif" ! * @javabean:property name="name" ! * class="java.lang.String" ! * displayName="Name" ! * shortDescription="Name of the EJB Local Home" ! * @javabean:property name="className" ! * class="java.lang.String" ! * displayName="Home interface" ! * shortDescription="Class of EJB Local Home" ! */ ! public class EJBLocalHomeProxy extends JNDIEntry ! { ! /** EJB Home */ ! protected EJBLocalHome home; ! /** EJB Home class */ ! protected Class homeClass; ! ! ! /** ! * Create the proxy by encapsulating the EJB Home interface ! * ! * @param context Description of the Parameter ! * @param jndiName Description of the Parameter ! * @exception Exception Exception in case of errors ! */ ! public EJBLocalHomeProxy(Context context, String jndiName) ! throws Exception ! { ! // Try to narrow to an EJBHome class ! Object o = context.lookup(jndiName); ! home = (EJBLocalHome) PortableRemoteObject.narrow(o, EJBLocalHome.class); ! ! // Search for the Home interface ! Class[] intf = home.getClass().getInterfaces(); ! for (int i = 0; i < intf.length; i++) ! { ! if (EJBLocalHome.class.isAssignableFrom(intf[i])) ! { ! homeClass = intf[i]; ! } ! } ! ! this.setName(jndiName); ! this.setClassName(homeClass.getName()); ! } ! ! ! /** ! * Implementation of toString() method. ! * ! * @return The name of the ejb home ! */ ! public String toString() ! { ! return homeClass.getName().substring(homeClass.getName().lastIndexOf(".") + 1); ! } ! ! } --- 1,81 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.ejb; ! ! import javax.ejb.EJBLocalHome; ! import javax.naming.Context; ! import javax.rmi.PortableRemoteObject; ! ! import org.ejtools.jndi.browser.model.JNDIEntry; ! ! /** ! * Proxy that hide the remote aspect of the EJB Local Home interface. ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Reference to Rickard Öberg ! * @javabean:class displayName="Enterprise Java Bean" ! * shortDescription="EJB Local Home interface" ! * @javabean:icons color16="/toolbarButtonGraphics/development/EnterpriseJavaBeanJar16.gif" ! * @javabean:property name="name" ! * class="java.lang.String" ! * displayName="Name" ! * shortDescription="Name of the EJB Local Home" ! * @javabean:property name="className" ! * class="java.lang.String" ! * displayName="Home interface" ! * shortDescription="Class of EJB Local Home" ! */ ! public class EJBLocalHomeProxy extends JNDIEntry ! { ! /** EJB Home */ ! protected EJBLocalHome home; ! /** EJB Home class */ ! protected Class homeClass; ! ! ! /** ! * Create the proxy by encapsulating the EJB Home interface ! * ! * @param context Description of the Parameter ! * @param jndiName Description of the Parameter ! * @exception Exception Exception in case of errors ! */ ! public EJBLocalHomeProxy(Context context, String jndiName) ! throws Exception ! { ! // Try to narrow to an EJBHome class ! Object o = context.lookup(jndiName); ! home = (EJBLocalHome) PortableRemoteObject.narrow(o, EJBLocalHome.class); ! ! // Search for the Home interface ! Class[] intf = home.getClass().getInterfaces(); ! for (int i = 0; i < intf.length; i++) ! { ! if (EJBLocalHome.class.isAssignableFrom(intf[i])) ! { ! homeClass = intf[i]; ! } ! } ! ! this.setName(jndiName); ! this.setClassName(homeClass.getName()); ! } ! ! ! /** ! * Implementation of toString() method. ! * ! * @return The name of the ejb home ! */ ! public String toString() ! { ! return homeClass.getName().substring(homeClass.getName().lastIndexOf(".") + 1); ! } ! ! } Index: EJBObjectProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/ejb/EJBObjectProxy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EJBObjectProxy.java 24 Feb 2003 22:32:10 -0000 1.3 --- EJBObjectProxy.java 27 Nov 2003 01:30:29 -0000 1.4 *************** *** 1,170 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.ejb; ! ! import java.awt.Component; ! import java.beans.BeanInfo; ! import java.beans.Customizer; ! import java.beans.Introspector; ! import java.beans.PropertyChangeListener; ! import java.beans.PropertyChangeSupport; ! import java.lang.reflect.InvocationHandler; ! import java.lang.reflect.Method; ! import java.lang.reflect.Proxy; ! ! import javax.ejb.EJBObject; ! ! import org.ejtools.adwt.GenericCustomizer; ! import org.ejtools.jndi.browser.model.JNDIEntry; ! ! /** ! * Proxy that hide the remote aspect of the EJB remote interface. Allows the execution of remote methods on the specified EJB. ! * ! * @author letiemble ! * @created 2 janvier 2002 ! * @version $Revision$ ! * @todo Reference to Rickard Öberg ! * @javabean:class displayName="Enterprise Java Bean" ! * shortDescription="EJB Remote interface" ! * @javabean:icons color16="/toolbarButtonGraphics/development/EnterpriseJavaBean16.gif" ! */ ! public class EJBObjectProxy extends JNDIEntry implements InvocationHandler ! { ! /** Description of the Field */ ! protected transient Customizer c; ! /** Description of the Field */ ! protected String desc; ! /** Description of the Field */ ! protected BeanInfo info; ! /** Description of the Field */ ! protected Object obj; ! /** Description of the Field */ ! protected Object proxy; ! /** Description of the Field */ ! protected PropertyChangeSupport ps; ! /** Description of the Field */ ! protected Class remote; ! ! ! /** ! * Constructor for the EJBObjectProxy object ! * ! * @param obj Description of Parameter ! * @param cl Description of Parameter ! * @exception Exception Description of Exception ! */ ! public EJBObjectProxy(Object obj, ClassLoader cl) ! throws Exception ! { ! this.obj = obj; ! ! Class[] intf = obj.getClass().getInterfaces(); ! for (int i = 0; i < intf.length; i++) ! { ! if (EJBObject.class.isAssignableFrom(intf[i])) ! { ! remote = intf[i]; ! } ! } ! ! this.info = Introspector.getBeanInfo(this.remote); ! this.proxy = Proxy.newProxyInstance(cl, new Class[]{BeanInfo.class, remote, PropertyChanger.class}, this); ! this.ps = new PropertyChangeSupport(proxy); ! } ! ! ! /** ! * Gets the component attribute of the EJBObjectProxy object ! * ! * @return The component value ! */ ! public Component getComponent() ! { ! if (c == null) ! { ! c = new GenericCustomizer(proxy); ! } ! return (Component) c; ! } ! ! ! /** ! * Description of the Method ! * ! * @param proxy Description of Parameter ! * @param method Description of Parameter ! * @param args Description of Parameter ! * @return Description of the Returned Value ! * @exception Throwable Description of Exception ! */ ! public Object invoke(Object proxy, Method method, Object[] args) ! throws Throwable ! { ! if (method.getDeclaringClass().equals(BeanInfo.class)) ! { ! return method.invoke(info, args); ! } ! else if (method.getDeclaringClass().equals(Object.class)) ! { ! return method.invoke(this, args); ! } ! else if (method.getDeclaringClass().equals(PropertyChanger.class)) ! { ! if (method.getName().startsWith("add")) ! { ! ps.addPropertyChangeListener((PropertyChangeListener) args[0]); ! } ! else ! { ! ps.removePropertyChangeListener((PropertyChangeListener) args[0]); ! } ! return null; ! } ! else ! { ! try ! { ! return method.invoke(obj, args); ! } ! finally ! { ! if (!(method.getName().startsWith("get") || method.getName().startsWith("is"))) ! { ! ps.firePropertyChange(null, null, null); ! } ! } ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! */ ! public String toString() ! { ! if (desc == null) ! { ! try ! { ! Method m = EJBObject.class.getMethod("getPrimaryKey", new Class[0]); ! desc = m.invoke(obj, new Object[0]).toString(); ! } ! catch (Exception e) ! { ! ! desc = remote.getName().substring(remote.getName().lastIndexOf(".") + 1); ! //desc = remote.toString(); ! ! } ! ! } ! return desc; ! } ! } ! --- 1,170 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.ejb; ! ! import java.awt.Component; ! import java.beans.BeanInfo; ! import java.beans.Customizer; ! import java.beans.Introspector; ! import java.beans.PropertyChangeListener; ! import java.beans.PropertyChangeSupport; ! import java.lang.reflect.InvocationHandler; ! import java.lang.reflect.Method; ! import java.lang.reflect.Proxy; ! ! import javax.ejb.EJBObject; ! ! import org.ejtools.adwt.GenericCustomizer; ! import org.ejtools.jndi.browser.model.JNDIEntry; ! ! /** ! * Proxy that hide the remote aspect of the EJB remote interface. Allows the execution of remote methods on the specified EJB. ! * ! * @author letiemble ! * @created 2 janvier 2002 ! * @version $Revision$ ! * @todo Reference to Rickard Öberg ! * @javabean:class displayName="Enterprise Java Bean" ! * shortDescription="EJB Remote interface" ! * @javabean:icons color16="/toolbarButtonGraphics/development/EnterpriseJavaBean16.gif" ! */ ! public class EJBObjectProxy extends JNDIEntry implements InvocationHandler ! { ! /** Description of the Field */ ! protected transient Customizer c; ! /** Description of the Field */ ! protected String desc; ! /** Description of the Field */ ! protected BeanInfo info; ! /** Description of the Field */ ! protected Object obj; ! /** Description of the Field */ ! protected Object proxy; ! /** Description of the Field */ ! protected PropertyChangeSupport ps; ! /** Description of the Field */ ! protected Class remote; ! ! ! /** ! * Constructor for the EJBObjectProxy object ! * ! * @param obj Description of Parameter ! * @param cl Description of Parameter ! * @exception Exception Description of Exception ! */ ! public EJBObjectProxy(Object obj, ClassLoader cl) ! throws Exception ! { ! this.obj = obj; ! ! Class[] intf = obj.getClass().getInterfaces(); ! for (int i = 0; i < intf.length; i++) ! { ! if (EJBObject.class.isAssignableFrom(intf[i])) ! { ! remote = intf[i]; ! } ! } ! ! this.info = Introspector.getBeanInfo(this.remote); ! this.proxy = Proxy.newProxyInstance(cl, new Class[]{BeanInfo.class, remote, PropertyChanger.class}, this); ! this.ps = new PropertyChangeSupport(proxy); ! } ! ! ! /** ! * Gets the component attribute of the EJBObjectProxy object ! * ! * @return The component value ! */ ! public Component getComponent() ! { ! if (c == null) ! { ! c = new GenericCustomizer(proxy); ! } ! return (Component) c; ! } ! ! ! /** ! * Description of the Method ! * ! * @param proxy Description of Parameter ! * @param method Description of Parameter ! * @param args Description of Parameter ! * @return Description of the Returned Value ! * @exception Throwable Description of Exception ! */ ! public Object invoke(Object proxy, Method method, Object[] args) ! throws Throwable ! { ! if (method.getDeclaringClass().equals(BeanInfo.class)) ! { ! return method.invoke(info, args); ! } ! else if (method.getDeclaringClass().equals(Object.class)) ! { ! return method.invoke(this, args); ! } ! else if (method.getDeclaringClass().equals(PropertyChanger.class)) ! { ! if (method.getName().startsWith("add")) ! { ! ps.addPropertyChangeListener((PropertyChangeListener) args[0]); ! } ! else ! { ! ps.removePropertyChangeListener((PropertyChangeListener) args[0]); ! } ! return null; ! } ! else ! { ! try ! { ! return method.invoke(obj, args); ! } ! finally ! { ! if (!(method.getName().startsWith("get") || method.getName().startsWith("is"))) ! { ! ps.firePropertyChange(null, null, null); ! } ! } ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! */ ! public String toString() ! { ! if (desc == null) ! { ! try ! { ! Method m = EJBObject.class.getMethod("getPrimaryKey", new Class[0]); ! desc = m.invoke(obj, new Object[0]).toString(); ! } ! catch (Exception e) ! { ! ! desc = remote.getName().substring(remote.getName().lastIndexOf(".") + 1); ! //desc = remote.toString(); ! ! } ! ! } ! return desc; ! } ! } ! Index: PropertyChanger.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/ejb/PropertyChanger.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PropertyChanger.java 10 Feb 2003 21:17:50 -0000 1.1 --- PropertyChanger.java 27 Nov 2003 01:30:29 -0000 1.2 *************** *** 1,35 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.ejb; ! ! import java.beans.PropertyChangeListener; ! ! /** ! * Interface that provides property change management. ! * ! * @author letiemble ! * @created 2 janvier 2002 ! * @version $Revision$ ! * @todo Reference to Rickard Öberg ! */ ! public interface PropertyChanger ! { ! /** ! * Adds a PropertyChangeListener to the underlying collection ! * ! * @param pcl The PropertyChangeListener to add ! */ ! public void addPropertyChangeListener(PropertyChangeListener pcl); ! ! ! /** ! * Removes a PropertyChangeListener to the underlying collection ! * ! * @param pcl The PropertyChangeListener to remove ! */ ! public void removePropertyChangeListener(PropertyChangeListener pcl); ! } --- 1,35 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.ejb; ! ! import java.beans.PropertyChangeListener; ! ! /** ! * Interface that provides property change management. ! * ! * @author letiemble ! * @created 2 janvier 2002 ! * @version $Revision$ ! * @todo Reference to Rickard Öberg ! */ ! public interface PropertyChanger ! { ! /** ! * Adds a PropertyChangeListener to the underlying collection ! * ! * @param pcl The PropertyChangeListener to add ! */ ! public void addPropertyChangeListener(PropertyChangeListener pcl); ! ! ! /** ! * Removes a PropertyChangeListener to the underlying collection ! * ! * @param pcl The PropertyChangeListener to remove ! */ ! public void removePropertyChangeListener(PropertyChangeListener pcl); ! } |