KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > EntityManagerReferenceDescriptor


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 package com.sun.enterprise.deployment;
24
25 import java.util.Map JavaDoc;
26 import java.util.HashMap JavaDoc;
27
28 import javax.persistence.PersistenceContextType;
29
30 import com.sun.enterprise.deployment.types.EntityManagerReference;
31
32 /**
33  * An object representing an component environment reference
34  * to an EntityManager
35  *
36 */

37 public class EntityManagerReferenceDescriptor extends
38     EnvironmentProperty implements EntityManagerReference {
39
40     private String JavaDoc unitName = null;
41     private PersistenceContextType contextType = PersistenceContextType.TRANSACTION;
42     private BundleDescriptor referringBundle;
43
44     private Map JavaDoc<String JavaDoc, String JavaDoc> properties = new HashMap JavaDoc<String JavaDoc,String JavaDoc>();
45
46     public EntityManagerReferenceDescriptor(String JavaDoc name,
47                                             String JavaDoc unitName,
48                                             PersistenceContextType type) {
49         super(name, "", "");
50
51         this.unitName = unitName;
52         this.contextType = type;
53     }
54
55     public EntityManagerReferenceDescriptor() {}
56
57     public void setUnitName(String JavaDoc unitName) {
58         
59         this.unitName = unitName;
60     }
61
62     public String JavaDoc getUnitName() {
63
64         return unitName;
65
66     }
67
68     public String JavaDoc getInjectResourceType() {
69         return "javax.persistence.EntityManager";
70     }
71
72     public void setInjectResourceType(String JavaDoc resourceType) {
73     }
74
75     public void setPersistenceContextType(PersistenceContextType type) {
76
77         contextType = type;
78
79     }
80
81     public PersistenceContextType getPersistenceContextType() {
82
83         return contextType;
84
85     }
86
87     public void addProperty(String JavaDoc name, String JavaDoc value) {
88         properties.put(name, value);
89     }
90
91     public Map JavaDoc<String JavaDoc,String JavaDoc> getProperties() {
92         return new HashMap JavaDoc<String JavaDoc,String JavaDoc>(properties);
93     }
94
95     public void setReferringBundleDescriptor(BundleDescriptor referringBundle)
96     {
97     this.referringBundle = referringBundle;
98     }
99
100     public BundleDescriptor getReferringBundleDescriptor()
101     {
102     return referringBundle;
103     }
104     
105 }
106
107
Popular Tags