01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.com
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package org.huihoo.jfox.jmx.queries;
09:
10: import javax.management.AttributeValueExp;
11: import javax.management.ValueExp;
12: import javax.management.ObjectName;
13: import javax.management.BadStringOperationException;
14: import javax.management.BadBinaryOpValueExpException;
15: import javax.management.BadAttributeValueExpException;
16: import javax.management.InvalidApplicationException;
17:
18: /**
19: *
20: * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
21: */
22:
23: public class QualifiedAttributeValueExp extends AttributeValueExp {
24:
25: private String className;
26:
27: public QualifiedAttributeValueExp() {
28: }
29:
30: public QualifiedAttributeValueExp(String s, String s1) {
31: super (s1);
32: className = s;
33: }
34:
35: public String getAttrClassName() {
36: return className;
37: }
38:
39: public ValueExp apply(ObjectName objectname)
40: throws BadStringOperationException,
41: BadBinaryOpValueExpException,
42: BadAttributeValueExpException, InvalidApplicationException {
43: try {
44: String s = server.getObjectInstance(objectname)
45: .getClassName();
46: if (s.equals(className))
47: return super .apply(objectname);
48: } catch (Exception exception) {
49: }
50: throw new InvalidApplicationException("qualified attribute");
51: }
52:
53: public String toString() {
54: if (className != null)
55: return className + "." + super.toString();
56: else
57: return super.toString();
58: }
59: }
|