Source Code Cross Referenced for AttributeChangeNotificationFilter.java in  » JMX » jfoxmx » javax » management » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » jfoxmx » javax.management 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* JFox, the OpenSource J2EE Application Server
002:         *
003:         * Copyright (C) 2002 huihoo.org
004:         * Distributable under GNU LGPL license
005:         * See the GNU Lesser General Public License for more details.
006:         */
007:
008:        package javax.management;
009:
010:        import java.io.Serializable;
011:        import java.util.Vector;
012:        import java.util.ArrayList;
013:        import java.util.List;
014:        import java.util.Iterator;
015:
016:        /**
017:         * This class implements of the {@link javax.management.NotificationFilter NotificationFilter}
018:         * interface for the {@link javax.management.AttributeChangeNotification attribute change notification}.
019:         * The filtering is performed on the name of the observed attribute.
020:         * <P>
021:         * It manages a list of enabled attribute names.
022:         * A method allows users to enable/disable as many attribute names as required.
023:         *
024:         * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
025:         */
026:
027:        public class AttributeChangeNotificationFilter implements 
028:                NotificationFilter, Serializable {
029:
030:            /**
031:             * List that contains the enabled attribute names.
032:             * The default value is an empty vector.
033:             */
034:            private List enabledAttributes = new ArrayList();
035:
036:            /**
037:             * Invoked before sending the specified notification to the listener.
038:             * <BR>This filter compares the attribute name of the specified attribute change notification
039:             * with each enabled attribute name.
040:             * If the attribute name equals one of the enabled attribute names,
041:             * the notification must be sent to the listener and this method returns <CODE>true</CODE>.
042:             *
043:             * @param notification The attribute change notification to be sent.
044:             * @return <CODE>true</CODE> if the notification has to be sent to the listener, <CODE>false</CODE> otherwise.
045:             */
046:            public synchronized boolean isNotificationEnabled(
047:                    Notification notification) {
048:
049:                String type = notification.getType();
050:
051:                if ((type == null)
052:                        || (type
053:                                .equals(AttributeChangeNotification.ATTRIBUTE_CHANGE) == false)
054:                        || (!(notification instanceof  AttributeChangeNotification))) {
055:                    return false;
056:                }
057:
058:                String attributeName = ((AttributeChangeNotification) notification)
059:                        .getAttributeName();
060:                for (Iterator iter = enabledAttributes.iterator(); iter
061:                        .hasNext();) {
062:                    String name = (String) iter.next();
063:                    if (attributeName.equals(name)) {
064:                        return true;
065:                    }
066:                }
067:
068:                return false;
069:            }
070:
071:            /**
072:             * Enables all the attribute change notifications the attribute name of which equals
073:             * the specified name to be sent to the listener.
074:             * <BR>If the specified name is already in the list of enabled attribute names,
075:             * this method has no effect.
076:             *
077:             * @param name The attribute name.
078:             * @exception java.lang.IllegalArgumentException The attribute name parameter is null.
079:             */
080:            public synchronized void enableAttribute(String name)
081:                    throws java.lang.IllegalArgumentException {
082:
083:                if (name == null) {
084:                    throw new java.lang.IllegalArgumentException(
085:                            "The name cannot be null.");
086:                }
087:                if (!enabledAttributes.contains(name)) {
088:                    enabledAttributes.add(name);
089:                }
090:            }
091:
092:            /**
093:             * Disables all the attribute change notifications the attribute name of which equals
094:             * the specified attribute name to be sent to the listener.
095:             * <BR>If the specified name is not in the list of enabled attribute names,
096:             * this method has no effect.
097:             *
098:             * @param name The attribute name.
099:             */
100:            public synchronized void disableAttribute(String name) {
101:                enabledAttributes.remove(name);
102:            }
103:
104:            /**
105:             * Disables all the attribute names.
106:             */
107:            public synchronized void disableAllAttributes() {
108:                enabledAttributes.clear();
109:            }
110:
111:            /**
112:             * Gets all the enabled attribute names for this filter.
113:             *
114:             * @return The list containing all the enabled attribute names.
115:             */
116:            public synchronized Vector getEnabledAttributes() {
117:                return new Vector(enabledAttributes);
118:            }
119:
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.