Java Code Examples for javax.management.openmbean.TabularData#put()

The following examples show how to use javax.management.openmbean.TabularData#put() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KarafContainerImpl.java    From brooklyn-library with Apache License 2.0 6 votes vote down vote up
@Override
@Effector(description="Updates the OSGi Service's properties, adding (and overriding) the given key-value pairs")
public void updateServiceProperties(
        @EffectorParam(name="serviceName", description="Name of the OSGi service") String serviceName, 
        Map<String,String> additionalVals) {
    TabularData table = (TabularData) jmxHelper.operation(OSGI_COMPENDIUM, "getProperties", serviceName);
    
    try {
        for (Map.Entry<String, String> entry: additionalVals.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            CompositeData data = new CompositeDataSupport(
                    JmxConstants.PROPERTY_TYPE,
                    MutableMap.of(JmxConstants.KEY, key, JmxConstants.TYPE, "String", JmxConstants.VALUE, value));
            table.remove(data.getAll(new String[] {JmxConstants.KEY}));
            table.put(data);
        }
    } catch (OpenDataException e) {
        throw Exceptions.propagate(e);
    }
    
    LOG.info("Updating monterey-service configuration with changes {}", additionalVals);
    if (LOG.isTraceEnabled()) LOG.trace("Updating monterey-service configuration with new configuration {}", table);
    
    jmxHelper.operation(OSGI_COMPENDIUM, "update", serviceName, table);
}
 
Example 2
Source File: TabularDataOrderTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 3
Source File: JavaMailJMSStatistics.java    From javamail with Apache License 2.0 5 votes vote down vote up
private static CompositeData convert(MessageAndAddresses maa) {
    if (maa == null) {
        return null;
    }
    try {
        TabularData addrData = new TabularDataSupport(TAB_ADDR_TYPE);
        for(Address addr : maa.getAddresses()) {
            addrData.put(new CompositeDataSupport(ROW_ADDR_TYPE, new String[]{"addressType", "address"}, new Object[]{addr.getType(), addr.toString()}));
        }
        TabularData headerData = new TabularDataSupport(TAB_HEADER_TYPE);
        Enumeration en = maa.getMessage().getAllHeaders();
        while (en.hasMoreElements()) {
            Header header = (Header) en.nextElement();
            headerData.put(new CompositeDataSupport(ROW_HEADER_TYPE, new String[]{"header-name", "header-value"}, new Object[]{header.getName(), header.getValue()}));
        }
        String error = null;
        if (maa.getException() != null) {
            StringWriter sw = new StringWriter();
            sw.append(maa.getException().toString());
            maa.getException().printStackTrace(new PrintWriter(sw));
            sw.flush();
            error = sw.toString();
        }
        return new CompositeDataSupport(MAIL_INFO_TYPE,
                new String[] {"messageId", "date", "subject", "toAddresses", "headers", "errorDescription"},
                new Object[]{maa.getMessage().getMessageID(), new Date(maa.getTimestamp()), maa.getMessage().getSubject(), addrData, headerData, error}
        );
    } catch (OpenDataException | MessagingException e) {
        throw new IllegalArgumentException("cannot convert MessageAndAddresses to CompositeData", e);
    }
}
 
Example 4
Source File: TabularDataOrderTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 5
Source File: TabularDataOrderTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 6
Source File: AdminDistributedSystemJmxImpl.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public TabularData getMissingPersistentMembersJMX() throws AdminException {
  
  try {
    Set<PersistentID> members = super.getMissingPersistentMembers();
    TabularData results = new TabularDataSupport(PERSISTENT_ID_TABLE_TYPE);
    for(PersistentID id : members) {
      CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS, new Object[] {id.getHost().toString(), id.getDirectory(), id.getUUID().toString()});
      results.put(idData);
    }
    return results;
  } catch( OpenDataException e) {
    logger.warning(LocalizedStrings.ONE_ARG, "Exception occurred while getting missing persistent members.", e);
    throw new AdminException(e);
  }
}
 
Example 7
Source File: TabularDataOrderTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 8
Source File: TabularDataOrderTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 9
Source File: AdminDistributedSystemJmxImpl.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public TabularData getMissingPersistentMembersJMX() throws AdminException {
  
  try {
    Set<PersistentID> members = super.getMissingPersistentMembers();
    TabularData results = new TabularDataSupport(PERSISTENT_ID_TABLE_TYPE);
    for(PersistentID id : members) {
      CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS, new Object[] {id.getHost().toString(), id.getDirectory(), id.getUUID().toString()});
      results.put(idData);
    }
    return results;
  } catch( OpenDataException e) {
    logger.warning(LocalizedStrings.ONE_ARG, "Exception occurred while getting missing persistent members.", e);
    throw new AdminException(e);
  }
}
 
Example 10
Source File: TabularDataOrderTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 11
Source File: TabularDataOrderTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 12
Source File: TabularDataOrderTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 13
Source File: TabularDataOrderTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 14
Source File: TabularDataOrderTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 15
Source File: TabularDataOrderTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 16
Source File: TabularDataOrderTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}
 
Example 17
Source File: TabularDataOrderTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static TabularData makeTable() throws OpenDataException {
    TabularData td = new TabularDataSupport(tt);
    for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
        CompositeData cd = new CompositeDataSupport(
                ct,
                new String[] {"name", "int"},
                new Object[] {entry.getKey(), entry.getValue()});
        td.put(cd);
    }
    return td;
}