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

How to use
Notification
in
javax.management

Best Java code snippets using javax.management.Notification (Showing top 20 results out of 2,331)

Refine searchRefine arrow

  • NotificationManager
  • Intent
  • NotificationBroadcasterSupport
  • AtomicLong
  • Context
  • StandardContext
  • Context
origin: apache/geode

Object notifSource = notification.getSource();
if (AdminDistributedSystemJmxImpl.NOTIF_MEMBER_JOINED.equals(notification.getType())) {
 ObjectName source = (ObjectName) notifSource;
notification = new Notification(notification.getType(), notifSource,
  notificationSequenceNumber.addAndGet(1L), notification.getTimeStamp(),
  notification.getMessage());
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: quartz-scheduler/quartz

/**
 * sendNotification
 * 
 * @param eventType
 * @param data
 * @param msg
 */
public void sendNotification(String eventType, Object data, String msg) {
  Notification notif = new Notification(eventType, this, sequenceNumber
      .incrementAndGet(), System.currentTimeMillis(), msg);
  if (data != null) {
    notif.setUserData(data);
  }
  emitter.sendNotification(notif);
}
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: stackoverflow.com

 NotificationManager notificationManager =
  (NotificationManager) getSystemService(Service.NOTIFICATION_SERVICE);
Notification notification = new Notification(/* your notification */);
PendingIntent pendingIntent = /* your intent */;
notification.setLatestEventInfo(this, /* your content */, pendingIntent);
notificationManager.notify(/* id */, notification);
origin: log4j/log4j

public
void handleNotification(Notification notification, Object handback) {
 cat.debug("Received notification: "+notification.getType());
 registerAppenderMBean((Appender) notification.getUserData() );
}
origin: stackoverflow.com

 NotificationManager nm = (NotificationManager) getSystemService(context.NOTIFICATION_SERVICE);
Notification notification = new Notification();
notification.flag = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;

Intent nIntent = new Intent();
nIntent = getPreviousIntent();

PendingIntent pi = PendingIntent.getActivity(this, 0, nIntent, 0);
notification.setLatestEventInfo(getContext(), "some Title", "some text", pi);
nm.notify(0,notification);
origin: stackoverflow.com

 private static void generateNotification(Context context, String message) {
  int icon = R.drawable.ic_stat_gcm;
  long when = System.currentTimeMillis();

  NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  Notification notification = new Notification(icon, message, when);

  String title = context.getString(R.string.app_name);
  Intent notificationIntent = new Intent(context, MainActivity.class);
  // set intent so it does not start a new activity
  notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
  PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
  notification.setLatestEventInfo(context, title, message, intent);
  notification.flags |= Notification.FLAG_AUTO_CANCEL;

  notificationManager.notify(0, notification);
}
origin: stackoverflow.com

private static void generateNotification(Context context ,String name,String number) {
int icon = R.drawable.ic_launcher;
 long when = System.currentTimeMillis();
 Intent notificationIntent = null;
 @SuppressWarnings("deprecation")
 Notification notification = new Notification(icon, "", when);
 NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
 notificationIntent = new Intent(Intent.ACTION_DIAL);
 notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 String p = "tel:" + number.trim();
 notificationIntent.setData(Uri.parse(p));
 PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
 notification.setLatestEventInfo(context, "uPosi", "Callback Reminder from "+name, intent);
 // notification.flags |= Notification.FLAG_AUTO_CANCEL;  
 notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE | Notification.FLAG_AUTO_CANCEL;
 notification.sound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + context.getPackageName() + "/raw/notification");
 notification.defaults |= Notification.DEFAULT_VIBRATE;        
 notificationManager.notify(generateUniqueId(), notification);
origin: stackoverflow.com

Notification notification = new Notification(icon, "Custom Notification", when);
notification.contentView = contentView;
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.contentIntent = contentIntent;
mNotificationManager.notify(1, notification);
origin: camunda/camunda-bpm-platform

protected void notifyJmx(String query, String type) {
  try {
    long sequence = notifySequence.incrementAndGet();
    if (isNotifyPool()) {
      if (this.pool!=null && this.pool.getJmxPool()!=null) {
        this.pool.getJmxPool().notify(type, query);
      }
    } else {
      if (notifier!=null) {
        Notification notification =
          new Notification(type,
                   this,
                   sequence,
                   System.currentTimeMillis(),
                   query);
        notifier.sendNotification(notification);
      }
    }
  } catch (RuntimeOperationsException e) {
    if (log.isDebugEnabled()) {
      log.debug("Unable to send failed query notification.",e);
    }
  }
}
origin: org.terracotta/terracotta-ee

public void broadcastLogEvent(final String event, final String[] throwableStringRep) {
 Notification notif = new Notification(LOGGING_EVENT_TYPE, this, sequenceNumber.incrementAndGet(),
                       System.currentTimeMillis(), event);
 notif.setUserData(throwableStringRep);
 sendNotification(notif);
 notif = new Notification(notif.getType(), getClass().getName(), notif.getSequenceNumber(), notif.getTimeStamp(),
              notif.getMessage());
 notif.setUserData(throwableStringRep);
 tcLoggingHistoryProvider.push(notif);
}
origin: stackoverflow.com

Notification notification = new Notification(icon, message, when);
String title = context.getString(R.string.app_name);
Intent notificationIntent = new Intent(context, SnapClientActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notification.vibrate = new long[] { 500, 500 };
notification.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
  Notification.FLAG_SHOW_LIGHTS;
notificationManager.notify(0, notification);
origin: stackoverflow.com

int notificationId = Integer.parseInt(intent.getData().getSchemeSpecificPart());
db = context.openOrCreateDatabase(DATABASE_NAME,
    SQLiteDatabase.CREATE_IF_NECESSARY, null);
    .getSystemService(Context.NOTIFICATION_SERVICE);
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText,
    contentIntent);
notification.defaults |= Notification.DEFAULT_SOUND;
mNotificationManager.notify(1234, notification);
origin: stackoverflow.com

int icon = R.drawable.notification_icon;        // icon from resources  
 CharSequence tickerText = "Hello";              // ticker-text  
 long when = System.currentTimeMillis();         // notification time  
 Context context = getApplicationContext();      // application Context  
 CharSequence contentTitle = "My notification";  // expanded message title  
 CharSequence contentText = "Hello World!";      // expanded message text  
 Intent notificationIntent = new Intent(this, MyClass.class);  
 PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);  
 // the next two lines initialize the Notification, using the configurations above  
 Notification notification = new Notification(icon, tickerText, when);  
 notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
origin: stackoverflow.com

 @Override
public void onReceive(Context context, Intent intent) {
  NotificationManager nm = (NotificationManager);
  context.getSystemService(Context.NOTIFICATION_SERVICE);
  Notification notification = new Notification();
  notification.tickerText = "10 Minutes past";
  nm.notify(0, notification);
}
origin: org.apache.cassandra/cassandra-all

@Override
public void progress(String tag, ProgressEvent event)
{
  if (tag.startsWith("repair:"))
  {
    Optional<int[]> legacyUserData = getLegacyUserdata(tag, event);
    if (legacyUserData.isPresent())
    {
      Notification jmxNotification = new Notification("repair", jmxObjectName, notificationSerialNumber.incrementAndGet(), event.getMessage());
      jmxNotification.setUserData(legacyUserData.get());
      broadcaster.sendNotification(jmxNotification);
    }
  }
}
origin: stackoverflow.com

private  void generateNotification(Context context, String message ) {
   int icon = R.drawable.icon;
   long when = System.currentTimeMillis();
   NotificationManager notificationManager = (NotificationManager)
       context.getSystemService(Context.NOTIFICATION_SERVICE);
   Notification notification = new Notification(icon, message);
   String title = context.getString(R.string.app_name);
   Intent notificationIntent;      
   notificationIntent = new Intent(context, ActivityName.class);
   notificationIntent.putExtra("From", "notifyFrag");
   notificationIntent .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
       Intent.FLAG_ACTIVITY_SINGLE_TOP);
   PendingIntent intent =
       PendingIntent.getActivity(context, 0, notificationIntent, 0);
   notificationIntent .setLatestEventInfo(context, title, message, intent);
   notification.flags |= Notification.FLAG_AUTO_CANCEL;
   notification.defaults |= Notification.DEFAULT_VIBRATE;
   notificationManager.notify(0, notification);
origin: org.apache.tomcat/tomcat-catalina

@Override
protected void initInternal() throws LifecycleException {
  super.initInternal();
  // Register the naming resources
  if (namingResources != null) {
    namingResources.init();
  }
  // Send j2ee.object.created notification
  if (this.getObjectName() != null) {
    Notification notification = new Notification("j2ee.object.created",
        this.getObjectName(), sequenceNumber.getAndIncrement());
    broadcaster.sendNotification(notification);
  }
}
origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
protected void initInternal() throws LifecycleException {
  super.initInternal();
  
  if (processTlds) {
    this.addLifecycleListener(new TldConfig());
  }
  // Register the naming resources
  if (namingResources != null) {
    onameNamingResources = register(namingResources,
        "type=NamingResources," + getObjectNameKeyProperties());
  }
  // Send j2ee.object.created notification 
  if (this.getObjectName() != null) {
    Notification notification = new Notification("j2ee.object.created",
        this.getObjectName(), sequenceNumber.getAndIncrement());
    broadcaster.sendNotification(notification);
  }
}
javax.managementNotification

Most used methods

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

Popular in Java

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • getSharedPreferences (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • IsNull (org.hamcrest.core)
    Is the value null?
  • CodeWhisperer alternatives
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