public void setServant(Object servant) { servantContainer = servant; if (servant instanceof Tie) this.servant = ((Tie) servant).getTarget(); else this.servant = servant; } }
protected void cleanUpTie(Tie cachedTie) throws java.rmi.NoSuchObjectException { cachedTie.setTarget(null); cachedTie.deactivate(); }
protected void exportObject(java.rmi.Remote remote) throws java.rmi.RemoteException { // create servant and tie PortableRemoteObject.exportObject(remote); Tie servantsTie = javax.rmi.CORBA.Util.getTie(remote); // Note: at this point the Tie doesnt have a delegate inside it, // so it is not really "exported". // The following call does orb.connect() which is the real exporting servantsTie.orb(orb); }
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) { for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); ) { java.lang.Object key = e.nextElement(); Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key); // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set. // We can ignore this because it means the tie is not connected to an ORB. try { if (orb == getTie(target).orb()) { try { unexportObject(target); } catch( java.rmi.NoSuchObjectException ex ) { // We neglect this exception if at all if it is // raised. It is not harmful. } } } catch (BAD_OPERATION bad) { /* Ignore */ } } }
public void registerTarget(Tie tie, Remote obj) { if (obj == null) throw new IllegalArgumentException("remote object is null"); tie.setTarget(obj); tie_map().put(obj, tie); // log.info("exported instance of "+obj.getClass()+" in // "+RMIState.current().getName()); }
obj = tie.getTarget(); final org.omg.CORBA.portable.ObjectImpl thisObject = (ObjectImpl) tie.thisObject(); final String[] ids = thisObject._ids();
/** Given any Tie, return the corresponding object refernce, activating * the Servant if necessary. */ public static org.omg.CORBA.Object activateTie( Tie tie ) { /** Any implementation of Tie should be either a Servant or an ObjectImpl, * depending on which style of code generation is used. rmic -iiop by * default results in an ObjectImpl-based Tie, while rmic -iiop -poa * results in a Servant-based Tie. Dynamic RMI-IIOP also uses Servant-based * Ties (see impl.presentation.rmi.ReflectiveTie). */ if (tie instanceof ObjectImpl) { return tie.thisObject() ; } else if (tie instanceof Servant) { Servant servant = (Servant)tie ; return activateServant( servant ) ; } else { throw wrapper.badActivateTieCall() ; } }
public void unexportObject(Remote obj) throws java.rmi.NoSuchObjectException { if (obj == null) return; java.util.Map tie_map = tie_map(); if (tie_map == null) return; Tie tie = (Tie) tie_map.remove(obj); if (tie == null) { logger.fine("unexporting unknown instance of " + obj.getClass().getName() + " from " + RMIState.current().getName()); return; } else { logger.finer("unexporting instance of " + obj.getClass().getName() + " from " + RMIState.current().getName()); } tie.deactivate(); }
protected void exportObject(java.rmi.Remote remote) throws java.rmi.RemoteException { // create servant and tie PortableRemoteObject.exportObject(remote); Tie servantsTie = javax.rmi.CORBA.Util.getTie(remote); // Note: at this point the Tie doesnt have a delegate inside it, // so it is not really "exported". // The following call does orb.connect() which is the real exporting servantsTie.orb(orb); }
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) { for (Enumeration<?> e = exportedServants.keys(); e.hasMoreElements();) { java.lang.Object key = e.nextElement(); Remote target = (Remote) (key instanceof Tie ? ((Tie) key).getTarget() : key); // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set. // We can ignore this because it means the tie is not connected to an ORB. try { if (orb == getTie(target).orb()) { try { unexportObject(target); } catch (java.rmi.NoSuchObjectException ex) { // We neglect this exception if at all if it is raised. It is not harmful. } } } catch (BAD_OPERATION bad) { /* Ignore */ } } }
@Override public void validateTargetObjectInterfaces(Remote targetObj) { if( targetObj != null ) { // All Remote interfaces implemented by targetObj will be // validated as a side-effect of calling setTarget(). // A runtime exception will be propagated if validation fails. Tie tie = presentationMgr.getTie(); tie.setTarget(targetObj); } else { throw new IllegalArgumentException ("null passed to validateTargetObjectInterfaces"); } }
/** * Given any Tie, return the corresponding object refernce, activating the Servant if necessary. */ public static org.omg.CORBA.Object activateTie(Tie tie) { /** * Any implementation of Tie should be either a Servant or an ObjectImpl, depending on which style of code * generation is used. rmic -iiop by default results in an ObjectImpl-based Tie, while rmic -iiop -poa results * in a Servant-based Tie. Dynamic RMI-IIOP also uses Servant-based Ties (see * impl.presentation.rmi.ReflectiveTie). */ if (tie instanceof ObjectImpl) { return tie.thisObject(); } else if (tie instanceof Servant) { Servant servant = (Servant) tie; return activateServant(servant); } else { throw wrapper.badActivateTieCall(); } }
tie.orb(orb); obj = PortableRemoteObject.toStub((Remote) obj);
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) { for (Enumeration<?> e = exportedServants.keys(); e.hasMoreElements();) { java.lang.Object key = e.nextElement(); Remote target = (Remote) (key instanceof Tie ? ((Tie) key).getTarget() : key); // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set. // We can ignore this because it means the tie is not connected to an ORB. try { if (orb == getTie(target).orb()) { try { unexportObject(target); } catch (java.rmi.NoSuchObjectException ex) { // We neglect this exception if at all if it is raised. It is not harmful. } } } catch (BAD_OPERATION bad) { /* Ignore */ } } }
public void setServant(Object servant) { servantContainer = servant ; if (servant instanceof Tie) this.servant = ((Tie)servant).getTarget() ; else this.servant = servant; } }
protected void cleanUpTie(Tie cachedTie) throws java.rmi.NoSuchObjectException { cachedTie.setTarget(null); cachedTie.deactivate(); }
public RemoteNamingServantLocator( ORB orb, Remote impl ) { this.orb = orb ; Tie tie = ORB.getPresentationManager().getTie() ; tie.setTarget( impl ) ; servant = Servant.class.cast( tie ) ; }
/** * Given any Tie, return the corresponding object refernce, activating the Servant if necessary. */ public static org.omg.CORBA.Object activateTie(Tie tie) { /** * Any implementation of Tie should be either a Servant or an ObjectImpl, depending on which style of code * generation is used. rmic -iiop by default results in an ObjectImpl-based Tie, while rmic -iiop -poa results * in a Servant-based Tie. Dynamic RMI-IIOP also uses Servant-based Ties (see * impl.presentation.rmi.ReflectiveTie). */ if (tie instanceof ObjectImpl) { return tie.thisObject(); } else if (tie instanceof Servant) { Servant servant = (Servant) tie; return activateServant(servant); } else { throw wrapper.badActivateTieCall(); } }
tie.orb(orb); obj = PortableRemoteObject.toStub((Remote) obj);
public void setServant(Object servant) { servantContainer = servant; if (servant instanceof Tie) this.servant = ((Tie) servant).getTarget(); else this.servant = servant; } }