KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > enterprise > deploy > model > XpathEvent


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 javax.enterprise.deploy.model;
25
26 import java.beans.PropertyChangeEvent JavaDoc;
27
28 /**
29  * An Event class describing ConfigBeans being added/subtracted
30  * from a server configuration.
31  */

32 public final class XpathEvent {
33
34    private final DDBean JavaDoc bean;
35    private final Object JavaDoc typ;
36    private PropertyChangeEvent JavaDoc changeEvent;
37
38    /**
39     * Adding a DDBean
40     */

41    public static final Object JavaDoc BEAN_ADDED = new Object JavaDoc();
42    /**
43     * Removing a DDBean
44     */

45    public static final Object JavaDoc BEAN_REMOVED = new Object JavaDoc();
46    /**
47     * Changing a DDBean
48     */

49    public static final Object JavaDoc BEAN_CHANGED = new Object JavaDoc();
50
51    /**
52     * A description of a change in the ConfigBean tree.
53     * @param bean The ConfigBean being added/removed.
54     * @param typ Indicates an add/remove event.
55     */

56    public XpathEvent(DDBean JavaDoc bean, Object JavaDoc typ) {
57        this.bean = bean; this.typ = typ;
58        }
59
60    public PropertyChangeEvent JavaDoc getChangeEvent() {
61        if(typ == BEAN_CHANGED) return changeEvent;
62        return null;
63    }
64    
65    public void setChangeEvent(PropertyChangeEvent JavaDoc pce) {
66        changeEvent = pce;
67    }
68    
69        /**
70         * The bean being added/removed/changed.
71         * @return The bean being added/removed/changed.
72         */

73    public DDBean JavaDoc getBean() {return bean;}
74
75    /** Is this an add event?
76     * @return true if this is an add event.
77     */

78    public boolean isAddEvent() {return typ == BEAN_ADDED;}
79
80    /** Is this a remove event?
81     * @return true if this is a remove event.
82     */

83    public boolean isRemoveEvent() {return typ == BEAN_REMOVED;}
84
85    /** Is this a change event?
86     * @return true if this is a change event.
87     */

88    public boolean isChangeEvent() {return typ == BEAN_CHANGED;}
89
90    }
91
Popular Tags