Java Code Examples for javax.management.MBeanParameterInfo

The following are top voted examples for showing how to use javax.management.MBeanParameterInfo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: phone-simulator   File: CapManStandardMBean.java   View source code 6 votes vote down vote up
@Override
public MBeanInfo getMBeanInfo() {

    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {
    // new MBeanAttributeInfo("LocalSsn", int.class.getName(), "Local Ssn", true, true, false),
    // new MBeanAttributeInfo("RemoteSsn", int.class.getName(), "Remote Ssn", true, true, false),
    new MBeanAttributeInfo("RemoteAddressDigits", String.class.getName(),
            "Remote address digits. If empty ROUTING_BASED_ON_DPC_AND_SSN is used for CalledPartyAddress (remoteSpc from SCCP), "
                    + "if not empty ROUTING_BASED_ON_GLOBAL_TITLE is used (address and Ssn from CAP)", true, true, false), };

    MBeanParameterInfo[] signString = new MBeanParameterInfo[] { new MBeanParameterInfo("val", String.class.getName(),
            "Index number or value") };

    MBeanOperationInfo[] operations = new MBeanOperationInfo[] {};

    return new MBeanInfo(CapMan.class.getName(), "Cap Management", attributes, null, operations, null);
}
 
Example 2
Project: phone-simulator   File: TestCheckImeiServerStandardManMBean.java   View source code 6 votes vote down vote up
@Override
public MBeanInfo getMBeanInfo() {

    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {

            new MBeanAttributeInfo("AutoEquipmentStatus", EquipmentStatusType.class.getName(), "EquipmentStatus parameter to be automatically send in CheckImeiResponse", true, true, false),
            new MBeanAttributeInfo("AutoEquipmentStatus_Value", String.class.getName(), "EquipmentStatus parameter to be automatically send in CheckImeiResponse", true, false, false),
            new MBeanAttributeInfo("OneNotificationFor100Dialogs", boolean.class.getName(),
                    "If true there will be only one notification per every 100 sent dialogs", true, true, true),
            new MBeanAttributeInfo("CurrentRequestDef", String.class.getName(), "Definition of the current request Dialog",
                    true, false, false),

    };

    MBeanParameterInfo[] putAutoEquipmentStatusParam = new MBeanParameterInfo[] { new MBeanParameterInfo("val", String.class.getName(), "EquipmentStatus value") };

    MBeanOperationInfo[] operations = new MBeanOperationInfo[] {
            new MBeanOperationInfo(
                    "putAutoEquipmentStatus",
                    "EquipmentStatus parameter to be automatically send in CheckImeiResponse: "
                            + "0:whiteListed,1:blackListed,2:greyListed",
                    putAutoEquipmentStatusParam, Void.TYPE.getName(), MBeanOperationInfo.ACTION),
            new MBeanOperationInfo("closeCurrentDialog", "Closing the current dialog", null, String.class.getName(), MBeanOperationInfo.ACTION)
    };
    return new MBeanInfo(TestCheckImeiServerMan.class.getName(), "CheckImeiServer test parameters management", attributes, null, operations, null);
}
 
Example 3
Project: phone-simulator   File: TestAtiServerStandardManMBean.java   View source code 6 votes vote down vote up
@Override
    public MBeanInfo getMBeanInfo() {

        MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {
                new MBeanAttributeInfo("ATIReaction", ATIReaction.class.getName(), "ATI response type", true, true, false),
                new MBeanAttributeInfo("ATIReaction_Value", String.class.getName(), "ATI response type", true, false, false), };

        MBeanParameterInfo[] signString = new MBeanParameterInfo[] { new MBeanParameterInfo("val", String.class.getName(), "Index number or value") };

//        MBeanParameterInfo[] performATIParam = new MBeanParameterInfo[] { new MBeanParameterInfo("msg", String.class.getName(), "Message text"),
//                new MBeanParameterInfo("address", String.class.getName(), "SubscriberIdentity: IMSI or MSISDN"), };

        MBeanOperationInfo[] operations = new MBeanOperationInfo[] {
//                new MBeanOperationInfo("performAtiRequest", "Send ATI request", performATIParam, String.class.getName(), MBeanOperationInfo.ACTION),
//                new MBeanOperationInfo("closeCurrentDialog", "Closing the current dialog", null, String.class.getName(), MBeanOperationInfo.ACTION),

                new MBeanOperationInfo("putATIReaction", "ATI response type: "
                        + "1:ReturnSuccess,2:ReturnSuccessSubscriberState,3:ReturnSystemFailureError,4:ReturnDataMissingError,5:ReturnUnknownSubscriberError",
                        signString, Void.TYPE.getName(), MBeanOperationInfo.ACTION),
                };

        return new MBeanInfo(TestAtiServerMan.class.getName(), "AtiServer test parameters management", attributes, null, operations, null);
    }
 
Example 4
Project: phone-simulator   File: TestMapLcsServerStandardManMBean.java   View source code 6 votes vote down vote up
@Override
public MBeanInfo getMBeanInfo() {

    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {
            new MBeanAttributeInfo("NetworkNodeNumberAddress", String.class.getName(),
                                   "NetworkNodeNumber address parameter for response",
                                   true, true, false), };

    MBeanParameterInfo[] performSRIResponseParam = new MBeanParameterInfo[] { };

    MBeanOperationInfo[] operations = new MBeanOperationInfo[] {
            new MBeanOperationInfo("performSendRoutingInfoForLCSResponse", "Send Routing Information for LCS response",
                                   performSRIResponseParam, String.class.getName(), MBeanOperationInfo.ACTION),
             };

    return new MBeanInfo(TestMapLcsServerMan.class.getName(), "MapLcsServer test parameters management", attributes, null, operations, null);
}
 
Example 5
Project: phone-simulator   File: TestMapLcsClientStandardManMBean.java   View source code 6 votes vote down vote up
@Override
public MBeanInfo getMBeanInfo() {

    // TODO: Put real attributes and operations

    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {
            new MBeanAttributeInfo("AddressNature", AddressNatureType.class.getName(),
                                   "AddressNature parameter for mlcNumber creating",
                                   true, true, false),
            new MBeanAttributeInfo("NumberingPlanType", NumberingPlanMapType.class.getName(),
                                   "NumberingPlanType parameter for mlcNumber creating",
                                   true, true, false),
            new MBeanAttributeInfo("NumberingPlan", String.class.getName(),
                                   "NumberingPlan parameter for mlcNumber creating",
                                   true, true, false), };

    MBeanParameterInfo[] performSRIRequestParam = new MBeanParameterInfo[] {
                   new MBeanParameterInfo("addressIMSI", String.class.getName(), "Address for IMSI") };

    MBeanOperationInfo[] operations = new MBeanOperationInfo[] {
            new MBeanOperationInfo("performSendRoutingInfoForLCSRequest", "Send Routing Information for LCS request",
                                   performSRIRequestParam, String.class.getName(), MBeanOperationInfo.ACTION),
             };

    return new MBeanInfo(TestMapLcsClientMan.class.getName(), "MapLcsClient test parameters management", attributes, null, operations, null);
}
 
Example 6
Project: eZooKeeper   File: JmxUtils.java   View source code 6 votes vote down vote up
public static final String getOperationName(MBeanOperationInfo info) {
    StringBuilder name = new StringBuilder(info.getName());
    name.append('(');

    MBeanParameterInfo[] parameterInfos = info.getSignature();

    if (parameterInfos != null) {

        int parameterCount = parameterInfos.length;
        for (int i = 0; i < parameterCount; i++) {
            MBeanParameterInfo parameterInfo = parameterInfos[i];
            String parameterType = getTypeName(parameterInfo.getType(), parameterInfo.getDescriptor());
            name.append(parameterType);

            if (i < parameterCount - 1) {
                name.append(", ");
            }
        }

    }

    name.append(')');
    return name.toString();
}
 
Example 7
Project: eZooKeeper   File: MBeanOperation.java   View source code 6 votes vote down vote up
/**
 * TODO: Comment.
 * 
 */
private void initInvocationSignature() {
    _InvocationSignature = null;

    MBeanParameterInfo[] signature = getInfo().getSignature();
    if (signature == null) {
        return;
    }

    List<String> paramTypeNameList = new ArrayList<String>();
    for (MBeanParameterInfo mbeanParameterInfo : signature) {
        paramTypeNameList.add(mbeanParameterInfo.getType());
    }

    _InvocationSignature = new String[paramTypeNameList.size()];
    _InvocationSignature = paramTypeNameList.toArray(_InvocationSignature);
}
 
Example 8
Project: eZooKeeper   File: MBeanOperationDoc.java   View source code 6 votes vote down vote up
public List<MBeanParameterDoc> getParameters() {

        if (_Parameters == null) {
            MBeanParameterInfo[] parameterInfos = getInfo().getSignature();

            if (parameterInfos == null || parameterInfos.length == 0) {
                return Collections.emptyList();
            }

            _Parameters = new ArrayList<MBeanParameterDoc>(parameterInfos.length);

            for (MBeanParameterInfo parameterInfo : parameterInfos) {
                MBeanParameterDoc parameterDoc = new MBeanParameterDoc(parameterInfo);
                _Parameters.add(parameterDoc);
            }
        }

        return _Parameters;
    }
 
Example 9
Project: tomcat7   File: JMXProxyServlet.java   View source code 6 votes vote down vote up
/**
 * Invokes an operation on an MBean.
 * @param onameStr The name of the MBean.
 * @param operation The name of the operation to invoke.
 * @param parameters An array of Strings containing the parameters to the
 *                   operation. They will be converted to the appropriate
 *                   types to call the reuested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr,
                                       String operation,
                                       String[] parameters)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,operation);
    MBeanParameterInfo[] signature = methodInfo.getSignature();
    String[] signatureTypes = new String[signature.length];
    Object[] values = new Object[signature.length];
    for (int i = 0; i < signature.length; i++) {
       MBeanParameterInfo pi = signature[i];
       signatureTypes[i] = pi.getType();
       values[i] = registry.convertValue(pi.getType(), parameters[i] );
     }

    return mBeanServer.invoke(oname,operation,values,signatureTypes);
}
 
Example 10
Project: lams   File: MetadataMBeanInfoAssembler.java   View source code 6 votes vote down vote up
/**
 * Reads {@code MBeanParameterInfo} from the {@code ManagedOperationParameter}
 * attributes attached to a method. Returns an empty array of {@code MBeanParameterInfo}
 * if no attributes are found.
 */
@Override
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey) {
	ManagedOperationParameter[] params = this.attributeSource.getManagedOperationParameters(method);
	if (ObjectUtils.isEmpty(params)) {
		return super.getOperationParameters(method, beanKey);
	}

	MBeanParameterInfo[] parameterInfo = new MBeanParameterInfo[params.length];
	Class<?>[] methodParameters = method.getParameterTypes();
	for (int i = 0; i < params.length; i++) {
		ManagedOperationParameter param = params[i];
		parameterInfo[i] =
				new MBeanParameterInfo(param.getName(), methodParameters[i].getName(), param.getDescription());
	}
	return parameterInfo;
}
 
Example 11
Project: lams   File: AbstractReflectiveMBeanInfoAssembler.java   View source code 6 votes vote down vote up
/**
 * Create parameter info for the given method.
 * <p>The default implementation returns an empty array of {@code MBeanParameterInfo}.
 * @param method the {@code Method} to get the parameter information for
 * @param beanKey the key associated with the MBean in the beans map
 * of the {@code MBeanExporter}
 * @return the {@code MBeanParameterInfo} array
 */
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey) {
	ParameterNameDiscoverer paramNameDiscoverer = getParameterNameDiscoverer();
	String[] paramNames = (paramNameDiscoverer != null ? paramNameDiscoverer.getParameterNames(method) : null);
	if (paramNames == null) {
		return new MBeanParameterInfo[0];
	}

	MBeanParameterInfo[] info = new MBeanParameterInfo[paramNames.length];
	Class<?>[] typeParameters = method.getParameterTypes();
	for(int i = 0; i < info.length; i++) {
		info[i] = new MBeanParameterInfo(paramNames[i], typeParameters[i].getName(), paramNames[i]);
	}

	return info;
}
 
Example 12
Project: OpenJSharp   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanConstructorInfo object with a default descriptor.
*
* @param name The name of the constructor.
* @param description A human readable description of the constructor.
* @param signature MBeanParameterInfo object array describing the parameters(arguments) of the constructor.
*/

public ModelMBeanConstructorInfo(String name,
                                 String description,
                                 MBeanParameterInfo[] signature)
{

        super(name, description, signature);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanConstructorInfo.class.getName(),
                    "ModelMBeanConstructorInfo(" +
                    "String,String,MBeanParameterInfo[])", "Entry");
        }
        consDescriptor = validDescriptor(null);
}
 
Example 13
Project: OpenJSharp   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the ModelMBeanConstructorInfo in human readable form.
*/
@Override
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanConstructorInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanConstructorInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 14
Project: OpenJSharp   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanOperationInfo object with a default descriptor.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
* @param signature MBeanParameterInfo objects describing the
* parameters(arguments) of the method.
* @param type The type of the method's return value.
* @param impact The impact of the method, one of INFO, ACTION,
* ACTION_INFO, UNKNOWN.
*/

public ModelMBeanOperationInfo(String name,
                               String description,
                               MBeanParameterInfo[] signature,
                               String type,
                               int impact)
{

        super(name, description, signature, type, impact);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanOperationInfo.class.getName(),
                    "ModelMBeanOperationInfo(" +
                    "String,String,MBeanParameterInfo[],String,int)",
                    "Entry");
        }
        operationDescriptor = validDescriptor(null);
}
 
Example 15
Project: OpenJSharp   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the
* ModelMBeanOperationInfo in human readable form.
*/
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanOperationInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanOperationInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; ReturnType: " + this.getReturnType() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 16
Project: apache-tomcat-7.0.73-with-comment   File: JMXProxyServlet.java   View source code 6 votes vote down vote up
/**
 * Invokes an operation on an MBean.
 * @param onameStr The name of the MBean.
 * @param operation The name of the operation to invoke.
 * @param parameters An array of Strings containing the parameters to the
 *                   operation. They will be converted to the appropriate
 *                   types to call the reuested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr,
                                       String operation,
                                       String[] parameters)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,operation);
    MBeanParameterInfo[] signature = methodInfo.getSignature();
    String[] signatureTypes = new String[signature.length];
    Object[] values = new Object[signature.length];
    for (int i = 0; i < signature.length; i++) {
       MBeanParameterInfo pi = signature[i];
       signatureTypes[i] = pi.getType();
       values[i] = registry.convertValue(pi.getType(), parameters[i] );
     }

    return mBeanServer.invoke(oname,operation,values,signatureTypes);
}
 
Example 17
Project: jdk8u-jdk   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanConstructorInfo object with a default descriptor.
*
* @param name The name of the constructor.
* @param description A human readable description of the constructor.
* @param signature MBeanParameterInfo object array describing the parameters(arguments) of the constructor.
*/

public ModelMBeanConstructorInfo(String name,
                                 String description,
                                 MBeanParameterInfo[] signature)
{

        super(name, description, signature);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanConstructorInfo.class.getName(),
                    "ModelMBeanConstructorInfo(" +
                    "String,String,MBeanParameterInfo[])", "Entry");
        }
        consDescriptor = validDescriptor(null);
}
 
Example 18
Project: jdk8u-jdk   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the ModelMBeanConstructorInfo in human readable form.
*/
@Override
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanConstructorInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanConstructorInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 19
Project: jdk8u-jdk   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanOperationInfo object with a default descriptor.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
* @param signature MBeanParameterInfo objects describing the
* parameters(arguments) of the method.
* @param type The type of the method's return value.
* @param impact The impact of the method, one of INFO, ACTION,
* ACTION_INFO, UNKNOWN.
*/

public ModelMBeanOperationInfo(String name,
                               String description,
                               MBeanParameterInfo[] signature,
                               String type,
                               int impact)
{

        super(name, description, signature, type, impact);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanOperationInfo.class.getName(),
                    "ModelMBeanOperationInfo(" +
                    "String,String,MBeanParameterInfo[],String,int)",
                    "Entry");
        }
        operationDescriptor = validDescriptor(null);
}
 
Example 20
Project: jdk8u-jdk   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the
* ModelMBeanOperationInfo in human readable form.
*/
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanOperationInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanOperationInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; ReturnType: " + this.getReturnType() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 21
Project: openjdk-jdk10   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanConstructorInfo object with a default descriptor.
*
* @param name The name of the constructor.
* @param description A human readable description of the constructor.
* @param signature MBeanParameterInfo object array describing the parameters(arguments) of the constructor.
*/

public ModelMBeanConstructorInfo(String name,
                                 String description,
                                 MBeanParameterInfo[] signature)
{

        super(name, description, signature);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
            MODELMBEAN_LOGGER.log(Level.TRACE,
                    "ModelMBeanConstructorInfo(" +
                    "String,String,MBeanParameterInfo[]) Entry");
        }
        consDescriptor = validDescriptor(null);
}
 
Example 22
Project: openjdk-jdk10   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the ModelMBeanConstructorInfo in human readable form.
*/
@Override
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
        MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
    }
        String retStr =
            "ModelMBeanConstructorInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 23
Project: openjdk-jdk10   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanOperationInfo object with a default descriptor.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
* @param signature MBeanParameterInfo objects describing the
* parameters(arguments) of the method.
* @param type The type of the method's return value.
* @param impact The impact of the method, one of INFO, ACTION,
* ACTION_INFO, UNKNOWN.
*/

public ModelMBeanOperationInfo(String name,
                               String description,
                               MBeanParameterInfo[] signature,
                               String type,
                               int impact)
{

        super(name, description, signature, type, impact);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
            MODELMBEAN_LOGGER.log(Level.TRACE,
                    "ModelMBeanOperationInfo(" +
                    "String,String,MBeanParameterInfo[],String,int) " +
                    "Entry");
        }
        operationDescriptor = validDescriptor(null);
}
 
Example 24
Project: openjdk-jdk10   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the
* ModelMBeanOperationInfo in human readable form.
*/
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
        MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
    }
        String retStr =
            "ModelMBeanOperationInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; ReturnType: " + this.getReturnType() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 25
Project: lazycat   File: JMXProxyServlet.java   View source code 6 votes vote down vote up
/**
 * Invokes an operation on an MBean.
 * 
 * @param onameStr
 *            The name of the MBean.
 * @param operation
 *            The name of the operation to invoke.
 * @param parameters
 *            An array of Strings containing the parameters to the
 *            operation. They will be converted to the appropriate types to
 *            call the requested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr, String operation, String[] parameters)
		throws OperationsException, MBeanException, ReflectionException {
	ObjectName oname = new ObjectName(onameStr);
	MBeanOperationInfo methodInfo = registry.getMethodInfo(oname, operation);
	MBeanParameterInfo[] signature = methodInfo.getSignature();
	String[] signatureTypes = new String[signature.length];
	Object[] values = new Object[signature.length];
	for (int i = 0; i < signature.length; i++) {
		MBeanParameterInfo pi = signature[i];
		signatureTypes[i] = pi.getType();
		values[i] = registry.convertValue(pi.getType(), parameters[i]);
	}

	return mBeanServer.invoke(oname, operation, values, signatureTypes);
}
 
Example 26
Project: openjdk9   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanConstructorInfo object with a default descriptor.
*
* @param name The name of the constructor.
* @param description A human readable description of the constructor.
* @param signature MBeanParameterInfo object array describing the parameters(arguments) of the constructor.
*/

public ModelMBeanConstructorInfo(String name,
                                 String description,
                                 MBeanParameterInfo[] signature)
{

        super(name, description, signature);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanConstructorInfo.class.getName(),
                    "ModelMBeanConstructorInfo(" +
                    "String,String,MBeanParameterInfo[])", "Entry");
        }
        consDescriptor = validDescriptor(null);
}
 
Example 27
Project: openjdk9   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the ModelMBeanConstructorInfo in human readable form.
*/
@Override
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanConstructorInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanConstructorInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 28
Project: openjdk9   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanOperationInfo object with a default descriptor.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
* @param signature MBeanParameterInfo objects describing the
* parameters(arguments) of the method.
* @param type The type of the method's return value.
* @param impact The impact of the method, one of INFO, ACTION,
* ACTION_INFO, UNKNOWN.
*/

public ModelMBeanOperationInfo(String name,
                               String description,
                               MBeanParameterInfo[] signature,
                               String type,
                               int impact)
{

        super(name, description, signature, type, impact);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanOperationInfo.class.getName(),
                    "ModelMBeanOperationInfo(" +
                    "String,String,MBeanParameterInfo[],String,int)",
                    "Entry");
        }
        operationDescriptor = validDescriptor(null);
}
 
Example 29
Project: openjdk9   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the
* ModelMBeanOperationInfo in human readable form.
*/
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanOperationInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanOperationInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; ReturnType: " + this.getReturnType() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 30
Project: Java8CN   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanConstructorInfo object with a default descriptor.
*
* @param name The name of the constructor.
* @param description A human readable description of the constructor.
* @param signature MBeanParameterInfo object array describing the parameters(arguments) of the constructor.
*/

public ModelMBeanConstructorInfo(String name,
                                 String description,
                                 MBeanParameterInfo[] signature)
{

        super(name, description, signature);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanConstructorInfo.class.getName(),
                    "ModelMBeanConstructorInfo(" +
                    "String,String,MBeanParameterInfo[])", "Entry");
        }
        consDescriptor = validDescriptor(null);
}
 
Example 31
Project: Java8CN   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the ModelMBeanConstructorInfo in human readable form.
*/
@Override
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanConstructorInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanConstructorInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 32
Project: Java8CN   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanOperationInfo object with a default descriptor.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
* @param signature MBeanParameterInfo objects describing the
* parameters(arguments) of the method.
* @param type The type of the method's return value.
* @param impact The impact of the method, one of INFO, ACTION,
* ACTION_INFO, UNKNOWN.
*/

public ModelMBeanOperationInfo(String name,
                               String description,
                               MBeanParameterInfo[] signature,
                               String type,
                               int impact)
{

        super(name, description, signature, type, impact);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanOperationInfo.class.getName(),
                    "ModelMBeanOperationInfo(" +
                    "String,String,MBeanParameterInfo[],String,int)",
                    "Entry");
        }
        operationDescriptor = validDescriptor(null);
}
 
Example 33
Project: Java8CN   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the
* ModelMBeanOperationInfo in human readable form.
*/
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanOperationInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanOperationInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; ReturnType: " + this.getReturnType() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 34
Project: spring4-understanding   File: MetadataMBeanInfoAssembler.java   View source code 6 votes vote down vote up
/**
 * Reads {@code MBeanParameterInfo} from the {@code ManagedOperationParameter}
 * attributes attached to a method. Returns an empty array of {@code MBeanParameterInfo}
 * if no attributes are found.
 */
@Override
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey) {
	ManagedOperationParameter[] params = this.attributeSource.getManagedOperationParameters(method);
	if (ObjectUtils.isEmpty(params)) {
		return super.getOperationParameters(method, beanKey);
	}

	MBeanParameterInfo[] parameterInfo = new MBeanParameterInfo[params.length];
	Class<?>[] methodParameters = method.getParameterTypes();
	for (int i = 0; i < params.length; i++) {
		ManagedOperationParameter param = params[i];
		parameterInfo[i] =
				new MBeanParameterInfo(param.getName(), methodParameters[i].getName(), param.getDescription());
	}
	return parameterInfo;
}
 
Example 35
Project: spring4-understanding   File: AbstractReflectiveMBeanInfoAssembler.java   View source code 6 votes vote down vote up
/**
 * Create parameter info for the given method.
 * <p>The default implementation returns an empty array of {@code MBeanParameterInfo}.
 * @param method the {@code Method} to get the parameter information for
 * @param beanKey the key associated with the MBean in the beans map
 * of the {@code MBeanExporter}
 * @return the {@code MBeanParameterInfo} array
 */
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey) {
	ParameterNameDiscoverer paramNameDiscoverer = getParameterNameDiscoverer();
	String[] paramNames = (paramNameDiscoverer != null ? paramNameDiscoverer.getParameterNames(method) : null);
	if (paramNames == null) {
		return new MBeanParameterInfo[0];
	}

	MBeanParameterInfo[] info = new MBeanParameterInfo[paramNames.length];
	Class<?>[] typeParameters = method.getParameterTypes();
	for (int i = 0; i < info.length; i++) {
		info[i] = new MBeanParameterInfo(paramNames[i], typeParameters[i].getName(), paramNames[i]);
	}

	return info;
}
 
Example 36
Project: my-spring-cache-redis   File: MetadataMBeanInfoAssembler.java   View source code 6 votes vote down vote up
/**
 * Reads {@code MBeanParameterInfo} from the {@code ManagedOperationParameter}
 * attributes attached to a method. Returns an empty array of {@code MBeanParameterInfo}
 * if no attributes are found.
 */
@Override
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey) {
	ManagedOperationParameter[] params = this.attributeSource.getManagedOperationParameters(method);
	if (ObjectUtils.isEmpty(params)) {
		return super.getOperationParameters(method, beanKey);
	}

	MBeanParameterInfo[] parameterInfo = new MBeanParameterInfo[params.length];
	Class<?>[] methodParameters = method.getParameterTypes();
	for (int i = 0; i < params.length; i++) {
		ManagedOperationParameter param = params[i];
		parameterInfo[i] =
				new MBeanParameterInfo(param.getName(), methodParameters[i].getName(), param.getDescription());
	}
	return parameterInfo;
}
 
Example 37
Project: my-spring-cache-redis   File: AbstractReflectiveMBeanInfoAssembler.java   View source code 6 votes vote down vote up
/**
 * Create parameter info for the given method.
 * <p>The default implementation returns an empty array of {@code MBeanParameterInfo}.
 * @param method the {@code Method} to get the parameter information for
 * @param beanKey the key associated with the MBean in the beans map
 * of the {@code MBeanExporter}
 * @return the {@code MBeanParameterInfo} array
 */
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey) {
	ParameterNameDiscoverer paramNameDiscoverer = getParameterNameDiscoverer();
	String[] paramNames = (paramNameDiscoverer != null ? paramNameDiscoverer.getParameterNames(method) : null);
	if (paramNames == null) {
		return new MBeanParameterInfo[0];
	}

	MBeanParameterInfo[] info = new MBeanParameterInfo[paramNames.length];
	Class<?>[] typeParameters = method.getParameterTypes();
	for(int i = 0; i < info.length; i++) {
		info[i] = new MBeanParameterInfo(paramNames[i], typeParameters[i].getName(), paramNames[i]);
	}

	return info;
}
 
Example 38
Project: jdk8u_jdk   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanConstructorInfo object with a default descriptor.
*
* @param name The name of the constructor.
* @param description A human readable description of the constructor.
* @param signature MBeanParameterInfo object array describing the parameters(arguments) of the constructor.
*/

public ModelMBeanConstructorInfo(String name,
                                 String description,
                                 MBeanParameterInfo[] signature)
{

        super(name, description, signature);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanConstructorInfo.class.getName(),
                    "ModelMBeanConstructorInfo(" +
                    "String,String,MBeanParameterInfo[])", "Entry");
        }
        consDescriptor = validDescriptor(null);
}
 
Example 39
Project: jdk8u_jdk   File: ModelMBeanConstructorInfo.java   View source code 6 votes vote down vote up
/**
* Returns a string containing the entire contents of the ModelMBeanConstructorInfo in human readable form.
*/
@Override
public String toString()
{
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanConstructorInfo.class.getName(),
                "toString()", "Entry");
    }
        String retStr =
            "ModelMBeanConstructorInfo: " + this.getName() +
            " ; Description: " + this.getDescription() +
            " ; Descriptor: " + this.getDescriptor() +
            " ; Signature: ";
        MBeanParameterInfo[] pTypes = this.getSignature();
        for (int i=0; i < pTypes.length; i++)
        {
                retStr = retStr.concat((pTypes[i]).getType() + ", ");
        }
        return retStr;
}
 
Example 40
Project: jdk8u_jdk   File: ModelMBeanOperationInfo.java   View source code 6 votes vote down vote up
/**
* Constructs a ModelMBeanOperationInfo object with a default descriptor.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
* @param signature MBeanParameterInfo objects describing the
* parameters(arguments) of the method.
* @param type The type of the method's return value.
* @param impact The impact of the method, one of INFO, ACTION,
* ACTION_INFO, UNKNOWN.
*/

public ModelMBeanOperationInfo(String name,
                               String description,
                               MBeanParameterInfo[] signature,
                               String type,
                               int impact)
{

        super(name, description, signature, type, impact);
        // create default descriptor
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    ModelMBeanOperationInfo.class.getName(),
                    "ModelMBeanOperationInfo(" +
                    "String,String,MBeanParameterInfo[],String,int)",
                    "Entry");
        }
        operationDescriptor = validDescriptor(null);
}