- Revision
- 770
- Author
- mauro
- Date
- 2008-07-28 03:20:38 -0500 (Mon, 28 Jul 2008)
Log Message
Made ScriptedRegistrar extend Registrar (and implemented by PicoRegistrar) to allow the AbstractRegistrar to use it as delegate. Fixed JRubyRegistrar configuration to allow webapp to start (although there are still runtime ruby exceptions, presumably due to 1.0.x-1.1.x compat issues).
Modified Paths
- trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/JRubyRegistrar.java
- trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml
- trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/AbstractScriptedRegistrar.java
- trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/ScriptedRegistrar.java
- trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/pico/PicoRegistrar.java
- trunk/waffle-ruby/src/main/java/org/codehaus/waffle/registrar/pico/RubyScriptedRegistrar.java
Diff
Modified: trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/JRubyRegistrar.java (769 => 770)
--- trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/JRubyRegistrar.java 2008-07-24 04:05:07 UTC (rev 769) +++ trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/JRubyRegistrar.java 2008-07-28 08:20:38 UTC (rev 770) @@ -1,12 +1,12 @@ package org.codehaus.waffle.example.jruby; +import java.util.ArrayList; +import java.util.List; + import org.codehaus.waffle.example.jruby.dao.SimplePersonDAO; import org.codehaus.waffle.registrar.AbstractScriptedRegistrar; import org.codehaus.waffle.registrar.Registrar; -import java.util.ArrayList; -import java.util.List; - public class JRubyRegistrar extends AbstractScriptedRegistrar { public JRubyRegistrar(Registrar delegate) {
Modified: trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml (769 => 770)
--- trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml 2008-07-24 04:05:07 UTC (rev 769) +++ trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml 2008-07-28 08:20:38 UTC (rev 770) @@ -33,7 +33,7 @@ <!-- Ruby Specific components --> <context-param> <param-name>org.codehaus.waffle.context.ContextContainerFactory</param-name> - <param-value>org.codehaus.waffle.context.pico.RubyAwarePicoContextContainerFactory</param-value> + <param-value>org.codehaus.waffle.context.pico.RubyPicoContextContainerFactory</param-value> </context-param> <context-param> <param-name>org.codehaus.waffle.bind.ControllerDataBinder</param-name>
Modified: trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/AbstractScriptedRegistrar.java (769 => 770)
--- trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/AbstractScriptedRegistrar.java 2008-07-24 04:05:07 UTC (rev 769) +++ trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/AbstractScriptedRegistrar.java 2008-07-28 08:20:38 UTC (rev 770) @@ -3,9 +3,11 @@ */ package org.codehaus.waffle.registrar; +import org.codehaus.waffle.WaffleException; + /** * A Registrar that provides registration methods for scripts. - * + * * @author Michael Ward * @author Mauro Talevi */ @@ -14,7 +16,11 @@ public AbstractScriptedRegistrar(Registrar delegate) { super(delegate); - scriptedRegistrar = (ScriptedRegistrar)delegate; + if ( delegate instanceof ScriptedRegistrar ){ + scriptedRegistrar = (ScriptedRegistrar) delegate; + } else { + throw new WaffleException("Delegate is not a ScriptedRegistrar: "+delegate); + } } public void registerScript(String key, String className) {
Modified: trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/ScriptedRegistrar.java (769 => 770)
--- trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/ScriptedRegistrar.java 2008-07-24 04:05:07 UTC (rev 769) +++ trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/ScriptedRegistrar.java 2008-07-28 08:20:38 UTC (rev 770) @@ -7,8 +7,9 @@ * Implementations of this interface will allow for scripts to be registered with Waffle. * * @author Michael Ward + * @author Mauro Talevi */ -public interface ScriptedRegistrar { +public interface ScriptedRegistrar extends Registrar { /** * Register a script with Waffle
Modified: trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/pico/PicoRegistrar.java (769 => 770)
--- trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/pico/PicoRegistrar.java 2008-07-24 04:05:07 UTC (rev 769) +++ trunk/waffle-core/src/main/java/org/codehaus/waffle/registrar/pico/PicoRegistrar.java 2008-07-28 08:20:38 UTC (rev 770) @@ -11,6 +11,7 @@ import org.codehaus.waffle.monitor.RegistrarMonitor; import org.codehaus.waffle.registrar.Registrar; import org.codehaus.waffle.registrar.RegistrarException; +import org.codehaus.waffle.registrar.ScriptedRegistrar; import org.picocontainer.ComponentAdapter; import org.picocontainer.ComponentMonitor; import org.picocontainer.InjectionFactory; @@ -28,7 +29,7 @@ * @author Michael Ward * @author Mauro Talevi */ -public class PicoRegistrar implements Registrar { +public class PicoRegistrar implements ScriptedRegistrar { private final MutablePicoContainer picoContainer; private final ParameterResolver parameterResolver; private final LifecycleStrategy lifecycleStrategy; @@ -157,4 +158,8 @@ // does nothing! } + public void registerScript(String key, String scriptedClassName) { + // does nothing! + } + }
Modified: trunk/waffle-ruby/src/main/java/org/codehaus/waffle/registrar/pico/RubyScriptedRegistrar.java (769 => 770)
--- trunk/waffle-ruby/src/main/java/org/codehaus/waffle/registrar/pico/RubyScriptedRegistrar.java 2008-07-24 04:05:07 UTC (rev 769) +++ trunk/waffle-ruby/src/main/java/org/codehaus/waffle/registrar/pico/RubyScriptedRegistrar.java 2008-07-28 08:20:38 UTC (rev 770) @@ -4,7 +4,6 @@ package org.codehaus.waffle.registrar.pico; import org.codehaus.waffle.monitor.RegistrarMonitor; -import org.codehaus.waffle.registrar.ScriptedRegistrar; import org.picocontainer.ComponentMonitor; import org.picocontainer.LifecycleStrategy; import org.picocontainer.MutablePicoContainer; @@ -16,7 +15,7 @@ * @author Michael Ward * @author Mauro Talevi */ -public class RubyScriptedRegistrar extends PicoRegistrar implements ScriptedRegistrar { +public class RubyScriptedRegistrar extends PicoRegistrar { public RubyScriptedRegistrar(MutablePicoContainer picoContainer, ParameterResolver parameterResolver,
To unsubscribe from this list please visit:
