Well, after begging and pleading with Mauro and Paul to let me take another crack at this, I undid my previous commit and took another shot at it. This time, I moved the code that Deployer relied on as a static factory into a new class called ScriptBuilderResolver. Using this you can now replace builder implementations for existing types or create new file types through code similar to this:
ScriptBuilderResolver resolver = new ScriptBuilderResolver();
resolver.registerBuilder(".groovy", "org.example.MySpecialGroovyBuilder");
ScriptedContainerBuilderFactory factory = new ScriptedContainerBuilderFactory(new File("MyCustomFile.groovy"), Thread.currentThread().getCustomClassLoader(), resolver);
ScriptedContainerBuilder builder = factory.getBuilder();
assert "org.example.MySpecialGroovyBuilder".equals(builder.getClass().getName());
Example Use Case For This Code:
I have a custom ComponentAdapter that relies on some other initialization code to occur after composition before becoming fully functional. Unfortunately, the default Groovy builder automatically called PicoContainer.start() on the container thus throwing all sorts of awful exceptions. By creating my own groovy builder that simply didn't call PicoContainer.start() until I was ready for it, problem was solved.
Final Note:
This version MUCH more closely matches the behavior in the RC-1 implementation because exceptions are thrown in the constructor like they were before.
HTH!
-Mike (R)
New CustomGroovyNodeBuilder is now the default node builder.