1 7 8 package com.sun.corba.se.impl.oa.poa ; 9 10 import java.util.Enumeration ; 11 12 import org.omg.PortableServer.POA ; 13 import org.omg.PortableServer.Servant ; 14 import org.omg.PortableServer.ServantManager ; 15 import org.omg.PortableServer.ServantLocator ; 16 import org.omg.PortableServer.ForwardRequest ; 17 import org.omg.PortableServer.POAPackage.NoServant ; 18 import org.omg.PortableServer.POAPackage.WrongPolicy ; 19 import org.omg.PortableServer.POAPackage.ObjectNotActive ; 20 import org.omg.PortableServer.POAPackage.ServantNotActive ; 21 import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; 22 import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; 23 import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ; 24 25 import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ; 26 import com.sun.corba.se.impl.orbutil.ORBUtility ; 27 import com.sun.corba.se.impl.orbutil.ORBConstants ; 28 29 import com.sun.corba.se.spi.oa.OAInvocationInfo ; 30 import com.sun.corba.se.impl.oa.NullServantImpl ; 31 32 35 public class POAPolicyMediatorImpl_NR_USM extends POAPolicyMediatorBase { 36 private ServantLocator locator ; 37 38 POAPolicyMediatorImpl_NR_USM( Policies policies, POAImpl poa ) 39 { 40 super( policies, poa ) ; 41 42 if (policies.retainServants()) 44 throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; 45 46 if (!policies.useServantManager()) 47 throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; 48 49 locator = null ; 50 } 51 52 protected java.lang.Object internalGetServant( byte[] id, 53 String operation ) throws ForwardRequest 54 { 55 if (locator == null) 56 throw poa.invocationWrapper().poaNoServantManager() ; 57 58 CookieHolder cookieHolder = orb.peekInvocationInfo().getCookieHolder() ; 59 60 java.lang.Object servant; 62 try{ 63 poa.unlock() ; 64 65 servant = locator.preinvoke(id, poa, operation, cookieHolder); 66 if (servant == null) 67 servant = new NullServantImpl( poa.omgInvocationWrapper().nullServantReturned() ) ; 68 else 69 setDelegate( (Servant )servant, id); 70 } finally { 71 poa.lock() ; 72 } 73 74 return servant; 75 } 76 77 public void returnServant() 78 { 79 OAInvocationInfo info = orb.peekInvocationInfo(); 80 if (locator == null) 81 return; 82 83 try { 84 poa.unlock() ; 85 locator.postinvoke(info.id(), (POA )(info.oa()), 86 info.getOperation(), info.getCookieHolder().value, 87 (Servant )(info.getServantContainer()) ); 88 } finally { 89 poa.lock() ; 90 } 91 } 92 93 public void etherealizeAll() 94 { 95 } 97 98 public void clearAOM() 99 { 100 } 102 103 public ServantManager getServantManager() throws WrongPolicy 104 { 105 return locator ; 106 } 107 108 public void setServantManager( ServantManager servantManager ) throws WrongPolicy 109 { 110 if (locator != null) 111 throw poa.invocationWrapper().servantManagerAlreadySet() ; 112 113 if (servantManager instanceof ServantLocator ) 114 locator = (ServantLocator )servantManager; 115 else 116 throw poa.invocationWrapper().servantManagerBadType() ; 117 } 118 119 public Servant getDefaultServant() throws NoServant , WrongPolicy 120 { 121 throw new WrongPolicy (); 122 } 123 124 public void setDefaultServant( Servant servant ) throws WrongPolicy 125 { 126 throw new WrongPolicy (); 127 } 128 129 public final void activateObject(byte[] id, Servant servant) 130 throws WrongPolicy , ServantAlreadyActive , ObjectAlreadyActive 131 { 132 throw new WrongPolicy (); 133 } 134 135 public Servant deactivateObject( byte[] id ) throws ObjectNotActive , WrongPolicy 136 { 137 throw new WrongPolicy (); 138 } 139 140 public byte[] servantToId( Servant servant ) throws ServantNotActive , WrongPolicy 141 { 142 throw new WrongPolicy (); 143 } 144 145 public Servant idToServant( byte[] id ) 146 throws WrongPolicy , ObjectNotActive 147 { 148 throw new WrongPolicy (); 149 } 150 } 151 | Popular Tags |