Package javax.management

Examples of javax.management.QueryExp


        for (int i = 0; i < data.length; i++) {
            ObjectName on = new ObjectName("test:type=Simple,query=" +
                                           querySubString + ",name=" + i);
            Simple s = new Simple(data[i][0]);
            mbs.registerMBean(s, on);
            QueryExp q = null;
            switch (type) {
                case 1:
                    q = Query.initialSubString(Query.attr("String"),
                                               Query.value(substring));
                    break;
                case 2:
                    q = Query.anySubString(Query.attr("String"),
                                           Query.value(substring));
                    break;
                case 3:
                    q = Query.finalSubString(Query.attr("String"),
                                             Query.value(substring));
                    break;
            }
            q.setMBeanServer(mbs);
            boolean r = q.apply(on);
            System.out.print("Attribute Value = " +
                mbs.getAttribute(on, "String"));
            if (r && "OK".equals(data[i][type])) {
                System.out.println(" OK");
            } else if (!r && "KO".equals(data[i][type])) {
View Full Code Here


    public Set<ObjectInstance>
        queryMBeans(ObjectName name,
                    MarshalledObject query,
                    Subject delegationSubject)
        throws IOException {
        final QueryExp queryValue;
        final boolean debug=logger.debugOn();

        if (debug) logger.debug("queryMBeans",
                 "connectionId=" + connectionId
                 +" unwrapping query with defaultClassLoader.");
View Full Code Here

    public Set<ObjectName>
        queryNames(ObjectName name,
                   MarshalledObject query,
                   Subject delegationSubject)
        throws IOException {
        final QueryExp queryValue;
        final boolean debug=logger.debugOn();

        if (debug) logger.debug("queryNames",
                 "connectionId=" + connectionId
                 +" unwrapping query with defaultClassLoader.");
View Full Code Here

     * @param queryExpStr - query expression string
     * @return set of mbeans that matches the query
     * @throws IOException - if there is a problem querying the JMX context
     */
    protected List queryMBeans(ObjectName objName, String queryExpStr) throws IOException {
        QueryExp queryExp = createQueryExp(queryExpStr);

        // Convert mbeans set to list to make it standard throughout the query
        // filter
        List mbeans = new ArrayList(jmxConnection.queryMBeans(objName, queryExp));

View Full Code Here

/*     */     throws Exception
/*     */   {
/*  95 */     HAPartition result = null;
/*  96 */     MBeanServer server = MBeanServerLocator.locate();
/*     */
/* 100 */     QueryExp exp = Query.and(Query.match(Query.attr("Name"), Query.value("ClusterPartition")), Query.match(Query.attr("PartitionName"), Query.value(name)));
/*     */
/* 111 */     Set mbeans = server.queryMBeans(null, exp);
/*     */     Iterator iter;
/* 112 */     if ((mbeans != null) && (mbeans.size() > 0))
/*     */     {
View Full Code Here

    public Set getMBeans() {
        try {
            if (server != null) {
                ObjectName objectName = new ObjectName(getObjectNameFilter());
                QueryExp query = null;
                return server.queryMBeans(objectName, query);
            } else {
                throw new Exception("MBean server has not been initialized");
            }
        } catch (Exception e) {
View Full Code Here

     *
     */
    private String getDomain() {
        try {
            ObjectName mbeanName = new ObjectName(getMBeanName());
            QueryExp query = null;
            Set results = server.queryMBeans(mbeanName, query);

            instance = (ObjectInstance) results.iterator().next();
            name = instance.getObjectName();
            return name.getDomain();
View Full Code Here

        try {
            if (server != null) {

                ObjectName objectName = new ObjectName(ctx.getObjectNameFilter());
                QueryExp query = null;
                Set results = server.queryMBeans(objectName, query);
                List mbeans = toList(results);
                printMBeanStack(out, mbeans);
            }
        } catch (MalformedObjectNameException e) {
View Full Code Here

    public void testReset() throws Exception {
        // get the stats for the route
        MBeanServer mbeanServer = getMBeanServer();

        QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("first"));
        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        ObjectName on = set.iterator().next();

        // send in 5 messages
View Full Code Here

    public void testReset() throws Exception {
        // get the stats for the route
        MBeanServer mbeanServer = getMBeanServer();

        QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("first"));
        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        ObjectName on = set.iterator().next();

        // send in 5 messages
View Full Code Here

TOP

Related Classes of javax.management.QueryExp

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.