Example usage for javax.management ObjectName quote

List of usage examples for javax.management ObjectName quote

Introduction

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

Prototype

public static String quote(String s) 

Source Link

Document

Returns a quoted form of the given String, suitable for inclusion in an ObjectName.

Usage

From source file:org.wso2.andes.test.utils.JMXTestUtils.java

/**
 * Retrive the ObjectName for the given Exchange on a VirtualHost.
 *
 * This is then used to create a proxy to the ManagedExchange MBean.
 *
 * @param virtualHostName the VirtualHost the Exchange is on
 * @param exchange the Exchange to retireve e.g. 'direct'
 * @return the ObjectName for the given Exchange on the VirtualHost
 *//*w  w  w.j av  a  2  s. c o m*/
@SuppressWarnings("static-access")
public ObjectName getExchangeObjectName(String virtualHostName, String exchange) {
    // Get the name of the test manager
    String query = "org.wso2.andes:type=VirtualHost.Exchange,VirtualHost=" + ObjectName.quote(virtualHostName)
            + ",name=" + ObjectName.quote(exchange) + ",*";

    Set<ObjectName> objectNames = queryObjects(query);

    _test.assertNotNull("Null ObjectName Set returned", objectNames);
    _test.assertEquals("Incorrect number of exchange with name '" + exchange + "' returned", 1,
            objectNames.size());

    // We have verified we have only one value in objectNames so return it
    ObjectName objectName = objectNames.iterator().next();
    _test.getLogger().info("Loading: " + objectName);
    return objectName;
}

From source file:org.apache.qpid.test.utils.JMXTestUtils.java

public String getQueueObjectNameString(String virtualHostName, String queue) {
    return "org.apache.qpid:type=VirtualHost.Queue,VirtualHost=" + ObjectName.quote(virtualHostName) + ",name="
            + ObjectName.quote(queue) + ",*";
}

From source file:org.apache.qpid.test.utils.JMXTestUtils.java

/**
 * Generate the ObjectName for the given Exchange on a VirtualHost.
 *//*from   ww w.j a va2s .  c o  m*/
public String getExchangeObjectName(String virtualHostName, String exchange) {
    return "org.apache.qpid:type=VirtualHost.Exchange,VirtualHost=" + ObjectName.quote(virtualHostName)
            + ",name=" + ObjectName.quote(exchange) + ",*";
}

From source file:org.wso2.andes.test.utils.JMXTestUtils.java

/**
 * Retrive all {@link ManagedConnection} objects for a particular virtual host.
 *//*from  w ww.  j  a  v a  2  s .  com*/
public List<ManagedConnection> getManagedConnections(String vhost) {
    // Get the name of the test manager
    String query = "org.wso2.andes:type=VirtualHost.Connection,VirtualHost=" + ObjectName.quote(vhost)
            + ",name=*";

    Set<ObjectName> objectNames = queryObjects(query);

    TestCase.assertNotNull("Null ObjectName Set returned", objectNames);

    return getManagedObjectList(ManagedConnection.class, objectNames);
}

From source file:org.apache.qpid.test.utils.JMXTestUtils.java

/**
 * Retrieve all {@link ManagedConnection} objects for a particular virtual host.
 *///from  w ww  .j a  v  a  2 s.com
public List<ManagedConnection> getManagedConnections(String vhost) {
    // Get the name of the test manager
    String query = "org.apache.qpid:type=VirtualHost.Connection,VirtualHost=" + ObjectName.quote(vhost)
            + ",name=*";

    Set<ObjectName> objectNames = queryObjects(query);

    TestCase.assertNotNull("Null ObjectName Set returned", objectNames);

    return getManagedObjectList(ManagedConnection.class, objectNames);
}

From source file:org.helios.rindle.store.redis.RedisConnectionPool.java

/**
 * Registers the passed client info provider
 * @param cip the client info provider to register
 *//*from   w  ww  .  j  a v a  2s.c  o  m*/
public void registerClientInfo(ClientInfoProvider cip) {
    if (cip != null) {
        infos.put(cip.getClientInfo().getName(), cip.getClientInfo());
        ObjectName on = JMXHelper.objectName("org.helios.rindle:type=PooledConnection,name="
                + ObjectName.quote(cip.getClientInfo().getName()));
        JMXHelper.registerMBean(cip.getClientInfo(), on);
    }
}

From source file:org.helios.rindle.store.redis.RedisConnectionPool.java

/**
 * Unregisters the passed client info provider
 * @param cip the client info provider to unregister
 *///from   w  w  w  .ja  v  a2s  .c  om
public void removeClientInfo(ClientInfoProvider cip) {
    if (cip != null) {
        infos.remove(cip.getClientInfo().getName());
        ObjectName on = JMXHelper.objectName("org.helios.rindle:type=PooledConnection,name="
                + ObjectName.quote(cip.getClientInfo().getName()));
        JMXHelper.unregisterMBean(on);
    }
}

From source file:io.fabric8.cxf.endpoint.ManagedApi.java

public ObjectName getObjectName() throws JMException {
    String busId = bus.getId();//from   ww  w  .  j  a  v  a2 s  . co m
    StringBuilder buffer = new StringBuilder();
    buffer.append(DOMAIN_NAME).append(':');
    buffer.append(ManagementConstants.BUS_ID_PROP).append('=').append(busId).append(',');
    buffer.append(ManagementConstants.TYPE_PROP).append('=').append("Bus.Service.Endpoint,");

    String serviceName = (String) endpoint.get(SERVICE_NAME);
    if (StringUtils.isEmpty(serviceName)) {
        serviceName = endpoint.getService().getName().toString();
    }
    serviceName = ObjectName.quote(serviceName);
    buffer.append(ManagementConstants.SERVICE_NAME_PROP).append('=').append(serviceName).append(',');

    String endpointName = (String) endpoint.get(ENDPOINT_NAME);
    if (StringUtils.isEmpty(endpointName)) {
        endpointName = endpoint.getEndpointInfo().getName().getLocalPart();
    }
    endpointName = ObjectName.quote(endpointName);
    buffer.append(ManagementConstants.PORT_NAME_PROP).append('=').append(endpointName).append(',');
    // Added the instance id to make the ObjectName unique
    buffer.append(ManagementConstants.INSTANCE_ID_PROP).append('=').append(endpoint.hashCode());

    //Use default domain name of server
    return new ObjectName(buffer.toString());
}