You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2003/11/06 20:44:28 UTC

cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/management NotificationType.java

dain        2003/11/06 11:44:28

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/management
                        NotificationType.java
  Log:
  Added a filter that only catches state change events.
  
  Revision  Changes    Path
  1.2       +22 -1     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/management/NotificationType.java
  
  Index: NotificationType.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/management/NotificationType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NotificationType.java	8 Sep 2003 04:38:34 -0000	1.1
  +++ NotificationType.java	6 Nov 2003 19:44:28 -0000	1.2
  @@ -143,4 +143,25 @@
               return false;
           }
       }
  +
  +    /**
  +     * A notification filter which only lets all J2EE state change notifications pass.
  +     * Specifically this is STATE_STARTING, STATE_RUNNING, STATE_STOPPING, STATE_STOPPED
  +     * and STATE_FAILED.
  +     */
  +    public static final NotificationFilter STATE_CHANGE_FILTER = new J2EEStateChangeFilter();
  +
  +    private static final class J2EEStateChangeFilter implements NotificationFilter {
  +        private J2EEStateChangeFilter() {
  +        }
  +
  +        public boolean isNotificationEnabled(Notification notification) {
  +            String type = notification.getType();
  +            return STATE_STARTING.equals(type) ||
  +                    STATE_RUNNING.equals(type) ||
  +                    STATE_STOPPING.equals(type) ||
  +                    STATE_STOPPED.equals(type) ||
  +                    STATE_FAILED.equals(type);
  +        }
  +    }
   }