Thread: [Ejtools-cvs] CVS: applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/ejb
Brought to you by:
letiemble
From: Laurent E. <let...@us...> - 2002-05-05 20:20:35
|
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/ejb In directory usw-pr-cvs1:/tmp/cvs-serv10280/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/ejb Modified Files: EJBHomeProxy.java EJBObjectProxy.java PropertyChanger.java Log Message: Add some JavaDocs Index: EJBHomeProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/ejb/EJBHomeProxy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EJBHomeProxy.java 2 May 2002 20:52:10 -0000 1.3 --- EJBHomeProxy.java 5 May 2002 20:20:33 -0000 1.4 *************** *** 23,53 **** /** ! * Description of the Class * ! * @author letiembl * @created 13 décembre 2001 */ public class EJBHomeProxy extends JNDIEntry implements InvocationHandler { ! /** Description of the Field */ protected EJBHome home; ! /** Description of the Field */ protected Class homeClass; ! /** Description of the Field */ protected BeanInfo info; ! /** Description of the Field */ protected Object proxy; /** ! * Sets the home attribute of the EJBean object * ! * @param o Description of Parameter ! * @exception Exception Description of Exception */ public EJBHomeProxy(Object o) throws Exception { home = (EJBHome) PortableRemoteObject.narrow(o, EJBHome.class); Class[] intf = home.getClass().getInterfaces(); for (int i = 0; i < intf.length; i++) --- 23,58 ---- /** ! * 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$ */ 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 o The EJB Home interface ! * @exception Exception Exception in case of errors */ public EJBHomeProxy(Object o) throws Exception { + // Try to narrow to an EJBHome class 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++) *************** *** 59,64 **** } - this.info = Introspector.getBeanInfo(this.homeClass); this.className = homeClass.getName(); this.proxy = Proxy.newProxyInstance(homeClass.getClassLoader(), new Class[]{BeanInfo.class, homeClass}, this); } --- 64,72 ---- } this.className = 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); } *************** *** 66,75 **** /** ! * Gets the component attribute of the EJBHomeProxy object * ! * @return The component value */ public Component getComponent() { if (c == null) { --- 74,84 ---- /** ! * Gets the JavaBean customizer of the context * ! * @return The customizer */ public Component getComponent() { + // Lazy creation if (c == null) { *************** *** 88,105 **** /** ! * 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)) { --- 97,116 ---- /** ! * 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)) { *************** *** 108,119 **** else { Iterator iterator = iterator(); while (iterator.hasNext()) { ! remove(iterator.next()); } Object result = method.invoke(home, args); if (result instanceof Collection) { --- 119,133 ---- 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) { *************** *** 121,130 **** while (enum.hasNext()) { ! add(new EJBObjectProxy(enum.next(), homeClass.getClassLoader())); } } else { ! add(new EJBObjectProxy(result, homeClass.getClassLoader())); } --- 135,144 ---- while (enum.hasNext()) { ! this.add(new EJBObjectProxy(enum.next(), homeClass.getClassLoader())); } } else { ! this.add(new EJBObjectProxy(result, homeClass.getClassLoader())); } *************** *** 135,141 **** /** ! * Description of the Method * ! * @return Description of the Return Value */ public String toString() --- 149,155 ---- /** ! * Implementation of toString() method. * ! * @return The name of the ejb home */ public String toString() Index: EJBObjectProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/ejb/EJBObjectProxy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EJBObjectProxy.java 2 May 2002 20:52:10 -0000 1.3 --- EJBObjectProxy.java 5 May 2002 20:20:33 -0000 1.4 *************** *** 23,30 **** /** ! * @author Rickard Oberg (ri...@dr...) * @created 2 janvier 2002 * @see <related> * @version $Revision$ */ public class EJBObjectProxy extends JNDIEntry implements InvocationHandler --- 23,33 ---- /** ! * Description of the Class ! * ! * @author letiemble * @created 2 janvier 2002 * @see <related> * @version $Revision$ + * @todo JavaDoc to complete */ public class EJBObjectProxy extends JNDIEntry implements InvocationHandler Index: PropertyChanger.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/ejb/PropertyChanger.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PropertyChanger.java 2 May 2002 20:52:10 -0000 1.3 --- PropertyChanger.java 5 May 2002 20:20:33 -0000 1.4 *************** *** 10,26 **** /** ! * Description of the Interface * ! * @author letiembl * @created 2 janvier 2002 */ public interface PropertyChanger { /** ! * Adds a feature to the PropertyChangeListener attribute of the ! * PropertyChanger object * ! * @param pcl The feature to be added to the PropertyChangeListener ! * attribute */ public void addPropertyChangeListener(PropertyChangeListener pcl); --- 10,25 ---- /** ! * Interface that provides property change management. * ! * @author letiemble * @created 2 janvier 2002 + * @version $Revision$ */ public interface PropertyChanger { /** ! * Adds a PropertyChangeListener to the underlying collection * ! * @param pcl The PropertyChangeListener to add */ public void addPropertyChangeListener(PropertyChangeListener pcl); *************** *** 28,34 **** /** ! * Description of the Method * ! * @param pcl Description of Parameter */ public void removePropertyChangeListener(PropertyChangeListener pcl); --- 27,33 ---- /** ! * Removes a PropertyChangeListener to the underlying collection * ! * @param pcl The PropertyChangeListener to remove */ public void removePropertyChangeListener(PropertyChangeListener pcl); |