1 7 package com.sun.corba.se.spi.oa ; 8 9 import org.omg.PortableInterceptor.ObjectReferenceTemplate ; 10 import org.omg.PortableInterceptor.ObjectReferenceFactory ; 11 12 import org.omg.CORBA.Policy ; 13 14 import org.omg.PortableInterceptor.ACTIVE ; 15 16 import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; 17 import com.sun.corba.se.spi.ior.IORFactories ; 18 import com.sun.corba.se.spi.ior.IORTemplate ; 19 import com.sun.corba.se.spi.ior.ObjectAdapterId; 20 import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; 21 import com.sun.corba.se.spi.logging.CORBALogDomains ; 22 import com.sun.corba.se.spi.oa.OADestroyed ; 23 import com.sun.corba.se.spi.oa.ObjectAdapter ; 24 import com.sun.corba.se.spi.orb.ORB ; 25 import com.sun.corba.se.spi.protocol.PIHandler ; 26 27 import com.sun.corba.se.impl.logging.POASystemException ; 28 import com.sun.corba.se.impl.logging.OMGSystemException ; 29 import com.sun.corba.se.impl.oa.poa.Policies; 30 31 abstract public class ObjectAdapterBase extends org.omg.CORBA.LocalObject 32 implements ObjectAdapter 33 { 34 private ORB orb; 35 36 private final POASystemException _iorWrapper ; 38 private final POASystemException _invocationWrapper ; 39 private final POASystemException _lifecycleWrapper ; 40 private final OMGSystemException _omgInvocationWrapper ; 41 private final OMGSystemException _omgLifecycleWrapper ; 42 43 private IORTemplate iortemp; 46 private byte[] adapterId ; 47 private ObjectReferenceTemplate adapterTemplate ; 48 private ObjectReferenceFactory currentFactory ; 49 50 public ObjectAdapterBase( ORB orb ) 51 { 52 this.orb = orb ; 53 _iorWrapper = POASystemException.get( orb, 54 CORBALogDomains.OA_IOR ) ; 55 _lifecycleWrapper = POASystemException.get( orb, 56 CORBALogDomains.OA_LIFECYCLE ) ; 57 _omgLifecycleWrapper = OMGSystemException.get( orb, 58 CORBALogDomains.OA_LIFECYCLE ) ; 59 _invocationWrapper = POASystemException.get( orb, 60 CORBALogDomains.OA_INVOCATION ) ; 61 _omgInvocationWrapper = OMGSystemException.get( orb, 62 CORBALogDomains.OA_INVOCATION ) ; 63 } 64 65 public final POASystemException iorWrapper() 66 { 67 return _iorWrapper ; 68 } 69 70 public final POASystemException lifecycleWrapper() 71 { 72 return _lifecycleWrapper ; 73 } 74 75 public final OMGSystemException omgLifecycleWrapper() 76 { 77 return _omgLifecycleWrapper ; 78 } 79 80 public final POASystemException invocationWrapper() 81 { 82 return _invocationWrapper ; 83 } 84 85 public final OMGSystemException omgInvocationWrapper() 86 { 87 return _omgInvocationWrapper ; 88 } 89 90 94 final public void initializeTemplate( ObjectKeyTemplate oktemp, 95 boolean notifyORB, Policies policies, String codebase, 96 String objectAdapterManagerId, ObjectAdapterId objectAdapterId) 97 { 98 adapterId = oktemp.getAdapterId() ; 99 100 iortemp = IORFactories.makeIORTemplate(oktemp) ; 101 102 orb.getCorbaTransportManager().addToIORTemplate( 105 iortemp, policies, 106 codebase, objectAdapterManagerId, objectAdapterId); 107 108 adapterTemplate = IORFactories.makeObjectReferenceTemplate( orb, 109 iortemp ) ; 110 currentFactory = adapterTemplate ; 111 112 if (notifyORB) { 113 PIHandler pih = orb.getPIHandler() ; 114 if (pih != null) 115 pih.objectAdapterCreated( this ) ; 117 } 118 119 iortemp.makeImmutable() ; 120 } 121 122 final public org.omg.CORBA.Object makeObject( String repId, byte[] oid ) 123 { 124 return currentFactory.make_object( repId, oid ) ; 125 } 126 127 final public byte[] getAdapterId() 128 { 129 return adapterId ; 130 } 131 132 final public ORB getORB() 133 { 134 return orb ; 135 } 136 137 abstract public Policy getEffectivePolicy( int type ) ; 138 139 final public IORTemplate getIORTemplate() 140 { 141 return iortemp ; 142 } 143 144 abstract public int getManagerId() ; 145 146 abstract public short getState() ; 147 148 final public ObjectReferenceTemplate getAdapterTemplate() 149 { 150 return adapterTemplate ; 151 } 152 153 final public ObjectReferenceFactory getCurrentFactory() 154 { 155 return currentFactory ; 156 } 157 158 final public void setCurrentFactory( ObjectReferenceFactory factory ) 159 { 160 currentFactory = factory ; 161 } 162 163 abstract public org.omg.CORBA.Object getLocalServant( byte[] objectId ) ; 164 165 abstract public void getInvocationServant( OAInvocationInfo info ) ; 166 167 abstract public void returnServant() ; 168 169 abstract public void enter() throws OADestroyed ; 170 171 abstract public void exit() ; 172 173 abstract protected ObjectCopierFactory getObjectCopierFactory() ; 174 175 public OAInvocationInfo makeInvocationInfo( byte[] objectId ) 178 { 179 OAInvocationInfo info = new OAInvocationInfo( this, objectId ) ; 180 info.setCopierFactory( getObjectCopierFactory() ) ; 181 return info ; 182 } 183 184 abstract public String [] getInterfaces( Object servant, byte[] objectId ) ; 185 } 186 | Popular Tags |