001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package javax.enterprise.deploy.model;
023:
024: import java.beans.PropertyChangeEvent;
025:
026: /**
027: * An event describing ConfigBeans added/changed/removed from a configuration
028: */
029: public final class XpathEvent {
030: // Constants -----------------------------------------------------
031:
032: /** A bean is added */
033: public static final Object BEAN_ADDED = new Object();
034: /** A bean is removed */
035: public static final Object BEAN_REMOVED = new Object();
036: /** A bean is changed */
037: public static final Object BEAN_CHANGED = new Object();
038:
039: // Attributes ----------------------------------------------------
040:
041: /** The bean */
042: private DDBean bean;
043: /** The type */
044: private Object type;
045: /** The property change event */
046: private PropertyChangeEvent propertyChangeEvent;
047:
048: // Static --------------------------------------------------------
049:
050: // Constructors --------------------------------------------------
051:
052: /**
053: * Create a new XpathEvent
054: *
055: * @param bean the bean
056: * @param type the event type
057: */
058: public XpathEvent(DDBean bean, Object type) {
059: this .bean = bean;
060: this .type = type;
061: }
062:
063: // Public --------------------------------------------------------
064:
065: /**
066: * Get the property change event
067: *
068: * @return the property change event
069: */
070: public PropertyChangeEvent getChangeEvent() {
071: return propertyChangeEvent;
072: }
073:
074: /**
075: * Set the property change event
076: *
077: * @param propertyChangeEvent the property change event
078: */
079: public void setChangeEvent(PropertyChangeEvent propertyChangeEvent) {
080: this .propertyChangeEvent = propertyChangeEvent;
081: }
082:
083: /**
084: * Get the DDBean
085: *
086: * @return the DDBean
087: */
088: public DDBean getBean() {
089: return bean;
090: }
091:
092: /**
093: * Is it an add event
094: *
095: * @return true when it is an add event, false otherwise
096: */
097: public boolean isAddEvent() {
098: return type == BEAN_ADDED;
099: }
100:
101: /**
102: * Is it a remove event
103: *
104: * @return true when it is a remove event, false otherwise
105: */
106: public boolean isRemoveEvent() {
107: return type == BEAN_REMOVED;
108: }
109:
110: /**
111: * Is it a change event
112: *
113: * @return true when it is a change event, false otherwise
114: */
115: public boolean isChangeEvent() {
116: return type == BEAN_CHANGED;
117: }
118:
119: // Package protected ---------------------------------------------
120:
121: // Protected -----------------------------------------------------
122:
123: // Private -------------------------------------------------------
124:
125: // Inner classes -------------------------------------------------
126: }
|