KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > oa > OAInvocationInfo


1 /*
2  * @(#)OAInvocationInfo.java 1.8 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package com.sun.corba.se.spi.oa;
8
9 import javax.rmi.CORBA.Tie JavaDoc ;
10
11 import org.omg.CORBA.portable.ServantObject JavaDoc;
12
13 import org.omg.PortableServer.Servant JavaDoc;
14
15 import org.omg.PortableServer.ServantLocatorPackage.CookieHolder JavaDoc;
16
17 import com.sun.corba.se.spi.oa.ObjectAdapter ;
18 import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
19
20 /** This class is a holder for the information required to implement POACurrent.
21 * It is also used for the ServantObject that is returned by _servant_preinvoke calls.
22 * This allows us to avoid allocating an extra object on each collocated invocation.
23 */

24 public class OAInvocationInfo extends ServantObject JavaDoc {
25     // This is the container object for the servant.
26
// In the RMI-IIOP case, it is the RMI-IIOP Tie, and the servant is the
27
// target of the Tie.
28
// In all other cases, it is the same as the Servant.
29
private java.lang.Object JavaDoc servantContainer ;
30
31     // These fields are to support standard OMG APIs.
32
private ObjectAdapter oa;
33     private byte[] oid;
34
35     // These fields are to support the Object adapter implementation.
36
private CookieHolder JavaDoc cookieHolder;
37     private String JavaDoc operation;
38
39     // This is the copier to be used by javax.rmi.CORBA.Util.copyObject(s)
40
// For the current request.
41
private ObjectCopierFactory factory ;
42
43     public OAInvocationInfo(ObjectAdapter oa, byte[] id )
44     {
45         this.oa = oa;
46         this.oid = id;
47     }
48
49     // Copy constructor of sorts; used in local optimization path
50
public OAInvocationInfo( OAInvocationInfo info, String JavaDoc operation )
51     {
52     this.servant = info.servant ;
53     this.servantContainer = info.servantContainer ;
54     this.cookieHolder = info.cookieHolder ;
55         this.oa = info.oa;
56         this.oid = info.oid;
57     this.factory = info.factory ;
58
59     this.operation = operation;
60     }
61
62     //getters
63
public ObjectAdapter oa() { return oa ; }
64     public byte[] id() { return oid ; }
65     public Object JavaDoc getServantContainer() { return servantContainer ; }
66
67     // Create CookieHolder on demand. This is only called by a single
68
// thread, so no synchronization is needed.
69
public CookieHolder JavaDoc getCookieHolder()
70     {
71     if (cookieHolder == null)
72         cookieHolder = new CookieHolder JavaDoc() ;
73
74     return cookieHolder;
75     }
76
77     public String JavaDoc getOperation() { return operation; }
78     public ObjectCopierFactory getCopierFactory() { return factory; }
79
80     //setters
81
public void setOperation( String JavaDoc operation ) { this.operation = operation ; }
82     public void setCopierFactory( ObjectCopierFactory factory ) { this.factory = factory ; }
83
84     public void setServant(Object JavaDoc servant)
85     {
86     servantContainer = servant ;
87     if (servant instanceof Tie JavaDoc)
88         this.servant = ((Tie JavaDoc)servant).getTarget() ;
89     else
90         this.servant = servant;
91     }
92 }
93
Popular Tags