01: package org.objectweb.jonas_ejb.container;
02:
03: import java.io.IOException;
04: import java.io.OutputStream;
05:
06: import org.objectweb.carol.cmi.ObjectId;
07: import org.objectweb.util.monolog.api.BasicLevel;
08:
09: public class JRepStatefulOutputStream extends JStatefulOutputStream {
10:
11: public JRepStatefulOutputStream(OutputStream out)
12: throws IOException {
13: super (out);
14: }
15:
16: protected Object replaceObject(Object obj) throws IOException {
17: Object ret;
18: /*if(obj instanceof DataSource) {
19: ConnectionManager cm = (ConnectionManager) obj;
20: String jndiname = cm.getDSName();
21: ret = new JWrapper(JWrapper.DATASOURCE, jndiname);
22: } else */
23: if (obj instanceof JRepStatefulLocal) {
24: // Local stateful -> a wrapper
25: TraceEjb.ssfpool.log(BasicLevel.DEBUG, "JRepStatefulLocal");
26: JRepStatefulLocal jrsl = (JRepStatefulLocal) obj;
27: String jndi = ((JLocalHome) jrsl.getSessionSwitch()
28: .getLocal().getEJBLocalHome()).getJndiLocalName();
29: ObjectId clusterOId = jrsl.getClusterOId();
30: ret = new JRepStatefulObjectId(jndi, clusterOId);
31: } else {
32: ret = super.replaceObject(obj);
33: }
34:
35: return ret;
36: }
37: }
|