Package com.sun.org.apache.commons.modeler

Examples of com.sun.org.apache.commons.modeler.ParameterInfo


            }

            //getDefaultAttributeValue
            operationInfo = createOperationInfo("getDefaultAttributeValue", "INFO",
                   "java.lang.String",
                   new ParameterInfo("attributeName", "java.lang.String", null),
                   LOCATED_IN_CONFIGBEAN);
            mergeWithOperationInfo(managedBean, operationInfo);
        }
       
        //classnames values for method's types
        String nameClass        = "javax.management.ObjectName";
        String attrClass        = "javax.management.Attribute";
        String namesClass       = (new ObjectName[0]).getClass().getName();
        String attrListClass    = (new AttributeList()).getClass().getName();
        String stringsClass     = (new String[0]).getClass().getName();

        FieldInfo field;
        ParameterInfo param;

        // **** P R O P E R T I E S  ******
        if(children.get("ElementProperty")!=null)
        {
            children.remove("ElementProperty");

           
            //getProperties
            operationInfo = createOperationInfo("getProperties", "INFO",
                   attrListClass, null, LOCATED_IN_CONFIGBEAN);
            mergeWithOperationInfo(managedBean, operationInfo);
           
            //getDefaulCustomProperties
//            operationInfo = createOperationInfo("getDefaultCustomProperties", "INFO",
//                   attrListClass, null, null);
//            mergeWithOperationInfo(managedBean, operationInfo);
           
            //getProperty
            operationInfo = createOperationInfo("getPropertyValue", "INFO",
                   "java.lang.Object",
                   new ParameterInfo("propertyName", "java.lang.String", null),
                   LOCATED_IN_CONFIGBEAN);
            mergeWithOperationInfo(managedBean, operationInfo);
           
            //setProperty
            operationInfo = createOperationInfo("setProperty", "ACTION",
                   "void",
                   new ParameterInfo("nameAndValue", attrClass, null),
                   LOCATED_IN_CONFIGBEAN);
            mergeWithOperationInfo(managedBean, operationInfo);
        }

        // **** S Y S T E M       P R O P E R T I E S  ******
        if(children.get("SystemProperty")!=null)
        {
            children.remove("SystemProperty");
           
            //getSystemProperties
            operationInfo = createOperationInfo("getSystemProperties", "INFO",
                   attrListClass, null, LOCATED_IN_CONFIGBEAN);
            mergeWithOperationInfo(managedBean, operationInfo);
           
            //getSystemProperty
            operationInfo = createOperationInfo("getSystemPropertyValue", "INFO",
                   "java.lang.Object",
                   new ParameterInfo("propertyName", "java.lang.String", null),
                   LOCATED_IN_CONFIGBEAN);
            mergeWithOperationInfo(managedBean, operationInfo);
           
            //setSystemProperty
            operationInfo = createOperationInfo("setSystemProperty", "ACTION",
                   "void",
                   new ParameterInfo("nameAndValue", attrClass, null),
                   LOCATED_IN_CONFIGBEAN);
            mergeWithOperationInfo(managedBean, operationInfo);
        }

        //**** C H I L D R E N  ******

        //children.remove("ElementProperty");
       
        if(children.size()>0)
        {
            String key;
            Enumeration keys = children.keys();
            while(keys.hasMoreElements())
            {
                key = (String)keys.nextElement();
                String clazz = (String)children.get(key);
                boolean bMulti = clazz.charAt(0)=='['?true:false;
                String  childName = getAttrNameFromMethodName(key, true, '-');
                //getter
                if((mode&EXPOSE_GETCHILD)!=0)
                {
                    //get child (ObjectName)
                    operationInfo = createOperationInfo("get"+key, "INFO",
                           bMulti?namesClass:nameClass,
                           null, LOCATED_IN_CONFIGBEAN);
                    addDataToChildOperInfo(childName, bMulti, operationInfo);
                    mergeWithOperationInfo(managedBean, operationInfo);
                    if(bMulti)
                    {
                        //get child NamesList(ObjectName)
                        operationInfo = createOperationInfo(
                             "get"+key+GET_LISTNAMES_OP_SUFFIX,
                             "INFO", stringsClass, null, null);
                        addDataToChildOperInfo(childName, bMulti, operationInfo);
                        mergeWithOperationInfo(managedBean, operationInfo);
                    }
                   
                    //getChildByKey
                    if(bMulti)
                    {
                        String prefix = "get"+key+"By";
                        for (int j = 0; j < methods.length; ++j)
                        {
                            String methodName=methods[j].getName();
                            if(methodName.startsWith(prefix))
                            {
                                operationInfo = createOperationInfo(methodName, "INFO",
                                       nameClass,
                                       new ParameterInfo("key", "java.lang.String", null),
                                       LOCATED_IN_CONFIGBEAN);
                                addDataToChildOperInfo(childName, bMulti, operationInfo);
                                mergeWithOperationInfo(managedBean, operationInfo);
                                break;
                            }
                        }
                    }
                }
                if((mode&EXPOSE_CREATECHILD)!=0)
                {
                    //CreateChild
                    String prefix = bMulti?"add"+key:"set"+key;
                    for (int j = 0; j < methods.length; ++j)
                    {
                        String methodName=methods[j].getName();
                        if(methodName.startsWith(prefix))
                        {
                            operationInfo = createOperationInfo("create"+key, "ACTION_INFO",
                                   nameClass,
                                   new ParameterInfo("attribute_list", attrListClass, null),
                                   LOCATED_IN_CONFIGBEAN);
                            addDataToChildOperInfo(childName, bMulti, operationInfo);
                            mergeWithOperationInfo(managedBean, operationInfo);
                            break;
                        }
                    }
                }
                if((mode&EXPOSE_DESTROYCHILD)!=0)
                {
                    if(!bMulti)
                    {
                        operationInfo = createOperationInfo("remove"+key,
                               "ACTION", "void", null, LOCATED_IN_CONFIGBEAN);
                        addDataToChildOperInfo(childName, bMulti, operationInfo);
                        mergeWithOperationInfo(managedBean, operationInfo);
                    }
                    else
                    {
                        String prefix = "get"+key+"By";
                        for (int j = 0; j < methods.length; ++j)
                        {
                            String methodName=methods[j].getName();
                            if(methodName.startsWith(prefix))
                            {
                                operationInfo = createOperationInfo("remove"+methodName.substring(3),
                                       "ACTION", "void",
                                       new ParameterInfo("key", "java.lang.String", null),
                                       LOCATED_IN_CONFIGBEAN);
                                addDataToChildOperInfo(childName, bMulti, operationInfo);
                                mergeWithOperationInfo(managedBean, operationInfo);
                                break;
                            }
View Full Code Here


        info.setName(method.getName());
        info.setReturnType(method.getReturnType().getName());
        Class paramsClasses[]=method.getParameterTypes();
        for(int k=0; k<paramsClasses.length; k++)
        {
            info.addParameter(new ParameterInfo("param"+(k+1), paramsClasses[k].getName(), null));
        }
        if (whereType!=null)
            info.addField(newField(WHERE_LOCATED_FIELD_NAME, whereType));
        return info;
    }
View Full Code Here

TOP

Related Classes of com.sun.org.apache.commons.modeler.ParameterInfo

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.