Example usage for javax.management MBeanNotificationInfo MBeanNotificationInfo

List of usage examples for javax.management MBeanNotificationInfo MBeanNotificationInfo

Introduction

In this page you can find the example usage for javax.management MBeanNotificationInfo MBeanNotificationInfo.

Prototype

public MBeanNotificationInfo(String[] notifTypes, String name, String description) 

Source Link

Document

Constructs an MBeanNotificationInfo object.

Usage

From source file:co.paralleluniverse.common.monitoring.PeriodicMonitor.java

@Override
public MBeanNotificationInfo[] getNotificationInfo() {
    String[] types = new String[] { AttributeChangeNotification.ATTRIBUTE_CHANGE };
    String _name = AttributeChangeNotification.class.getName();
    String description = "An attribute of this MBean has changed";
    MBeanNotificationInfo info = new MBeanNotificationInfo(types, _name, description);
    return new MBeanNotificationInfo[] { info };
}

From source file:com.cisco.oss.foundation.monitoring.ServerInfo.java

@Override
public MBeanNotificationInfo[] getNotificationInfo() {
    String[] types = new String[] { AttributeChangeNotification.ATTRIBUTE_CHANGE };
    String name = AttributeChangeNotification.class.getName();
    String description = "An attribute of this MBean has changed";
    MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);

    return new MBeanNotificationInfo[] { info };
}

From source file:com.example.Hello.java

@Override
public MBeanNotificationInfo[] getNotificationInfo() {
    String[] types = new String[] { AttributeChangeNotification.ATTRIBUTE_CHANGE };
    String name = AttributeChangeNotification.class.getName();
    String description = "An attribute of this MBean has changed";
    MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);
    return new MBeanNotificationInfo[] { info };
}

From source file:net.sbbi.upnp.jmx.UPNPDiscovery.java

/**
 * Main constructor, will discover all devices types
 * @param discoveryTimeout devices discoverytimeout in MS, 0 for default timeout, 
 *                         increase this value if devices are not responding
 * @param notifySSDPEvents boolean to indicate if the MBean should broadcast JMX UPNPDiscoveryNotifications when an matching
 *                         device is joining or leaving the network.
 * @param registerChildDevices when set to true, discovered device child devices services will also be exposed as
 *                             UPNPServiceMBean objects
 *///from  ww w. j a  v a 2  s  . c o  m
public UPNPDiscovery(int discoveryTimeout, boolean notifySSDPEvents, boolean registerChildDevices) {
    this.registerChildDevices = registerChildDevices;
    this.notifySSDPEvents = notifySSDPEvents;
    this.discoveryTimeout = discoveryTimeout;
    if (this.discoveryTimeout == 0) {
        this.discoveryTimeout = Discovery.DEFAULT_TIMEOUT;
    }
    notifier = new NotificationBroadcasterSupport();
    registeredBeansPerUDN = new HashMap();
    String[] types = new String[] { SSDP_ALIVE_NOTIFICATION, SSDP_BYEBYE_NOTIFICATION };
    notifInfo = new MBeanNotificationInfo[] {
            new MBeanNotificationInfo(types, Notification.class.getName(), "SSDP UPNP events notifications") };
    searchTargets = new HashSet();
    searchTargets.add(Discovery.ROOT_DEVICES);
}

From source file:com.adaptris.core.runtime.ChannelManager.java

@Override
public MBeanNotificationInfo[] getNotificationInfo() {
    MBeanNotificationInfo adapterLifecycle = new MBeanNotificationInfo(
            new String[] { NOTIF_TYPE_CHANNEL_LIFECYCLE, NOTIF_TYPE_CHANNEL_CONFIG },
            Notification.class.getName(), "Channel Notifications");

    return new MBeanNotificationInfo[] { adapterLifecycle };
}

From source file:com.adaptris.core.runtime.WorkflowManager.java

@Override
public MBeanNotificationInfo[] getNotificationInfo() {
    MBeanNotificationInfo adapterLifecycle = new MBeanNotificationInfo(
            new String[] { NOTIF_TYPE_WORKFLOW_LIFECYCLE, NOTIF_TYPE_WORKFLOW_CONFIG },
            Notification.class.getName(), "Workflow Notifications");

    return new MBeanNotificationInfo[] { adapterLifecycle };
}

From source file:com.adaptris.core.runtime.AdapterManager.java

@Override
public MBeanNotificationInfo[] getNotificationInfo() {
    MBeanNotificationInfo adapterLifecycle = new MBeanNotificationInfo(
            new String[] { NOTIF_TYPE_ADAPTER_LIFECYCLE, NOTIF_TYPE_ADAPTER_CONFIG },
            Notification.class.getName(), "Adapter Notifications");

    return new MBeanNotificationInfo[] { adapterLifecycle };
}

From source file:com.cyberway.issue.crawler.admin.CrawlJob.java

/**
 * Build up the MBean info for Heritrix main.
 * @return Return created mbean info instance.
 * @throws InitializationException //from  www  .j  a va 2  s  .c  om
 */
protected OpenMBeanInfoSupport buildMBeanInfo() throws InitializationException {
    // Start adding my attributes.
    List<OpenMBeanAttributeInfo> attributes = new ArrayList<OpenMBeanAttributeInfo>();

    // Attributes.
    attributes.add(new OpenMBeanAttributeInfoSupport(NAME_ATTR, "Crawl job name", SimpleType.STRING, true,
            false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(STATUS_ATTR, "Short basic status message",
            SimpleType.STRING, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(FRONTIER_SHORT_REPORT_ATTR, "Short frontier report",
            SimpleType.STRING, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(THREADS_SHORT_REPORT_ATTR, "Short threads report",
            SimpleType.STRING, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(UID_ATTR, "Crawl job UID", SimpleType.STRING, true, false,
            false));
    attributes.add(new OpenMBeanAttributeInfoSupport(TOTAL_DATA_ATTR, "Total data received", SimpleType.LONG,
            true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(CRAWL_TIME_ATTR, "Crawl time", SimpleType.LONG, true,
            false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(CURRENT_DOC_RATE_ATTR, "Current crawling rate (Docs/sec)",
            SimpleType.DOUBLE, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(CURRENT_KB_RATE_ATTR, "Current crawling rate (Kb/sec)",
            SimpleType.LONG, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(THREAD_COUNT_ATTR, "Active thread count",
            SimpleType.INTEGER, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(DOC_RATE_ATTR, "Crawling rate (Docs/sec)",
            SimpleType.DOUBLE, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(KB_RATE_ATTR, "Current crawling rate (Kb/sec)",
            SimpleType.LONG, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(DOWNLOAD_COUNT_ATTR, "Count of downloaded documents",
            SimpleType.LONG, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(DISCOVERED_COUNT_ATTR, "Count of discovered documents",
            SimpleType.LONG, true, false, false));

    // Add in the crawl order attributes.
    addCrawlOrderAttributes(this.getController().getOrder(), attributes);

    // Add the bdbje attributes.  Convert to open mbean attributes.
    // First do bdbeje setup.  Then add a subset of the bdbje attributes.
    // Keep around the list of names as a convenience for when it comes
    // time to test if attribute is supported.
    Environment env = this.controller.getBdbEnvironment();
    try {
        this.bdbjeMBeanHelper = new JEMBeanHelper(env.getConfig(), env.getHome(), true);
    } catch (DatabaseException e) {
        e.printStackTrace();
        InitializationException ie = new InitializationException(e.getMessage());
        ie.setStackTrace(e.getStackTrace());
        throw ie;
    }
    this.bdbjeAttributeNameList = Arrays.asList(new String[] { JEMBeanHelper.ATT_ENV_HOME,
            JEMBeanHelper.ATT_OPEN, JEMBeanHelper.ATT_IS_READ_ONLY, JEMBeanHelper.ATT_IS_TRANSACTIONAL,
            JEMBeanHelper.ATT_CACHE_SIZE, JEMBeanHelper.ATT_CACHE_PERCENT, JEMBeanHelper.ATT_LOCK_TIMEOUT,
            JEMBeanHelper.ATT_IS_SERIALIZABLE, JEMBeanHelper.ATT_SET_READ_ONLY, });
    addBdbjeAttributes(attributes, this.bdbjeMBeanHelper.getAttributeList(env), this.bdbjeAttributeNameList);

    // Operations.
    List<OpenMBeanOperationInfo> operations = new ArrayList<OpenMBeanOperationInfo>();
    OpenMBeanParameterInfo[] args = new OpenMBeanParameterInfoSupport[3];
    args[0] = new OpenMBeanParameterInfoSupport("url", "URL to add to the frontier", SimpleType.STRING);
    args[1] = new OpenMBeanParameterInfoSupport("forceFetch", "True if URL is to be force fetched",
            SimpleType.BOOLEAN);
    args[2] = new OpenMBeanParameterInfoSupport("seed", "True if URL is a seed", SimpleType.BOOLEAN);
    operations.add(new OpenMBeanOperationInfoSupport(IMPORT_URI_OPER, "Add passed URL to the frontier", args,
            SimpleType.VOID, MBeanOperationInfo.ACTION));

    args = new OpenMBeanParameterInfoSupport[4];
    args[0] = new OpenMBeanParameterInfoSupport("pathOrUrl", "Path or URL to file of URLs", SimpleType.STRING);
    args[1] = new OpenMBeanParameterInfoSupport("style", "Format format:default|crawlLog|recoveryJournal",
            SimpleType.STRING);
    args[2] = new OpenMBeanParameterInfoSupport("forceFetch", "True if URLs are to be force fetched",
            SimpleType.BOOLEAN);
    args[3] = new OpenMBeanParameterInfoSupport("seed", "True if all content are seeds.", SimpleType.BOOLEAN);
    operations.add(new OpenMBeanOperationInfoSupport(IMPORT_URIS_OPER,
            "Add file of passed URLs to the frontier", args, SimpleType.STRING, MBeanOperationInfo.ACTION));

    args = new OpenMBeanParameterInfoSupport[4];
    args[0] = new OpenMBeanParameterInfoSupport("filename", "File to print to", SimpleType.STRING);
    args[1] = new OpenMBeanParameterInfoSupport("regexp", "Regular expression URLs must match",
            SimpleType.STRING);
    args[2] = new OpenMBeanParameterInfoSupport("numberOfMatches", "Maximum number of matches to return",
            SimpleType.INTEGER);
    args[3] = new OpenMBeanParameterInfoSupport("verbose", "Should they be verbose descriptions",
            SimpleType.BOOLEAN);
    operations.add(new OpenMBeanOperationInfoSupport(DUMP_URIS_OPER,
            "Dump pending URIs from frontier to a file", args, SimpleType.VOID, MBeanOperationInfo.ACTION));

    operations.add(new OpenMBeanOperationInfoSupport(PAUSE_OPER, "Pause crawling (noop if already paused)",
            null, SimpleType.VOID, MBeanOperationInfo.ACTION));

    operations.add(new OpenMBeanOperationInfoSupport(RESUME_OPER, "Resume crawling (noop if already resumed)",
            null, SimpleType.VOID, MBeanOperationInfo.ACTION));

    args = new OpenMBeanParameterInfoSupport[1];
    args[0] = new OpenMBeanParameterInfoSupport("name", "Name of report ('all', 'standard', etc.).",
            SimpleType.STRING);
    operations.add(new OpenMBeanOperationInfoSupport(FRONTIER_REPORT_OPER, "Full frontier report", args,
            SimpleType.STRING, MBeanOperationInfo.INFO));

    operations.add(new OpenMBeanOperationInfoSupport(THREADS_REPORT_OPER, "Full thread report", null,
            SimpleType.STRING, MBeanOperationInfo.INFO));

    operations.add(new OpenMBeanOperationInfoSupport(SEEDS_REPORT_OPER, "Seeds report", null, SimpleType.STRING,
            MBeanOperationInfo.INFO));

    operations.add(new OpenMBeanOperationInfoSupport(PROGRESS_STATISTICS_OPER,
            "Progress statistics at time of invocation", null, SimpleType.STRING, MBeanOperationInfo.INFO));

    operations.add(new OpenMBeanOperationInfoSupport(PROGRESS_STATISTICS_LEGEND_OPER,
            "Progress statistics legend", null, SimpleType.STRING, MBeanOperationInfo.INFO));

    operations.add(new OpenMBeanOperationInfoSupport(CHECKPOINT_OPER, "Start a checkpoint", null,
            SimpleType.VOID, MBeanOperationInfo.ACTION));

    // Add bdbje operations. Add subset only. Keep around the list so have
    // it to hand when figuring what operations are supported. Usual actual
    // Strings because not accessible from JEMBeanHelper.
    this.bdbjeOperationsNameList = Arrays.asList(new String[] { "cleanLog", "evictMemory", "checkpoint", "sync",
            "getEnvironmentStatsToString", "getLockStatsToString", "getDatabaseNames", OP_DB_STAT });
    addBdbjeOperations(operations, this.bdbjeMBeanHelper.getOperationList(env), this.bdbjeOperationsNameList);

    // Register notifications
    List<MBeanNotificationInfo> notifications = new ArrayList<MBeanNotificationInfo>();
    notifications.add(new MBeanNotificationInfo(
            new String[] { "crawlStarted", "crawlEnding", "crawlPaused", "crawlResuming", PROG_STATS },
            this.getClass().getName() + ".notifications",
            "CrawlStatusListener events and progress statistics as " + "notifications"));
    MBeanNotificationInfo[] notificationsArray = new MBeanNotificationInfo[notifications.size()];
    notifications.toArray(notificationsArray);

    // Build the info object.
    OpenMBeanAttributeInfoSupport[] attributesArray = new OpenMBeanAttributeInfoSupport[attributes.size()];
    attributes.toArray(attributesArray);
    OpenMBeanOperationInfoSupport[] operationsArray = new OpenMBeanOperationInfoSupport[operations.size()];
    operations.toArray(operationsArray);
    return new OpenMBeanInfoSupport(this.getClass().getName(), "Current Crawl Job as OpenMBean",
            attributesArray, new OpenMBeanConstructorInfoSupport[] {}, operationsArray, notificationsArray);
}

From source file:org.apache.qpid.server.jmx.mbeans.QueueMBean.java

/**
 * returns Notifications sent by this MBean.
 *//*from w w  w. j a v  a 2  s  . c  o  m*/
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
    String[] notificationTypes = new String[] { MonitorNotification.THRESHOLD_VALUE_EXCEEDED };
    String name = MonitorNotification.class.getName();
    String description = "Either Message count or Queue depth or Message size has reached threshold high value";
    MBeanNotificationInfo info1 = new MBeanNotificationInfo(notificationTypes, name, description);

    return new MBeanNotificationInfo[] { info1 };
}

From source file:org.cipango.callflow.JmxMessageLog.java

public MBeanNotificationInfo[] getNotificationInfo() {
    String[] types = new String[] { "SIP" };
    String name = MBeanNotificationInfo.class.getName();
    String description = "SIP message notification";
    MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);

    return new MBeanNotificationInfo[] { info };
}