Package javax.management

Examples of javax.management.AttributeChangeNotification


    assertSame("The 'source' property of the Notification is not being set to the ObjectName of the associated MBean.", objectName, mbean.getActualNotification().getSource());
  }

  public void testSendAttributeChangeNotification() throws Exception {
    StubSpringModelMBean mbean = new StubSpringModelMBean();
    Notification notification = new AttributeChangeNotification(mbean, 1872, System.currentTimeMillis(), "Shall we break for some tea?", "agree", "java.lang.Boolean", Boolean.FALSE, Boolean.TRUE);
    ObjectName objectName = createObjectName();

    NotificationPublisher publisher = new ModelMBeanNotificationPublisher(mbean, objectName, mbean);
    publisher.sendNotification(notification);
View Full Code Here


    assertSame("The 'source' property of the Notification is not being set to the ObjectName of the associated MBean.", objectName, mbean.getActualNotification().getSource());
  }

  public void testSendAttributeChangeNotificationWhereSourceIsNotTheManagedResource() throws Exception {
    StubSpringModelMBean mbean = new StubSpringModelMBean();
    Notification notification = new AttributeChangeNotification(this, 1872, System.currentTimeMillis(), "Shall we break for some tea?", "agree", "java.lang.Boolean", Boolean.FALSE, Boolean.TRUE);
    ObjectName objectName = createObjectName();

    NotificationPublisher publisher = new ModelMBeanNotificationPublisher(mbean, objectName, mbean);
    publisher.sendNotification(notification);
View Full Code Here

    NotificationListenerBean listenerBean = new NotificationListenerBean();
    listenerBean.setNotificationListener(listener);
    listenerBean.setNotificationFilter(new NotificationFilter() {
      public boolean isNotificationEnabled(Notification notification) {
        if (notification instanceof AttributeChangeNotification) {
          AttributeChangeNotification changeNotification = (AttributeChangeNotification) notification;
          return "Name".equals(changeNotification.getAttributeName());
        }
        else {
          return false;
        }
      }
View Full Code Here

    private Map attributeHandbacks = new HashMap();

    public void handleNotification(Notification notification, Object handback) {
      if (notification instanceof AttributeChangeNotification) {
        AttributeChangeNotification attNotification = (AttributeChangeNotification) notification;
        String attributeName = attNotification.getAttributeName();

        Integer currentCount = (Integer) this.attributeCounts.get(attributeName);

        if (currentCount != null) {
          int count = currentCount.intValue() + 1;
View Full Code Here

        assertEquals(9, resolvedData.getBundleId());
        assertEquals("file:/location", resolvedData.getLocation());
        assertEquals(BundleEvent.RESOLVED, resolvedData.getEventType());

        assertEquals(1, attributeChanges.size());
        AttributeChangeNotification ac = attributeChanges.get(0);
        assertEquals("BundleIds", ac.getAttributeName());
        assertEquals(0, ((long [])ac.getOldValue()).length);
        assertEquals(1, ((long [])ac.getNewValue()).length);
        assertEquals(9L, ((long [])ac.getNewValue())[0]);
    }
View Full Code Here

                            final Notification notification = new Notification(EVENT, OBJECTNAME,
                                    notificationSequenceNumber.getAndIncrement());
                            notification.setUserData(new BundleEventData(event).toCompositeData());

                            // also send notifications to the bundleIDs attribute listeners, if a bundle was added or removed
                            final AttributeChangeNotification attributeChangeNotification =
                                    getAttributeChangeNotification(event);

                            eventDispatcher.submit(new Runnable() {
                                public void run() {
                                    sendNotification(notification);
View Full Code Here

            long[] newIDs = new long[newList.size()];
            for (int i = 0; i < newIDs.length; i++) {
                newIDs[i] = newList.get(i);
            }

            return new AttributeChangeNotification(OBJECTNAME, attributeChangeNotificationSequenceNumber.getAndIncrement(),
                    System.currentTimeMillis(), "BundleIds changed", "BundleIds", "Array of long", oldIDs, newIDs);
        default:
            return null;
        }
    }
View Full Code Here

                            final Notification notification = new Notification(EVENT, OBJECTNAME,
                                    notificationSequenceNumber.getAndIncrement());
                            notification.setUserData(new ServiceEventData(serviceevent).toCompositeData());

                            // also send notifications to the serviceIDs attribute listeners, if a service was added or removed
                            final AttributeChangeNotification attributeChangeNotification =
                                    getAttributeChangeNotification(serviceevent);

                            eventDispatcher.submit(new Runnable() {
                                public void run() {
                                    sendNotification(notification);
View Full Code Here

            long[] newIDs = new long[newList.size()];
            for (int i = 0; i < newIDs.length; i++) {
                newIDs[i] = newList.get(i);
            }

            return new AttributeChangeNotification(OBJECTNAME, attributeChangeNotificationSequenceNumber.getAndIncrement(),
                    System.currentTimeMillis(), "ServiceIds changed", "ServiceIds", "Array of long", oldIDs, newIDs);
        default:
            return null;
        }
    }
View Full Code Here

        assertEquals("bundle", data.get(BUNDLE_SYMBOLIC_NAME));
        assertArrayEquals(new String[] {"org.apache.aries.jmx.Mock" }, (String[]) data.get(OBJECT_CLASS));
        assertEquals(ServiceEvent.MODIFIED, data.get(EVENT));

        assertEquals(1, attributeChanges.size());
        AttributeChangeNotification ac = attributeChanges.get(0);
        assertEquals("ServiceIds", ac.getAttributeName());
        assertEquals(0, ((long [])ac.getOldValue()).length);
        assertEquals(1, ((long [])ac.getNewValue()).length);
        assertEquals(44L, ((long [])ac.getNewValue())[0]);
    }
View Full Code Here

TOP

Related Classes of javax.management.AttributeChangeNotification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.