Tabnine Logo
Notification.getSource
Code IndexAdd Tabnine to your IDE (free)

How to use
getSource
method
in
javax.management.Notification

Best Java code snippets using javax.management.Notification.getSource (Showing top 20 results out of 333)

origin: spring-projects/spring-framework

/**
 * Replaces the notification source if necessary to do so.
 * From the {@link Notification javadoc}:
 * <i>"It is strongly recommended that notification senders use the object name
 * rather than a reference to the MBean object as the source."</i>
 * @param notification the {@link Notification} whose
 * {@link javax.management.Notification#getSource()} might need massaging
 */
private void replaceNotificationSourceIfNecessary(Notification notification) {
  if (notification.getSource() == null || notification.getSource().equals(this.managedResource)) {
    notification.setSource(this.objectName);
  }
}
origin: org.springframework/spring-context

/**
 * Replaces the notification source if necessary to do so.
 * From the {@link Notification javadoc}:
 * <i>"It is strongly recommended that notification senders use the object name
 * rather than a reference to the MBean object as the source."</i>
 * @param notification the {@link Notification} whose
 * {@link javax.management.Notification#getSource()} might need massaging
 */
private void replaceNotificationSourceIfNecessary(Notification notification) {
  if (notification.getSource() == null || notification.getSource().equals(this.managedResource)) {
    notification.setSource(this.objectName);
  }
}
origin: groovy/groovy-core

  private static Map buildOperationNotificationPacket(Notification note) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("event", note.getType());
    result.put("source", note.getSource());
    result.put("sequenceNumber", note.getSequenceNumber());
    result.put("timeStamp", note.getTimeStamp());
    result.put("data", note.getUserData());
    return result;
  }
}
origin: apache/geode

Object notifSource = notification.getSource();
if (AdminDistributedSystemJmxImpl.NOTIF_MEMBER_JOINED.equals(notification.getType())) {
 ObjectName source = (ObjectName) notifSource;
origin: spring-projects/spring-framework

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);
  assertNotNull(mbean.getActualNotification());
  assertTrue(mbean.getActualNotification() instanceof AttributeChangeNotification);
  assertSame("The exact same Notification is not being passed through from the publisher to the mbean.", notification, mbean.getActualNotification());
  assertSame("The 'source' property of the Notification is *wrongly* being set to the ObjectName of the associated MBean.", this, mbean.getActualNotification().getSource());
}
origin: spring-projects/spring-framework

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);
  assertNotNull(mbean.getActualNotification());
  assertTrue(mbean.getActualNotification() instanceof AttributeChangeNotification);
  assertSame("The exact same Notification is not being passed through from the publisher to the mbean.", notification, mbean.getActualNotification());
  assertSame("The 'source' property of the Notification is not being set to the ObjectName of the associated MBean.", objectName, mbean.getActualNotification().getSource());
}
origin: spring-projects/spring-framework

public void testSendVanillaNotification() throws Exception {
  StubSpringModelMBean mbean = new StubSpringModelMBean();
  Notification notification = new Notification("network.alarm.router", mbean, 1872);
  ObjectName objectName = createObjectName();
  NotificationPublisher publisher = new ModelMBeanNotificationPublisher(mbean, objectName, mbean);
  publisher.sendNotification(notification);
  assertNotNull(mbean.getActualNotification());
  assertSame("The exact same Notification is not being passed through from the publisher to the mbean.", notification, mbean.getActualNotification());
  assertSame("The 'source' property of the Notification is not being set to the ObjectName of the associated MBean.", objectName, mbean.getActualNotification().getSource());
}
origin: spring-projects/spring-integration

private void verifyReceipt(PollableChannel channel, String beanName) {
  Message<?> message = channel.receive(1000);
  assertNotNull(message);
  assertEquals(Notification.class, message.getPayload().getClass());
  assertEquals("ABC", ((Notification) message.getPayload()).getMessage());
  assertTrue(((String) ((Notification) message.getPayload()).getSource()).endsWith(beanName));
}
origin: spring-projects/spring-integration

@Test
public void simplePublish() {
  MessageHandler handler = context.getBean("testPublisher", MessageHandler.class);
  assertEquals(0, this.listener.notifications.size());
  handler.handleMessage(new GenericMessage<String>("foo"));
  assertEquals(1, this.listener.notifications.size());
  Notification notification = this.listener.notifications.get(0);
  assertEquals(this.publisherObjectName, notification.getSource());
  assertEquals("foo", notification.getMessage());
  assertEquals("test.type", notification.getType());
}
origin: spring-projects/spring-integration

@Test
public void simpleNotification() {
  QueueChannel outputChannel = new QueueChannel();
  NotificationListeningMessageProducer adapter = new NotificationListeningMessageProducer();
  adapter.setServer(this.server);
  adapter.setObjectName(this.objectName);
  adapter.setOutputChannel(outputChannel);
  adapter.setBeanFactory(mock(BeanFactory.class));
  adapter.afterPropertiesSet();
  adapter.start();
  adapter.onApplicationEvent(new ContextRefreshedEvent(Mockito.mock(ApplicationContext.class)));
  this.numberHolder.publish("foo");
  Message<?> message = outputChannel.receive(0);
  assertNotNull(message);
  assertTrue(message.getPayload() instanceof Notification);
  Notification notification = (Notification) message.getPayload();
  assertEquals("foo", notification.getMessage());
  assertEquals(objectName, notification.getSource());
  assertNull(message.getHeaders().get(JmxHeaders.NOTIFICATION_HANDBACK));
}
origin: spring-projects/spring-integration

@Test
public void notificationWithHandback() {
  QueueChannel outputChannel = new QueueChannel();
  NotificationListeningMessageProducer adapter = new NotificationListeningMessageProducer();
  adapter.setServer(this.server);
  adapter.setObjectName(this.objectName);
  adapter.setOutputChannel(outputChannel);
  Integer handback = 123;
  adapter.setHandback(handback);
  adapter.setBeanFactory(mock(BeanFactory.class));
  adapter.afterPropertiesSet();
  adapter.start();
  adapter.onApplicationEvent(new ContextRefreshedEvent(Mockito.mock(ApplicationContext.class)));
  this.numberHolder.publish("foo");
  Message<?> message = outputChannel.receive(0);
  assertNotNull(message);
  assertTrue(message.getPayload() instanceof Notification);
  Notification notification = (Notification) message.getPayload();
  assertEquals("foo", notification.getMessage());
  assertEquals(objectName, notification.getSource());
  assertEquals(handback, message.getHeaders().get(JmxHeaders.NOTIFICATION_HANDBACK));
}
origin: org.jboss.jbossas/jboss-as-connector

 public boolean isNotificationEnabled(Notification n)
 {
   return RARDeployment.MCF_ATTRIBUTE_CHANGED_NOTIFICATION.equals(n.getType())
      && managedConnectionFactoryName.equals(n.getSource());
 }
},
origin: io.snappydata/gemfire-hydra-tests

public String toString(){
 StringBuilder sb = new StringBuilder();
 sb.append("Recorded Notif [ Type ").append(jmxNotificaiton.getType())
 .append(" source : ").append(jmxNotificaiton.getSource())
 .append(" message : ").append(jmxNotificaiton.getMessage())
 .append(" userData : ").append(jmxNotificaiton.getUserData())
 .append(" timestamp : ").append(jmxNotificaiton.getTimeStamp())
 .append(" ]");
 return sb.toString();
}
origin: org.cyclopsgroup/jmxterm

  @Override
  public void handleNotification(Notification notification, Object handback) {
    Session session = getSession();
    StringBuilder sb = new StringBuilder("notification received: ");
    sb.append("timestamp=").append(notification.getTimeStamp());
    sb.append(",class=").append(notification.getClass().getName());
    sb.append(",source=").append(notification.getSource());
    sb.append(",type=").append(notification.getType());
    sb.append(",message=").append(notification.getMessage());
    session.output.println(sb.toString());
  }
}
origin: org.kohsuke.droovy/groovy

  private static Map buildOperationNotificationPacket(Notification note) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("event", note.getType());
    result.put("source", note.getSource());
    result.put("sequenceNumber", note.getSequenceNumber());
    result.put("timeStamp", note.getTimeStamp());
    result.put("data", note.getUserData());
    return result;
  }
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

  private static Map buildOperationNotificationPacket(Notification note) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("event", note.getType());
    result.put("source", note.getSource());
    result.put("sequenceNumber", note.getSequenceNumber());
    result.put("timeStamp", note.getTimeStamp());
    result.put("data", note.getUserData());
    return result;
  }
}
origin: org.codehaus.groovy/groovy-jmx

  private static Map buildOperationNotificationPacket(Notification note) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("event", note.getType());
    result.put("source", note.getSource());
    result.put("sequenceNumber", note.getSequenceNumber());
    result.put("timeStamp", note.getTimeStamp());
    result.put("data", note.getUserData());
    return result;
  }
}
origin: org.codehaus.groovy/groovy-jdk14

  private static Map buildOperationNotificationPacket(Notification note) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("event", note.getType());
    result.put("source", note.getSource());
    result.put("sequenceNumber", note.getSequenceNumber());
    result.put("timeStamp", note.getTimeStamp());
    result.put("data", note.getUserData());
    return result;
  }
}
origin: io.snappydata/gemfire-hydra-tests

private void printJMXNotification(Notification notification, Object handback) {
 StringBuilder sb = new StringBuilder();
 sb.append("JMXNotificationListener(" + prefix + ") : Notification [ type=").append(notification.getType()).append(", message=")
   .append(notification.getMessage())
   .append(", source=").append(notification.getSource())
   .append(", seqNo=").append(notification.getSequenceNumber())
   .append(", timestamp=").append(notification.getTimeStamp())
   .append(", data=").append(ObjectToString(notification.getUserData()))
   .append(", handbackObject=").append(ObjectToString(handback)).append(" ]");
 logInfo(sb.toString());
}
origin: net.open-esb.core/jbi-admin-common

/**
 * Handle the Event Notification
 * @param the notification
 * @param the handback object
 *  
 * @see javax.management.NotificationListener#handleNotification(javax.management.Notification, java.lang.Object)
 */
public void handleNotification(Notification notification, Object handback) {
  EventNotificationImpl event = new EventNotificationImpl(notification.getSource());
  event.setNotification(notification);
  executorService.execute(new NotificationSender(this.listeners, event));
}

javax.managementNotificationgetSource

Popular methods of Notification

  • getType
  • <init>
  • getUserData
  • setUserData
  • getMessage
  • getTimeStamp
  • getSequenceNumber
  • setSource
  • toString
  • setSequenceNumber
  • getAttachments
  • getClass
  • getAttachments,
  • getClass,
  • getFlag,
  • getIntent,
  • getTitle,
  • setCreatedd_time,
  • setId,
  • setLatestEventInfo,
  • setLink

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSharedPreferences (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Notification (javax.management)
  • JPanel (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now