Example usage for org.springframework.jmx.support ObjectNameManager getInstance

List of usage examples for org.springframework.jmx.support ObjectNameManager getInstance

Introduction

In this page you can find the example usage for org.springframework.jmx.support ObjectNameManager getInstance.

Prototype

public static ObjectName getInstance(String objectName) throws MalformedObjectNameException 

Source Link

Document

Retrieve the ObjectName instance corresponding to the supplied name.

Usage

From source file:org.vbossica.springbox.jmx.MetadataNamingOverridingStrategy.java

@Override
public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
    ObjectName objectName = super.getObjectName(managedBean, beanKey);
    String finalName = resolver.resolve(objectName.getCanonicalName());

    if (finalName != null && StringUtils.hasText(finalName)) {
        logger.info("replacing " + objectName + " by " + finalName);
        return ObjectNameManager.getInstance(finalName);
    }/* w  w w  . j a  v  a 2  s .  c o  m*/
    return objectName;
}

From source file:com.wakacommerce.common.cache.StatisticsServiceImpl.java

@Override
public ObjectName getObjectName() throws MalformedObjectNameException {
    return ObjectNameManager.getInstance("com.wakacommerce:name=StatisticsService." + appName);
}

From source file:org.broadleafcommerce.common.cache.StatisticsServiceImpl.java

@Override
public ObjectName getObjectName() throws MalformedObjectNameException {
    return ObjectNameManager.getInstance("org.broadleafcommerce:name=StatisticsService." + appName);
}

From source file:org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.java

@Override
protected ObjectName getObjectName(Object bean, String beanKey) throws MalformedObjectNameException {
    if (bean instanceof SelfNaming) {
        return ((SelfNaming) bean).getObjectName();
    }// ww w.j a  v a 2  s  .c o  m

    if (bean instanceof EndpointMBean) {
        StringBuilder builder = new StringBuilder();
        builder.append(this.domain);
        builder.append(":type=Endpoint");
        builder.append(",name=" + beanKey);
        if (parentContextContainsSameBean(this.applicationContext, beanKey)) {
            builder.append(",context=" + ObjectUtils.getIdentityHexString(this.applicationContext));
        }
        if (this.ensureUniqueRuntimeObjectNames) {
            builder.append(
                    ",identity=" + ObjectUtils.getIdentityHexString(((EndpointMBean) bean).getEndpoint()));
        }
        builder.append(getStaticNames());
        return ObjectNameManager.getInstance(builder.toString());
    }

    return this.defaultNamingStrategy.getObjectName(bean, beanKey);
}

From source file:org.springframework.jmx.access.MBeanClientInterceptor.java

/**
 * Set the {@code ObjectName} of the MBean which calls are routed to,
 * as {@code ObjectName} instance or as {@code String}.
 *//*w  w w  .j a va  2 s .co  m*/
public void setObjectName(Object objectName) throws MalformedObjectNameException {
    this.objectName = ObjectNameManager.getInstance(objectName);
}

From source file:org.springframework.jmx.export.naming.KeyNamingStrategy.java

/**
 * Attempts to retrieve the {@code ObjectName} via the given key, trying to
 * find a mapped value in the mappings first.
 *///from  ww w.j a v a 2s  . c o m
@Override
public ObjectName getObjectName(Object managedBean, @Nullable String beanKey)
        throws MalformedObjectNameException {
    Assert.notNull(beanKey, "KeyNamingStrategy requires bean key");
    String objectName = null;
    if (this.mergedMappings != null) {
        objectName = this.mergedMappings.getProperty(beanKey);
    }
    if (objectName == null) {
        objectName = beanKey;
    }
    return ObjectNameManager.getInstance(objectName);
}

From source file:org.springframework.jmx.support.ConnectorServerFactoryBean.java

/**
 * Set the <code>ObjectName</code> used to register the <code>JMXConnectorServer</code>
 * itself with the <code>MBeanServer</code>.
 * @throws MalformedObjectNameException if the <code>ObjectName</code> is malformed
 */// w w  w  .  j a  va 2 s. co  m
public void setObjectName(String objectName) throws MalformedObjectNameException {
    this.objectName = ObjectNameManager.getInstance(objectName);
}