All Downloads are FREE. Search and download functionalities are using the official Maven repository.

flex.management.jmx.MBeanOperationInfo Maven / Gradle / Ivy

There is a newer version: 4.8.0
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package flex.management.jmx;

/**
 * Remotable MBeanOperationInfo class that complies with Flash serialization requirements.
 *
 * @author shodgson
 */
public class MBeanOperationInfo
{
    /**
     * The operation name.
     */
    public String name;
    
    /**
     * The operation description.
     */
    public String description;
    
    /**
     * The operation's argument signature.
     */
    public MBeanParameterInfo[] signature;
    
    /**
     * The operation's return type.
     */
    public String returnType;
    
    /**
     * The impact of the operation; one of INFO, ACTION, ACTION_INFO, UNKNOWN.
     */
    public int impact;
    
    /**
     * Constructs an empty MBeanOperationInfo instance.    
     */
    public MBeanOperationInfo()
    {}
    
    /**
     * Constructs a MBeanOperationInfo instance based upon a
     * javax.management.MBeanOperationInfo instance.
     * 
     * @param mbeanOperationInfo The JMX MBeanOperationInfo instance to base this instance on.
     */
    public MBeanOperationInfo(javax.management.MBeanOperationInfo mbeanOperationInfo)
    {
        name = mbeanOperationInfo.getName();
        description = mbeanOperationInfo.getDescription();
        signature = convertSignature(mbeanOperationInfo.getSignature());
        returnType = mbeanOperationInfo.getReturnType();
        impact = mbeanOperationInfo.getImpact();
    }
    
    /**
     * Utility method to convert this MBeanOperationInfo to a
     * javax.management.MBeanOperationInfo instance.
     * 
     * @return A JMX MBeanOperationInfo based upon this instance.
     */
    public javax.management.MBeanOperationInfo toMBeanOperationInfo()
    {
        return new javax.management.MBeanOperationInfo(name,
                                                       description,
                                                       convertSignature(signature),
                                                       returnType,
                                                       impact);
    }
    
    /**
     * Utility method to convert JMX parameter info instances to Flash friendly parameter info instances.
     * 
     * @param source JMX parameter info instances.
     * @return Flash friendly parameter info instances.
     */
    private MBeanParameterInfo[] convertSignature(javax.management.MBeanParameterInfo[] source)
    {
        MBeanParameterInfo[] signature = new MBeanParameterInfo[source.length];
        for (int i = 0; i < source.length; i++)
        {
            signature[i] = new MBeanParameterInfo(source[i]);
        }
        return signature;
    }
    
    /**
     * Utility method to convert Flash friendly parameter info instances to JMX parameter info instances.
     * 
     * @param source Flash friendly parameter info instances.
     * @return JMX parameter info instances.
     */
    private javax.management.MBeanParameterInfo[] convertSignature(MBeanParameterInfo[] source)
    {
        javax.management.MBeanParameterInfo[] signature = new javax.management.MBeanParameterInfo[source.length];
        for (int i = 0; i < source.length; i++)
        {
            signature[i] = source[i].toMBeanParameterInfo();
        }
        return signature;
    }
        
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy