/** Retrieve a <code>ClassRealmImpl</code> by its id. * * @param id The id. * * @return The matching class-realm. * * @throws NoSuchRealmException If the id does not correspond * to any known class-realm. */ DefaultClassRealm getRealmImpl(String id) throws NoSuchRealmException { return (DefaultClassRealm) getRealm( id ); }
/** * Retrieve the main entry realm. * * @return The main entry realm. * @throws NoSuchRealmException If the specified main entry realm does not exist. */ public ClassRealm getMainRealm() throws NoSuchRealmException { return getWorld().getRealm( getMainRealmName() ); }
/** * Retrieve the main entry realm. * * @return The main entry realm. * @throws NoSuchRealmException If the specified main entry realm does not exist. */ public ClassRealm getMainRealm() throws NoSuchRealmException { return getWorld().getRealm( getMainRealmName() ); }
/** Retrieve the main entry realm. * * @return The main entry realm. * * @throws NoSuchRealmException If the specified main entry realm does not exist. */ public ClassRealm getMainRealm() throws NoSuchRealmException { return getWorld().getRealm(getMainRealmName()); }
/** * Loads a class given its name and classpath location. * * @param location Specifies where this plugins should be obtained from, or * <code>null</code> if we should use our own classloader. * @param name The name of the class to load. * * @return The requested class. * * @throws ClassNotFoundException */ public Class<?> loadClass(AbstractClassPathLocation location, String name) throws ClassNotFoundException { // In case no location is supplied ... if (location == null) { return getClass().getClassLoader().loadClass(name); } try { if (this.initializedProperly) { final ClassLoader classLoader = this.classWorld.getRealm(location.getRealm()).getClassLoader(); return classLoader.loadClass(name); } } catch (ClassNotFoundException e) { return getClass().getClassLoader().loadClass(name); } catch (NoSuchRealmException e) { e.printStackTrace(); } // And again, this time we run this code if we have not been inititalized properly return getClass().getClassLoader().loadClass(name); }
/** * Returns a resource as an input stream for a given location. * * @param location The location to use. * @param name The requested resource. * @return The input stream for the requested resource or <code>null</code> if none * was found. */ public InputStream getResourceAsStream(AbstractClassPathLocation location, String name) { // In case no location is supplied ... if (location == null) { return getClass().getClassLoader().getResourceAsStream(name); } try { final ClassLoader classLoader = this.classWorld.getRealm(location.getRealm()).getClassLoader(); return classLoader.getResourceAsStream(name); } catch (NoSuchRealmException e) { e.printStackTrace(); } return null; }
public org.codehaus.plexus.classworlds.realm.ClassRealm getRealm( String id ) throws org.codehaus.plexus.classworlds.realm.NoSuchRealmException { try { return ClassRealmReverseAdapter.getInstance( world.getRealm( id ) ); } catch ( NoSuchRealmException e ) { throw new org.codehaus.plexus.classworlds.realm.NoSuchRealmException( this, e.getId() ); } }
public org.codehaus.plexus.classworlds.realm.ClassRealm getRealm( String id ) throws org.codehaus.plexus.classworlds.realm.NoSuchRealmException { try { return ClassRealmReverseAdapter.getInstance( world.getRealm( id ) ); } catch ( NoSuchRealmException e ) { throw new org.codehaus.plexus.classworlds.realm.NoSuchRealmException( this, e.getId() ); } }
final ClassLoader classLoader = this.classWorld.getRealm(location.getRealm()).getClassLoader(); final Collection<String> listClassNames = location.listToplevelClassNames();
remoting.setParent(launcher.getWorld().getRealm("plexus.core.maven")); remoting.addConstituent(remotingJar.toURI().toURL());
remoting.setParent(launcher.getWorld().getRealm("plexus.core.maven")); remoting.addConstituent(remotingJar.toURI().toURL());
private static synchronized ClassRealm getOrCreateClassRealm(final ClassRealm classRealm, final File jrubyJar) throws MalformedURLException, ScriptException { ClassRealm jruby; try { jruby = classRealm.getWorld().getRealm("jruby"); } catch (final NoSuchRealmException e) { try { jruby = classRealm.getWorld().newRealm("jruby"); if(jrubyJar != null){ jruby.addConstituent(jrubyJar.toURI().toURL()); } } catch (final DuplicateRealmException ee) { throw new ScriptException("could not setup classrealm for jruby", ee); } } return jruby; }
ClassRealm realm = launcher.getWorld().getRealm( launcher.getMainRealmName() );
ClassRealm jruby; try { jruby = classRealm.getWorld().getRealm("jruby");