Java Code Examples for javax.rmi.CORBA.Util#loadClass()
The following examples show how to use
javax.rmi.CORBA.Util#loadClass() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openjdk-jdk9 File: StubFactoryFactoryDynamicBase.java License: GNU General Public License v2.0 | 5 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { Class cls = null ; try { cls = Util.loadClass( className, remoteCodeBase, classLoader ) ; } catch (ClassNotFoundException exc) { throw wrapper.classNotFound3( CompletionStatus.COMPLETED_MAYBE, exc, className ) ; } PresentationManager pm = ORB.getPresentationManager() ; if (IDLEntity.class.isAssignableFrom( cls ) && !Remote.class.isAssignableFrom( cls )) { // IDL stubs must always use static factories. PresentationManager.StubFactoryFactory sff = pm.getStubFactoryFactory( false ) ; PresentationManager.StubFactory sf = sff.createStubFactory( className, true, remoteCodeBase, expectedClass, classLoader ) ; return sf ; } else { PresentationManager.ClassData classData = pm.getClassData( cls ) ; return makeDynamicStubFactory( pm, classData, classLoader ) ; } }
Example 2
Source Project: jdk1.8-source-analysis File: StubFactoryFactoryDynamicBase.java License: Apache License 2.0 | 5 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { Class cls = null ; try { cls = Util.loadClass( className, remoteCodeBase, classLoader ) ; } catch (ClassNotFoundException exc) { throw wrapper.classNotFound3( CompletionStatus.COMPLETED_MAYBE, exc, className ) ; } PresentationManager pm = ORB.getPresentationManager() ; if (IDLEntity.class.isAssignableFrom( cls ) && !Remote.class.isAssignableFrom( cls )) { // IDL stubs must always use static factories. PresentationManager.StubFactoryFactory sff = pm.getStubFactoryFactory( false ) ; PresentationManager.StubFactory sf = sff.createStubFactory( className, true, remoteCodeBase, expectedClass, classLoader ) ; return sf ; } else { PresentationManager.ClassData classData = pm.getClassData( cls ) ; return makeDynamicStubFactory( pm, classData, classLoader ) ; } }
Example 3
Source Project: jdk1.8-source-analysis File: RepositoryId.java License: Apache License 2.0 | 5 votes |
public final Class getClassFromType() throws ClassNotFoundException { if (clazz != null) return clazz; Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); if (specialCase != null){ clazz = specialCase; return specialCase; } else { try{ return Util.loadClass(getClassName(), null, null); } catch(ClassNotFoundException cnfe){ if (defaultServerURL != null) { try{ return getClassFromType(defaultServerURL); } catch(MalformedURLException mue){ throw cnfe; } } else throw cnfe; } } }
Example 4
Source Project: TencentKona-8 File: StubFactoryFactoryDynamicBase.java License: GNU General Public License v2.0 | 5 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { Class cls = null ; try { cls = Util.loadClass( className, remoteCodeBase, classLoader ) ; } catch (ClassNotFoundException exc) { throw wrapper.classNotFound3( CompletionStatus.COMPLETED_MAYBE, exc, className ) ; } PresentationManager pm = ORB.getPresentationManager() ; if (IDLEntity.class.isAssignableFrom( cls ) && !Remote.class.isAssignableFrom( cls )) { // IDL stubs must always use static factories. PresentationManager.StubFactoryFactory sff = pm.getStubFactoryFactory( false ) ; PresentationManager.StubFactory sf = sff.createStubFactory( className, true, remoteCodeBase, expectedClass, classLoader ) ; return sf ; } else { PresentationManager.ClassData classData = pm.getClassData( cls ) ; return makeDynamicStubFactory( pm, classData, classLoader ) ; } }
Example 5
Source Project: hottub File: RepositoryId.java License: GNU General Public License v2.0 | 5 votes |
public final Class getClassFromType() throws ClassNotFoundException { if (clazz != null) return clazz; Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); if (specialCase != null){ clazz = specialCase; return specialCase; } else { try{ return Util.loadClass(getClassName(), null, null); } catch(ClassNotFoundException cnfe){ if (defaultServerURL != null) { try{ return getClassFromType(defaultServerURL); } catch(MalformedURLException mue){ throw cnfe; } } else throw cnfe; } } }
Example 6
Source Project: hottub File: Utility.java License: GNU General Public License v2.0 | 5 votes |
public static Class loadClassForClass (String className, String remoteCodebase, ClassLoader loader, Class relatedType, ClassLoader relatedTypeClassLoader) throws ClassNotFoundException { if (relatedType == null) return Util.loadClass(className, remoteCodebase, loader); Class loadedClass = null; try { loadedClass = Util.loadClass(className, remoteCodebase, loader); } catch (ClassNotFoundException cnfe) { if (relatedType.getClassLoader() == null) throw cnfe; } // If no class was not loaded, or if the loaded class is not of the // correct type, make a further attempt to load the correct class // using the classloader of the related type. // _REVISIT_ Is this step necessary, or should the Util,loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if (loadedClass == null || (loadedClass.getClassLoader() != null && loadedClass.getClassLoader().loadClass(relatedType.getName()) != relatedType)) { if (relatedType.getClassLoader() != relatedTypeClassLoader) throw new IllegalArgumentException( "relatedTypeClassLoader not class loader of relatedType."); if (relatedTypeClassLoader != null) loadedClass = relatedTypeClassLoader.loadClass(className); } return loadedClass; }
Example 7
Source Project: jdk8u60 File: StubFactoryFactoryDynamicBase.java License: GNU General Public License v2.0 | 5 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { Class cls = null ; try { cls = Util.loadClass( className, remoteCodeBase, classLoader ) ; } catch (ClassNotFoundException exc) { throw wrapper.classNotFound3( CompletionStatus.COMPLETED_MAYBE, exc, className ) ; } PresentationManager pm = ORB.getPresentationManager() ; if (IDLEntity.class.isAssignableFrom( cls ) && !Remote.class.isAssignableFrom( cls )) { // IDL stubs must always use static factories. PresentationManager.StubFactoryFactory sff = pm.getStubFactoryFactory( false ) ; PresentationManager.StubFactory sf = sff.createStubFactory( className, true, remoteCodeBase, expectedClass, classLoader ) ; return sf ; } else { PresentationManager.ClassData classData = pm.getClassData( cls ) ; return makeDynamicStubFactory( pm, classData, classLoader ) ; } }
Example 8
Source Project: openjdk-8-source File: Utility.java License: GNU General Public License v2.0 | 5 votes |
public static Class loadClassForClass (String className, String remoteCodebase, ClassLoader loader, Class relatedType, ClassLoader relatedTypeClassLoader) throws ClassNotFoundException { if (relatedType == null) return Util.loadClass(className, remoteCodebase, loader); Class loadedClass = null; try { loadedClass = Util.loadClass(className, remoteCodebase, loader); } catch (ClassNotFoundException cnfe) { if (relatedType.getClassLoader() == null) throw cnfe; } // If no class was not loaded, or if the loaded class is not of the // correct type, make a further attempt to load the correct class // using the classloader of the related type. // _REVISIT_ Is this step necessary, or should the Util,loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if (loadedClass == null || (loadedClass.getClassLoader() != null && loadedClass.getClassLoader().loadClass(relatedType.getName()) != relatedType)) { if (relatedType.getClassLoader() != relatedTypeClassLoader) throw new IllegalArgumentException( "relatedTypeClassLoader not class loader of relatedType."); if (relatedTypeClassLoader != null) loadedClass = relatedTypeClassLoader.loadClass(className); } return loadedClass; }
Example 9
Source Project: openjdk-jdk8u-backup File: StubFactoryFactoryDynamicBase.java License: GNU General Public License v2.0 | 5 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { Class cls = null ; try { cls = Util.loadClass( className, remoteCodeBase, classLoader ) ; } catch (ClassNotFoundException exc) { throw wrapper.classNotFound3( CompletionStatus.COMPLETED_MAYBE, exc, className ) ; } PresentationManager pm = ORB.getPresentationManager() ; if (IDLEntity.class.isAssignableFrom( cls ) && !Remote.class.isAssignableFrom( cls )) { // IDL stubs must always use static factories. PresentationManager.StubFactoryFactory sff = pm.getStubFactoryFactory( false ) ; PresentationManager.StubFactory sf = sff.createStubFactory( className, true, remoteCodeBase, expectedClass, classLoader ) ; return sf ; } else { PresentationManager.ClassData classData = pm.getClassData( cls ) ; return makeDynamicStubFactory( pm, classData, classLoader ) ; } }
Example 10
Source Project: openjdk-8-source File: RepositoryId.java License: GNU General Public License v2.0 | 5 votes |
public final Class getClassFromType() throws ClassNotFoundException { if (clazz != null) return clazz; Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); if (specialCase != null){ clazz = specialCase; return specialCase; } else { try{ return Util.loadClass(getClassName(), null, null); } catch(ClassNotFoundException cnfe){ if (defaultServerURL != null) { try{ return getClassFromType(defaultServerURL); } catch(MalformedURLException mue){ throw cnfe; } } else throw cnfe; } } }
Example 11
Source Project: JDKSourceCode1.8 File: Utility.java License: MIT License | 5 votes |
public static Class loadClassForClass (String className, String remoteCodebase, ClassLoader loader, Class relatedType, ClassLoader relatedTypeClassLoader) throws ClassNotFoundException { if (relatedType == null) return Util.loadClass(className, remoteCodebase, loader); Class loadedClass = null; try { loadedClass = Util.loadClass(className, remoteCodebase, loader); } catch (ClassNotFoundException cnfe) { if (relatedType.getClassLoader() == null) throw cnfe; } // If no class was not loaded, or if the loaded class is not of the // correct type, make a further attempt to load the correct class // using the classloader of the related type. // _REVISIT_ Is this step necessary, or should the Util,loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if (loadedClass == null || (loadedClass.getClassLoader() != null && loadedClass.getClassLoader().loadClass(relatedType.getName()) != relatedType)) { if (relatedType.getClassLoader() != relatedTypeClassLoader) throw new IllegalArgumentException( "relatedTypeClassLoader not class loader of relatedType."); if (relatedTypeClassLoader != null) loadedClass = relatedTypeClassLoader.loadClass(className); } return loadedClass; }
Example 12
Source Project: openjdk-jdk8u File: Utility.java License: GNU General Public License v2.0 | 5 votes |
public static Class loadClassForClass (String className, String remoteCodebase, ClassLoader loader, Class relatedType, ClassLoader relatedTypeClassLoader) throws ClassNotFoundException { if (relatedType == null) return Util.loadClass(className, remoteCodebase, loader); Class loadedClass = null; try { loadedClass = Util.loadClass(className, remoteCodebase, loader); } catch (ClassNotFoundException cnfe) { if (relatedType.getClassLoader() == null) throw cnfe; } // If no class was not loaded, or if the loaded class is not of the // correct type, make a further attempt to load the correct class // using the classloader of the related type. // _REVISIT_ Is this step necessary, or should the Util,loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if (loadedClass == null || (loadedClass.getClassLoader() != null && loadedClass.getClassLoader().loadClass(relatedType.getName()) != relatedType)) { if (relatedType.getClassLoader() != relatedTypeClassLoader) throw new IllegalArgumentException( "relatedTypeClassLoader not class loader of relatedType."); if (relatedTypeClassLoader != null) loadedClass = relatedTypeClassLoader.loadClass(className); } return loadedClass; }
Example 13
Source Project: openjdk-8-source File: StubFactoryFactoryDynamicBase.java License: GNU General Public License v2.0 | 5 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { Class cls = null ; try { cls = Util.loadClass( className, remoteCodeBase, classLoader ) ; } catch (ClassNotFoundException exc) { throw wrapper.classNotFound3( CompletionStatus.COMPLETED_MAYBE, exc, className ) ; } PresentationManager pm = ORB.getPresentationManager() ; if (IDLEntity.class.isAssignableFrom( cls ) && !Remote.class.isAssignableFrom( cls )) { // IDL stubs must always use static factories. PresentationManager.StubFactoryFactory sff = pm.getStubFactoryFactory( false ) ; PresentationManager.StubFactory sf = sff.createStubFactory( className, true, remoteCodeBase, expectedClass, classLoader ) ; return sf ; } else { PresentationManager.ClassData classData = pm.getClassData( cls ) ; return makeDynamicStubFactory( pm, classData, classLoader ) ; } }
Example 14
Source Project: openjdk-8-source File: StubFactoryFactoryStaticImpl.java License: GNU General Public License v2.0 | 4 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { String stubName = null ; if (isIDLStub) stubName = Utility.idlStubName( className ) ; else stubName = Utility.stubNameForCompiler( className ) ; ClassLoader expectedTypeClassLoader = (expectedClass == null ? classLoader : expectedClass.getClassLoader()); // The old code was optimized to try to guess which way to load classes // first. The real stub class name could either be className or // "org.omg.stub." + className. We will compute this as follows: // If stubName starts with a "forbidden" package, try the prefixed // version first, otherwise try the non-prefixed version first. // In any case, try both forms if necessary. String firstStubName = stubName ; String secondStubName = stubName ; if (PackagePrefixChecker.hasOffendingPrefix(stubName)) firstStubName = PackagePrefixChecker.packagePrefix() + stubName ; else secondStubName = PackagePrefixChecker.packagePrefix() + stubName ; Class clz = null; try { clz = Util.loadClass( firstStubName, remoteCodeBase, expectedTypeClassLoader ) ; } catch (ClassNotFoundException e1) { // log only at FINE level wrapper.classNotFound1( CompletionStatus.COMPLETED_MAYBE, e1, firstStubName ) ; try { clz = Util.loadClass( secondStubName, remoteCodeBase, expectedTypeClassLoader ) ; } catch (ClassNotFoundException e2) { throw wrapper.classNotFound2( CompletionStatus.COMPLETED_MAYBE, e2, secondStubName ) ; } } // XXX Is this step necessary, or should the Util.loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if ((clz == null) || ((expectedClass != null) && !expectedClass.isAssignableFrom(clz))) { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); clz = cl.loadClass(className); } catch (Exception exc) { // XXX make this a system exception IllegalStateException ise = new IllegalStateException( "Could not load class " + stubName ) ; ise.initCause( exc ) ; throw ise ; } } return new StubFactoryStaticImpl( clz ) ; }
Example 15
Source Project: hottub File: RepositoryId.java License: GNU General Public License v2.0 | 4 votes |
public final Class getClassFromType(String url) throws ClassNotFoundException, MalformedURLException { return Util.loadClass(getClassName(), url, null); }
Example 16
Source Project: TencentKona-8 File: StubFactoryFactoryStaticImpl.java License: GNU General Public License v2.0 | 4 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { String stubName = null ; if (isIDLStub) stubName = Utility.idlStubName( className ) ; else stubName = Utility.stubNameForCompiler( className ) ; ClassLoader expectedTypeClassLoader = (expectedClass == null ? classLoader : expectedClass.getClassLoader()); // The old code was optimized to try to guess which way to load classes // first. The real stub class name could either be className or // "org.omg.stub." + className. We will compute this as follows: // If stubName starts with a "forbidden" package, try the prefixed // version first, otherwise try the non-prefixed version first. // In any case, try both forms if necessary. String firstStubName = stubName ; String secondStubName = stubName ; if (PackagePrefixChecker.hasOffendingPrefix(stubName)) firstStubName = PackagePrefixChecker.packagePrefix() + stubName ; else secondStubName = PackagePrefixChecker.packagePrefix() + stubName ; Class clz = null; try { clz = Util.loadClass( firstStubName, remoteCodeBase, expectedTypeClassLoader ) ; } catch (ClassNotFoundException e1) { // log only at FINE level wrapper.classNotFound1( CompletionStatus.COMPLETED_MAYBE, e1, firstStubName ) ; try { clz = Util.loadClass( secondStubName, remoteCodeBase, expectedTypeClassLoader ) ; } catch (ClassNotFoundException e2) { throw wrapper.classNotFound2( CompletionStatus.COMPLETED_MAYBE, e2, secondStubName ) ; } } // XXX Is this step necessary, or should the Util.loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if ((clz == null) || ((expectedClass != null) && !expectedClass.isAssignableFrom(clz))) { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); clz = cl.loadClass(className); } catch (Exception exc) { // XXX make this a system exception IllegalStateException ise = new IllegalStateException( "Could not load class " + stubName ) ; ise.initCause( exc ) ; throw ise ; } } return new StubFactoryStaticImpl( clz ) ; }
Example 17
Source Project: openjdk-jdk9 File: RepositoryId.java License: GNU General Public License v2.0 | 4 votes |
public final Class getClassFromType(String url) throws ClassNotFoundException, MalformedURLException { return Util.loadClass(getClassName(), url, null); }
Example 18
Source Project: jdk8u60 File: StubFactoryFactoryStaticImpl.java License: GNU General Public License v2.0 | 4 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { String stubName = null ; if (isIDLStub) stubName = Utility.idlStubName( className ) ; else stubName = Utility.stubNameForCompiler( className ) ; ClassLoader expectedTypeClassLoader = (expectedClass == null ? classLoader : expectedClass.getClassLoader()); // The old code was optimized to try to guess which way to load classes // first. The real stub class name could either be className or // "org.omg.stub." + className. We will compute this as follows: // If stubName starts with a "forbidden" package, try the prefixed // version first, otherwise try the non-prefixed version first. // In any case, try both forms if necessary. String firstStubName = stubName ; String secondStubName = stubName ; if (PackagePrefixChecker.hasOffendingPrefix(stubName)) firstStubName = PackagePrefixChecker.packagePrefix() + stubName ; else secondStubName = PackagePrefixChecker.packagePrefix() + stubName ; Class clz = null; try { clz = Util.loadClass( firstStubName, remoteCodeBase, expectedTypeClassLoader ) ; } catch (ClassNotFoundException e1) { // log only at FINE level wrapper.classNotFound1( CompletionStatus.COMPLETED_MAYBE, e1, firstStubName ) ; try { clz = Util.loadClass( secondStubName, remoteCodeBase, expectedTypeClassLoader ) ; } catch (ClassNotFoundException e2) { throw wrapper.classNotFound2( CompletionStatus.COMPLETED_MAYBE, e2, secondStubName ) ; } } // XXX Is this step necessary, or should the Util.loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if ((clz == null) || ((expectedClass != null) && !expectedClass.isAssignableFrom(clz))) { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); clz = cl.loadClass(className); } catch (Exception exc) { // XXX make this a system exception IllegalStateException ise = new IllegalStateException( "Could not load class " + stubName ) ; ise.initCause( exc ) ; throw ise ; } } return new StubFactoryStaticImpl( clz ) ; }
Example 19
Source Project: openjdk-jdk9 File: StubFactoryFactoryStaticImpl.java License: GNU General Public License v2.0 | 4 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { String stubName = null ; if (isIDLStub) stubName = Utility.idlStubName( className ) ; else stubName = Utility.stubNameForCompiler( className ) ; ClassLoader expectedTypeClassLoader = (expectedClass == null ? classLoader : expectedClass.getClassLoader()); // The old code was optimized to try to guess which way to load classes // first. The real stub class name could either be className or // "org.omg.stub." + className. We will compute this as follows: // If stubName starts with a "forbidden" package, try the prefixed // version first, otherwise try the non-prefixed version first. // In any case, try both forms if necessary. String firstStubName = stubName ; String secondStubName = stubName ; if (PackagePrefixChecker.hasOffendingPrefix(stubName)) firstStubName = PackagePrefixChecker.packagePrefix() + stubName ; else secondStubName = PackagePrefixChecker.packagePrefix() + stubName ; Class clz = null; try { clz = Util.loadClass( firstStubName, remoteCodeBase, expectedTypeClassLoader ) ; } catch (ClassNotFoundException e1) { // log only at FINE level wrapper.classNotFound1( CompletionStatus.COMPLETED_MAYBE, e1, firstStubName ) ; try { clz = Util.loadClass( secondStubName, remoteCodeBase, expectedTypeClassLoader ) ; } catch (ClassNotFoundException e2) { throw wrapper.classNotFound2( CompletionStatus.COMPLETED_MAYBE, e2, secondStubName ) ; } } // XXX Is this step necessary, or should the Util.loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if ((clz == null) || ((expectedClass != null) && !expectedClass.isAssignableFrom(clz))) { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); clz = cl.loadClass(className); } catch (Exception exc) { // XXX make this a system exception IllegalStateException ise = new IllegalStateException( "Could not load class " + stubName ) ; ise.initCause( exc ) ; throw ise ; } } return new StubFactoryStaticImpl( clz ) ; }
Example 20
Source Project: openjdk-jdk8u-backup File: RepositoryId.java License: GNU General Public License v2.0 | 4 votes |
public final Class getClassFromType(String url) throws ClassNotFoundException, MalformedURLException { return Util.loadClass(getClassName(), url, null); }