KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > selfmanagement > Rule


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.management.selfmanagement;
25
26 import com.sun.enterprise.admin.selfmanagement.event.Event;
27
28 /**
29  * Denotes the configured rule in the server instance. It abstracts all the
30  * Rule relevent information in it.
31  *
32  * @author Pankaj Jairath
33  */

34 class Rule {
35     /** One of the states of the rule */
36     final static int ENABLED = 0;
37     
38     final static int INACTIVE = 1;
39     
40     final static int DISABLED = 2;
41     
42     final static int NOACTION = 3;
43     
44     private String JavaDoc name = null;
45     
46     private String JavaDoc description = null;
47     
48     private int state = -1;
49     
50     private Event event = null;
51     
52     private Object JavaDoc actionMBean = null;
53
54     private boolean isEnabled = false;
55     
56     /** Creates a new instance of Rule */
57     Rule(String JavaDoc ruleName, String JavaDoc ruleDescription) {
58         name = ruleName;
59         ruleDescription = ruleDescription;
60     }
61
62     /** Sets the name of the configured Rule */
63     void setName(String JavaDoc ruleName) {
64         name = ruleName;
65     }
66  
67     
68     /** Retrieves name of the configured rule */
69     String JavaDoc getName() {
70         return name;
71     }
72     
73     /** Retrieves the description of the configured rule */
74     String JavaDoc getDescription() {
75         return description;
76     }
77     
78     /** Sets the current state of the configured Rule */
79     void setState(int ruleState) {
80         state = ruleState;
81     }
82     
83     /** Retrieves the current state of the configured Rule */
84     int getState() {
85         return state;
86     }
87     
88     /** Associates the event with the Rule */
89     void setEvent(Event ruleEvent) {
90         event = ruleEvent;
91     }
92     
93     /** Retrieves the Event associated with the Rule */
94     Event getEvent() {
95         return event;
96     }
97     
98     /** Associates the Action with the configured Rule */
99     void setAction(Object JavaDoc actionInstance) {
100         actionMBean = actionInstance;
101     }
102     
103     /** Retrieves the Action associated with the Rule */
104     Object JavaDoc getAction() {
105         return actionMBean;
106     }
107
108     /** Set the enabled status */
109     void setEnabled(boolean status) {
110         isEnabled = status;
111     }
112
113     /** Provides the enabled status of the rule */
114     boolean isEnabled() {
115         return isEnabled;
116     }
117 }
118
Popular Tags