[Ejtools-cvs] applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service CacheService.j
Brought to you by:
letiemble
|
From: <let...@us...> - 2003-11-27 01:13:42
|
Update of /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service In directory sc8-pr-cvs1:/tmp/cvs-serv13614/jmx.browser/src/main/org/ejtools/jmx/browser/model/service Modified Files: CacheService.java CacheServiceProvider.java ConnectionMetaData.java ConnectionServiceProvider.java CustomizationService.java CustomizationServiceProvider.java NotificationService.java NotificationServiceProvider.java Log Message: Address Bug #775745 Address Todo #800902 Address Todo #755528 Remove @created tags Add support for MXJ4 2.0.0 (still beta) Add support for JXM Remoting through RMI Index: CacheService.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service/CacheService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CacheService.java 10 Feb 2003 20:49:31 -0000 1.1 --- CacheService.java 27 Nov 2003 01:13:07 -0000 1.2 *************** *** 1,68 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.io.Serializable; ! import java.util.Enumeration; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface CacheService extends Serializable ! { ! /** Description of the Field */ ! public final int DOMAIN_TYPE = 0; ! /** Description of the Field */ ! public final int RESOURCE_TYPE = 1; ! ! ! /** ! * Adds a feature to the Entity attribute of the CacheService object ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! * @param value Description of the Parameter ! */ ! public void add(int type, Object key, Object value); ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! */ ! public void remove(int type, Object key); ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @return Description of the Return Value ! */ ! public Enumeration keys(int type); ! ! ! /** Description of the Method */ ! public void clear(); ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object get(int type, Object key); ! } --- 1,68 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.io.Serializable; ! import java.util.Enumeration; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface CacheService extends Serializable ! { ! /** Description of the Field */ ! public final int DOMAIN_TYPE = 0; ! /** Description of the Field */ ! public final int RESOURCE_TYPE = 1; ! ! ! /** ! * Adds a feature to the Entity attribute of the CacheService object ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! * @param value Description of the Parameter ! */ ! public void add(int type, Object key, Object value); ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! */ ! public void remove(int type, Object key); ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @return Description of the Return Value ! */ ! public Enumeration keys(int type); ! ! ! /** Description of the Method */ ! public void clear(); ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object get(int type, Object key); ! } Index: CacheServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service/CacheServiceProvider.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CacheServiceProvider.java 24 Feb 2003 22:02:36 -0000 1.2 --- CacheServiceProvider.java 27 Nov 2003 01:13:07 -0000 1.3 *************** *** 1,168 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Enumeration; ! import java.util.Hashtable; ! import java.util.Iterator; ! import java.util.Vector; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Service release to complete ! */ ! public class CacheServiceProvider extends CustomBeanContextServiceProvider implements CacheService ! { ! /** Description of the Field */ ! protected Hashtable domains = new Hashtable(); ! /** Description of the Field */ ! protected Hashtable resources = new Hashtable(); ! /** Description of the Field */ ! protected CacheService service = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(CacheServiceProvider.class); ! ! ! /** Constructor for the ConnectionServiceProvider object */ ! public CacheServiceProvider() ! { ! service = this; ! } ! ! ! /** ! * Adds a feature to the Entity attribute of the CacheServiceProvider object ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! * @param value Description of the Parameter ! */ ! public void add(int type, Object key, Object value) ! { ! this.getTable(type).put(key, value); ! // logger.debug("Entity added " + type + ", " + key); ! } ! ! ! /** Description of the Method */ ! public void clear() ! { ! super.clear(); ! this.getTable(CacheService.DOMAIN_TYPE).clear(); ! this.getTable(CacheService.RESOURCE_TYPE).clear(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object get(int type, Object key) ! { ! return this.getTable(type).get(key); ! } ! ! ! /** ! * Getter for the currentServiceSelectors attribute ! * ! * @param bcs Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @return The value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) ! { ! return (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the service attribute ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @param serviceSelector Description of the Parameter ! * @return The value ! */ ! public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) ! { ! return this.service; ! } ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @return Description of the Return Value ! */ ! public Enumeration keys(int type) ! { ! return this.getTable(type).keys(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param service Description of the Parameter ! */ ! public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) { } ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! */ ! public void remove(int type, Object key) ! { ! this.getTable(type).remove(key); ! // logger.debug("Entity removed " + type + ", " + key); ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{CacheService.class}; ! } ! ! ! /** ! * Gets the table attribute of the CacheServiceProvider object ! * ! * @param type Description of the Parameter ! * @return The table value ! */ ! protected Hashtable getTable(int type) ! { ! if (type == CacheService.DOMAIN_TYPE) ! { ! return this.domains; ! } ! return this.resources; ! } ! } --- 1,165 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Enumeration; ! import java.util.Hashtable; ! import java.util.Iterator; ! import java.util.Vector; ! ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Service release to complete ! */ ! public class CacheServiceProvider extends CustomBeanContextServiceProvider implements CacheService ! { ! /** Description of the Field */ ! protected Hashtable domains = new Hashtable(); ! /** Description of the Field */ ! protected Hashtable resources = new Hashtable(); ! /** Description of the Field */ ! protected CacheService service = null; ! ! ! /** Constructor for the ConnectionServiceProvider object */ ! public CacheServiceProvider() ! { ! service = this; ! } ! ! ! /** ! * Adds a feature to the Entity attribute of the CacheServiceProvider object ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! * @param value Description of the Parameter ! */ ! public void add(int type, Object key, Object value) ! { ! this.getTable(type).put(key, value); ! // logger.debug("Entity added " + type + ", " + key); ! } ! ! ! /** Description of the Method */ ! public void clear() ! { ! super.clear(); ! this.getTable(CacheService.DOMAIN_TYPE).clear(); ! this.getTable(CacheService.RESOURCE_TYPE).clear(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object get(int type, Object key) ! { ! return this.getTable(type).get(key); ! } ! ! ! /** ! * Getter for the currentServiceSelectors attribute ! * ! * @param bcs Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @return The value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) ! { ! return (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the service attribute ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @param serviceSelector Description of the Parameter ! * @return The value ! */ ! public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) ! { ! return this.service; ! } ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @return Description of the Return Value ! */ ! public Enumeration keys(int type) ! { ! return this.getTable(type).keys(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param service Description of the Parameter ! */ ! public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) { } ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! * @param key Description of the Parameter ! */ ! public void remove(int type, Object key) ! { ! this.getTable(type).remove(key); ! // logger.debug("Entity removed " + type + ", " + key); ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{CacheService.class}; ! } ! ! ! /** ! * Gets the table attribute of the CacheServiceProvider object ! * ! * @param type Description of the Parameter ! * @return The table value ! */ ! protected Hashtable getTable(int type) ! { ! if (type == CacheService.DOMAIN_TYPE) ! { ! return this.domains; ! } ! return this.resources; ! } ! } Index: ConnectionMetaData.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service/ConnectionMetaData.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ConnectionMetaData.java 24 Feb 2003 22:02:37 -0000 1.2 --- ConnectionMetaData.java 27 Nov 2003 01:13:07 -0000 1.3 *************** *** 22,29 **** --- 22,31 ---- ConnectionMetaData.PACKAGES, ConnectionMetaData.URL, + ConnectionMetaData.SERVICE, ConnectionMetaData.CONTEXT, ConnectionMetaData.PRINCIPAL, ConnectionMetaData.CREDENTIALS }; + /** Description of the Field */ public final static String CLASS_NAME = "classname"; *************** *** 40,43 **** --- 42,47 ---- /** Description of the Field */ public final static String URL = "url"; + /** Description of the Field */ + public final static String SERVICE = "service"; Index: ConnectionServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service/ConnectionServiceProvider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConnectionServiceProvider.java 24 Feb 2003 22:02:35 -0000 1.3 --- ConnectionServiceProvider.java 27 Nov 2003 01:13:07 -0000 1.4 *************** *** 43,65 **** * * @param metadata Description of the Parameter */ public ConnectionServiceProvider(Profile metadata) { ! try ! { ! ConnectionService service = (ConnectionService) Thread.currentThread().getContextClassLoader().loadClass(metadata.getProperty(ConnectionMetaData.CLASS_NAME)).newInstance(); ! this.setup(service); ! } ! catch (ClassNotFoundException cnfe) ! { ! logger.error(cnfe.getMessage(), cnfe); ! } ! catch (IllegalAccessException iae) { ! logger.error(iae.getMessage(), iae); } ! catch (Exception e) { ! logger.error(e.getMessage(), e); } } --- 43,75 ---- * * @param metadata Description of the Parameter + * @param loader Description of the Parameter */ public ConnectionServiceProvider(Profile metadata) { ! // Create the connection service from metadatas ! String clazz = metadata.getProperty(ConnectionMetaData.CLASS_NAME); ! if (clazz != null) { ! try ! { ! ConnectionService service = (ConnectionService) Thread.currentThread().getContextClassLoader().loadClass(clazz).newInstance(); ! this.setup(service); ! } ! catch (ClassNotFoundException cnfe) ! { ! logger.error(cnfe.getMessage(), cnfe); ! } ! catch (IllegalAccessException iae) ! { ! logger.error(iae.getMessage(), iae); ! } ! catch (Exception e) ! { ! logger.error(e.getMessage(), e); ! } } ! else { ! logger.error("Class provided is null"); } } Index: CustomizationService.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service/CustomizationService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CustomizationService.java 10 Feb 2003 20:49:30 -0000 1.1 --- CustomizationService.java 27 Nov 2003 01:13:07 -0000 1.2 *************** *** 1,42 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.io.Serializable; ! import java.util.Collection; ! ! import org.ejtools.jmx.browser.mbean.View; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface CustomizationService extends Serializable ! { ! /** ! * Gets the views attribute of the CustomizationService object ! * ! * @return The views value ! */ ! public Collection getViews(); ! ! ! /** ! * Gets the view attribute of the CustomizationService object ! * ! * @param index Description of the Parameter ! * @return The view value ! * @paramindex Description of the Parameter ! * @paramindex Description of the Parameter ! * @paramindex Description of the Parameter ! */ ! public View getView(int index); ! } --- 1,42 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.io.Serializable; ! import java.util.Collection; ! ! import org.ejtools.jmx.browser.mbean.View; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface CustomizationService extends Serializable ! { ! /** ! * Gets the views attribute of the CustomizationService object ! * ! * @return The views value ! */ ! public Collection getViews(); ! ! ! /** ! * Gets the view attribute of the CustomizationService object ! * ! * @param index Description of the Parameter ! * @return The view value ! * @paramindex Description of the Parameter ! * @paramindex Description of the Parameter ! * @paramindex Description of the Parameter ! */ ! public View getView(int index); ! } Index: CustomizationServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service/CustomizationServiceProvider.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CustomizationServiceProvider.java 12 Feb 2003 21:22:42 -0000 1.2 --- CustomizationServiceProvider.java 27 Nov 2003 01:13:07 -0000 1.3 *************** *** 1,192 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Arrays; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! import org.ejtools.jmx.browser.mbean.CustomViewDeployer; ! import org.ejtools.jmx.browser.mbean.View; ! import org.ejtools.jmx.browser.model.Resource; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Service release to complete ! */ ! public class CustomizationServiceProvider extends CustomBeanContextServiceProvider implements CustomizationService ! { ! /** Description of the Field */ ! protected CustomizationService service = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(CustomizationServiceProvider.class); ! ! ! /** Constructor for the CustomizationServiceProvider object */ ! public CustomizationServiceProvider() ! { ! this.service = this; ! } ! ! ! /** ! * Getter for the currentServiceSelectors attribute ! * ! * @param bcs Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @return The value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) ! { ! return (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the service attribute ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @param serviceSelector Description of the Parameter ! * @return The value ! * @parambcs Description of the Parameter ! * @paramrequestor Description of the Parameter ! * @paramserviceClass Description of the Parameter ! * @paramserviceSelector Description of the Parameter ! * @parambcs Description of the Parameter ! * @paramrequestor Description of the Parameter ! * @paramserviceClass Description of the Parameter ! * @paramserviceSelector Description of the Parameter ! * @parambcs Description of Parameter ! * @paramrequestor Description of Parameter ! * @paramserviceClass Description of Parameter ! * @paramserviceSelector Description of Parameter ! */ ! public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) ! { ! return service; ! } ! ! ! /** ! * Gets the view attribute of the CustomizationServiceProvider object ! * ! * @param index Description of the Parameter ! * @return The view value ! * @paramindex Description of the Parameter ! * @paramindex Description of the Parameter ! * @paramindex Description of the Parameter ! */ ! public View getView(int index) ! { ! logger.debug("Getting view by index=" + index); ! ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! View result = null; ! ! if (context.hasService(ConnectionService.class) && context.hasService(CacheService.class)) ! { ! logger.debug("Using service ConnectionService and CacheService..."); ! try ! { ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! CacheService cache = (CacheService) context.getService(this, this, CacheService.class, this, this); ! ! Resource resource = (Resource) cache.get(CacheService.RESOURCE_TYPE, CustomViewDeployer.OBJECT_NAME); ! if (resource != null) ! { ! result = (View) resource.invoke("getView", new Object[]{new Integer(index)}, new String[]{"int"}); ! } ! ! context.releaseService(this, this, CacheService.class); ! context.releaseService(this, this, ConnectionService.class); ! } ! catch (Exception e) ! { ! e.printStackTrace(); ! logger.error("Error during utilisation of service ConnectionService or CacheService (" + e.getMessage() + ")"); ! } ! } ! ! return result; ! } ! ! ! /** ! * Gets the views attribute of the CustomizationServiceProvider object ! * ! * @return The views value ! */ ! public Collection getViews() ! { ! logger.debug("Getting views"); ! ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! Collection result = new Vector(); ! ! if (context.hasService(ConnectionService.class) && context.hasService(CacheService.class)) ! { ! logger.debug("Using service ConnectionService and CacheService..."); ! try ! { ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! CacheService cache = (CacheService) context.getService(this, this, CacheService.class, this, this); ! ! Resource resource = (Resource) cache.get(CacheService.RESOURCE_TYPE, CustomViewDeployer.OBJECT_NAME); ! if (resource != null) ! { ! View[] views = (View[]) resource.getAttribute("Views"); ! if (views != null) ! { ! result.addAll(Arrays.asList(views)); ! } ! } ! ! context.releaseService(this, this, CacheService.class); ! context.releaseService(this, this, ConnectionService.class); ! } ! catch (Exception e) ! { ! e.printStackTrace(); ! logger.error("Error during utilisation of service ConnectionService or CacheService (" + e.getMessage() + ")"); ! } ! } ! ! return result; ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param service Description of the Parameter ! */ ! public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) { } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{CustomizationService.class}; ! } ! } --- 1,177 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Arrays; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! import org.ejtools.jmx.browser.mbean.CustomViewDeployer; ! import org.ejtools.jmx.browser.mbean.View; ! import org.ejtools.jmx.browser.model.Resource; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 d?cembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Service release to complete ! */ ! public class CustomizationServiceProvider extends CustomBeanContextServiceProvider implements CustomizationService ! { ! /** Description of the Field */ ! protected CustomizationService service = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(CustomizationServiceProvider.class); ! ! ! /** Constructor for the CustomizationServiceProvider object */ ! public CustomizationServiceProvider() ! { ! this.service = this; ! } ! ! ! /** ! * Getter for the currentServiceSelectors attribute ! * ! * @param bcs Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @return The value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) ! { ! return (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the service attribute ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @param serviceSelector Description of the Parameter ! * @return The value ! */ ! public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) ! { ! return service; ! } ! ! ! /** ! * Gets the view attribute of the CustomizationServiceProvider object ! * ! * @param index Description of the Parameter ! * @return The view value ! */ ! public View getView(int index) ! { ! logger.debug("Getting view by index=" + index); ! ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! View result = null; ! ! if (context.hasService(ConnectionService.class) && context.hasService(CacheService.class)) ! { ! logger.debug("Using service ConnectionService and CacheService..."); ! try ! { ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! CacheService cache = (CacheService) context.getService(this, this, CacheService.class, this, this); ! ! Resource resource = (Resource) cache.get(CacheService.RESOURCE_TYPE, CustomViewDeployer.OBJECT_NAME); ! if (resource != null) ! { ! result = (View) resource.invoke("getView", new Object[]{new Integer(index)}, new String[]{"int"}); ! } ! ! context.releaseService(this, this, CacheService.class); ! context.releaseService(this, this, ConnectionService.class); ! } ! catch (Exception e) ! { ! e.printStackTrace(); ! logger.error("Error during utilisation of service ConnectionService or CacheService (" + e.getMessage() + ")"); ! } ! } ! ! return result; ! } ! ! ! /** ! * Gets the views attribute of the CustomizationServiceProvider object ! * ! * @return The views value ! */ ! public Collection getViews() ! { ! logger.debug("Getting views"); ! ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! Collection result = new Vector(); ! ! if (context.hasService(ConnectionService.class) && context.hasService(CacheService.class)) ! { ! logger.debug("Using service ConnectionService and CacheService..."); ! try ! { ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! CacheService cache = (CacheService) context.getService(this, this, CacheService.class, this, this); ! ! Resource resource = (Resource) cache.get(CacheService.RESOURCE_TYPE, CustomViewDeployer.OBJECT_NAME); ! if (resource != null) ! { ! View[] views = (View[]) resource.getAttribute("Views"); ! if (views != null) ! { ! result.addAll(Arrays.asList(views)); ! } ! } ! ! context.releaseService(this, this, CacheService.class); ! context.releaseService(this, this, ConnectionService.class); ! } ! catch (Exception e) ! { ! e.printStackTrace(); ! logger.error("Error during utilisation of service ConnectionService or CacheService (" + e.getMessage() + ")"); ! } ! } ! ! return result; ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param service Description of the Parameter ! */ ! public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) { } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{CustomizationService.class}; ! } ! } Index: NotificationService.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service/NotificationService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NotificationService.java 10 Feb 2003 20:49:29 -0000 1.1 --- NotificationService.java 27 Nov 2003 01:13:07 -0000 1.2 *************** *** 1,66 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.io.Serializable; ! import java.util.Collection; ! ! import javax.management.ObjectName; ! ! /** ! * @author letiembl ! * @created 13 juin 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface NotificationService extends Serializable ! { ! /** ! * Adds a feature to the ObjectName attribute of the NotificationService object ! * ! * @param object The feature to be added to the ObjectName attribute ! * @paramobject The feature to be added to the ObjectName attribute ! * @paramobject The feature to be added to the ObjectName attribute ! * @paramobject The feature to be added to the ObjectName attribute ! */ ! public void addObjectName(ObjectName object); ! ! ! /** ! * Description of the Method ! * ! * @param object Description of the Parameter ! * @paramobject Description of the Parameter ! * @paramobject Description of the Parameter ! * @paramobject Description of the Parameter ! */ ! public void removeObjectName(ObjectName object); ! ! ! /** ! * Description of the Method ! * ! * @param object Description of the Parameter ! * @return Description of the Return Value ! * @paramobject Description of the Parameter ! * @paramobject Description of the Parameter ! * @paramobject Description of the Parameter ! */ ! public boolean hasObjectName(ObjectName object); ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public Collection listAll(); ! ! ! /** Description of the Method */ ! public void clearAll(); ! } --- 1,66 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.io.Serializable; ! import java.util.Collection; ! ! import javax.management.ObjectName; ! ! /** ! * @author letiembl ! * @created 13 juin 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface NotificationService extends Serializable ! { ! /** ! * Adds a feature to the ObjectName attribute of the NotificationService object ! * ! * @param object The feature to be added to the ObjectName attribute ! * @paramobject The feature to be added to the ObjectName attribute ! * @paramobject The feature to be added to the ObjectName attribute ! * @paramobject The feature to be added to the ObjectName attribute ! */ ! public void addObjectName(ObjectName object); ! ! ! /** ! * Description of the Method ! * ! * @param object Description of the Parameter ! * @paramobject Description of the Parameter ! * @paramobject Description of the Parameter ! * @paramobject Description of the Parameter ! */ ! public void removeObjectName(ObjectName object); ! ! ! /** ! * Description of the Method ! * ! * @param object Description of the Parameter ! * @return Description of the Return Value ! * @paramobject Description of the Parameter ! * @paramobject Description of the Parameter ! * @paramobject Description of the Parameter ! */ ! public boolean hasObjectName(ObjectName object); ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public Collection listAll(); ! ! ! /** Description of the Method */ ! public void clearAll(); ! } Index: NotificationServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/model/service/NotificationServiceProvider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NotificationServiceProvider.java 1 Apr 2003 21:53:10 -0000 1.3 --- NotificationServiceProvider.java 27 Nov 2003 01:13:07 -0000 1.4 *************** *** 1,396 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.awt.Component; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.beans.beancontext.BeanContextServices; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.ResourceBundle; ! import java.util.Vector; ! ! import javax.management.Notification; ! import javax.management.NotificationListener; ! import javax.management.ObjectName; ! import javax.swing.JTable; ! import javax.swing.table.AbstractTableModel; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! import org.ejtools.swing.table.TableModelSorter; ! import org.ejtools.util.LimitedStack; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class NotificationServiceProvider extends CustomBeanContextServiceProvider implements BeanContextChildComponentProxy, NotificationService, NotificationListener ! { ! /** Description of the Field */ ! protected NotificationTableModel model = null; ! /** Description of the Field */ ! protected LimitedStack notifications = new LimitedStack(500); ! /** Description of the Field */ ! protected Vector objectNames = new Vector(); ! /** Description of the Field */ ! protected NotificationService service = null; ! /** Description of the Field */ ! protected JTable table = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(NotificationServiceProvider.class); ! /** Description of the Field */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.jmx.browser.Resources"); ! ! ! /** Constructor for the ConnectionServiceProvider object */ ! public NotificationServiceProvider() ! { ! this.service = this; ! } ! ! ! /** ! * Adds a feature to the ObjectName attribute of the NotificationService object ! * ! * @param object The feature to be added to the ObjectName attribute ! */ ! public void addObjectName(ObjectName object) ! { ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! if (this.hasObjectName(object)) ! { ! return; ! } ! ! if (context.hasService(ConnectionService.class)) ! { ! logger.debug("Using service ConnectionService..."); ! try ! { ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! service.getMBeanServer().addNotificationListener(object, this, null, "EJTOOLS JMX BROWSER"); ! this.objectNames.add(object.getCanonicalName()); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation of service ConnectionService", e); ! } ! finally ! { ! context.releaseService(this, this, ConnectionService.class); ! } ! } ! } ! ! ! /** Description of the Method */ ! public void clearAll() ! { ! this.notifications.clear(); ! } ! ! ! /** ! * @return The component value ! */ ! public Component getComponent() ! { ! if (this.table == null) ! { ! this.model = new NotificationServiceProvider.NotificationTableModel(); ! TableModelSorter sorter = new TableModelSorter(this.model); ! this.table = new JTable(sorter); ! sorter.addMouseListenerToHeaderInTable(this.table); ! } ! return this.table; ! } ! ! ! /** ! * Getter for the currentServiceSelectors attribute ! * ! * @param bcs Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @return The currentServiceSelectors value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) ! { ! return (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the service attribute ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @param serviceSelector Description of the Parameter ! * @return The service value ! */ ! public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) ! { ! return this.service; ! } ! ! ! /** ! * Description of the Method ! * ! * @param notification Description of the Parameter ! * @param handback Description of the Parameter ! */ ! public void handleNotification(Notification notification, java.lang.Object handback) ! { ! logger.debug("Notification received (" + handback + ")"); ! this.notifications.push(notification); ! if (this.model != null) ! { ! this.model.fireTableRowsInserted(this.notifications.size(), this.notifications.size()); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param object Description of the Parameter ! * @return Description of the Return Value ! */ ! public boolean hasObjectName(ObjectName object) ! { ! return this.objectNames.contains(object.getCanonicalName()); ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public Collection listAll() ! { ! return this.reverse(notifications); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param service Description of the Parameter ! */ ! public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) { } ! ! ! /** ! * Description of the Method ! * ! * @param object Description of the Parameter ! */ ! public void removeObjectName(ObjectName object) ! { ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! if (!this.hasObjectName(object)) ! { ! return; ! } ! ! if (context.hasService(ConnectionService.class)) ! { ! logger.debug("Using service ConnectionService..."); ! try ! { ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! service.getMBeanServer().removeNotificationListener(object, this); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation of service ConnectionService", e); ! } ! finally ! { ! this.objectNames.remove(object.getCanonicalName()); ! context.releaseService(this, this, ConnectionService.class); ! } ! } ! } ! ! ! /** A unit test for JUnit */ ! public void test() ! { ! for (int i = 0; i < 50; i++) ! { ! Notification n = new Notification("aze", "qsd", 1000); ! this.notifications.add(n); ! } ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{NotificationService.class}; ! } ! ! ! /** ! * Description of the Method ! * ! * @param collection Description of the Parameter ! * @return Description of the Return Value ! * @todo Move elsewhere ! */ ! protected Collection reverse(Collection collection) ! { ! Vector result = new Vector(); ! ! Iterator it = collection.iterator(); ! while (it.hasNext()) ! { ! result.insertElementAt(it.next(), 0); ! } ! ! return result; ! } ! ! ! /** ! * Description of the Class ! * ! * @author letiembl ! * @created 18 septembre 2002 ! * @version $Revision$ ! * @todo I18N ! */ ! private class NotificationTableModel extends AbstractTableModel ! { ! /** Description of the Field */ ! private String COLUMN_MESSAGE = resources.getString("notification.table.column.message"); ! /** Description of the Field */ ! private String COLUMN_SEQUENCE = resources.getString("notification.table.column.sequence"); ! /** Description of the Field */ ! private String COLUMN_SOURCE = resources.getString("notification.table.column.source"); ! /** Description of the Field */ ! private String COLUMN_TIMESTAMP = resources.getString("notification.table.column.timestamp"); ! /** Description of the Field */ ! private String COLUMN_TYPE = resources.getString("notification.table.column.type"); ! ! ! /** ! * @param columnIndex Description of the Parameter ! * @return The columnClass value ! */ ! public Class getColumnClass(int columnIndex) ! { ! switch (columnIndex) ! { ! case 0: ! return Object.class; ! case 1: ! return String.class; ! case 2: ! return String.class; ! case 3: ! return String.class; ! case 4: ! return String.class; ! } ! return Object.class; ! } ! ! ! /** ! * @return The columnCount value ! */ ! public int getColumnCount() ! { ! return 5; ! } ! ! ! /** ! * @param columnIndex Description of the Parameter ! * @return The columnName value ! */ ! public String getColumnName(int columnIndex) ! { ! switch (columnIndex) ! { ! case 0: ! return COLUMN_SOURCE; ! case 1: ! return COLUMN_TIMESTAMP; ! case 2: ! return COLUMN_SEQUENCE; ! case 3: ! return COLUMN_TYPE; ! case 4: ! return COLUMN_MESSAGE; ! } ! return super.getColumnName(columnIndex); ! } ! ! ! /** ! * @return The rowCount value ! */ ! public int getRowCount() ! { ! return NotificationServiceProvider.this.notifications.size(); ! } ! ! ! /** ! * @param rowIndex Description of the Parameter ! * @param columnIndex Description of the Parameter ! * @return The valueAt value ! */ ! public Object getValueAt(int rowIndex, int columnIndex) ! { ! Object o = null; ! if (rowIndex < NotificationServiceProvider.this.notifications.size()) ! { ! Notification notif = (Notification) NotificationServiceProvider.this.notifications.elementAt(rowIndex); ! switch (columnIndex) ! { ! case 0: ! o = notif.getSource(); ! break; ! case 1: ! o = new String("" + notif.getTimeStamp()); ! break; ! case 2: ! o = new String("" + notif.getSequenceNumber()); ! break; ! case 3: ! o = notif.getType(); ! break; ! case 4: ! o = notif.getMessage(); ! break; ! } ! } ! if (o == null) ! { ! o = new String(); ! } ! return o; ! } ! } ! } --- 1,396 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.model.service; ! ! import java.awt.Component; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.beans.beancontext.BeanContextServices; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.ResourceBundle; ! import java.util.Vector; ! ! import javax.management.Notification; ! import javax.management.NotificationListener; ! import javax.management.ObjectName; ! import javax.swing.JTable; ! import javax.swing.table.AbstractTableModel; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! import org.ejtools.swing.table.TableModelSorter; ! import org.ejtools.util.LimitedStack; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class NotificationServiceProvider extends CustomBeanContextServiceProvider implements BeanContextChildComponentProxy, NotificationService, NotificationListener ! { ! /** Description of the Field */ ! protected NotificationTableModel model = null; ! /** Description of the Field */ ! protected LimitedStack notifications = new LimitedStack(500); ! /** Description of the Field */ ! protected Vector objectNames = new Vector(); ! /** Description of the Field */ ! protected NotificationService service = null; ! /** Description of the Field */ ! protected JTable table = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(NotificationServiceProvider.class); ! /** Description of the Field */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.jmx.browser.Resources"); ! ! ! /** Constructor for the ConnectionServiceProvider object */ ! public NotificationServiceProvider() ! { ! this.service = this; ! } ! ! ! /** ! * Adds a feature to the ObjectName attribute of the NotificationService object ! * ! * @param object The feature to be added to the ObjectName attribute ! */ ! public void addObjectName(ObjectName object) ! { ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! if (this.hasObjectName(object)) ! { ! return; ! } ! ! if (context.hasService(ConnectionService.class)) ! { ! logger.debug("Using service ConnectionService..."); ! try ! { ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! service.getMBeanServer().addNotificationListener(object, this, null, "EJTOOLS JMX BROWSER"); ! this.objectNames.add(object.getCanonicalName()); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation of service ConnectionService", e); ! } ! finally ! { ! context.releaseService(this, this, ConnectionService.class); ! } ! } ! } ! ! ! /** Description of the Method */ ! public void clearAll() ! { ! this.notifications.clear(); ! } ! ! ! /** ! * @return The component value ! */ ! public Component getComponent() ! { ! if (this.table == null) ! { ! this.model = new NotificationServiceProvider.NotificationTableModel(); ! TableModelSorter sorter = new TableModelSorter(this.model); ! this.table = new JTable(sorter); ! sorter.addMouseListenerToHeaderInTable(this.table); ! } ! return this.table; ! } ! ! ! /** ! * Getter for the currentServiceSelectors attribute ! * ! * @param bcs Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @return The currentServiceSelectors value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) ! { ! return (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the service attribute ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @param serviceSelector Description of the Parameter ! * @return The service value ! */ ! public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) ! { ! return this.service; ! } ! ! ! /** ! * Description of the Method ! * ! * @param notification Description of the Parameter ! * @param handback Description of the Parameter ! */ ! public void handleNotification(Notification notification, java.lang.Object handback) ! { ! logger.debug("Notification received (" + handback + ")"); ! this.notifications.push(notification); ! if (this.model != null) ! { ! this.model.fireTableRowsInserted(this.notifications.size(), this.notifications.size()); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param object Description of the Parameter ! * @return Description of the Return Value ! */ ! public boolean hasObjectName(ObjectName object) ! { ! return this.objectNames.contains(object.getCanonicalName()); ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public Collection listAll() ! { ! return this.reverse(notifications); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param service Description of the Parameter ! */ ! public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) { } ! ! ! /** ! * Description of the Method ! * ! * @param object Description of the Parameter ! */ ! public void removeObjectName(ObjectName object) ! { ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! if (!this.hasObjectName(object)) ! { ! return; ! } ! ! if (context.hasService(ConnectionService.class)) ! { ! logger.debug("Using service ConnectionService..."); ! try ! { ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! service.getMBeanServer().removeNotificationListener(object, this); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation of service ConnectionService", e); ! } ! finally ! { ! this.objectNames.remove(object.getCanonicalName()); ! context.releaseService(this, this, ConnectionService.class); ! } ! } ! } ! ! ! /** A unit test for JUnit */ ! public void test() ! { ! for (int i = 0; i < 50; i++) ! { ! Notification n = new Notification("aze", "qsd", 1000); ! this.notifications.add(n); ! } ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{NotificationService.class}; ! } ! ! ! /** ! * Description of the Method ! * ! * @param collection Description of the Parameter ! * @return Description of the Return Value ! * @todo Move elsewhere ! */ ! protected Collection reverse(Collection collection) ! { ! Vector result = new Vector(); ! ! Iterator it = collection.iterator(); ! while (it.hasNext()) ! { ! result.insertElementAt(it.next(), 0); ! } ! ! return result; ! } ! ! ! /** ! * Description of the Class ! * ! * @author letiembl ! * @created 18 septembre 2002 ! * @version $Revision$ ! * @todo I18N ! */ ! private class NotificationTableModel extends AbstractTableModel ! { ! /** Description of the Field */ ! private String COLUMN_MESSAGE = resources.getString("notification.table.column.message"); ! /** Description of the Field */ ! private String COLUMN_SEQUENCE = resources.getString("notification.table.column.sequence"); ! /** Description of the Field */ ! private String COLUMN_SOURCE = resources.getString("notification.table.column.source"); ! /** Description of the Field */ ! private String COLUMN_TIMESTAMP = resources.getString("notification.table.column.timestamp"); ! /** Description of the Field */ ! private String COLUMN_TYPE = resources.getString("notification.table.column.type"); ! ! ! /** ! * @param columnIndex Description of the Parameter ! * @return The columnClass value ! */ ! public Class getColumnClass(int columnIndex) ! { ! switch (columnIndex) ! { ! case 0: ! return Object.class; ! case 1: ! return String.class; ! case 2: ! return String.class; ! case 3: ! return String.class; ! case 4: ! return String.class; ! } ! return Object.class; ! } ! ! ! /** ! * @return The columnCount value ! */ ! public int getColumnCount() ! { ! return 5; ! } ! ! ! /** ! * @param columnIndex Description of the Parameter ! * @return The columnName value ! */ ! public String getColumnName(int columnIndex) ! { ! switch (columnIndex) ! { ! case 0: ! return COLUMN_SOURCE; ! case 1: ! return COLUMN_TIMESTAMP; ! case 2: ! return COLUMN_SEQUENCE; ! case 3: ! return COLUMN_TYPE; ! ... [truncated message content] |