Example usage for javax.management.openmbean SimpleType LONG

List of usage examples for javax.management.openmbean SimpleType LONG

Introduction

In this page you can find the example usage for javax.management.openmbean SimpleType LONG.

Prototype

SimpleType LONG

To view the source code for javax.management.openmbean SimpleType LONG.

Click Source Link

Document

The SimpleType instance describing values whose Java class name is java.lang.Long.

Usage

From source file:org.osgi.jmx.codec.OSGiServiceEvent.java

private static CompositeType createServiceEventType() {
    String description = "This eventType encapsulates OSGi service events";
    String[] itemNames = ServiceStateMBean.SERVICE_EVENT;
    OpenType[] itemTypes = new OpenType[5];
    String[] itemDescriptions = new String[5];
    itemTypes[0] = SimpleType.LONG;
    itemTypes[1] = SimpleType.LONG;
    itemTypes[2] = SimpleType.STRING;
    itemTypes[3] = STRING_ARRAY_TYPE;/*from   www.  j  a va  2s  . co m*/
    itemTypes[4] = SimpleType.INTEGER;

    itemDescriptions[0] = "The id of the bundle which registered the service";
    itemDescriptions[1] = "The id of the bundle which registered the service";
    itemDescriptions[2] = "The location of the bundle that registered the service";
    itemDescriptions[3] = "An string array containing the interfaces under which the service has been registered";
    itemDescriptions[4] = "The eventType of the event: {REGISTERED=1, MODIFIED=2 UNREGISTERING=3}";
    try {
        return new CompositeType("ServiceEvent", description, itemNames, itemDescriptions, itemTypes);
    } catch (OpenDataException e) {
        log.error("Unable to create ServiceEvent OpenData eventType", e);
        return null;
    }

}

From source file:org.eclipse.gyrex.monitoring.internal.mbeans.MetricSetMBean.java

private OpenType detectType(final Class type) {
    if ((Long.class == type) || (Long.TYPE == type)) {
        return SimpleType.LONG;
    } else if ((Integer.class == type) || (Integer.TYPE == type)) {
        return SimpleType.INTEGER;
    } else if ((Double.class == type) || (Double.TYPE == type)) {
        return SimpleType.DOUBLE;
    } else if ((Float.class == type) || (Float.TYPE == type)) {
        return SimpleType.FLOAT;
    } else if ((Byte.class == type) || (Byte.TYPE == type)) {
        return SimpleType.BYTE;
    } else if ((Short.class == type) || (Short.TYPE == type)) {
        return SimpleType.SHORT;
    } else if ((Boolean.class == type) || (Boolean.TYPE == type)) {
        return SimpleType.BOOLEAN;
    } else if (BigDecimal.class == type) {
        return SimpleType.BIGDECIMAL;
    } else if (BigInteger.class == type) {
        return SimpleType.BIGINTEGER;
    } else if ((Character.class == type) || (Character.TYPE == type)) {
        return SimpleType.CHARACTER;
    }//from  w w  w  .  j  a va2 s. co m

    // last fallback to strings
    if (isConvertibleToString(type)) {
        return SimpleType.STRING;
    }

    // give up
    return null;
}

From source file:com.alibaba.dragoon.stat.SpringIbatisStatementStats.java

public static CompositeType getCompositeTypeInternal() throws OpenDataException {
    if (compositeType != null) {
        return compositeType;
    }//  w  ww .  j  a va  2  s .c  o m

    OpenType<?>[] indexTypes = new OpenType<?>[] { SimpleType.STRING, SimpleType.STRING, SimpleType.LONG,
            SimpleType.LONG, SimpleType.LONG, SimpleType.DATE, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.INTEGER, SimpleType.INTEGER };

    String[] indexNames = { "id", "resource", "executeCount", "errorCount", "totalTime", "lastTime",
            "updateCount", "fetchObjectCount", "effectedRowCount", "concurrentMax", "runningCount" };

    String[] indexDescriptions = indexNames;

    compositeType = new CompositeType("IbatisStatementStat", "IbatisStatementStat", indexNames,
            indexDescriptions, indexTypes);

    return compositeType;
}

From source file:org.wso2.andes.server.information.management.QueueManagementInformationMBean.java

/***
 * Virtual host information are needed in the constructor to evaluate user permissions for
 * queue management actions.(e.g. purge)
 *
 * @param vHostMBean Used to access the virtual host information
 * @throws NotCompliantMBeanException/* w w  w.  j  a v  a2  s . c  o m*/
 */
public QueueManagementInformationMBean(VirtualHostImpl.VirtualHostMBean vHostMBean)
        throws NotCompliantMBeanException, OpenDataException {
    super(QueueManagementInformation.class, QueueManagementInformation.TYPE);

    andesChannel = Andes.getInstance().createChannel(new FlowControlListener() {
        @Override
        public void block() {
            restoreBlockedByFlowControl = true;
        }

        @Override
        public void unblock() {
            restoreBlockedByFlowControl = false;
        }

        @Override
        public void disconnect() {
            // Do nothing. since its not applicable.
        }
    });

    VirtualHost virtualHost = vHostMBean.getVirtualHost();

    queueRegistry = virtualHost.getQueueRegistry();
    disablePubAck = new DisablePubAckImpl();

    _msgContentAttributeTypes[0] = SimpleType.STRING; // For message properties
    _msgContentAttributeTypes[1] = SimpleType.STRING; // For content type
    _msgContentAttributeTypes[2] = new ArrayType(1, SimpleType.STRING); // For message content
    _msgContentAttributeTypes[3] = SimpleType.STRING; // For JMS message id
    _msgContentAttributeTypes[4] = SimpleType.BOOLEAN; // For redelivered
    _msgContentAttributeTypes[5] = SimpleType.LONG; // For JMS timeStamp
    _msgContentAttributeTypes[6] = SimpleType.STRING; // For dlc message destination
    _msgContentAttributeTypes[7] = SimpleType.LONG; // For andes message metadata id
    _msgContentType = new CompositeType("Message Content", "Message content for queue browse",
            VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC
                    .toArray(new String[VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.size()]),
            VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.toArray(
                    new String[VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.size()]),
            _msgContentAttributeTypes);
    lz4CompressionHelper = new LZ4CompressionHelper();
}

From source file:org.jolokia.converter.json.TabularDataExtractor.java

private Object getKey(CompositeType rowType, String key, String value) {
    OpenType keyType = rowType.getType(key);
    if (SimpleType.STRING == keyType) {
        return value;
    } else if (SimpleType.INTEGER == keyType) {
        return Integer.parseInt(value);
    } else if (SimpleType.LONG == keyType) {
        return Long.parseLong(value);
    } else if (SimpleType.SHORT == keyType) {
        return Short.parseShort(value);
    } else if (SimpleType.BYTE == keyType) {
        return Byte.parseByte(value);
    } else if (SimpleType.OBJECTNAME == keyType) {
        try {/*from   ww  w .j a  v  a2 s  .  c o  m*/
            return new ObjectName(value);
        } catch (MalformedObjectNameException e) {
            throw new IllegalArgumentException("Can not convert " + value + " to an ObjectName", e);
        }
    } else {
        throw new IllegalArgumentException(
                "All keys must be a string, integer, long, short, byte or ObjectName type for accessing TabularData via a path. "
                        + "This is not the case for '" + key + "' which is of type " + keyType);
    }
}

From source file:com.alibaba.dragoon.stat.WebURIStatistic.java

public static CompositeType getCompositeType() throws JMException {

    OpenType<?>[] indexTypes = new OpenType<?>[] {
            ////from   w  ww . ja v  a  2s  . c o m
            SimpleType.LONG, SimpleType.STRING, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.LONG, // count
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING, SimpleType.STRING, // LastErrorClass
            SimpleType.STRING, SimpleType.DATE, SimpleType.STRING, SimpleType.DATE, SimpleType.STRING // LastErrorUser
            , SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, // LastErrorUser
            SimpleType.LONG, new ArrayType<Long>(SimpleType.LONG, true),
            new ArrayType<CompositeType>(1, Profiler.EntryStatistic.getCompositeType())//
            , SimpleType.STRING //
            //
            , SimpleType.LONG, SimpleType.LONG, SimpleType.LONG//
            //
            , SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG //
            , SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG//
            , SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG //
            , new ArrayType<Integer>(SimpleType.INTEGER, true), SimpleType.LONG };

    String[] indexNames = { //
            //
            "ID", "URI", "RunningCount", "ConcurrentMax", "Count", //
            "ErrorCount", "TotalTime", "MaxTime", "LastErrorMessage", "LastErrorClass" //
            , "LastErrorStackTrace", "LastErrorTime", "LastErrorReferer", "LastAccessedTime", "LastErrorUser" //
            , "JdbcExecuteCount", "JdbcFetchRowCount", "JdbcFetchRowPeak", "JdbcUpdateCount", "JdbcCommitCount" //
            , "JdbcRollbackCount", "Histogram", "ProfileEntries", "LastErrorUrl" // added by wangye

            , "OSMacOSXCount", "OSWindowsCount", "OSLinuxCount", "BrowserIE6Count", "BrowserIE7Count",
            "BrowserIE8Count", "BrowserIE9Count", "BrowserIE10Count", "BrowserIECount", "BrowserFirefoxCount",
            "BrowserChromeCount", "BrowserSafariCount", "BrowserOperaCount", "DeviceAndroidCount",
            "DeviceIpadCount", "DeviceIphoneCount", "DeviceWindowsPhoneCount" //
            , "IP", "JdbcTransactionMillis" };
    String[] indexDescriptions = indexNames;
    return new CompositeType("URIStatistic", "URI Statistic", indexNames, indexDescriptions, indexTypes);
}

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   w w  w  . j a va  2 s .co m
 */
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);
}