当前位置: 首页>>代码示例>>Java>>正文


Java MBeanConstructorInfo类代码示例

本文整理汇总了Java中javax.management.MBeanConstructorInfo的典型用法代码示例。如果您正苦于以下问题:Java MBeanConstructorInfo类的具体用法?Java MBeanConstructorInfo怎么用?Java MBeanConstructorInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MBeanConstructorInfo类属于javax.management包,在下文中一共展示了MBeanConstructorInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:MustBeValidCommand.java

示例2: printMBeanInfo

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
private void printMBeanInfo(MBeanInfo mbInfo) {
    System.out.println("Description " + mbInfo.getDescription());

    for (MBeanConstructorInfo ctor : mbInfo.getConstructors()) {
        System.out.println("Constructor " + ctor.getName());
    }

    for (MBeanAttributeInfo att : mbInfo.getAttributes()) {
        System.out.println("Attribute " + att.getName()
        + " [" + att.getType() + "]");
    }

    for (MBeanOperationInfo oper : mbInfo.getOperations()) {
        System.out.println("Operation " + oper.getName());
    }

    for (MBeanNotificationInfo notif : mbInfo.getNotifications()) {
        System.out.println("Notification " + notif.getName());
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:MXBeanInteropTest2.java

示例3: buildDynamicMBeanInfo

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
private
void buildDynamicMBeanInfo() {
  Constructor[] constructors = this.getClass().getConstructors();
  dConstructors[0] = new MBeanConstructorInfo(
       "HierarchyDynamicMBean(): Constructs a HierarchyDynamicMBean instance",
constructors[0]);

  vAttributes.add(new MBeanAttributeInfo(THRESHOLD,
			   "java.lang.String",
			   "The \"threshold\" state of the hiearchy.",
			   true,
			   true,
			   false));

  MBeanParameterInfo[] params = new MBeanParameterInfo[1];
  params[0] = new MBeanParameterInfo("name", "java.lang.String",
		       "Create a logger MBean" );
  dOperations[0] = new MBeanOperationInfo("addLoggerMBean",
		    "addLoggerMBean(): add a loggerMBean",
		    params ,
		    "javax.management.ObjectName",
		    MBeanOperationInfo.ACTION);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:24,代码来源:HierarchyDynamicMBean.java

示例4: getMBeanInfo

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
/**
 * Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object. 
 * @see javax.management.DynamicMBean#getMBeanInfo()
 */
@Override
   public MBeanInfo getMBeanInfo()
   {
	MBeanConstructorInfo[] constructors = null;
	MBeanAttributeInfo[] attributes = getMBeanAttributes();
	MBeanOperationInfo[] operations = getMBeanOperations();
	MBeanNotificationInfo[] notifications = null;
	
	MBeanInfo info = new MBeanInfo(
			this.getClass().getName(), 
			"Router Statistics", 
			attributes, 
			constructors, 
			operations, 
			notifications);
	
    return info;
   }
 
开发者ID:VHAINNOVATIONS,项目名称:Telepathology,代码行数:23,代码来源:RouterStatisticsAdvice.java

示例5: buildProcessorMBeanInfo

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
private MBeanInfo buildProcessorMBeanInfo() {
    ArrayList<MBeanAttributeInfo> info = new ArrayList<>();

    info.add(new MBeanAttributeInfo(
            Constants.PlatformMetricType.PROCESSOR_CPU_USAGE.getMetricTypeId().getIDString(),
            Double.class.getCanonicalName(),
            "CPU usage",
            true,
            false,
            false));

    return new MBeanInfo(
            PlatformMBean.class.getCanonicalName(),
            "Processor information",
            info.toArray(new MBeanAttributeInfo[0]),
            new MBeanConstructorInfo[0],
            new MBeanOperationInfo[0],
            new MBeanNotificationInfo[0]);
}
 
开发者ID:hawkular,项目名称:hawkular-agent,代码行数:20,代码来源:PlatformMBeanGenerator.java

示例6: getMBeanInfo

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
@Override
public MBeanInfo getMBeanInfo() {
	try {
		Class<?> cls = this.getClass();
		Constructor<?> constructor = cls.getConstructor(new Class[] {});
		Method readConnectionsRequested = cls.getMethod("readConnectionsRequested", new Class[]{});
		Method readConnectionsRelease = cls.getMethod("readConnectionsRelease", new Class[]{});
		Method readCacheInts = cls.getMethod("readCacheInts", new Class[]{});
		Method readCacheMiss = cls.getMethod("readCacheMiss", new Class[]{});
		MBeanAttributeInfo connectionsRequested = new MBeanAttributeInfo("connections requested", "connections requested", readConnectionsRequested, null);
		MBeanAttributeInfo connectionsRelease = new MBeanAttributeInfo("Connections Release", "Connections Release", readConnectionsRelease, null);
		MBeanAttributeInfo cacheInts = new MBeanAttributeInfo("cache ints", "cache ints", readCacheInts, null);
		MBeanAttributeInfo cacheMiss = new MBeanAttributeInfo("Cache Miss", "Cache Miss", readCacheMiss, null);
		MBeanConstructorInfo mBeanConstructorInfo = new MBeanConstructorInfo("Constructor for Statistics", constructor);
		MBeanInfo mBeanInfo = new MBeanInfo(cls.getName(), "Monitor that controls the server", new MBeanAttributeInfo[] { connectionsRequested, connectionsRelease, cacheInts, cacheMiss }, new MBeanConstructorInfo[] {mBeanConstructorInfo}, null, null);
		return mBeanInfo;
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:Justice-love,项目名称:oceandata,代码行数:22,代码来源:Statistics.java

示例7: getMBeanConstructorInfo

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
/**
 * Retrieves the constructor info from given constructor.
 * @param cons
 * @return MBeanConstructorInfo
 */
private static MBeanConstructorInfo getMBeanConstructorInfo(Constructor cons)
{
    String desc = _defaultConstructorDescription;
    Annotation anno = cons.getAnnotation(MBeanConstructor.class);
    if (anno != null && MBeanConstructor.class.isInstance(anno))
    {
        desc = MBeanConstructor.class.cast(anno).value();
        if(desc == null)
        {
            desc = _defaultConstructorDescription;
        }
    }

    //MBeanParameterInfo[] paramsInfo = getParametersInfo(cons.getParameterAnnotations(),
    //                                                    cons.getParameterTypes());

    return new MBeanConstructorInfo(cons.getName(), desc, null);
}
 
开发者ID:wso2,项目名称:andes,代码行数:24,代码来源:MBeanIntrospector.java

示例8: setUp

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
/**
 * Create MBeanConstructorInfo objects.
 * 
 * @throws NoSuchMethodException
 * @throws SecurityException
 */
public void setUp() throws Exception {
    final Class c = Hello.class;

    inf1 = new MBeanConstructorInfo("Constructor with parameters", c
        .getConstructor(new Class[] { String.class, String.class,
            String.class, boolean.class, Object.class }));
    inf2 = new MBeanConstructorInfo(
        "org.apache.harmony.test.func.api.javax.management.share.Hello",
        "Constructor with parameters", sig2);

    inf3 = new MBeanConstructorInfo("Constructor without parameters", c
        .getConstructor(new Class[0]));
    inf4 = new MBeanConstructorInfo(
        "org.apache.harmony.test.func.api.javax.management.share.Hello",
        "Constructor without parameters", sig1);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:MBeanConstructorInfoTest.java

示例9: getMBeanInfo

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
@Override
public MBeanInfo getMBeanInfo() {
    List<MBeanAttributeInfo> atts = new LinkedList<>();

    for (Field field : fields.values()) {
        MBeanAttributeInfo att = new MBeanAttributeInfo(
                field.getName(),
                field.getType().getName(),
                null,
                true,
                !(readonly || Modifier.isFinal(field.getModifiers())),
                field.getType() == Boolean.TYPE,
                null);

        atts.add(att);
    }

    return new MBeanInfo(
            getClass().getName(), null,
            atts.toArray(new MBeanAttributeInfo[atts.size()]),
            new MBeanConstructorInfo[0],
            new MBeanOperationInfo[0],
            new MBeanNotificationInfo[0]);
}
 
开发者ID:addthis,项目名称:basis,代码行数:25,代码来源:FieldBasedDynamicMBean.java

示例10: findConstructors

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
private static MBeanConstructorInfo[] findConstructors(Class<?> c) {
    Constructor<?>[] cons = c.getConstructors();
    MBeanConstructorInfo[] mbc = new MBeanConstructorInfo[cons.length];
    for (int i = 0; i < cons.length; i++) {
        final String descr = "Public constructor of the MBean";
        mbc[i] = new MBeanConstructorInfo(descr, cons[i]);
    }
    return mbc;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:MBeanIntrospector.java

示例11: getConstructor

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
/**
 * Returns the ModelMBeanConstructorInfo requested by name.
 * If no ModelMBeanConstructorInfo exists for this name null is returned.
 *
 * @param inName the name of the constructor.
 *
 * @return the constructor info for the named constructor, or null
 * if there is none.
 *
 * @exception MBeanException Wraps a distributed communication Exception.
 * @exception RuntimeOperationsException Wraps an IllegalArgumentException
 *            for a null constructor name.
 */

public ModelMBeanConstructorInfo getConstructor(String inName)
throws MBeanException, RuntimeOperationsException {
    ModelMBeanConstructorInfo retInfo = null;
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanInfoSupport.class.getName(),
                "getConstructor(String)", "Entry");
    }
    if (inName == null) {
        throw new RuntimeOperationsException(
                new IllegalArgumentException("Constructor name is null"),
                "Exception occurred trying to get the " +
                "ModelMBeanConstructorInfo of the MBean");
    }
    MBeanConstructorInfo[] consList = modelMBeanConstructors; //this.getConstructors();
    int numCons = 0;
    if (consList != null) numCons = consList.length;

    for (int i=0; (i < numCons) && (retInfo == null); i++) {
        if (inName.equals(consList[i].getName())) {
            retInfo = ((ModelMBeanConstructorInfo) consList[i].clone());
        }
    }
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanInfoSupport.class.getName(),
                "getConstructor(String)", "Exit");
    }

    return retInfo;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:ModelMBeanInfoSupport.java

示例12: readObject

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
/**
 * Deserializes a {@link ModelMBeanInfoSupport} from an {@link ObjectInputStream}.
 */
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
    if (compat) {
        // Read an object serialized in the old serial form
        //
        ObjectInputStream.GetField fields = in.readFields();
        modelMBeanDescriptor =
                (Descriptor) fields.get("modelMBeanDescriptor", null);
        if (fields.defaulted("modelMBeanDescriptor")) {
            throw new NullPointerException("modelMBeanDescriptor");
        }
        modelMBeanAttributes =
                (MBeanAttributeInfo[]) fields.get("mmbAttributes", null);
        if (fields.defaulted("mmbAttributes")) {
            throw new NullPointerException("mmbAttributes");
        }
        modelMBeanConstructors =
                (MBeanConstructorInfo[]) fields.get("mmbConstructors", null);
        if (fields.defaulted("mmbConstructors")) {
            throw new NullPointerException("mmbConstructors");
        }
        modelMBeanNotifications =
                (MBeanNotificationInfo[]) fields.get("mmbNotifications", null);
        if (fields.defaulted("mmbNotifications")) {
            throw new NullPointerException("mmbNotifications");
        }
        modelMBeanOperations =
                (MBeanOperationInfo[]) fields.get("mmbOperations", null);
        if (fields.defaulted("mmbOperations")) {
            throw new NullPointerException("mmbOperations");
        }
    } else {
        // Read an object serialized in the new serial form
        //
        in.defaultReadObject();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:ModelMBeanInfoSupport.java

示例13: constructorArray

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
private static MBeanConstructorInfo[]
        constructorArray(OpenMBeanConstructorInfo[] src) {
    if (src == null)
        return null;
    MBeanConstructorInfo[] dst = new MBeanConstructorInfo[src.length];
    System.arraycopy(src, 0, dst, 0, src.length);
    // may throw an ArrayStoreException
    return dst;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:OpenMBeanInfoSupport.java

示例14: makeCtorInfos

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
static private MBeanConstructorInfo[] makeCtorInfos(String[][] spec) {
    final MBeanConstructorInfo[] result =
        new MBeanConstructorInfo[spec.length];
    final MBeanParameterInfo[] pars = makeParInfos(parameters);
    for (int i=0;i<result.length;i++) {
        System.out.println("\tCreate an MBeanConstructorInfo: " +
                           spec[i][0]);
        final MBeanConstructorInfo item =
            new MBeanConstructorInfo(spec[i][1],spec[i][0],pars);
        result[i]=item;
    }
    return result;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:MustBeValidCommand.java

示例15: check

import javax.management.MBeanConstructorInfo; //导入依赖的package包/类
private static void check(MBeanServer mbs, ObjectName on) throws Exception {
    MBeanInfo mbi = mbs.getMBeanInfo(on);

    // check the MBean itself
    check(mbi);

    // check attributes
    MBeanAttributeInfo[] attrs = mbi.getAttributes();
    for (MBeanAttributeInfo attr : attrs) {
        check(attr);
        if (attr.getName().equals("ReadOnly"))
            check("@Full", attr.getDescriptor(), expectedFullDescriptor);
    }

    // check operations
    MBeanOperationInfo[] ops = mbi.getOperations();
    for (MBeanOperationInfo op : ops) {
        check(op);
        check(op.getSignature());
    }

    MBeanConstructorInfo[] constrs = mbi.getConstructors();
    for (MBeanConstructorInfo constr : constrs) {
        check(constr);
        check(constr.getSignature());
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:AnnotationTest.java


注:本文中的javax.management.MBeanConstructorInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。