[Red5commits] [1666] added more ctors to GroovyScriptFactory?inprocess of fixing issue with demoserv

pgregoire luke at codegent.com
Thu Jan 25 19:50:08 EST 2007


added more ctors to GroovyScriptFactory?
inprocess of fixing issue with demoservice.rb and js, seems to be a problem in getConnectionLocal.getScope.getResources


Timestamp: 01/25/07 19:34:42 EST (less than one hour ago) 
Change: 1666 
Author: pgregoire

Files (see diff or trac for details): 
java/server/trunk/src/org/red5/server/script/groovy/GroovyScriptFactory.java
java/server/trunk/src/org/red5/server/script/jruby
java/server/trunk/webapps/oflaDemo/WEB-INF/red5-web.xml
java/server/trunk/webapps/oflaDemo/WEB-INF/src/applications/demoservice.rb


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/1666

Index: /java/server/trunk/src/org/red5/server/script/groovy/GroovyScriptFactory.java
===================================================================
--- /java/server/trunk/src/org/red5/server/script/groovy/GroovyScriptFactory.java (revision 1606)
+++ /java/server/trunk/src/org/red5/server/script/groovy/GroovyScriptFactory.java (revision 1666)
@@ -48,4 +48,6 @@
 	private final String scriptSourceLocator;
 
+	private final Class[] scriptInterfaces;	
+	
 	/**
 	 * Create a new GroovyScriptFactory for the given script source.
@@ -59,6 +61,27 @@
 		Assert.hasText(scriptSourceLocator);
 		this.scriptSourceLocator = scriptSourceLocator;
+		this.scriptInterfaces = null;
 	}
+	
+	public GroovyScriptFactory(String scriptSourceLocator, Class scriptInterface) {
+		Assert.hasText(scriptSourceLocator);
+		this.scriptSourceLocator = scriptSourceLocator;
+		if (null == scriptInterface) {
+			this.scriptInterfaces = new Class[] {};
+		} else {
+			this.scriptInterfaces = new Class[] { scriptInterface };
+		}
+	}	
 
+	public GroovyScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces) {
+		Assert.hasText(scriptSourceLocator);
+		this.scriptSourceLocator = scriptSourceLocator;
+		if (null == scriptInterfaces || scriptInterfaces.length < 1) {
+			this.scriptInterfaces = new Class[] {};
+		} else {
+			this.scriptInterfaces = scriptInterfaces;
+		}
+	}	
+	
 	/** {@inheritDoc} */
     public String getScriptSourceLocator() {
@@ -72,5 +95,5 @@
 	 */
 	public Class[] getScriptInterfaces() {
-		return null;
+		return scriptInterfaces;
 	}
 
Index: /java/server/trunk/webapps/oflaDemo/WEB-INF/src/applications/demoservice.rb
===================================================================
--- /java/server/trunk/webapps/oflaDemo/WEB-INF/src/applications/demoservice.rb (revision 1404)
+++ /java/server/trunk/webapps/oflaDemo/WEB-INF/src/applications/demoservice.rb (revision 1666)
@@ -3,4 +3,5 @@
 module RedFive
     include_package "org.springframework.core.io"
+    include_package "org.red5.server.webapp.oflaDemo"
 end
 include_class "org.red5.server.api.Red5"
@@ -12,5 +13,5 @@
 # @author Paul Gregoire
 #
-class DemoService
+class DemoService < RedFive::DemoServiceImpl
 
     attr_reader :filesMap
@@ -25,7 +26,8 @@
 		puts "Getting the FLV files"
 		begin
-		    #puts "R5 con local: #{Red5::getConnectionLocal}"
-		    #puts "Scope: #{Red5::getConnectionLocal.getScope}"
+		    puts "R5 con local: #{Red5::getConnectionLocal}"
+		    puts "Scope: #{Red5::getConnectionLocal.getScope}"
 			flvs = Red5::getConnectionLocal.getScope.getResources("streams/*.flv")
+			puts "FLV list #{flvs}"
 			for flv in flvs
 				file = flv.getFile
@@ -46,5 +48,6 @@
 			end
 		rescue
-			puts "Error in getListOfAvailableFLVs"
+			puts "Error in getListOfAvailableFLVs #{errorType}\n"
+			puts caller.join("\n");
 		end
 		return filesMap
Index: /java/server/trunk/webapps/oflaDemo/WEB-INF/red5-web.xml
===================================================================
--- /java/server/trunk/webapps/oflaDemo/WEB-INF/red5-web.xml (revision 1657)
+++ /java/server/trunk/webapps/oflaDemo/WEB-INF/red5-web.xml (revision 1666)
@@ -22,8 +22,9 @@
 		<property name="virtualHosts" value="${webapp.virtualHosts}" />
 	</bean>
-	
+	 	
 	<bean id="web.handler" 
 	    class="org.red5.server.webapp.oflaDemo.Application" />
-<!-- 
+
+<!--
 	<bean id="web.handler" class="org.red5.server.script.rhino.RhinoScriptFactory">
 		<constructor-arg index="0" value="classpath:applications/main.js"/>
@@ -38,7 +39,6 @@
 		</constructor-arg>
 	</bean>
--->
-<!-- 
-	<bean id="web.handler" class="org.red5.server.script.jruby.JRubyScriptFactory">
+
+	<bean id="web.handler" class="org.springframework.scripting.jruby.JRubyScriptFactory">
 		<constructor-arg index="0" value="classpath:applications/main.rb"/>
 		<constructor-arg index="1">
@@ -49,4 +49,14 @@
 		</constructor-arg>
 	</bean>		
+
+	<bean id="web.handler" class="org.red5.server.script.groovy.GroovyScriptFactory">
+		<constructor-arg index="0" value="classpath:applications/main.groovy"/>
+		<constructor-arg index="1">
+			<list>
+				<value>org.red5.server.api.IScopeHandler</value>
+				<value>org.red5.server.adapter.IApplication</value>
+			</list>
+		</constructor-arg>
+	</bean>	
 
 	<bean id="web.handler" class="org.red5.server.script.jython.JythonScriptFactory">
@@ -83,5 +93,5 @@
 	</bean>
 
-	<bean id="demoService.service" class="org.red5.server.script.jruby.JRubyScriptFactory">
+	<bean id="demoService.service" class="org.springframework.scripting.jruby.JRubyScriptFactory">
 		<constructor-arg index="0" value="classpath:applications/demoservice.rb"/>
 		<constructor-arg index="1">
@@ -91,5 +101,5 @@
 		</constructor-arg>
 	</bean>	
-
+	
 	<bean id="demoService.service" class="org.red5.server.script.jython.JythonScriptFactory">
 		<constructor-arg index="0" value="classpath:applications/demoservice.py"/>


Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.



More information about the Red5commits mailing list