Package org.hyperic.sigar

Examples of org.hyperic.sigar.SigarInvoker


                Object obj;
                if (useReflection) {
                    obj = method.invoke((Object)sigar, objArgs);
                }
                else {
                    obj = invoke(new SigarInvoker(proxy, type), objArgs, null);
                }
               
                if (iter > 0) {
                    if (memstat(iter)) {
                        this.out.print(type);
                        if (arg != null) {
                            this.out.print(" " + arg);
                        }
                        output();
                    }
                }

                String value;
                if (obj instanceof Object[]) {
                    value = argsToString((Object[])obj);
                }
                else {
                    value = String.valueOf(obj);
                }
                trace(type + argsToString(objArgs) + "=" + value);
                continue;
            }

            Method[] attrs = attrClass.getMethods();

            for (int j=0; j<attrs.length; j++) {
                Method getter = attrs[j];
                if (getter.getDeclaringClass() != attrClass) {
                    continue;
                }

                String attrName = getter.getName();
                if (!attrName.startsWith("get")) {
                    continue;
                }

                attrName = attrName.substring(3);
                objArgs = new Object[0];
                if (parms.length > 0) {
                    if (type.startsWith("Proc")) {
                        arg = this.pids.getName(iter);
                    }
                    else if (type.startsWith("Net")) {
                        arg = this.netif.getName(iter);
                    }
                    else if (type.startsWith("MultiProc")) {
                        arg = "State.Name.eq=java";
                    }
                    else if (type.equals("FileSystemUsage") ||
                             type.equals("MountedFileSystemUsage"))
                    {
                        arg = this.fs.getName(iter);
                    }
                    else if (type.equals("FileInfo") ||
                             type.equals("LinkInfo"))
                    {
                        arg = this.files.getName(iter);
                    }
                    else if (type.equals("DirStat")) {
                        arg = this.dirs.getName(iter);
                    }
                    else {
                        trace("SKIPPING: " + type);
                        continue;
                    }

                    objArgs = new Object[] { arg };
                }

                if (isNonStringArg(method)) {
                    continue;
                }

                Object obj;
                if (useReflection) {
                    Object typeObject = method.invoke((Object)sigar, objArgs);
                    obj = getter.invoke(typeObject, new Object[0]);
                }
                else {
                    obj = invoke(new SigarInvoker(proxy, type), objArgs, attrName);
                }

                if (iter > 0) {
                    if (memstat(iter)) {
                        this.out.print(type);
View Full Code Here


                output("startSize=" + startSize +
                       ", endSize=" + currentSize +
                       ", diff=" + (currentSize - startSize));
            }
            else {
                Object obj = invoke(new SigarInvoker(proxy, type), null, attr);

                output(obj.toString());
            }
        }
        else {
View Full Code Here

                Object obj;
                if (useReflection) {
                    obj = method.invoke((Object)sigar, objArgs);
                }
                else {
                    obj = invoke(new SigarInvoker(proxy, type), objArgs, null);
                }
               
                if (iter > 0) {
                    if (memstat(iter)) {
                        this.out.print(type);
                        if (arg != null) {
                            this.out.print(" " + arg);
                        }
                        output();
                    }
                }

                String value;
                if (obj instanceof Object[]) {
                    value = argsToString((Object[])obj);
                }
                else {
                    value = String.valueOf(obj);
                }
                trace(type + argsToString(objArgs) + "=" + value);
                continue;
            }

            Method[] attrs = attrClass.getMethods();

            for (int j=0; j<attrs.length; j++) {
                Method getter = attrs[j];
                if (getter.getDeclaringClass() != attrClass) {
                    continue;
                }

                String attrName = getter.getName();
                if (!attrName.startsWith("get")) {
                    continue;
                }

                attrName = attrName.substring(3);
                objArgs = new Object[0];
                if (parms.length > 0) {
                    if (type.startsWith("Proc")) {
                        arg = this.pids.getName(iter);
                    }
                    else if (type.startsWith("Net")) {
                        arg = this.netif.getName(iter);
                    }
                    else if (type.startsWith("MultiProc")) {
                        arg = "State.Name.eq=java";
                    }
                    else if (type.equals("FileSystemUsage") ||
                             type.equals("MountedFileSystemUsage"))
                    {
                        arg = this.fs.getName(iter);
                    }
                    else if (type.equals("FileInfo") ||
                             type.equals("LinkInfo"))
                    {
                        arg = this.files.getName(iter);
                    }
                    else if (type.equals("DirStat")) {
                        arg = this.dirs.getName(iter);
                    }
                    else {
                        trace("SKIPPING: " + type);
                        continue;
                    }

                    objArgs = new Object[] { arg };
                }

                if (isNonStringArg(method)) {
                    continue;
                }

                Object obj;
                if (useReflection) {
                    Object typeObject = method.invoke((Object)sigar, objArgs);
                    obj = getter.invoke(typeObject, new Object[0]);
                }
                else {
                    obj = invoke(new SigarInvoker(proxy, type), objArgs, attrName);
                }

                if (iter > 0) {
                    if (memstat(iter)) {
                        this.out.print(type);
View Full Code Here

                output("startSize=" + startSize +
                       ", endSize=" + currentSize +
                       ", diff=" + (currentSize - startSize));
            }
            else {
                Object obj = invoke(new SigarInvoker(proxy, type), null, attr);

                output(obj.toString());
            }
        }
        else {
View Full Code Here

TOP

Related Classes of org.hyperic.sigar.SigarInvoker

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.