Package org.springframework.jmx.export.metadata

Examples of org.springframework.jmx.export.metadata.ManagedResource


    }

    @Override
    public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
        Class managedClass = AopUtils.getTargetClass(managedBean);
        ManagedResource mr = this.attributeSource.getManagedResource(managedClass);

        // Check that an object name has been specified.
        if (mr != null && StringUtils.hasText(mr.getObjectName())) {
            return ObjectName.getInstance(mr.getObjectName());
        } else {
            String domain = this.defaultDomain;
            if (domain == null)
                domain = ClassUtils.getPackageName(managedClass);
            return ObjectName.getInstance(domain + ":type=components,name=" + beanKey);
View Full Code Here


   * Reads managed resource description from the source level metadata.
   * Returns an empty <code>String</code> if no description can be found.
   */
  @Override
  protected String getDescription(Object managedBean, String beanKey) {
    ManagedResource mr = this.attributeSource.getManagedResource(getClassToExpose(managedBean));
    return (mr != null ? mr.getDescription() : "");
  }
View Full Code Here

   * <code>persistPolicy</code>, <code>persistPeriod</code>, <code>persistLocation</code>
   * and <code>persistName</code> descriptor fields if they are present in the metadata.
   */
  @Override
  protected void populateMBeanDescriptor(Descriptor desc, Object managedBean, String beanKey) {
    ManagedResource mr = this.attributeSource.getManagedResource(getClassToExpose(managedBean));
    if (mr == null) {
      throw new InvalidMetadataException(
          "No ManagedResource attribute found for class: " + getClassToExpose(managedBean));
    }

    applyCurrencyTimeLimit(desc, mr.getCurrencyTimeLimit());

    if (mr.isLog()) {
      desc.setField(FIELD_LOG, "true");
    }
    if (StringUtils.hasLength(mr.getLogFile())) {
      desc.setField(FIELD_LOG_FILE, mr.getLogFile());
    }

    if (StringUtils.hasLength(mr.getPersistPolicy())) {
      desc.setField(FIELD_PERSIST_POLICY, mr.getPersistPolicy());
    }
    if (mr.getPersistPeriod() >= 0) {
      desc.setField(FIELD_PERSIST_PERIOD, Integer.toString(mr.getPersistPeriod()));
    }
    if (StringUtils.hasLength(mr.getPersistName())) {
      desc.setField(FIELD_PERSIST_NAME, mr.getPersistName());
    }
    if (StringUtils.hasLength(mr.getPersistLocation())) {
      desc.setField(FIELD_PERSIST_LOCATION, mr.getPersistLocation());
    }
  }
View Full Code Here

    }

    @Override
    public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
        Class managedClass = AopUtils.getTargetClass(managedBean);
        ManagedResource mr = this.attributeSource.getManagedResource(managedClass);

        // Check that an object name has been specified.
        if (mr != null && StringUtils.hasText(mr.getObjectName())) {
            return ObjectName.getInstance(mr.getObjectName());
        } else {
            String domain = this.defaultDomain;
            if (domain == null)
                domain = ClassUtils.getPackageName(managedClass);
            return ObjectName.getInstance(domain + ":type=components,name=" + beanKey);
View Full Code Here

TOP

Related Classes of org.springframework.jmx.export.metadata.ManagedResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.