/
CMP20Wrapper.java
125 lines (94 loc) · 3.31 KB
/
CMP20Wrapper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
/*
* $Id$
*/
package com.sun.ts.tests.common.ejb.wrappers;
import java.util.Properties;
import javax.naming.NamingException;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import jakarta.ejb.CreateException;
import jakarta.ejb.EJBException;
import jakarta.ejb.EntityBean;
import jakarta.ejb.EntityContext;
import jakarta.ejb.RemoveException;
public abstract class CMP20Wrapper implements EntityBean {
/* Entity instance data */
public abstract Integer getId();
public abstract void setId(Integer i);
public abstract String getBrandName();
public abstract void setBrandName(String s);
public abstract float getPrice();
public abstract void setPrice(float p);
protected EntityContext ectx = null;
protected TSNamingContext nctx = null;
/*
* Bean life cycle.
*/
public Integer ejbCreate(Properties props, int id, String brandName,
float price) throws CreateException {
TestUtil.logTrace("[CMP20Wrapper] ejbCreate()");
Integer pk = new Integer(id);
try {
TestUtil.logTrace("[CMP20Wrapper] initialize logging...");
TestUtil.init(props);
setId(pk);
setBrandName(brandName);
setPrice(price);
} catch (Exception e) {
TestUtil.logErr("[CMP20Wrapper] Caught exception: " + e);
throw new CreateException("Exception occurred: " + e);
}
return null;
}
public void ejbPostCreate(Properties props, int id, String brandName,
float price) {
TestUtil.logTrace("[CMP20Wrapper] ejbPostCreate()");
}
public void setEntityContext(EntityContext c) {
try {
TestUtil.logTrace("[CMP20Wrapper] setEntityContext()");
ectx = c;
TestUtil.logMsg("[CMP20Wrapper] Obtaining TS Naming Context...");
nctx = new TSNamingContext();
} catch (NamingException e) {
TestUtil.logErr("[CMP20Wrapper] Naming Exception : " + e);
throw new EJBException("Cannot obtain Naming Context" + e);
} catch (Exception e) {
TestUtil.logErr("[CMP20Wrapper] Caught exception: " + e);
throw new EJBException("Caught exception: " + e);
}
}
public void unsetEntityContext() {
TestUtil.logTrace("[CMP20Wrapper] unsetEntityContext()");
}
public void ejbRemove() throws RemoveException {
TestUtil.logTrace("[CMP20Wrapper] ejbRemove()");
}
public void ejbActivate() {
TestUtil.logTrace("[CMP20Wrapper] ejbActivate()");
}
public void ejbPassivate() {
TestUtil.logTrace("[CMP20Wrapper] ejbPassivate()");
}
public void ejbLoad() {
TestUtil.logTrace("[CMP20Wrapper] ejbLoad()");
}
public void ejbStore() {
TestUtil.logTrace("[CMP20Wrapper] ejbStore()");
}
}