public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "Component Descriptor: " ); for ( ComponentDescriptor<?> cd : components ) { sb.append( cd.getHumanReadableKey() ).append( "\n" ); } sb.append( "---" ); return sb.toString(); }
private ComponentInstantiationException makeException( ClassRealm componentClassRealm, ComponentDescriptor componentDescriptor, Class implementationClass, Throwable e ) { // ---------------------------------------------------------------------- // Display the realm when there is an error, We should probably return a string here so we // can incorporate this into the error message for easy debugging. // ---------------------------------------------------------------------- String msg; if ( componentClassRealm == null ) { msg = "classRealm is null for " + componentDescriptor; } else { msg = "Could not instantiate component: " + componentDescriptor.getHumanReadableKey() + " realm: " + componentClassRealm.getId(); } return new ComponentInstantiationException( msg, e ); } }
throw new ComponentLifecycleException("Error constructing component " + descriptor.getHumanReadableKey(), e); } catch (LinkageError e) { throw new ComponentLifecycleException("Error constructing component " + descriptor.getHumanReadableKey(), e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader);
role, roleHints, componentDescriptor.getHumanReadableKey()); role, roleHints, componentDescriptor.getHumanReadableKey());
public int compare( ComponentDescriptor d1, ComponentDescriptor d2 ) { return d1.getHumanReadableKey().compareTo( d2.getHumanReadableKey() ); } });
@Override public final String toString() { final StringBuilder buf = new StringBuilder( "Component Descriptor: " ); for ( final ComponentDescriptor<?> cd : components ) { buf.append( cd.getHumanReadableKey() ).append( "\n" ); } return buf.append( "---" ).toString(); }
+ descriptor.getHumanReadableKey() + " from class realm " + realm, e ); + descriptor.getHumanReadableKey() + " from class realm " + realm, e );
public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "Component Descriptor: " ); for ( ComponentDescriptor<?> cd : components ) { sb.append( cd.getHumanReadableKey() ).append( "\n" ); } sb.append( "---" ); return sb.toString(); }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append( "Component Descriptor: " ); for ( Iterator i = components.iterator(); i.hasNext(); ) { ComponentDescriptor cd = (ComponentDescriptor) i.next(); sb.append( cd.getHumanReadableKey() ).append( "\n" ); } sb.append( "---" ); return sb.toString(); }
msg.append( componentDescriptor.getHumanReadableKey() );
protected Field getFieldByName( Object component, String fieldName, ComponentDescriptor componentDescriptor ) throws CompositionException { Field field; try { field = ReflectionUtils.getFieldByNameIncludingSuperclasses( fieldName, component.getClass() ); } catch( NoClassDefFoundError e ) { throw new CompositionException( "Embedded NoClassDefFoundError while looking up " + Field.class.getName() + " for: " + fieldName + " in: " + componentDescriptor.getImplementation(), e ); } if ( field == null ) { StringBuffer msg = new StringBuffer( "Component Composition failed. No field of name: '" ); msg.append( fieldName ); msg.append( "' exists in component: " ); msg.append( componentDescriptor.getHumanReadableKey() ); throw new CompositionException( msg.toString() ); } return field; }
private ComponentInstantiationException makeException( ClassRealm componentClassRealm, ComponentDescriptor componentDescriptor, Class implementationClass, Throwable e ) { // ---------------------------------------------------------------------- // Display the realm when there is an error, We should probably return a string here so we // can incorporate this into the error message for easy debugging. // ---------------------------------------------------------------------- String msg; if ( componentClassRealm == null ) { msg = "classRealm is null for " + componentDescriptor; } else { msg = "Could not instantiate component: " + componentDescriptor.getHumanReadableKey() + " realm: " + componentClassRealm.getId(); } return new ComponentInstantiationException( msg, e ); } }
public Object newInstance( ComponentDescriptor componentDescriptor, ClassRealm classRealm, PlexusContainer container ) throws ComponentInstantiationException { ClassLoader currentContextLoader = Thread.currentThread().getContextClassLoader(); try { ClassLoader cl = classRealm.getClassLoader(); Class loader = classRealm.loadClass("clojure.plexus.factory.ClojureLoader"); Method m = loader.getDeclaredMethod("instantiate",String.class); Thread.currentThread().setContextClassLoader(cl); Object obj=m.invoke(loader,componentDescriptor.getImplementation()); return obj; } catch ( Exception e ) { classRealm.display(); throw new ComponentInstantiationException( "Failed to extract Clojure component for: " + componentDescriptor.getHumanReadableKey(), e ); } finally { Thread.currentThread() .setContextClassLoader(currentContextLoader); } }
msg.append( componentDescriptor.getHumanReadableKey() );
public Object newInstance( ComponentDescriptor componentDescriptor, ClassRealm classRealm, PlexusContainer container ) throws ComponentInstantiationException { try { return new AntScriptInvoker( componentDescriptor, new RealmDelegatingClassLoader( classRealm )); } catch ( IOException e ) { throw new ComponentInstantiationException( "Failed to extract Ant script for: " + componentDescriptor.getHumanReadableKey(), e ); } }
throw new ComponentLifecycleException("Error constructing component " + descriptor.getHumanReadableKey(), e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader);
assignment = new ComponentMap( container, lookupRealm, role, roleHints, hostComponentDescriptor.getHumanReadableKey() ); assignment = new ComponentList( container, lookupRealm, role, roleHints, hostComponentDescriptor.getHumanReadableKey() );
role, roleHints, componentDescriptor.getHumanReadableKey()); role, roleHints, componentDescriptor.getHumanReadableKey());