KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > mdr > events > ExtentEvent


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.api.mdr.events;
20
21 import java.util.Collection JavaDoc;
22 import javax.jmi.reflect.RefObject;
23
24 /** MDR event used for representing events related to lifecycle of package extents in a repository
25  * (creation and deletion of extents).
26  *
27  * @author Martin Matula
28  */

29 public class ExtentEvent extends MDRChangeEvent {
30     /** Bitmask representing all the events related to extent lifecycle. */
31     public static final int EVENTMASK_EXTENT = 0x801FFFF;
32
33     /** Identifier for event type that indicates creation of a new extent in a repository. */
34     public static final int EVENT_EXTENT_CREATE = 0x8010001;
35     /** Identifier for event type that indicates an extent is to be/was deleted. */
36     public static final int EVENT_EXTENT_DELETE = 0x8010002;
37
38     private final String JavaDoc extentName;
39     private final RefObject metaObject;
40     private final Collection JavaDoc existingExtents;
41     private final boolean empty;
42     
43     /** Creates new ExtentEvent object.
44      * @param source Event source (MDRepository in case of extent creation, RefPackage in case of extent deletion).
45      * @param type Event type.
46      * @param extentName Name of created/deleted extent.
47      * @param metaObject Metaobject of created/deleted extent or null.
48      * @param existingExtents Immutable collection of existing extents that were provided to be used for clustering or null.
49      */

50     public ExtentEvent (Object JavaDoc source, int type, String JavaDoc extentName, RefObject metaObject, Collection JavaDoc existingExtents) {
51         this (source, type, extentName, metaObject, existingExtents, true);
52     }
53     
54     public ExtentEvent(Object JavaDoc source, int type, String JavaDoc extentName, RefObject metaObject, Collection JavaDoc existingExtents, boolean empty) {
55         super(source, type);
56         this.extentName = extentName;
57         this.metaObject = metaObject;
58         this.existingExtents = existingExtents;
59         this.empty = empty;
60     }
61     
62     /** Returns name of deleted/created extent.
63      * @return Name of created/deleted extent.
64      */

65     public String JavaDoc getExtentName() {
66         return extentName;
67     }
68     
69     /** Returns metaobject of created/deleted extent.
70      * @return metaobject of created/deleted extent or null.
71      */

72     public RefObject getMetaObject() {
73         return metaObject;
74     }
75     
76     /** Returns collection of existing extents provided to be used for package clustering.
77      * @return Collection of extents or null.
78      */

79     public Collection JavaDoc getExistingExtents() {
80         return existingExtents;
81     }
82     
83     /** Returns true in the case that the created package is empty.
84      * The false value means that the extent was created by partition mounting.
85      * @return boolean
86      */

87     public boolean isEmpty () {
88         return this.empty;
89     }
90 }
91
Popular Tags