public void display() { realm.display(); }
public void display() { realm.display(); }
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); } }
public Object newInstance( ComponentDescriptor componentDescriptor, ClassRealm classRealm, PlexusContainer container ) throws ComponentInstantiationException { URL scriptLocation = getScriptLocation( componentDescriptor, container.getContainerRealm() ); Object result = null; try { result = parseComponent( scriptLocation, container.getContainerRealm() ); } catch ( Exception e ) { container.getContainerRealm().display(); if ( e instanceof ComponentInstantiationException ) { throw (ComponentInstantiationException) e; } else { throw new ComponentInstantiationException( "Cannot build component for: " + componentDescriptor.getComponentKey(), e ); } } return result; }