Package org.omg.CORBA.portable

Examples of org.omg.CORBA.portable.Delegate


        String giopMethodName = classData.getIDLNameTranslator().
            getIDLName( method ;
        DynamicMethodMarshaller dmm =
            pm.getDynamicMethodMarshaller( method ) ;

        Delegate delegate = null ;
        try {
            delegate = StubAdapter.getDelegate( stub ) ;
        } catch (SystemException ex) {
            throw Util.mapSystemException(ex) ;
        }

        if (!isLocal()) {
            try {
                org.omg.CORBA_2_3.portable.InputStream in = null ;
                try {
                    // create request
                    org.omg.CORBA_2_3.portable.OutputStream out =
                        (org.omg.CORBA_2_3.portable.OutputStream)
                        delegate.request( stub, giopMethodName, true);

                    // marshal arguments
                    dmm.writeArguments( out, args ) ;

                    // finish invocation
                    in = (org.omg.CORBA_2_3.portable.InputStream)
                        delegate.invoke( stub, out);

                    // unmarshal result
                    return dmm.readResult( in ) ;
                } catch (ApplicationException ex) {
                    throw dmm.readException( ex ) ;
                } catch (RemarshalException ex) {
                    return invoke( proxy, method, args ) ;
                } finally {
                    delegate.releaseReply( stub, in );
                }
            } catch (SystemException ex) {
                throw Util.mapSystemException(ex) ;
            }
        } else {
            // local branch
            ORB orb = (ORB)delegate.orb( stub ) ;
            ServantObject so = delegate.servant_preinvoke( stub, giopMethodName,
                method.getDeclaringClass() );
            if (so == null) {
                return invoke( stub, method, args ) ;
            }
            try {
                Object[] copies = dmm.copyArguments( args, orb ) ;

                if (!method.isAccessible()) {
                    // Make sure that we can invoke a method from a normally
                    // inaccessible package, as this reflective class must always
                    // be able to invoke a non-public method.
                    AccessController.doPrivileged(new PrivilegedAction() {
                        public Object run() {
                            method.setAccessible( true ) ;
                            return null ;
                        }
                    } ) ;
                }

                Object result = method.invoke( so.servant, copies ) ;

                return dmm.copyResult( result, orb ) ;
            } catch (InvocationTargetException ex) {
                Throwable mex = ex.getCause() ;
                // mex should never be null, as null cannot be thrown
                Throwable exCopy = (Throwable)Util.copyObject(mex,orb);
                if (dmm.isDeclaredException( exCopy ))
                    throw exCopy ;
                else
                    throw Util.wrapException(exCopy);
            } catch (Throwable thr) {
                if (thr instanceof ThreadDeath)
                    throw (ThreadDeath)thr ;

                // This is not a user thrown exception from the
                // method call, so don't copy it.  This is either
                // an error or a reflective invoke exception.
                throw Util.wrapException( thr ) ;
            } finally {
                delegate.servant_postinvoke( stub, so);
            }
        }
    }
View Full Code Here


                                    remoteCodebase,onlyMostDerived);
                        }
                    } else {
                        // Use the cached stub. Is the delegate set?
                        try {
                            Delegate stubDel = StubAdapter.getDelegate(
                                entry.stub ) ;
                        } catch (Exception e2) {
                            // No, so set it if we can...
                            try {
                                Delegate del = StubAdapter.getDelegate(
                                    tie ) ;
                                StubAdapter.setDelegate( entry.stub,
                                    del ) ;
                            } catch (Exception e) {}
                        }
View Full Code Here

            // Stub == null, so cache the miss...
            tieToStubCache.put(tie,CACHE_MISS);
        } else {
            if (tieIsStub) {
                try {
                    Delegate del = StubAdapter.getDelegate( tie ) ;
                    StubAdapter.setDelegate( stub, del ) ;
                } catch( Exception e1 ) {
                    // The tie does not have a delegate set, so stash
                    // this tie away using the stub as a key so that
                    // later, when the stub is connected, we can find
                    // and connect the tie as well...

                    synchronized (stubToTieCache) {
                        stubToTieCache.put(stub,tie);
                    }
                }
            } else {
                // Tie extends Servant
                try {
                    Delegate delegate = StubAdapter.getDelegate( tie ) ;
                    StubAdapter.setDelegate( stub, delegate ) ;
                } catch( org.omg.CORBA.BAD_INV_ORDER bad) {
                    synchronized (stubToTieCache) {
                        stubToTieCache.put(stub,tie);
                    }
View Full Code Here

            String codebase = null;
            try {
                // We can't assume that narrowFrom is a CORBA_2_3 stub, yet
                // it may have a 2_3 Delegate that provides a codebase.  Swallow
                // the ClassCastException otherwise.
                Delegate delegate = StubAdapter.getDelegate( narrowFrom ) ;
                codebase = ((org.omg.CORBA_2_3.portable.Delegate)delegate).
                    get_codebase(narrowFrom);

            } catch (ClassCastException e) {
                wrapper.classCastExceptionInLoadStub( e ) ;
View Full Code Here

  try {
        PresentationManager.StubFactory stubFact = stubFactory;
      org.omg.CORBA.Object ref = _createRef(rf, instanceKey,repoid);

      org.omg.CORBA.Object stub = stubFact.makeStub();
            Delegate delegate = StubAdapter.getDelegate(ref);
            StubAdapter.setDelegate(stub, delegate);              

      return (Remote) stub;

  } catch(Exception e) {
View Full Code Here

                // Check if it is already connected to the ORB by getting
                // the delegate.  If BAD_OPERATION is not thrown, then the
                // stub is connected.  This will happen if istream is an
                // IIOP input stream.
                Delegate delegate = StubAdapter.getDelegate(obj);

            } catch(org.omg.CORBA.BAD_OPERATION bo) {
               

                // Stub is not connected. This can happen if istream is
View Full Code Here

                                    remoteCodebase,onlyMostDerived);
                        }
                    } else {
                        // Use the cached stub. Is the delegate set?
                        try {
                            Delegate stubDel = StubAdapter.getDelegate(
                                entry.stub ) ;
                        } catch (Exception e2) {
                            // No, so set it if we can...
                            try {
                                Delegate del = StubAdapter.getDelegate(
                                    tie ) ;
                                StubAdapter.setDelegate( entry.stub,
                                    del ) ;
                            } catch (Exception e) {}
                        }
View Full Code Here

            // Stub == null, so cache the miss...
            tieToStubCache.put(tie,CACHE_MISS);
        } else {
            if (tieIsStub) {
                try {
                    Delegate del = StubAdapter.getDelegate( tie ) ;
                    StubAdapter.setDelegate( stub, del ) ;
                } catch( Exception e1 ) {
                    // The tie does not have a delegate set, so stash
                    // this tie away using the stub as a key so that
                    // later, when the stub is connected, we can find
                    // and connect the tie as well...

                    synchronized (stubToTieCache) {
                        stubToTieCache.put(stub,tie);
                    }
                }
            } else {
                // Tie extends Servant
                try {
                    Delegate delegate = StubAdapter.getDelegate( tie ) ;
                    StubAdapter.setDelegate( stub, delegate ) ;
                } catch( org.omg.CORBA.BAD_INV_ORDER bad) {
                    synchronized (stubToTieCache) {
                        stubToTieCache.put(stub,tie);
                    }
View Full Code Here

            String codebase = null;
            try {
                // We can't assume that narrowFrom is a CORBA_2_3 stub, yet
                // it may have a 2_3 Delegate that provides a codebase.  Swallow
                // the ClassCastException otherwise.
                Delegate delegate = StubAdapter.getDelegate( narrowFrom ) ;
                codebase = ((org.omg.CORBA_2_3.portable.Delegate)delegate).
                    get_codebase(narrowFrom);

            } catch (ClassCastException e) {
                wrapper.classCastExceptionInLoadStub( e ) ;
View Full Code Here

        // If ref is a local object, it is not a Stub!
        if (!StubAdapter.isStub(ref))
            return false ;

        Delegate del = StubAdapter.getDelegate(ref) ;
        if (del == null)
            return false ;

        // Optimize the x.is_equivalent( x ) case
        if (del == this)
View Full Code Here

TOP

Related Classes of org.omg.CORBA.portable.Delegate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.