1 22 package org.jboss.mx.util; 23 24 import javax.management.QueryExp ; 25 import javax.management.ObjectName ; 26 import javax.management.BadStringOperationException ; 27 import javax.management.BadBinaryOpValueExpException ; 28 import javax.management.BadAttributeValueExpException ; 29 import javax.management.InvalidApplicationException ; 30 import javax.management.MBeanServer ; 31 import javax.management.InstanceNotFoundException ; 32 33 38 public class InstanceOfQueryExp implements QueryExp 39 { 40 41 private static final long serialVersionUID = -1; 42 43 MBeanServer server; 44 String classname; 45 46 public InstanceOfQueryExp(String classname) 47 { 48 this.classname = classname; 49 } 50 51 public boolean apply(ObjectName name) 52 throws BadStringOperationException , 53 BadBinaryOpValueExpException , 54 BadAttributeValueExpException , 55 InvalidApplicationException 56 { 57 try 58 { 59 return server.isInstanceOf(name, classname); 60 } 61 catch (InstanceNotFoundException e) 62 { 63 throw new InvalidApplicationException (name); 64 } 65 } 66 67 public void setMBeanServer(MBeanServer server) 68 { 69 this.server = server; 70 } 71 } 72 | Popular Tags |