KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > mdr > storagemodel > TransientStorableClass


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
20 package org.netbeans.mdr.storagemodel;
21 import java.lang.ref.WeakReference JavaDoc;
22 import java.lang.ref.Reference JavaDoc;
23 import java.lang.ref.ReferenceQueue JavaDoc;
24 import java.util.HashMap JavaDoc;
25 import java.util.ArrayList JavaDoc;
26 import java.util.Collection JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import java.util.Map JavaDoc;
29 import java.util.List JavaDoc;
30 import org.netbeans.mdr.persistence.MOFID;
31 import org.netbeans.mdr.persistence.StorageException;
32 import org.netbeans.mdr.persistence.StorageBadRequestException;
33 /**
34  *
35  * @author Tomas Zezula
36  */

37 public class TransientStorableClass extends StorableClass implements Transient {
38     
39     
40     /** Creates a new instance of TransientStorableClass */
41     public TransientStorableClass() {
42         super ();
43     }
44     
45     public TransientStorableClass(MdrStorage mdrStorage, org.netbeans.mdr.persistence.MOFID packageId, org.netbeans.mdr.persistence.MOFID metaId,
46         List JavaDoc attrDescs, List JavaDoc clAttrDescs, Map JavaDoc datatypes, boolean classDerived,
47         boolean instanceDerived, boolean isSingleton, boolean isAbstract) throws StorageException {
48             super (mdrStorage, packageId, metaId, attrDescs, clAttrDescs, datatypes, classDerived, instanceDerived, isSingleton, isAbstract);
49     }
50     
51     public Collection JavaDoc allObjects (boolean subclasses) throws StorageException {
52         if (subclasses) {
53             return super.allObjects (subclasses);
54         }
55         else {
56             return collectInstances ();
57         }
58     }
59     
60     public boolean isTransient () {
61         return true;
62     }
63     
64     
65     
66     private synchronized Collection JavaDoc collectInstances () throws StorageException {
67         MdrStorage storage = this.getMdrStorage ();
68         return new IndexImmutSet(storage, storage.getTransientStorage ().getMultivaluedIndex (MdrStorage.IDX_OBJECTS_BY_CLASSES), this.getMofId ());
69     }
70     
71     
72 }
73
Popular Tags