private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm) throws ComponentConfigurationException { List<String> runtimeClasspathElements; try { // noinspection unchecked runtimeClasspathElements = (List<String>) expressionEvaluator .evaluate("${project.runtimeClasspathElements}"); } catch (ExpressionEvaluationException e) { throw new ComponentConfigurationException( "There was a problem evaluating: ${project.runtimeClasspathElements}", e); } // Add the project dependencies to the ClassRealm final URL[] urls = buildURLs(runtimeClasspathElements); for (URL url : urls) { containerRealm.addConstituent(url); } }
public void configureComponent(Object component, PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm, ConfigurationListener listener) throws ComponentConfigurationException { addProjectDependenciesToClassRealm(expressionEvaluator, containerRealm); converterLookup.registerConverter(new ClassRealmConverter(containerRealm)); ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter(); converter.processConfiguration(converterLookup, component, containerRealm.getClassLoader(), configuration, expressionEvaluator, listener); }
@Deprecated public void setClassRealm( final org.codehaus.classworlds.ClassRealm classRealm ) { if ( classRealm.getClassLoader() instanceof ClassRealm ) { setClassRealm( (ClassRealm) classRealm.getClassLoader() ); } else { setClassRealm( ClassRealmReverseAdapter.getInstance( classRealm ) ); } }
private ClassRealmReverseAdapter( ClassRealm oldRealm ) { super( ClassWorldReverseAdapter.getInstance( oldRealm.getWorld() ), oldRealm.getId(), oldRealm.getClassLoader() ); this.realm = oldRealm; }
/** * Retrieve the main entry class. * * @return The main entry class. * @throws ClassNotFoundException If the class cannot be found. * @throws NoSuchRealmException If the specified main entry realm does not exist. */ public Class getMainClass() throws ClassNotFoundException, NoSuchRealmException { return getMainRealm().loadClass( getMainClassName() ); }
/** * 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 class. * * @return The main entry class. * @throws ClassNotFoundException If the class cannot be found. * @throws NoSuchRealmException If the specified main entry realm does not exist. */ public Class getMainClass() throws ClassNotFoundException, NoSuchRealmException { return getMainRealm().loadClass( getMainClassName() ); }
/** * @see ClassRealm#createChildRealm */ public ClassRealm createChildRealm( String id ) { ClassRealm childRealm = new DefaultClassRealm( getWorld(), id ); childRealm.setParent( this ); return childRealm; } }
public Object fromConfiguration( ConverterLookup converterLookup, PlexusConfiguration configuration, Class type, Class baseType, ClassLoader classLoader, ExpressionEvaluator expressionEvaluator, ConfigurationListener listener ) throws ComponentConfigurationException { Object retValue = fromExpression( configuration, expressionEvaluator, type ); if ( retValue == null ) { retValue = classRealm; } // backwards compatibility for old ClassWorld fields if ( retValue instanceof ClassRealm && org.codehaus.classworlds.ClassRealm.class.isAssignableFrom( type ) ) { retValue = ClassRealmAdapter.getInstance( (ClassRealm) retValue ); } return retValue; }
public org.codehaus.plexus.classworlds.realm.ClassRealm locateSourceRealm( String className ) { return getInstance( realm.locateSourceRealm( className ) ); }
/** @see ClassLoader */ public URL getResource( String name ) { return getRealm().getResource( name ); }
private ClassRealmReverseAdapter( ClassRealm oldRealm ) { super( ClassWorldReverseAdapter.getInstance( oldRealm.getWorld() ), oldRealm.getId(), oldRealm.getClassLoader() ); this.realm = oldRealm; }
@Override public void configureComponent(Object component, PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm, ConfigurationListener listener) throws ComponentConfigurationException { addProjectDependenciesToClassRealm(expressionEvaluator, containerRealm); ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter(); converter.processConfiguration(converterLookup, component, containerRealm.getClassLoader(), configuration, expressionEvaluator, listener); }
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm) throws ComponentConfigurationException { List<String> compileClasspathElements; try { //noinspection unchecked compileClasspathElements = (List<String>) expressionEvaluator.evaluate("${project.compileClasspathElements}"); } catch (ExpressionEvaluationException e) { throw new ComponentConfigurationException("There was a problem evaluating: ${project.compileClasspathElements}", e); } // Add the project dependencies to the ClassRealm final URL[] urls = buildURLs(compileClasspathElements); for (URL url : urls) { containerRealm.addConstituent(url); } }
/** Retrieve the main entry class. * * @return The main entry class. * * @throws ClassNotFoundException If the class cannot be found. * @throws NoSuchRealmException If the specified main entry realm does not exist. */ public Class getMainClass() throws ClassNotFoundException, NoSuchRealmException { return getMainRealm().loadClass(getMainClassName()); }
/** 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()); }
protected Object newInstance( ComponentDescriptor componentDescriptor, org.codehaus.classworlds.ClassRealm classRealm, PlexusContainer container ) throws ComponentInstantiationException { throw new IllegalStateException( getClass().getName() + " does not implement component creation." ); }
public org.codehaus.plexus.classworlds.realm.ClassRealm locateSourceRealm( String className ) { return getInstance( realm.locateSourceRealm( className ) ); }
final org.codehaus.classworlds.ClassRealm cr = ClassRealmAdapter.getInstance( containerRealm );