src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java

Thu, 31 Aug 2017 18:10:36 +0800

author
aoqi
date
Thu, 31 Aug 2017 18:10:36 +0800
changeset 748
6845b95cba6b
parent 158
91006f157c46
parent 0
7ef37b2cdcad
permissions
-rw-r--r--

merge

     1 /*
     2  * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.corba.se.impl.presentation.rmi;
    28 import java.rmi.Remote ;
    29 import javax.rmi.CORBA.Tie ;
    31 import javax.rmi.CORBA.Util;
    33 import org.omg.CORBA.CompletionStatus;
    35 import org.omg.CORBA.portable.IDLEntity ;
    37 import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
    38 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
    40 import com.sun.corba.se.spi.orb.ORB;
    42 import com.sun.corba.se.spi.logging.CORBALogDomains ;
    44 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
    46 public abstract class StubFactoryFactoryDynamicBase extends
    47     StubFactoryFactoryBase
    48 {
    49     protected final ORBUtilSystemException wrapper ;
    51     public StubFactoryFactoryDynamicBase()
    52     {
    53         wrapper = ORBUtilSystemException.get(
    54             CORBALogDomains.RPC_PRESENTATION ) ;
    55     }
    57     public PresentationManager.StubFactory createStubFactory(
    58         String className, boolean isIDLStub, String remoteCodeBase,
    59         Class expectedClass, ClassLoader classLoader)
    60     {
    61         Class cls = null ;
    63         try {
    64             cls = Util.loadClass( className, remoteCodeBase, classLoader ) ;
    65         } catch (ClassNotFoundException exc) {
    66             throw wrapper.classNotFound3(
    67                 CompletionStatus.COMPLETED_MAYBE, exc, className ) ;
    68         }
    70         PresentationManager pm = ORB.getPresentationManager() ;
    72         if (IDLEntity.class.isAssignableFrom( cls ) &&
    73             !Remote.class.isAssignableFrom( cls )) {
    74             // IDL stubs must always use static factories.
    75             PresentationManager.StubFactoryFactory sff =
    76                 pm.getStubFactoryFactory( false ) ;
    77             PresentationManager.StubFactory sf =
    78                 sff.createStubFactory( className, true, remoteCodeBase,
    79                     expectedClass, classLoader ) ;
    80             return sf ;
    81         } else {
    82             PresentationManager.ClassData classData = pm.getClassData( cls ) ;
    83             return makeDynamicStubFactory( pm, classData, classLoader ) ;
    84         }
    85     }
    87     public abstract PresentationManager.StubFactory makeDynamicStubFactory(
    88         PresentationManager pm, PresentationManager.ClassData classData,
    89         ClassLoader classLoader ) ;
    91     public Tie getTie( Class cls )
    92     {
    93         PresentationManager pm = ORB.getPresentationManager() ;
    94         return new ReflectiveTie( pm, wrapper ) ;
    95     }
    97     public boolean createsDynamicStubs()
    98     {
    99         return true ;
   100     }
   101 }

mercurial