KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > event > EventKey


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.event;
25
26 import javax.management.QueryExp JavaDoc;
27 import javax.management.ObjectName JavaDoc;
28
29 import com.sun.enterprise.admin.common.constant.AdminConstants;
30 import java.util.logging.Level JavaDoc;
31 import java.util.logging.Logger JavaDoc;
32
33
34 /**
35  * This class encapsulates event information that will be useful
36  * in devlivering the event, like the target mbean name and
37  * and/or query expression, so that this can be potentially can be delivered
38  * to one than one MBean
39  *
40  * @author Satish Viswanatham
41  * @version 1.0
42  */

43 public class EventKey implements java.io.Serializable JavaDoc {
44
45     static Logger JavaDoc logger = Logger.getLogger(AdminConstants.kLoggerName);
46
47     static final String JavaDoc MALFORMED_OBJECT_NAME = "event.object_name_in_event_is_invalid";
48
49     /**
50      * Target object name for event
51      */

52     private ObjectName JavaDoc objName;
53
54     /**
55      * Filter query for event processing
56      */

57     private QueryExp JavaDoc qry;
58
59
60     /**
61      * public constructor
62      */

63     public EventKey ( String JavaDoc name, QueryExp JavaDoc q) {
64         try {
65            objName = new ObjectName JavaDoc ( name);
66            qry = q;
67         } catch( Exception JavaDoc e) {
68             //throw a warning
69
// user need to reset values
70
logger.log(Level.WARNING, MALFORMED_OBJECT_NAME, name);
71         }
72     }
73     
74     /**
75      * retuns the ObjectName
76      */

77     public ObjectName JavaDoc getObjectName() { return objName; }
78
79     /**
80      * return query for this event
81      *
82      * @return QuertExp query object
83      */

84     public QueryExp JavaDoc getQuery() { return qry; }
85
86
87     /**
88      * object name setter
89      */

90     public void setObjectName(ObjectName JavaDoc obj) { objName = obj; }
91
92     /**
93      * query exp setter
94      */

95     public void setQuery(QueryExp JavaDoc q) { qry = q;}
96 }
97
Popular Tags