Package org.jmanage.core.util

Examples of org.jmanage.core.util.Expression


        if(args.length == 0){
            usage();
            return false;
        }

        Expression expression = new Expression(args[0]);
        /* set the values */
        MBeanService service = ServiceFactory.getMBeanService();
        String[][] attributes = getAttributes(args);
        AttributeListData[] attrListData =
                service.setAttributes(
                        context.getServiceContext(expression.getAppName(),
                                expression.getMBeanName()),
                        attributes);
        Out.println();
        Out.println("Changed Attributes:");
        CommandUtils.printAttributeLists(attrListData);
        return true;
View Full Code Here


    private String mbeanName = WILDCARD;
    /* this could be attribute or operation name */
    private String targetName = WILDCARD;

    public ACLContext(String aclContext){
        Expression expr = new Expression(aclContext);
        if(expr.getAppName() != null){
            appName = expr.getAppName();
        }
        if(expr.getMBeanName() != null){
            // todo: we need to convert the MBean name to canonical name
            //   for comparision. It will be good to further improve
            //    the comparision by allowing wild card comparisions.
            mbeanName = expr.getMBeanName();
        }
        if(expr.getTargetName() != null){
            targetName = expr.getTargetName();
        }
    }
View Full Code Here

        }
        return false;
    }
   
    public String toString(){
        return new Expression(appName, mbeanName, targetName).toString();
    }
View Full Code Here

        String[] args = context.getCommand().getArgs();
        if(args.length == 0){
            usage();
            return false;
        }
        Expression expression = new Expression(args[0]);
        if(expression.getAppName() == null ||
                expression.getMBeanName() == null ||
                expression.getTargetName() == null){
            usage();
            return false;
        }
        String[] params = new String[args.length - 1];
        for(int i=0; i<params.length; i++){
            params[i] = args[i+1];
        }
        /* execute the operation */
        MBeanService service = ServiceFactory.getMBeanService();
        ServiceContext serviceContext = context.getServiceContext(expression.getAppName(),
                        expression.getMBeanName());
        OperationResultData[] resultData =
                service.invoke(serviceContext,
                        expression.getTargetName(),
                        params);

        for(int i=0; i<resultData.length; i++){
            Out.println();
            Out.print(resultData[i].getApplicationName() + " > ");
View Full Code Here

        if(args.length < 3){
            usage();
            return false;
        }

        Expression expression = new Expression(args[0]);
        /* set the values */
        MBeanService service = ServiceFactory.getMBeanService();
        String[][] attributes = getAttributes(args);
        if(logger.isLoggable(Level.FINE)){
            logger.log(Level.FINE, "Setting attr. name=" + attributes[0][0] +
                    " value=" + attributes[0][1]);
        }
        AttributeListData[] attrListData =
                service.setAttributes(
                        context.getServiceContext(expression.getAppName(),
                                expression.getMBeanName()),
                        attributes);
        Out.println();
        Out.println("Changed Attributes:");
        CommandUtils.printAttributeLists(attrListData);
        return true;
View Full Code Here

        Map<String, ObjectAttribute> attrMap = new HashMap<String, ObjectAttribute>();
        Map<String, ObjectAttribute> wholeAttrMap = new HashMap<String, ObjectAttribute>();
        StringTokenizer st = new StringTokenizer(displayNames, "|");
        MBeanService mbeanService = ServiceFactory.getMBeanService();
        for (Object anExpression : exprList) {
            Expression expression = (Expression) anExpression;
            ServiceContext srvcContext = null;
            ObjectAttribute objAttribute = null;
            try {
                srvcContext = Utils.getServiceContext(context, expression);
                objAttribute = mbeanService.getObjectAttribute(srvcContext,
                        expression.getTargetName());
            } finally {
                if (srvcContext != null)
                    srvcContext.getServerConnection().close();
            }
            assert objAttribute != null;
            assert objAttribute.getStatus() == ObjectAttribute.STATUS_OK;
            if(attribRepWhole.equals(expression.toString()))
              wholeAttrMap.put(st.nextToken(), objAttribute);
            else
              attrMap.put(st.nextToken(), objAttribute);
        }
View Full Code Here

           expression = expression.substring(1, expression.length()-1);
           if(expression.endsWith("|true")){
             expression = expression.substring(0, expression.indexOf("|true"));
             attribRepWhole = expression;
           }
           exprList.add(new Expression(expression));
       }
       return exprList;
   }
View Full Code Here

        assert attributes != null;
        List exprList = parse(attributes);
        List<ObjectAttribute> objectAttrList = new LinkedList<ObjectAttribute>();
        MBeanService mbeanService = ServiceFactory.getMBeanService();
        for (Object anExpression : exprList) {
            Expression expression = (Expression) anExpression;
            ServiceContext srvcContext = null;
            ObjectAttribute objAttribute = null;
            try {
                srvcContext = Utils.getServiceContext(context, expression);
                objAttribute = mbeanService.getObjectAttribute(srvcContext,
                        expression.getTargetName());
            } finally {
                if (srvcContext != null)
                    srvcContext.getServerConnection().close();
            }
            assert objAttribute != null;
View Full Code Here

            while(!expression.endsWith("]")){
                assert tokenizer.hasMoreTokens();
                expression += "," + tokenizer.nextToken();
            }
            expression = expression.substring(1, expression.length()-1);
            exprList.add(new Expression(expression));
        }
        return exprList;
    }
View Full Code Here

TOP

Related Classes of org.jmanage.core.util.Expression

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.